1 | var __extends = this && this.__extends || function(d, b) {
|
2 | function __() {
|
3 | this.constructor = d;
|
4 | }
|
5 | for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
|
6 | d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, new __());
|
7 | }, powerbi;
|
8 |
|
9 | !function(powerbi) {
|
10 | var visuals;
|
11 | !function(visuals) {
|
12 | var Point = function() {
|
13 | function Point(x, y) {
|
14 | this.x = x || 0, this.y = y || 0;
|
15 | }
|
16 | return Point;
|
17 | }();
|
18 | visuals.Point = Point;
|
19 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
20 | }(powerbi || (powerbi = {}));
|
21 |
|
22 | var powerbi;
|
23 |
|
24 | !function(powerbi) {
|
25 | var visuals;
|
26 | !function(visuals) {
|
27 | var Rect = function() {
|
28 | function Rect(left, top, width, height) {
|
29 | this.left = left || 0, this.top = top || 0, this.width = width || 0, this.height = height || 0;
|
30 | }
|
31 | return Rect;
|
32 | }();
|
33 | visuals.Rect = Rect;
|
34 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
35 | }(powerbi || (powerbi = {}));
|
36 |
|
37 | var powerbi;
|
38 |
|
39 | !function(powerbi) {
|
40 | var visuals;
|
41 | !function(visuals) {
|
42 | function createLegend(legendParentElement, interactive, interactivityService, isScrollable, legendPosition) {
|
43 | return void 0 === isScrollable && (isScrollable = !1), void 0 === legendPosition && (legendPosition = LegendPosition.Top),
|
44 | interactive ? new CartesianChartInteractiveLegend(legendParentElement) : new SVGLegend(legendParentElement, legendPosition, interactivityService, isScrollable);
|
45 | }
|
46 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter;
|
47 | !function(LegendIcon) {
|
48 | LegendIcon[LegendIcon.Box = 0] = "Box", LegendIcon[LegendIcon.Circle = 1] = "Circle",
|
49 | LegendIcon[LegendIcon.Line = 2] = "Line";
|
50 | }(visuals.LegendIcon || (visuals.LegendIcon = {}));
|
51 | visuals.LegendIcon;
|
52 | !function(LegendPosition) {
|
53 | LegendPosition[LegendPosition.Top = 0] = "Top", LegendPosition[LegendPosition.Bottom = 1] = "Bottom",
|
54 | LegendPosition[LegendPosition.Right = 2] = "Right", LegendPosition[LegendPosition.Left = 3] = "Left",
|
55 | LegendPosition[LegendPosition.None = 4] = "None", LegendPosition[LegendPosition.TopCenter = 5] = "TopCenter",
|
56 | LegendPosition[LegendPosition.BottomCenter = 6] = "BottomCenter", LegendPosition[LegendPosition.RightCenter = 7] = "RightCenter",
|
57 | LegendPosition[LegendPosition.LeftCenter = 8] = "LeftCenter";
|
58 | }(visuals.LegendPosition || (visuals.LegendPosition = {}));
|
59 | var LegendPosition = visuals.LegendPosition;
|
60 | visuals.legendProps = {
|
61 | show: "show",
|
62 | position: "position",
|
63 | titleText: "titleText",
|
64 | showTitle: "showTitle",
|
65 | labelColor: "labelColor",
|
66 | fontSize: "fontSize"
|
67 | }, visuals.createLegend = createLegend;
|
68 | var Legend;
|
69 | !function(Legend) {
|
70 | function isLeft(orientation) {
|
71 | switch (orientation) {
|
72 | case LegendPosition.Left:
|
73 | case LegendPosition.LeftCenter:
|
74 | return !0;
|
75 |
|
76 | default:
|
77 | return !1;
|
78 | }
|
79 | }
|
80 | function isTop(orientation) {
|
81 | switch (orientation) {
|
82 | case LegendPosition.Top:
|
83 | case LegendPosition.TopCenter:
|
84 | return !0;
|
85 |
|
86 | default:
|
87 | return !1;
|
88 | }
|
89 | }
|
90 | function positionChartArea(chartArea, legend) {
|
91 | var legendMargins = legend.getMargins(), legendOrientation = legend.getOrientation();
|
92 | chartArea.style({
|
93 | "margin-left": Legend.isLeft(legendOrientation) ? legendMargins.width + "px" : null,
|
94 | "margin-top": Legend.isTop(legendOrientation) ? legendMargins.height + "px" : null
|
95 | });
|
96 | }
|
97 | Legend.isLeft = isLeft, Legend.isTop = isTop, Legend.positionChartArea = positionChartArea;
|
98 | }(Legend = visuals.Legend || (visuals.Legend = {}));
|
99 | var SVGLegend = function() {
|
100 | function SVGLegend(element, legendPosition, interactivityService, isScrollable) {
|
101 | this.legendDataStartIndex = 0, this.arrowPosWindow = 1, this.lastCalculatedWidth = 0,
|
102 | this.visibleLegendWidth = 0, this.visibleLegendHeight = 0, this.legendFontSizeMarginDifference = 0,
|
103 | this.legendFontSizeMarginValue = 0, this.svg = d3.select(element.get(0)).append("svg").style("position", "absolute"),
|
104 | this.svg.style("display", "inherit"), this.svg.classed("legend", !0), interactivityService && (this.clearCatcher = visuals.appendClearCatcher(this.svg)),
|
105 | this.group = this.svg.append("g").attr("id", "legendGroup"), this.interactivityService = interactivityService,
|
106 | this.isScrollable = isScrollable, this.element = element, this.changeOrientation(legendPosition),
|
107 | this.parentViewport = {
|
108 | height: 0,
|
109 | width: 0
|
110 | }, this.calculateViewport(), this.updateLayout();
|
111 | }
|
112 | return SVGLegend.prototype.updateLayout = function() {
|
113 | var legendViewport = this.viewport, orientation = this.orientation;
|
114 | this.svg.attr({
|
115 | height: legendViewport.height || (orientation === LegendPosition.None ? 0 : this.parentViewport.height),
|
116 | width: legendViewport.width || (orientation === LegendPosition.None ? 0 : this.parentViewport.width)
|
117 | });
|
118 | var isRight = orientation === LegendPosition.Right || orientation === LegendPosition.RightCenter, isBottom = orientation === LegendPosition.Bottom || orientation === LegendPosition.BottomCenter;
|
119 | this.svg.style({
|
120 | "margin-left": isRight ? this.parentViewport.width - legendViewport.width + "px" : null,
|
121 | "margin-top": isBottom ? this.parentViewport.height - legendViewport.height + "px" : null
|
122 | });
|
123 | }, SVGLegend.prototype.calculateViewport = function() {
|
124 | switch (this.orientation) {
|
125 | case LegendPosition.Top:
|
126 | case LegendPosition.Bottom:
|
127 | case LegendPosition.TopCenter:
|
128 | case LegendPosition.BottomCenter:
|
129 | var pixelHeight = PixelConverter.fromPointToPixel(this.data && this.data.fontSize ? this.data.fontSize : SVGLegend.DefaultFontSizeInPt), fontHeightSize = SVGLegend.TopLegendHeight + (pixelHeight - SVGLegend.DefaultFontSizeInPt);
|
130 | return void (this.viewport = {
|
131 | height: fontHeightSize,
|
132 | width: 0
|
133 | });
|
134 |
|
135 | case LegendPosition.Right:
|
136 | case LegendPosition.Left:
|
137 | case LegendPosition.RightCenter:
|
138 | case LegendPosition.LeftCenter:
|
139 | var width = this.lastCalculatedWidth ? this.lastCalculatedWidth : this.parentViewport.width * SVGLegend.LegendMaxWidthFactor;
|
140 | return void (this.viewport = {
|
141 | height: 0,
|
142 | width: width
|
143 | });
|
144 |
|
145 | case LegendPosition.None:
|
146 | this.viewport = {
|
147 | height: 0,
|
148 | width: 0
|
149 | };
|
150 | }
|
151 | }, SVGLegend.prototype.getMargins = function() {
|
152 | return this.viewport;
|
153 | }, SVGLegend.prototype.isVisible = function() {
|
154 | return this.orientation !== LegendPosition.None;
|
155 | }, SVGLegend.prototype.changeOrientation = function(orientation) {
|
156 | orientation ? this.orientation = orientation : this.orientation = LegendPosition.Top,
|
157 | this.svg.attr("orientation", orientation);
|
158 | }, SVGLegend.prototype.getOrientation = function() {
|
159 | return this.orientation;
|
160 | }, SVGLegend.prototype.drawLegend = function(data, viewport) {
|
161 | for (var clonedData = powerbi.Prototype.inherit(data), newDataPoints = [], _i = 0, _a = data.dataPoints; _i < _a.length; _i++) {
|
162 | var dp = _a[_i];
|
163 | newDataPoints.push(powerbi.Prototype.inherit(dp));
|
164 | }
|
165 | clonedData.dataPoints = newDataPoints, this.setTooltipToLegendItems(clonedData),
|
166 | this.drawLegendInternal(clonedData, viewport, !0);
|
167 | }, SVGLegend.prototype.drawLegendInternal = function(data, viewport, autoWidth) {
|
168 | this.parentViewport = viewport, this.data = data, this.interactivityService && this.interactivityService.applySelectionStateToData(data.dataPoints),
|
169 | 0 === data.dataPoints.length && this.changeOrientation(LegendPosition.None), this.getOrientation() === LegendPosition.None && (data.dataPoints = []);
|
170 | var mapControl = this.element.children(".mapControl");
|
171 | mapControl.length > 0 && !this.isTopOrBottom(this.orientation) && mapControl.css("display", "inline-block"),
|
172 | this.calculateViewport();
|
173 | var layout = this.calculateLayout(data, autoWidth), titleLayout = layout.title, titleData = titleLayout ? [ titleLayout ] : [], hasSelection = this.interactivityService && powerbi.visuals.dataHasSelection(data.dataPoints), group = this.group;
|
174 | if (this.isCentered(this.orientation)) {
|
175 | var centerOffset = 0;
|
176 | this.isTopOrBottom(this.orientation) ? (centerOffset = Math.max(0, (this.parentViewport.width - this.visibleLegendWidth) / 2),
|
177 | group.attr("transform", visuals.SVGUtil.translate(centerOffset, 0))) : (centerOffset = Math.max((this.parentViewport.height - this.visibleLegendHeight) / 2),
|
178 | group.attr("transform", visuals.SVGUtil.translate(0, centerOffset)));
|
179 | } else group.attr("transform", null);
|
180 | var legendTitle = group.selectAll(SVGLegend.LegendTitle.selector).data(titleData);
|
181 | legendTitle.enter().append("text").classed(SVGLegend.LegendTitle["class"], !0),
|
182 | legendTitle.style({
|
183 | fill: data.labelColor,
|
184 | "font-size": PixelConverter.fromPoint(data.fontSize),
|
185 | "font-family": SVGLegend.DefaultTitleFontFamily
|
186 | }).text(function(d) {
|
187 | return d.text;
|
188 | }).attr({
|
189 | x: function(d) {
|
190 | return d.x;
|
191 | },
|
192 | y: function(d) {
|
193 | return d.y;
|
194 | }
|
195 | }).append("title").text(data.title), legendTitle.exit().remove();
|
196 | var virtualizedDataPoints = data.dataPoints.slice(this.legendDataStartIndex, this.legendDataStartIndex + layout.numberOfItems), iconRadius = powerbi.TextMeasurementService.estimateSvgTextHeight(SVGLegend.getTextProperties(!1, "", this.data.fontSize)) / SVGLegend.LegendIconRadiusFactor;
|
197 | iconRadius = this.legendFontSizeMarginValue > SVGLegend.DefaultTextMargin && iconRadius > SVGLegend.LegendIconRadius ? iconRadius : SVGLegend.LegendIconRadius;
|
198 | var legendItems = group.selectAll(SVGLegend.LegendItem.selector).data(virtualizedDataPoints, function(d) {
|
199 | return d.identity.getKey() + (null != d.layerNumber ? d.layerNumber : "");
|
200 | }), itemsEnter = legendItems.enter().append("g").classed(SVGLegend.LegendItem["class"], !0);
|
201 | if (itemsEnter.append("circle").classed(SVGLegend.LegendIcon["class"], !0), itemsEnter.append("text").classed(SVGLegend.LegendText["class"], !0),
|
202 | itemsEnter.append("title").text(function(d) {
|
203 | return d.tooltip;
|
204 | }), itemsEnter.style({
|
205 | "font-family": SVGLegend.DefaultFontFamily
|
206 | }), legendItems.select(SVGLegend.LegendIcon.selector).attr({
|
207 | cx: function(d, i) {
|
208 | return d.glyphPosition.x;
|
209 | },
|
210 | cy: function(d) {
|
211 | return d.glyphPosition.y;
|
212 | },
|
213 | r: iconRadius
|
214 | }).style({
|
215 | fill: function(d) {
|
216 | return hasSelection && !d.selected ? visuals.LegendBehavior.dimmedLegendColor : d.color;
|
217 | }
|
218 | }), legendItems.select("title").text(function(d) {
|
219 | return d.tooltip;
|
220 | }), legendItems.select(SVGLegend.LegendText.selector).attr({
|
221 | x: function(d) {
|
222 | return d.textPosition.x;
|
223 | },
|
224 | y: function(d) {
|
225 | return d.textPosition.y;
|
226 | }
|
227 | }).text(function(d) {
|
228 | return d.label;
|
229 | }).style({
|
230 | fill: data.labelColor,
|
231 | "font-size": PixelConverter.fromPoint(data.fontSize)
|
232 | }), this.interactivityService) {
|
233 | var iconsSelection = legendItems.select(SVGLegend.LegendIcon.selector), behaviorOptions = {
|
234 | legendItems: legendItems,
|
235 | legendIcons: iconsSelection,
|
236 | clearCatcher: this.clearCatcher
|
237 | };
|
238 | this.interactivityService.bind(data.dataPoints, new visuals.LegendBehavior(), behaviorOptions, {
|
239 | isLegend: !0
|
240 | });
|
241 | }
|
242 | legendItems.exit().remove(), this.drawNavigationArrows(layout.navigationArrows),
|
243 | this.updateLayout();
|
244 | }, SVGLegend.prototype.normalizePosition = function(points) {
|
245 | this.legendDataStartIndex >= points.length && (this.legendDataStartIndex = points.length - 1),
|
246 | this.legendDataStartIndex < 0 && (this.legendDataStartIndex = 0);
|
247 | }, SVGLegend.prototype.calculateTitleLayout = function(title) {
|
248 | var width = 0, hasTitle = !_.isEmpty(title);
|
249 | if (hasTitle) {
|
250 | var isHorizontal = this.isTopOrBottom(this.orientation), maxMeasureLength = void 0;
|
251 | if (isHorizontal) {
|
252 | var fontSizeMargin = this.legendFontSizeMarginValue > SVGLegend.DefaultTextMargin ? SVGLegend.TextAndIconPadding + this.legendFontSizeMarginDifference : SVGLegend.TextAndIconPadding, fixedHorizontalIconShift = SVGLegend.TextAndIconPadding + SVGLegend.LegendIconRadius, fixedHorizontalTextShift = SVGLegend.LegendIconRadius + fontSizeMargin + fixedHorizontalIconShift;
|
253 | maxMeasureLength = this.parentViewport.width * SVGLegend.LegendMaxWidthFactor - fixedHorizontalTextShift - SVGLegend.LegendEdgeMariginWidth;
|
254 | } else maxMeasureLength = this.legendFontSizeMarginValue < SVGLegend.DefaultTextMargin ? SVGLegend.MaxTitleLength : SVGLegend.MaxTitleLength + SVGLegend.DefaultMaxLegendFactor * this.legendFontSizeMarginDifference;
|
255 | var textProperties = SVGLegend.getTextProperties(!0, title, this.data.fontSize), text = title;
|
256 | return width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
257 | width > maxMeasureLength && (text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, maxMeasureLength),
|
258 | textProperties.text = text, width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties)),
|
259 | isHorizontal ? width += SVGLegend.TitlePadding : text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, this.viewport.width),
|
260 | {
|
261 | x: 0,
|
262 | y: 0,
|
263 | text: text,
|
264 | width: width,
|
265 | height: powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties)
|
266 | };
|
267 | }
|
268 | return null;
|
269 | }, SVGLegend.prototype.calculateLayout = function(data, autoWidth) {
|
270 | var dataPoints = data.dataPoints;
|
271 | if (0 === data.dataPoints.length) return {
|
272 | startIndex: null,
|
273 | numberOfItems: 0,
|
274 | title: null,
|
275 | navigationArrows: []
|
276 | };
|
277 | this.legendFontSizeMarginValue = PixelConverter.fromPointToPixel(this.data && void 0 !== this.data.fontSize ? this.data.fontSize : SVGLegend.DefaultFontSizeInPt),
|
278 | this.legendFontSizeMarginDifference = this.legendFontSizeMarginValue - SVGLegend.DefaultTextMargin,
|
279 | this.normalizePosition(dataPoints), this.legendDataStartIndex < dataPoints.length && (dataPoints = dataPoints.slice(this.legendDataStartIndex));
|
280 | var navArrows, numberOfItems, title = this.calculateTitleLayout(data.title);
|
281 | return this.isTopOrBottom(this.orientation) ? (navArrows = this.isScrollable ? this.calculateHorizontalNavigationArrowsLayout(title) : [],
|
282 | numberOfItems = this.calculateHorizontalLayout(dataPoints, title, navArrows)) : (navArrows = this.isScrollable ? this.calculateVerticalNavigationArrowsLayout(title) : [],
|
283 | numberOfItems = this.calculateVerticalLayout(dataPoints, title, navArrows, autoWidth)),
|
284 | {
|
285 | numberOfItems: numberOfItems,
|
286 | title: title,
|
287 | navigationArrows: navArrows
|
288 | };
|
289 | }, SVGLegend.prototype.updateNavigationArrowLayout = function(navigationArrows, remainingDataLength, visibleDataLength) {
|
290 | 0 === this.legendDataStartIndex && navigationArrows.shift();
|
291 | var lastWindow = this.arrowPosWindow;
|
292 | this.arrowPosWindow = visibleDataLength, navigationArrows && navigationArrows.length > 0 && this.arrowPosWindow === remainingDataLength && (this.arrowPosWindow = lastWindow,
|
293 | navigationArrows.length = navigationArrows.length - 1);
|
294 | }, SVGLegend.prototype.calculateHorizontalNavigationArrowsLayout = function(title) {
|
295 | 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);
|
296 | return data.push({
|
297 | x: rightShift,
|
298 | y: translateY,
|
299 | path: arrowLeft.path,
|
300 | rotateTransform: arrowLeft.transform,
|
301 | type: 1
|
302 | }), data.push({
|
303 | x: this.parentViewport.width - width,
|
304 | y: translateY,
|
305 | path: arrowRight.path,
|
306 | rotateTransform: arrowRight.transform,
|
307 | type: 0
|
308 | }), data;
|
309 | }, SVGLegend.prototype.calculateVerticalNavigationArrowsLayout = function(title) {
|
310 | 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;
|
311 | return data.push({
|
312 | x: rightShift,
|
313 | y: width + titleHeight,
|
314 | path: arrowTop.path,
|
315 | rotateTransform: arrowTop.transform,
|
316 | type: 1
|
317 | }), data.push({
|
318 | x: rightShift,
|
319 | y: this.parentViewport.height - height,
|
320 | path: arrowBottom.path,
|
321 | rotateTransform: arrowBottom.transform,
|
322 | type: 0
|
323 | }), data;
|
324 | }, SVGLegend.calculateHorizontalLegendItemsWidths = function(dataPoints, availableWidth, iconPadding, fontSize) {
|
325 | var dataPointsLength = dataPoints.length, maxItemWidth = dataPointsLength > 0 ? availableWidth / dataPointsLength | 0 : 0, maxItemTextWidth = maxItemWidth - iconPadding;
|
326 | maxItemTextWidth < SVGLegend.MaxTextLength && (maxItemTextWidth = SVGLegend.MaxTextLength,
|
327 | maxItemWidth = maxItemTextWidth + iconPadding), maxItemWidth > availableWidth && (maxItemWidth = availableWidth,
|
328 | maxItemTextWidth = maxItemWidth - iconPadding);
|
329 | for (var occupiedWidth = 0, legendItems = [], _i = 0, dataPoints_1 = dataPoints; _i < dataPoints_1.length; _i++) {
|
330 | 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;
|
331 | if (occupiedWidth += actualWidth, occupiedWidth >= availableWidth) {
|
332 | 0 === legendItems.length ? (legendItems.push({
|
333 | dataPoint: dataPoint,
|
334 | textProperties: textProperties,
|
335 | desiredWidth: desiredWidth,
|
336 | desiredOverMaxWidth: !0,
|
337 | width: desiredWidth
|
338 | }), occupiedWidth = availableWidth) : occupiedWidth -= actualWidth;
|
339 | break;
|
340 | }
|
341 | legendItems.push({
|
342 | dataPoint: dataPoint,
|
343 | textProperties: textProperties,
|
344 | desiredWidth: desiredWidth,
|
345 | desiredOverMaxWidth: overMaxWidth,
|
346 | width: desiredWidth
|
347 | });
|
348 | }
|
349 | var itemsOverMax = _.filter(legendItems, function(li) {
|
350 | return li.desiredOverMaxWidth;
|
351 | }), numItemsOverMax = itemsOverMax.length;
|
352 | if (numItemsOverMax > 0) for (var extraWidth = availableWidth - occupiedWidth, _a = 0, itemsOverMax_1 = itemsOverMax; _a < itemsOverMax_1.length; _a++) {
|
353 | var item = itemsOverMax_1[_a], extraWidthPerItem = extraWidth / numItemsOverMax, newMaxItemWidth = maxItemWidth + extraWidthPerItem, usedExtraWidth = void 0;
|
354 | item.desiredWidth <= newMaxItemWidth ? (item.desiredOverMaxWidth = !1, usedExtraWidth = item.desiredWidth - maxItemWidth) : (item.width = newMaxItemWidth,
|
355 | usedExtraWidth = newMaxItemWidth - maxItemWidth), extraWidth -= usedExtraWidth,
|
356 | numItemsOverMax--;
|
357 | }
|
358 | return legendItems;
|
359 | }, SVGLegend.prototype.calculateHorizontalLayout = function(dataPoints, title, navigationArrows) {
|
360 | 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);
|
361 | title && (occupiedWidth += title.width, title.y = verticalCenter + title.height / 2 - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(SVGLegend.getTextProperties(!0, title.text, this.data.fontSize))),
|
362 | this.legendDataStartIndex > 0 && (occupiedWidth += SVGLegend.LegendArrowOffset);
|
363 | var dataPointsLength = dataPoints.length, availableWidth = this.parentViewport.width - occupiedWidth, legendItems = SVGLegend.calculateHorizontalLegendItemsWidths(dataPoints, availableWidth, iconTotalItemPadding, this.data.fontSize);
|
364 | numberOfItems = legendItems.length, numberOfItems !== dataPointsLength && (availableWidth -= SVGLegend.LegendArrowOffset,
|
365 | legendItems = SVGLegend.calculateHorizontalLegendItemsWidths(dataPoints, availableWidth, iconTotalItemPadding, this.data.fontSize),
|
366 | numberOfItems = legendItems.length);
|
367 | for (var _i = 0, legendItems_1 = legendItems; _i < legendItems_1.length; _i++) {
|
368 | var legendItem = legendItems_1[_i], dataPoint = legendItem.dataPoint;
|
369 | if (dataPoint.glyphPosition = {
|
370 | x: occupiedWidth + SVGLegend.LegendIconRadius + this.legendFontSizeMarginDifference / SVGLegend.LegendIconRadiusFactor,
|
371 | y: this.viewport.height * SVGLegend.LegendIconYRatio
|
372 | }, dataPoint.textPosition = {
|
373 | x: occupiedWidth + fixedTextShift,
|
374 | y: textYCoordinate
|
375 | }, legendItem.desiredOverMaxWidth) {
|
376 | var textWidth = legendItem.width - iconTotalItemPadding, text = powerbi.TextMeasurementService.getTailoredTextOrDefault(legendItem.textProperties, textWidth);
|
377 | dataPoint.label = text;
|
378 | }
|
379 | occupiedWidth += legendItem.width;
|
380 | }
|
381 | return this.visibleLegendWidth = occupiedWidth, this.updateNavigationArrowLayout(navigationArrows, dataPointsLength, numberOfItems),
|
382 | numberOfItems;
|
383 | }, SVGLegend.prototype.calculateVerticalLayout = function(dataPoints, title, navigationArrows, autoWidth) {
|
384 | 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;
|
385 | title && (totalSpaceOccupiedThusFar += spaceNeededByTitle, title.x = SVGLegend.TextAndIconPadding,
|
386 | title.y = spaceNeededByTitle, maxHorizontalSpaceUsed = title.width || 0), this.legendDataStartIndex > 0 && (totalSpaceOccupiedThusFar += SVGLegend.LegendArrowOffset);
|
387 | for (var dataPointsLength = dataPoints.length, i = 0; dataPointsLength > i; i++) {
|
388 | var dp = dataPoints[i], textProperties = SVGLegend.getTextProperties(!1, dp.label, this.data.fontSize);
|
389 | dp.glyphPosition = {
|
390 | x: fixedHorizontalIconShift,
|
391 | y: totalSpaceOccupiedThusFar + extraShiftForTextAlignmentToIcon - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(textProperties)
|
392 | }, dp.textPosition = {
|
393 | x: fixedHorizontalTextShift,
|
394 | y: totalSpaceOccupiedThusFar + extraShiftForTextAlignmentToIcon
|
395 | };
|
396 | var width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties);
|
397 | if (width > maxHorizontalSpaceUsed && (maxHorizontalSpaceUsed = width), width > maxHorizontalSpaceAvaliable) {
|
398 | var text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, maxHorizontalSpaceAvaliable);
|
399 | dp.label = text;
|
400 | }
|
401 | if (totalSpaceOccupiedThusFar += verticalLegendHeight, totalSpaceOccupiedThusFar > parentHeight) {
|
402 | numberOfItems = i;
|
403 | break;
|
404 | }
|
405 | }
|
406 | 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,
|
407 | this.visibleLegendHeight = totalSpaceOccupiedThusFar, navigationArrows.forEach(function(d) {
|
408 | return d.x = _this.lastCalculatedWidth / 2;
|
409 | }), this.updateNavigationArrowLayout(navigationArrows, dataPointsLength, numberOfItems),
|
410 | numberOfItems;
|
411 | }, SVGLegend.prototype.drawNavigationArrows = function(layout) {
|
412 | var _this = this, arrows = this.group.selectAll(SVGLegend.NavigationArrow.selector).data(layout);
|
413 | arrows.enter().append("g").on("click", function(d) {
|
414 | var pos = _this.legendDataStartIndex;
|
415 | _this.legendDataStartIndex = 0 === d.type ? pos + _this.arrowPosWindow : pos - _this.arrowPosWindow,
|
416 | _this.drawLegendInternal(_this.data, _this.parentViewport, !1);
|
417 | }).classed(SVGLegend.NavigationArrow["class"], !0).append("path"), arrows.attr("transform", function(d) {
|
418 | return visuals.SVGUtil.translate(d.x, d.y);
|
419 | }).select("path").attr({
|
420 | d: function(d) {
|
421 | return d.path;
|
422 | },
|
423 | transform: function(d) {
|
424 | return d.rotateTransform;
|
425 | }
|
426 | }), arrows.exit().remove();
|
427 | }, SVGLegend.prototype.isTopOrBottom = function(orientation) {
|
428 | switch (orientation) {
|
429 | case LegendPosition.Top:
|
430 | case LegendPosition.Bottom:
|
431 | case LegendPosition.BottomCenter:
|
432 | case LegendPosition.TopCenter:
|
433 | return !0;
|
434 |
|
435 | default:
|
436 | return !1;
|
437 | }
|
438 | }, SVGLegend.prototype.isCentered = function(orientation) {
|
439 | switch (orientation) {
|
440 | case LegendPosition.BottomCenter:
|
441 | case LegendPosition.LeftCenter:
|
442 | case LegendPosition.RightCenter:
|
443 | case LegendPosition.TopCenter:
|
444 | return !0;
|
445 |
|
446 | default:
|
447 | return !1;
|
448 | }
|
449 | }, SVGLegend.prototype.reset = function() {}, SVGLegend.getTextProperties = function(isTitle, text, fontSize) {
|
450 | return {
|
451 | text: text,
|
452 | fontFamily: isTitle ? SVGLegend.DefaultTitleFontFamily : SVGLegend.DefaultFontFamily,
|
453 | fontSize: PixelConverter.fromPoint(fontSize || SVGLegend.DefaultFontSizeInPt)
|
454 | };
|
455 | }, SVGLegend.prototype.setTooltipToLegendItems = function(data) {
|
456 | for (var _i = 0, _a = data.dataPoints; _i < _a.length; _i++) {
|
457 | var dataPoint = _a[_i];
|
458 | dataPoint.tooltip = dataPoint.label;
|
459 | }
|
460 | }, SVGLegend.DefaultFontSizeInPt = 8, SVGLegend.LegendIconRadius = 5, SVGLegend.LegendIconRadiusFactor = 5,
|
461 | SVGLegend.MaxTextLength = 60, SVGLegend.MaxTitleLength = 80, SVGLegend.TextAndIconPadding = 5,
|
462 | SVGLegend.TitlePadding = 15, SVGLegend.LegendEdgeMariginWidth = 10, SVGLegend.LegendMaxWidthFactor = .3,
|
463 | SVGLegend.TopLegendHeight = 24, SVGLegend.DefaultTextMargin = PixelConverter.fromPointToPixel(SVGLegend.DefaultFontSizeInPt),
|
464 | SVGLegend.DefaultMaxLegendFactor = SVGLegend.MaxTitleLength / SVGLegend.DefaultTextMargin,
|
465 | SVGLegend.LegendIconYRatio = .52, SVGLegend.LegendArrowOffset = 10, SVGLegend.LegendArrowHeight = 15,
|
466 | SVGLegend.LegendArrowWidth = 7.5, SVGLegend.DefaultFontFamily = "wf_segoe-ui_normal",
|
467 | SVGLegend.DefaultTitleFontFamily = "wf_segoe-ui_Semibold", SVGLegend.LegendItem = createClassAndSelector("legendItem"),
|
468 | SVGLegend.LegendText = createClassAndSelector("legendText"), SVGLegend.LegendIcon = createClassAndSelector("legendIcon"),
|
469 | SVGLegend.LegendTitle = createClassAndSelector("legendTitle"), SVGLegend.NavigationArrow = createClassAndSelector("navArrow"),
|
470 | SVGLegend;
|
471 | }();
|
472 | visuals.SVGLegend = SVGLegend;
|
473 | var LegendData, CartesianChartInteractiveLegend = function() {
|
474 | function CartesianChartInteractiveLegend(element) {
|
475 | this.legendContainerParent = d3.select(element.get(0));
|
476 | }
|
477 | return CartesianChartInteractiveLegend.prototype.getMargins = function() {
|
478 | return {
|
479 | height: CartesianChartInteractiveLegend.LegendHeight,
|
480 | width: 0
|
481 | };
|
482 | }, CartesianChartInteractiveLegend.prototype.drawLegend = function(legendData) {
|
483 | var data = legendData.dataPoints;
|
484 | if (!(data.length < 1)) {
|
485 | var legendContainerDiv = this.legendContainerParent.select(CartesianChartInteractiveLegend.LegendContainerSelector);
|
486 | if (legendContainerDiv.empty()) {
|
487 | if (!data.length) return;
|
488 | var divToPrepend = $("<div></div>").height(this.getMargins().height).addClass(CartesianChartInteractiveLegend.LegendContainerClass);
|
489 | $(this.legendContainerParent[0]).prepend(divToPrepend), legendContainerDiv = d3.select(divToPrepend.get(0));
|
490 | }
|
491 | this.legendContainerDiv = legendContainerDiv, this.drawTitle(data), this.drawLegendItems(data);
|
492 | }
|
493 | }, CartesianChartInteractiveLegend.prototype.reset = function() {
|
494 | this.legendContainerDiv && (this.legendContainerDiv.remove(), this.legendContainerDiv = null);
|
495 | }, CartesianChartInteractiveLegend.prototype.isVisible = function() {
|
496 | return !0;
|
497 | }, CartesianChartInteractiveLegend.prototype.changeOrientation = function(orientation) {},
|
498 | CartesianChartInteractiveLegend.prototype.getOrientation = function() {
|
499 | return LegendPosition.Top;
|
500 | }, CartesianChartInteractiveLegend.prototype.drawTitle = function(data) {
|
501 | var titleDiv = this.legendContainerDiv.selectAll("div." + CartesianChartInteractiveLegend.LegendTitleClass), item = titleDiv.data([ data[0] ]), itemEnter = item.enter(), titleDivEnter = itemEnter.append("div").attr("class", CartesianChartInteractiveLegend.LegendTitleClass);
|
502 | titleDivEnter.filter(function(d) {
|
503 | return d.iconOnlyOnLabel;
|
504 | }).append("span").attr("class", CartesianChartInteractiveLegend.legendIconClass).html(CartesianChartInteractiveLegend.legendPlaceSelector),
|
505 | titleDivEnter.append("span"), item.filter(function(d) {
|
506 | return d.iconOnlyOnLabel;
|
507 | }).select("span." + CartesianChartInteractiveLegend.legendIconClass).style(CartesianChartInteractiveLegend.legendColorCss, function(d) {
|
508 | return d.color;
|
509 | }), item.select("span:last-child").text(function(d) {
|
510 | return d.category;
|
511 | });
|
512 | }, CartesianChartInteractiveLegend.prototype.drawLegendItems = function(data) {
|
513 | this.ensureLegendTableCreated();
|
514 | var dataPointsMatrix = CartesianChartInteractiveLegend.splitArrayToOddEven(data), legendItemsContainer = this.legendContainerDiv.select("tbody").selectAll("tr").data(dataPointsMatrix), legendItemsEnter = legendItemsContainer.enter(), rowEnter = legendItemsEnter.append("tr"), cellEnter = rowEnter.selectAll("td").data(function(d) {
|
515 | return d;
|
516 | }, function(d) {
|
517 | return d.label;
|
518 | }).enter().append("td").attr("class", CartesianChartInteractiveLegend.LegendItem), cellSpanEnter = cellEnter.append("span");
|
519 | cellSpanEnter.filter(function(d) {
|
520 | return !d.iconOnlyOnLabel;
|
521 | }).append("span").html(CartesianChartInteractiveLegend.legendPlaceSelector).attr("class", CartesianChartInteractiveLegend.legendIconClass).attr("white-space", "nowrap"),
|
522 | cellSpanEnter.append("span").attr("class", CartesianChartInteractiveLegend.legendItemNameClass),
|
523 | cellSpanEnter.append("span").attr("class", CartesianChartInteractiveLegend.legendItemMeasureClass);
|
524 | var legendCells = legendItemsContainer.selectAll("td").data(function(d) {
|
525 | return d;
|
526 | }, function(d) {
|
527 | return d.label;
|
528 | });
|
529 | legendCells.select("span." + CartesianChartInteractiveLegend.legendItemNameClass).html(function(d) {
|
530 | return powerbi.visuals.TextUtil.removeBreakingSpaces(d.label);
|
531 | }), legendCells.select("span." + CartesianChartInteractiveLegend.legendItemMeasureClass).html(function(d) {
|
532 | return " " + d.measure;
|
533 | }), legendCells.select("span." + CartesianChartInteractiveLegend.legendIconClass).style("color", function(d) {
|
534 | return d.color;
|
535 | }), legendCells.exit().remove();
|
536 | }, CartesianChartInteractiveLegend.prototype.ensureLegendTableCreated = function() {
|
537 | if (this.legendContainerDiv.select("div table").empty()) {
|
538 | var legendTable = this.legendContainerDiv.append("div").append("table");
|
539 | legendTable.style("table-layout", "fixed").append("tbody"), this.setPanGestureOnLegend(legendTable);
|
540 | }
|
541 | }, CartesianChartInteractiveLegend.prototype.setPanGestureOnLegend = function(legendTable) {
|
542 | var viewportWidth = $(this.legendContainerDiv.select("div:nth-child(2)")[0]).width(), xscale = d3.scale.linear().domain([ 0, viewportWidth ]).range([ 0, viewportWidth ]), zoom = d3.behavior.zoom().scaleExtent([ 1, 1 ]).x(xscale).on("zoom", function() {
|
543 | if ($(legendTable[0]).width() > viewportWidth) {
|
544 | var t = zoom.translate(), tx_1 = t[0], ty = t[1];
|
545 | tx_1 = Math.min(tx_1, 0), tx_1 = Math.max(tx_1, viewportWidth - $(legendTable[0]).width()),
|
546 | zoom.translate([ tx_1, ty ]), legendTable.style("-ms-transform", function() {
|
547 | return visuals.SVGUtil.translateXWithPixels(tx_1);
|
548 | }), legendTable.style("-webkit-transform", function() {
|
549 | return visuals.SVGUtil.translateXWithPixels(tx_1);
|
550 | }), legendTable.style("transform", function() {
|
551 | return visuals.SVGUtil.translateXWithPixels(tx_1);
|
552 | });
|
553 | }
|
554 | });
|
555 | this.legendContainerDiv ? this.legendContainerDiv.call(zoom) : legendTable.call(zoom);
|
556 | }, CartesianChartInteractiveLegend.splitArrayToOddEven = function(data) {
|
557 | for (var oddData = [], evenData = [], i = 0; i < data.length; ++i) i % 2 === 0 ? evenData.push(data[i]) : oddData.push(data[i]);
|
558 | return [ evenData, oddData ];
|
559 | }, CartesianChartInteractiveLegend.LegendHeight = 70, CartesianChartInteractiveLegend.LegendContainerClass = "interactive-legend",
|
560 | CartesianChartInteractiveLegend.LegendContainerSelector = ".interactive-legend",
|
561 | CartesianChartInteractiveLegend.LegendTitleClass = "title", CartesianChartInteractiveLegend.LegendItem = "item",
|
562 | CartesianChartInteractiveLegend.legendPlaceSelector = "■", CartesianChartInteractiveLegend.legendIconClass = "icon",
|
563 | CartesianChartInteractiveLegend.legendColorCss = "color", CartesianChartInteractiveLegend.legendItemNameClass = "itemName",
|
564 | CartesianChartInteractiveLegend.legendItemMeasureClass = "itemMeasure", CartesianChartInteractiveLegend;
|
565 | }();
|
566 | !function(LegendData) {
|
567 | function update(legendData, legendObject) {
|
568 | if (null == legendObject[visuals.legendProps.show] && (legendObject[visuals.legendProps.show] = !0),
|
569 | legendObject[visuals.legendProps.show] === !1 && (legendData.dataPoints = []), legendObject[visuals.legendProps.show] === !0 && null == legendObject[visuals.legendProps.position] && (legendObject[visuals.legendProps.position] = visuals.legendPosition.top),
|
570 | void 0 !== legendObject[visuals.legendProps.fontSize] && (legendData.fontSize = legendObject[visuals.legendProps.fontSize]),
|
571 | void 0 !== legendObject[visuals.legendProps.labelColor]) {
|
572 | var fillColor = legendObject[visuals.legendProps.labelColor];
|
573 | null != fillColor && (legendData.labelColor = fillColor.solid.color);
|
574 | }
|
575 | legendObject[visuals.legendProps.showTitle] === !1 ? legendData.title = "" : void 0 !== legendObject[visuals.legendProps.titleText] && (legendData.title = legendObject[visuals.legendProps.titleText]);
|
576 | }
|
577 | LegendData.DefaultLegendLabelFillColor = "#666666", LegendData.update = update;
|
578 | }(LegendData = visuals.LegendData || (visuals.LegendData = {}));
|
579 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
580 | }(powerbi || (powerbi = {}));
|
581 |
|
582 | var powerbi;
|
583 |
|
584 | !function(powerbi) {
|
585 | var visuals;
|
586 | !function(visuals) {
|
587 | var axisScale;
|
588 | !function(axisScale) {
|
589 | axisScale.linear = "linear", axisScale.log = "log", axisScale.type = powerbi.createEnumType([ {
|
590 | value: axisScale.linear,
|
591 | displayName: function(resources) {
|
592 | return resources.get("Visual_Axis_Linear");
|
593 | }
|
594 | }, {
|
595 | value: axisScale.log,
|
596 | displayName: function(resources) {
|
597 | return resources.get("Visual_Axis_Log");
|
598 | }
|
599 | } ]);
|
600 | }(axisScale = visuals.axisScale || (visuals.axisScale = {}));
|
601 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
602 | }(powerbi || (powerbi = {}));
|
603 |
|
604 | var powerbi;
|
605 |
|
606 | !function(powerbi) {
|
607 | var visuals;
|
608 | !function(visuals) {
|
609 | var axisStyle;
|
610 | !function(axisStyle) {
|
611 | axisStyle.showBoth = "showBoth", axisStyle.showTitleOnly = "showTitleOnly", axisStyle.showUnitOnly = "showUnitOnly",
|
612 | axisStyle.type = powerbi.createEnumType([ {
|
613 | value: axisStyle.showTitleOnly,
|
614 | displayName: function(resources) {
|
615 | return resources.get("Visual_Axis_ShowTitleOnly");
|
616 | }
|
617 | }, {
|
618 | value: axisStyle.showUnitOnly,
|
619 | displayName: function(resources) {
|
620 | return resources.get("Visual_Axis_ShowUnitOnly");
|
621 | }
|
622 | }, {
|
623 | value: axisStyle.showBoth,
|
624 | displayName: function(resources) {
|
625 | return resources.get("Visual_Axis_ShowBoth");
|
626 | }
|
627 | } ]);
|
628 | }(axisStyle = visuals.axisStyle || (visuals.axisStyle = {}));
|
629 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
630 | }(powerbi || (powerbi = {}));
|
631 |
|
632 | var powerbi;
|
633 |
|
634 | !function(powerbi) {
|
635 | var visuals;
|
636 | !function(visuals) {
|
637 | var axisType;
|
638 | !function(axisType) {
|
639 | axisType.scalar = "Scalar", axisType.categorical = "Categorical", axisType.both = "Both",
|
640 | axisType.type = powerbi.createEnumType([ {
|
641 | value: axisType.scalar,
|
642 | displayName: function(resources) {
|
643 | return resources.get("Visual_Axis_Scalar");
|
644 | }
|
645 | }, {
|
646 | value: axisType.categorical,
|
647 | displayName: function(resources) {
|
648 | return resources.get("Visual_Axis_Categorical");
|
649 | }
|
650 | } ]);
|
651 | }(axisType = visuals.axisType || (visuals.axisType = {}));
|
652 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
653 | }(powerbi || (powerbi = {}));
|
654 |
|
655 | var powerbi;
|
656 |
|
657 | !function(powerbi) {
|
658 | var visuals;
|
659 | !function(visuals) {
|
660 | var basicShapeType;
|
661 | !function(basicShapeType) {
|
662 | basicShapeType.rectangle = "rectangle", basicShapeType.oval = "oval", basicShapeType.line = "line",
|
663 | basicShapeType.arrow = "arrow", basicShapeType.triangle = "triangle", basicShapeType.type = powerbi.createEnumType([ {
|
664 | value: basicShapeType.rectangle,
|
665 | displayName: "rectangle"
|
666 | }, {
|
667 | value: basicShapeType.oval,
|
668 | displayName: "oval"
|
669 | }, {
|
670 | value: basicShapeType.line,
|
671 | displayName: "line"
|
672 | }, {
|
673 | value: basicShapeType.arrow,
|
674 | displayName: "arrow"
|
675 | }, {
|
676 | value: basicShapeType.triangle,
|
677 | displayName: "triangle"
|
678 | } ]);
|
679 | }(basicShapeType = visuals.basicShapeType || (visuals.basicShapeType = {}));
|
680 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
681 | }(powerbi || (powerbi = {}));
|
682 |
|
683 | var powerbi;
|
684 |
|
685 | !function(powerbi) {
|
686 | var visuals;
|
687 | !function(visuals) {
|
688 | var imageScalingType;
|
689 | !function(imageScalingType) {
|
690 | imageScalingType.normal = "Normal", imageScalingType.fit = "Fit", imageScalingType.fill = "Fill",
|
691 | imageScalingType.type = powerbi.createEnumType([ {
|
692 | value: imageScalingType.normal,
|
693 | displayName: function(resources) {
|
694 | return resources.get("Visual_ImageScalingType_Normal");
|
695 | }
|
696 | }, {
|
697 | value: imageScalingType.fit,
|
698 | displayName: function(resources) {
|
699 | return resources.get("Visual_ImageScalingType_Fit");
|
700 | }
|
701 | }, {
|
702 | value: imageScalingType.fill,
|
703 | displayName: function(resources) {
|
704 | return resources.get("Visual_ImageScalingType_Fill");
|
705 | }
|
706 | } ]);
|
707 | }(imageScalingType = visuals.imageScalingType || (visuals.imageScalingType = {}));
|
708 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
709 | }(powerbi || (powerbi = {}));
|
710 |
|
711 | var powerbi;
|
712 |
|
713 | !function(powerbi) {
|
714 | var visuals;
|
715 | !function(visuals) {
|
716 | var labelPosition;
|
717 | !function(labelPosition) {
|
718 | labelPosition.insideEnd = "InsideEnd", labelPosition.insideCenter = "InsideCenter",
|
719 | labelPosition.outsideEnd = "OutsideEnd", labelPosition.insideBase = "InsideBase",
|
720 | labelPosition.type = powerbi.createEnumType([ {
|
721 | value: labelPosition.insideEnd,
|
722 | displayName: function(resources) {
|
723 | return resources.get("Visual_LabelPosition_InsideEnd");
|
724 | }
|
725 | }, {
|
726 | value: labelPosition.outsideEnd,
|
727 | displayName: function(resources) {
|
728 | return resources.get("Visual_LabelPosition_OutsideEnd");
|
729 | }
|
730 | }, {
|
731 | value: labelPosition.insideCenter,
|
732 | displayName: function(resources) {
|
733 | return resources.get("Visual_LabelPosition_InsideCenter");
|
734 | }
|
735 | }, {
|
736 | value: labelPosition.insideBase,
|
737 | displayName: function(resources) {
|
738 | return resources.get("Visual_LabelPosition_InsideBase");
|
739 | }
|
740 | } ]);
|
741 | }(labelPosition = visuals.labelPosition || (visuals.labelPosition = {}));
|
742 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
743 | }(powerbi || (powerbi = {}));
|
744 |
|
745 | var powerbi;
|
746 |
|
747 | !function(powerbi) {
|
748 | var visuals;
|
749 | !function(visuals) {
|
750 | var labelStyle;
|
751 | !function(labelStyle) {
|
752 | labelStyle.category = "Category", labelStyle.data = "Data", labelStyle.both = "Both",
|
753 | labelStyle.type = powerbi.createEnumType([ {
|
754 | value: labelStyle.category,
|
755 | displayName: function(resources) {
|
756 | return resources.get("Visual_LabelStyle_Category");
|
757 | }
|
758 | }, {
|
759 | value: labelStyle.data,
|
760 | displayName: function(resources) {
|
761 | return resources.get("Visual_LabelStyle_DataValue");
|
762 | }
|
763 | }, {
|
764 | value: labelStyle.both,
|
765 | displayName: function(resources) {
|
766 | return resources.get("Visual_LabelStyle_Both");
|
767 | }
|
768 | } ]);
|
769 | }(labelStyle = visuals.labelStyle || (visuals.labelStyle = {}));
|
770 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
771 | }(powerbi || (powerbi = {}));
|
772 |
|
773 | var powerbi;
|
774 |
|
775 | !function(powerbi) {
|
776 | var visuals;
|
777 | !function(visuals) {
|
778 | var legendPosition;
|
779 | !function(legendPosition) {
|
780 | legendPosition.top = "Top", legendPosition.bottom = "Bottom", legendPosition.left = "Left",
|
781 | legendPosition.right = "Right", legendPosition.topCenter = "TopCenter", legendPosition.bottomCenter = "BottomCenter",
|
782 | legendPosition.leftCenter = "LeftCenter", legendPosition.rightCenter = "RightCenter",
|
783 | legendPosition.type = powerbi.createEnumType([ {
|
784 | value: legendPosition.top,
|
785 | displayName: function(resources) {
|
786 | return resources.get("Visual_LegendPosition_Top");
|
787 | }
|
788 | }, {
|
789 | value: legendPosition.bottom,
|
790 | displayName: function(resources) {
|
791 | return resources.get("Visual_LegendPosition_Bottom");
|
792 | }
|
793 | }, {
|
794 | value: legendPosition.left,
|
795 | displayName: function(resources) {
|
796 | return resources.get("Visual_LegendPosition_Left");
|
797 | }
|
798 | }, {
|
799 | value: legendPosition.right,
|
800 | displayName: function(resources) {
|
801 | return resources.get("Visual_LegendPosition_Right");
|
802 | }
|
803 | }, {
|
804 | value: legendPosition.topCenter,
|
805 | displayName: function(resources) {
|
806 | return resources.get("Visual_LegendPosition_TopCenter");
|
807 | }
|
808 | }, {
|
809 | value: legendPosition.bottomCenter,
|
810 | displayName: function(resources) {
|
811 | return resources.get("Visual_LegendPosition_BottomCenter");
|
812 | }
|
813 | }, {
|
814 | value: legendPosition.leftCenter,
|
815 | displayName: function(resources) {
|
816 | return resources.get("Visual_LegendPosition_LeftCenter");
|
817 | }
|
818 | }, {
|
819 | value: legendPosition.rightCenter,
|
820 | displayName: function(resources) {
|
821 | return resources.get("Visual_LegendPosition_RightCenter");
|
822 | }
|
823 | } ]);
|
824 | }(legendPosition = visuals.legendPosition || (visuals.legendPosition = {}));
|
825 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
826 | }(powerbi || (powerbi = {}));
|
827 |
|
828 | var powerbi;
|
829 |
|
830 | !function(powerbi) {
|
831 | var visuals;
|
832 | !function(visuals) {
|
833 | var kpiDirection;
|
834 | !function(kpiDirection) {
|
835 | kpiDirection.positive = "Positive", kpiDirection.negative = "Negative", kpiDirection.type = powerbi.createEnumType([ {
|
836 | value: kpiDirection.positive,
|
837 | displayName: function(resources) {
|
838 | return resources.get("Visual_KPI_Direction_Positive");
|
839 | }
|
840 | }, {
|
841 | value: kpiDirection.negative,
|
842 | displayName: function(resources) {
|
843 | return resources.get("Visual_KPI_Direction_Negative");
|
844 | }
|
845 | } ]);
|
846 | }(kpiDirection = visuals.kpiDirection || (visuals.kpiDirection = {}));
|
847 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
848 | }(powerbi || (powerbi = {}));
|
849 |
|
850 | var powerbi;
|
851 |
|
852 | !function(powerbi) {
|
853 | var visuals;
|
854 | !function(visuals) {
|
855 | var lineStyle;
|
856 | !function(lineStyle) {
|
857 | lineStyle.dashed = "dashed", lineStyle.solid = "solid", lineStyle.dotted = "dotted",
|
858 | lineStyle.type = powerbi.createEnumType([ {
|
859 | value: lineStyle.dashed,
|
860 | displayName: function(resources) {
|
861 | return resources.get("Visual_LineStyle_Dashed");
|
862 | }
|
863 | }, {
|
864 | value: lineStyle.solid,
|
865 | displayName: function(resources) {
|
866 | return resources.get("Visual_LineStyle_Solid");
|
867 | }
|
868 | }, {
|
869 | value: lineStyle.dotted,
|
870 | displayName: function(resources) {
|
871 | return resources.get("Visual_LineStyle_Dotted");
|
872 | }
|
873 | } ]);
|
874 | }(lineStyle = visuals.lineStyle || (visuals.lineStyle = {}));
|
875 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
876 | }(powerbi || (powerbi = {}));
|
877 |
|
878 | var powerbi;
|
879 |
|
880 | !function(powerbi) {
|
881 | var visuals;
|
882 | !function(visuals) {
|
883 | var outline;
|
884 | !function(outline_1) {
|
885 | function showTop(outline) {
|
886 | return [ outline_1.topOnly, outline_1.topBottom, outline_1.frame ].some(function(o) {
|
887 | return o === outline;
|
888 | });
|
889 | }
|
890 | function showRight(outline) {
|
891 | return [ outline_1.rightOnly, outline_1.leftRight, outline_1.frame ].some(function(o) {
|
892 | return o === outline;
|
893 | });
|
894 | }
|
895 | function showBottom(outline) {
|
896 | return [ outline_1.bottomOnly, outline_1.topBottom, outline_1.frame ].some(function(o) {
|
897 | return o === outline;
|
898 | });
|
899 | }
|
900 | function showLeft(outline) {
|
901 | return [ outline_1.leftOnly, outline_1.leftRight, outline_1.frame ].some(function(o) {
|
902 | return o === outline;
|
903 | });
|
904 | }
|
905 | outline_1.none = "None", outline_1.bottomOnly = "BottomOnly", outline_1.topOnly = "TopOnly",
|
906 | outline_1.leftOnly = "LeftOnly", outline_1.rightOnly = "RightOnly", outline_1.topBottom = "TopBottom",
|
907 | outline_1.leftRight = "LeftRight", outline_1.frame = "Frame", outline_1.showTop = showTop,
|
908 | outline_1.showRight = showRight, outline_1.showBottom = showBottom, outline_1.showLeft = showLeft,
|
909 | outline_1.type = powerbi.createEnumType([ {
|
910 | value: outline_1.none,
|
911 | displayName: function(resources) {
|
912 | return resources.get("Visual_Outline_none");
|
913 | }
|
914 | }, {
|
915 | value: outline_1.bottomOnly,
|
916 | displayName: function(resources) {
|
917 | return resources.get("Visual_Outline_bottom_only");
|
918 | }
|
919 | }, {
|
920 | value: outline_1.topOnly,
|
921 | displayName: function(resources) {
|
922 | return resources.get("Visual_Outline_top_only");
|
923 | }
|
924 | }, {
|
925 | value: outline_1.leftOnly,
|
926 | displayName: function(resources) {
|
927 | return resources.get("Visual_Outline_LeftOnly");
|
928 | }
|
929 | }, {
|
930 | value: outline_1.rightOnly,
|
931 | displayName: function(resources) {
|
932 | return resources.get("Visual_Outline_RightOnly");
|
933 | }
|
934 | }, {
|
935 | value: outline_1.topBottom,
|
936 | displayName: function(resources) {
|
937 | return resources.get("Visual_Outline_top_Bottom");
|
938 | }
|
939 | }, {
|
940 | value: outline_1.leftRight,
|
941 | displayName: function(resources) {
|
942 | return resources.get("Visual_Outline_leftRight");
|
943 | }
|
944 | }, {
|
945 | value: outline_1.frame,
|
946 | displayName: function(resources) {
|
947 | return resources.get("Visual_Outline_frame");
|
948 | }
|
949 | } ]);
|
950 | }(outline = visuals.outline || (visuals.outline = {}));
|
951 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
952 | }(powerbi || (powerbi = {}));
|
953 |
|
954 | var powerbi;
|
955 |
|
956 | !function(powerbi) {
|
957 | var visuals;
|
958 | !function(visuals) {
|
959 | var referenceLinePosition;
|
960 | !function(referenceLinePosition) {
|
961 | referenceLinePosition.back = "back", referenceLinePosition.front = "front", referenceLinePosition.type = powerbi.createEnumType([ {
|
962 | value: referenceLinePosition.back,
|
963 | displayName: function(resources) {
|
964 | return resources.get("Visual_Reference_Line_Behind");
|
965 | }
|
966 | }, {
|
967 | value: referenceLinePosition.front,
|
968 | displayName: function(resources) {
|
969 | return resources.get("Visual_Reference_Line_InFront");
|
970 | }
|
971 | } ]);
|
972 | }(referenceLinePosition = visuals.referenceLinePosition || (visuals.referenceLinePosition = {}));
|
973 | var referenceLineDataLabelHorizontalPosition;
|
974 | !function(referenceLineDataLabelHorizontalPosition) {
|
975 | referenceLineDataLabelHorizontalPosition.left = "left", referenceLineDataLabelHorizontalPosition.right = "right",
|
976 | referenceLineDataLabelHorizontalPosition.type = powerbi.createEnumType([ {
|
977 | value: referenceLineDataLabelHorizontalPosition.left,
|
978 | displayName: function(resources) {
|
979 | return resources.get("Visual_Reference_Line_Data_Label_Left");
|
980 | }
|
981 | }, {
|
982 | value: referenceLineDataLabelHorizontalPosition.right,
|
983 | displayName: function(resources) {
|
984 | return resources.get("Visual_Reference_Line_Data_Label_Right");
|
985 | }
|
986 | } ]);
|
987 | }(referenceLineDataLabelHorizontalPosition = visuals.referenceLineDataLabelHorizontalPosition || (visuals.referenceLineDataLabelHorizontalPosition = {}));
|
988 | var referenceLineDataLabelVerticalPosition;
|
989 | !function(referenceLineDataLabelVerticalPosition) {
|
990 | referenceLineDataLabelVerticalPosition.above = "above", referenceLineDataLabelVerticalPosition.under = "under",
|
991 | referenceLineDataLabelVerticalPosition.type = powerbi.createEnumType([ {
|
992 | value: referenceLineDataLabelVerticalPosition.above,
|
993 | displayName: function(resources) {
|
994 | return resources.get("Visual_Reference_Line_Data_Label_Above");
|
995 | }
|
996 | }, {
|
997 | value: referenceLineDataLabelVerticalPosition.under,
|
998 | displayName: function(resources) {
|
999 | return resources.get("Visual_Reference_Line_Data_Label_Under");
|
1000 | }
|
1001 | } ]);
|
1002 | }(referenceLineDataLabelVerticalPosition = visuals.referenceLineDataLabelVerticalPosition || (visuals.referenceLineDataLabelVerticalPosition = {}));
|
1003 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1004 | }(powerbi || (powerbi = {}));
|
1005 |
|
1006 | var powerbi;
|
1007 |
|
1008 | !function(powerbi) {
|
1009 | var visuals;
|
1010 | !function(visuals) {
|
1011 | var slicerOrientation;
|
1012 | !function(slicerOrientation) {
|
1013 | slicerOrientation.type = powerbi.createEnumType([ {
|
1014 | value: 0,
|
1015 | displayName: function(resources) {
|
1016 | return resources.get("Slicer_Orientation_Vertical");
|
1017 | }
|
1018 | }, {
|
1019 | value: 1,
|
1020 | displayName: function(resources) {
|
1021 | return resources.get("Slicer_Orientation_Horizontal");
|
1022 | }
|
1023 | } ]);
|
1024 | }(slicerOrientation = visuals.slicerOrientation || (visuals.slicerOrientation = {}));
|
1025 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1026 | }(powerbi || (powerbi = {}));
|
1027 |
|
1028 | var powerbi;
|
1029 |
|
1030 | !function(powerbi) {
|
1031 | var visuals;
|
1032 | !function(visuals) {
|
1033 | var yAxisPosition;
|
1034 | !function(yAxisPosition) {
|
1035 | yAxisPosition.left = "Left", yAxisPosition.right = "Right", yAxisPosition.type = powerbi.createEnumType([ {
|
1036 | value: yAxisPosition.left,
|
1037 | displayName: function(resources) {
|
1038 | return resources.get("Visual_yAxis_Left");
|
1039 | }
|
1040 | }, {
|
1041 | value: yAxisPosition.right,
|
1042 | displayName: function(resources) {
|
1043 | return resources.get("Visual_yAxis_Right");
|
1044 | }
|
1045 | } ]);
|
1046 | }(yAxisPosition = visuals.yAxisPosition || (visuals.yAxisPosition = {}));
|
1047 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1048 | }(powerbi || (powerbi = {}));
|
1049 |
|
1050 | var powerbi;
|
1051 |
|
1052 | !function(powerbi) {
|
1053 | var visuals;
|
1054 | !function(visuals) {
|
1055 | var AnimatorCommon;
|
1056 | !function(AnimatorCommon) {
|
1057 | function GetAnimationDuration(animator, suppressAnimations) {
|
1058 | return suppressAnimations || !animator ? 0 : animator.getDuration();
|
1059 | }
|
1060 | AnimatorCommon.MinervaAnimationDuration = 250, AnimatorCommon.MaxDataPointsToAnimate = 1e3,
|
1061 | AnimatorCommon.GetAnimationDuration = GetAnimationDuration;
|
1062 | }(AnimatorCommon = visuals.AnimatorCommon || (visuals.AnimatorCommon = {}));
|
1063 | var BaseAnimator = function() {
|
1064 | function BaseAnimator(options) {
|
1065 | options && options.duration && (this.animationDuration = options.duration), this.animationDuration = this.animationDuration >= 0 ? this.animationDuration : AnimatorCommon.MinervaAnimationDuration;
|
1066 | }
|
1067 | return BaseAnimator.prototype.getDuration = function() {
|
1068 | return this.animationDuration;
|
1069 | }, BaseAnimator.prototype.animate = function(options) {
|
1070 | return null;
|
1071 | }, BaseAnimator.prototype.getEasing = function() {
|
1072 | return "cubic-in-out";
|
1073 | }, BaseAnimator;
|
1074 | }();
|
1075 | visuals.BaseAnimator = BaseAnimator;
|
1076 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1077 | }(powerbi || (powerbi = {}));
|
1078 |
|
1079 | var powerbi;
|
1080 |
|
1081 | !function(powerbi) {
|
1082 | var visuals;
|
1083 | !function(visuals) {
|
1084 | var WebColumnChartAnimator = function(_super) {
|
1085 | function WebColumnChartAnimator(options) {
|
1086 | _super.call(this, options);
|
1087 | }
|
1088 | return __extends(WebColumnChartAnimator, _super), WebColumnChartAnimator.prototype.animate = function(options) {
|
1089 | var result = {
|
1090 | failed: !0,
|
1091 | shapes: null
|
1092 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel, dataPointCount = viewModel.categories.length * viewModel.series.length;
|
1093 | 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))),
|
1094 | this.previousViewModel = viewModel, result);
|
1095 | }, WebColumnChartAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1096 | var data = options.viewModel, itemCS = options.itemCS, shapeSelection = options.series.selectAll(itemCS.selector), shapes = shapeSelection.data(function(d) {
|
1097 | return d.data;
|
1098 | }, function(d) {
|
1099 | return d.key;
|
1100 | }), hasHighlights = data.hasHighlights;
|
1101 | return shapes.enter().append("rect").attr("class", function(d) {
|
1102 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
1103 | }).attr(options.layout.shapeLayoutWithoutHighlights), shapes.style("fill", function(d) {
|
1104 | return d.color;
|
1105 | }).style("fill-opacity", function(d) {
|
1106 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !1, hasHighlights);
|
1107 | }).transition().duration(this.animationDuration).attr(options.layout.shapeLayout),
|
1108 | shapes.exit().remove(), {
|
1109 | failed: !1,
|
1110 | shapes: shapes
|
1111 | };
|
1112 | }, WebColumnChartAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1113 | var shapes = this.animateDefaultShapes(options.viewModel, options.series, options.layout, options.itemCS);
|
1114 | return {
|
1115 | failed: !1,
|
1116 | shapes: shapes
|
1117 | };
|
1118 | }, WebColumnChartAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1119 | var itemCS = options.itemCS, shapeSelection = options.series.selectAll(itemCS.selector), shapes = shapeSelection.data(function(d) {
|
1120 | return d.data;
|
1121 | }, function(d) {
|
1122 | return d.key;
|
1123 | }), hasSelection = options.interactivityService && options.interactivityService.hasSelection();
|
1124 | return shapes.enter().append("rect").attr("class", function(d) {
|
1125 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
1126 | }), shapes.style("fill", function(d) {
|
1127 | return d.color;
|
1128 | }).style("fill-opacity", function(d) {
|
1129 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, d.selected, !d.selected);
|
1130 | }).transition().duration(this.animationDuration).attr(options.layout.shapeLayout).transition().duration(0).delay(this.animationDuration).style("fill-opacity", function(d) {
|
1131 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
1132 | }), shapes.exit().transition().duration(this.animationDuration).attr(hasSelection ? options.layout.zeroShapeLayout : options.layout.shapeLayoutWithoutHighlights).remove(),
|
1133 | {
|
1134 | failed: !1,
|
1135 | shapes: shapes
|
1136 | };
|
1137 | }, WebColumnChartAnimator.prototype.animateDefaultShapes = function(data, series, layout, itemCS) {
|
1138 | var shapeSelection = series.selectAll(itemCS.selector), shapes = shapeSelection.data(function(d) {
|
1139 | return d.data;
|
1140 | }, function(d) {
|
1141 | return d.key;
|
1142 | });
|
1143 | return shapes.enter().append("rect").attr("class", function(d) {
|
1144 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
1145 | }), shapes.style("fill", function(d) {
|
1146 | return d.color;
|
1147 | }).style("fill-opacity", function(d) {
|
1148 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !1, data.hasHighlights);
|
1149 | }).transition().duration(this.animationDuration).attr(layout.shapeLayout), shapes.exit().remove(),
|
1150 | shapes;
|
1151 | }, WebColumnChartAnimator;
|
1152 | }(visuals.BaseAnimator);
|
1153 | visuals.WebColumnChartAnimator = WebColumnChartAnimator;
|
1154 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1155 | }(powerbi || (powerbi = {}));
|
1156 |
|
1157 | var powerbi;
|
1158 |
|
1159 | !function(powerbi) {
|
1160 | var visuals;
|
1161 | !function(visuals) {
|
1162 | var WebDonutChartAnimator = function(_super) {
|
1163 | function WebDonutChartAnimator(options) {
|
1164 | _super.call(this, options);
|
1165 | }
|
1166 | return __extends(WebDonutChartAnimator, _super), WebDonutChartAnimator.prototype.animate = function(options) {
|
1167 | var result = {
|
1168 | failed: !0,
|
1169 | shapes: null,
|
1170 | highlightShapes: null
|
1171 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel;
|
1172 | 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))),
|
1173 | this.previousViewModel = viewModel, result;
|
1174 | }, WebDonutChartAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1175 | var shapes = this.animateDefaultShapes(options), highlightShapes = options.graphicsContext.select(".slices").selectAll("path.slice-highlight").data(options.viewModel.dataPoints.filter(function(value) {
|
1176 | return null != value.data.highlightRatio;
|
1177 | }), function(d) {
|
1178 | return d.data.identity.getKey();
|
1179 | });
|
1180 | return highlightShapes.enter().insert("path").classed("slice-highlight", !0).each(function(d) {
|
1181 | this._current = d;
|
1182 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints.filter(function(value) {
|
1183 | return null != value.data.highlightRatio;
|
1184 | })), highlightShapes.style("fill", function(d) {
|
1185 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1186 | }).style("fill-opacity", function(d) {
|
1187 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, options.viewModel.hasHighlights);
|
1188 | }).style("stroke-dasharray", function(d) {
|
1189 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio, d.data.highlightRatio);
|
1190 | }).style("stroke-width", function(d) {
|
1191 | return d.data.strokeWidth;
|
1192 | }).attr(options.layout.shapeLayout).transition().duration(this.animationDuration).attr(options.layout.highlightShapeLayout),
|
1193 | highlightShapes.exit().remove(), visuals.NewDataLabelUtils.drawDefaultLabels(options.labelGraphicsContext, options.labels, !1, !0, !0),
|
1194 | visuals.NewDataLabelUtils.drawLabelLeaderLines(options.labelGraphicsContext, options.labels),
|
1195 | {
|
1196 | failed: !1,
|
1197 | shapes: shapes,
|
1198 | highlightShapes: highlightShapes
|
1199 | };
|
1200 | }, WebDonutChartAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1201 | var shapes = this.animateDefaultShapes(options), highlightShapes = this.animateDefaultHighlightShapes(options);
|
1202 | return visuals.NewDataLabelUtils.drawDefaultLabels(options.labelGraphicsContext, options.labels, !1, !0, !0),
|
1203 | visuals.NewDataLabelUtils.drawLabelLeaderLines(options.labelGraphicsContext, options.labels),
|
1204 | {
|
1205 | failed: !1,
|
1206 | shapes: shapes,
|
1207 | highlightShapes: highlightShapes
|
1208 | };
|
1209 | }, WebDonutChartAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1210 | var hasSelection = options.interactivityService && options.interactivityService.hasSelection(), duration = this.animationDuration, shapes = options.graphicsContext.select(".slices").selectAll("path.slice").data(options.viewModel.dataPoints, function(d) {
|
1211 | return d.data.identity.getKey();
|
1212 | });
|
1213 | shapes.enter().insert("path").classed("slice", !0).each(function(d) {
|
1214 | this._current = d;
|
1215 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints), shapes.style("fill", function(d) {
|
1216 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1217 | }).style("fill-opacity", function(d) {
|
1218 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, d.data.selected, !d.data.selected);
|
1219 | }).style("stroke-dasharray", function(d) {
|
1220 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio);
|
1221 | }).style("stroke-width", function(d) {
|
1222 | return d.data.strokeWidth;
|
1223 | }).transition().duration(duration).attr(options.layout.shapeLayout).transition().duration(0).delay(duration).style("fill-opacity", function(d) {
|
1224 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
1225 | }), shapes.exit().remove();
|
1226 | var highlightShapes = options.graphicsContext.select(".slices").selectAll("path.slice-highlight").data(options.viewModel.dataPoints.filter(function(value) {
|
1227 | return null != value.data.highlightRatio;
|
1228 | }), function(d) {
|
1229 | return d.data.identity.getKey();
|
1230 | });
|
1231 | return highlightShapes.enter().insert("path").classed("slice-highlight", !0).each(function(d) {
|
1232 | this._current = d;
|
1233 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints.filter(function(value) {
|
1234 | return null != value.data.highlightRatio;
|
1235 | })), highlightShapes.style("fill", function(d) {
|
1236 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1237 | }).style("fill-opacity", function(d) {
|
1238 | return visuals.ColumnUtil.getFillOpacity(!1, !0, !1, !0);
|
1239 | }).style("stroke-dasharray", function(d) {
|
1240 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio, d.data.highlightRatio);
|
1241 | }).style("stroke-width", function(d) {
|
1242 | return d.data.strokeWidth;
|
1243 | }).transition().duration(duration).attr(hasSelection ? options.layout.zeroShapeLayout : options.layout.shapeLayout).remove(),
|
1244 | highlightShapes.exit().remove(), visuals.NewDataLabelUtils.drawDefaultLabels(options.labelGraphicsContext, options.labels, !1, !0, !0),
|
1245 | visuals.NewDataLabelUtils.drawLabelLeaderLines(options.labelGraphicsContext, options.labels),
|
1246 | {
|
1247 | failed: !1,
|
1248 | shapes: shapes,
|
1249 | highlightShapes: highlightShapes
|
1250 | };
|
1251 | }, WebDonutChartAnimator.prototype.animateDefaultShapes = function(options) {
|
1252 | var shapes = options.graphicsContext.select(".slices").selectAll("path.slice").data(options.viewModel.dataPoints, function(d) {
|
1253 | return d.data.identity.getKey();
|
1254 | });
|
1255 | return shapes.enter().insert("path").classed("slice", !0).each(function(d) {
|
1256 | this._current = d;
|
1257 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints), shapes.style("fill", function(d) {
|
1258 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1259 | }).style("fill-opacity", function(d) {
|
1260 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, !1, options.viewModel.hasHighlights);
|
1261 | }).style("stroke-dasharray", function(d) {
|
1262 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio);
|
1263 | }).style("stroke-width", function(d) {
|
1264 | return d.data.strokeWidth;
|
1265 | }).transition().duration(this.animationDuration).attr(options.layout.shapeLayout),
|
1266 | shapes.exit().remove(), shapes;
|
1267 | }, WebDonutChartAnimator.prototype.animateDefaultHighlightShapes = function(options) {
|
1268 | var highlightShapes = options.graphicsContext.select(".slices").selectAll("path.slice-highlight").data(options.viewModel.dataPoints.filter(function(value) {
|
1269 | return null != value.data.highlightRatio;
|
1270 | }), function(d) {
|
1271 | return d.data.identity.getKey();
|
1272 | });
|
1273 | return highlightShapes.enter().insert("path").classed("slice-highlight", !0).each(function(d) {
|
1274 | this._current = d;
|
1275 | }), visuals.DonutChart.isSingleColor(options.viewModel.dataPoints.filter(function(value) {
|
1276 | return null != value.data.highlightRatio;
|
1277 | })), highlightShapes.style("fill", function(d) {
|
1278 | return d.data.color ? d.data.color : options.colors.getNewColorScale().getColor(d.data.identity.getKey()).value;
|
1279 | }).style("fill-opacity", function(d) {
|
1280 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, options.viewModel.hasHighlights);
|
1281 | }).style("stroke-dasharray", function(d) {
|
1282 | return visuals.DonutChart.drawStrokeForDonutChart(options.radius, options.innerArcRadiusRatio, d, options.sliceWidthRatio, d.data.highlightRatio);
|
1283 | }).style("stroke-width", function(d) {
|
1284 | return d.data.strokeWidth;
|
1285 | }).transition().duration(this.animationDuration).attr(options.layout.highlightShapeLayout),
|
1286 | highlightShapes.exit().remove(), highlightShapes;
|
1287 | }, WebDonutChartAnimator;
|
1288 | }(visuals.BaseAnimator);
|
1289 | visuals.WebDonutChartAnimator = WebDonutChartAnimator;
|
1290 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1291 | }(powerbi || (powerbi = {}));
|
1292 |
|
1293 | var powerbi;
|
1294 |
|
1295 | !function(powerbi) {
|
1296 | var visuals;
|
1297 | !function(visuals) {
|
1298 | var WebFunnelAnimator = function(_super) {
|
1299 | function WebFunnelAnimator(options) {
|
1300 | _super.call(this, options);
|
1301 | }
|
1302 | return __extends(WebFunnelAnimator, _super), WebFunnelAnimator.prototype.animate = function(options) {
|
1303 | var result = {
|
1304 | failed: !0,
|
1305 | shapes: null,
|
1306 | dataLabels: null
|
1307 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel;
|
1308 | 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))),
|
1309 | this.previousViewModel = viewModel, result;
|
1310 | }, WebFunnelAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1311 | var data = options.viewModel, layout = options.layout, hasHighlights = !0, hasSelection = !1;
|
1312 | this.animateDefaultAxis(options.axisGraphicsContext, options.axisOptions, options.isHidingPercentBars);
|
1313 | var shapes = options.shapeGraphicsContext.selectAll(visuals.FunnelChart.Selectors.funnel.bars.selector).data(data.slices, function(d) {
|
1314 | return d.key;
|
1315 | });
|
1316 | shapes.enter().append("rect").attr("class", function(d) {
|
1317 | return d.highlight ? visuals.FunnelChart.FunnelBarHighlightClass : visuals.FunnelChart.Selectors.funnel.bars["class"];
|
1318 | }).attr(layout.shapeLayoutWithoutHighlights), shapes.style("fill", function(d) {
|
1319 | return d.color;
|
1320 | }).style("fill-opacity", function(d) {
|
1321 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
1322 | }).transition().duration(this.animationDuration).attr(layout.shapeLayout), shapes.exit().remove(),
|
1323 | this.animatePercentBars(options);
|
1324 | var dataLabels = this.animateDefaultDataLabels(options);
|
1325 | return {
|
1326 | failed: !1,
|
1327 | shapes: shapes,
|
1328 | dataLabels: dataLabels
|
1329 | };
|
1330 | }, WebFunnelAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1331 | var data = options.viewModel, layout = options.layout;
|
1332 | this.animateDefaultAxis(options.axisGraphicsContext, options.axisOptions, options.isHidingPercentBars);
|
1333 | var shapes = this.animateDefaultShapes(data, data.slices, options.shapeGraphicsContext, layout);
|
1334 | this.animatePercentBars(options);
|
1335 | var dataLabels = this.animateDefaultDataLabels(options);
|
1336 | return {
|
1337 | failed: !1,
|
1338 | shapes: shapes,
|
1339 | dataLabels: dataLabels
|
1340 | };
|
1341 | }, WebFunnelAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1342 | var data = options.viewModel, layout = options.layout, hasSelection = options.interactivityService ? options.interactivityService.hasSelection() : !1;
|
1343 | this.animateDefaultAxis(options.axisGraphicsContext, options.axisOptions, options.isHidingPercentBars);
|
1344 | var shapes = options.shapeGraphicsContext.selectAll(visuals.FunnelChart.Selectors.funnel.bars.selector).data(data.slices, function(d) {
|
1345 | return d.key;
|
1346 | });
|
1347 | shapes.enter().append("rect").attr("class", function(d) {
|
1348 | return d.highlight ? visuals.FunnelChart.FunnelBarHighlightClass : visuals.FunnelChart.Selectors.funnel.bars["class"];
|
1349 | }), shapes.style("fill", function(d) {
|
1350 | return d.color;
|
1351 | }).style("fill-opacity", function(d) {
|
1352 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !d.selected);
|
1353 | }).transition().duration(this.animationDuration).attr(layout.shapeLayoutWithoutHighlights).transition().duration(0).delay(this.animationDuration).style("fill-opacity", function(d) {
|
1354 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
1355 | });
|
1356 | var exitShapes = shapes.exit();
|
1357 | exitShapes.transition().duration(this.animationDuration).attr(hasSelection ? layout.zeroShapeLayout : layout.shapeLayoutWithoutHighlights).remove(),
|
1358 | this.animatePercentBars(options);
|
1359 | var dataLabels = this.animateDefaultDataLabels(options);
|
1360 | return {
|
1361 | failed: !1,
|
1362 | shapes: shapes,
|
1363 | dataLabels: dataLabels
|
1364 | };
|
1365 | }, WebFunnelAnimator.prototype.animateDefaultAxis = function(graphicsContext, axisOptions, isHidingPercentBars) {
|
1366 | 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);
|
1367 | graphicsContext.classed("axis", !0).transition().duration(this.animationDuration).attr("transform", visuals.SVGUtil.translate(0, axisOptions.margin.top)).call(xAxis);
|
1368 | }, WebFunnelAnimator.prototype.animateDefaultShapes = function(data, slices, graphicsContext, layout) {
|
1369 | var hasHighlights = data.hasHighlights, shapes = graphicsContext.selectAll(visuals.FunnelChart.Selectors.funnel.bars.selector).data(slices, function(d) {
|
1370 | return d.key;
|
1371 | });
|
1372 | return shapes.enter().append("rect").attr("class", function(d) {
|
1373 | return d.highlight ? visuals.FunnelChart.FunnelBarHighlightClass : visuals.FunnelChart.Selectors.funnel.bars["class"];
|
1374 | }), shapes.style("fill", function(d) {
|
1375 | return d.color;
|
1376 | }).style("fill-opacity", function(d) {
|
1377 | return function(d) {
|
1378 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !1, hasHighlights);
|
1379 | };
|
1380 | }).transition().duration(this.animationDuration).attr(layout.shapeLayout), shapes.exit().remove(),
|
1381 | shapes;
|
1382 | }, WebFunnelAnimator.prototype.animateDefaultDataLabels = function(options) {
|
1383 | var dataLabels;
|
1384 | return options.viewModel.dataLabelsSettings.show && options.viewModel.canShowDataLabels ? dataLabels = visuals.dataLabelUtils.drawDefaultLabelsForFunnelChart(options.viewModel.slices, options.labelGraphicsContext, options.labelLayout, !0, this.animationDuration) : visuals.dataLabelUtils.cleanDataLabels(options.labelGraphicsContext),
|
1385 | dataLabels;
|
1386 | }, WebFunnelAnimator.prototype.animatePercentBars = function(options) {
|
1387 | var data = options.viewModel, isHidingPercentBars = options.isHidingPercentBars;
|
1388 | if (isHidingPercentBars || !data.slices || (data.hasHighlights ? data.slices.length / 2 : data.slices.length) < 2) return void this.animatePercentBarComponents([], options);
|
1389 | var slices = [ data.slices[data.hasHighlights ? 1 : 0], data.slices[data.slices.length - 1] ], baseline = visuals.FunnelChart.getFunnelSliceValue(slices[0]);
|
1390 | if (0 >= baseline) return void this.animatePercentBarComponents([], options);
|
1391 | var percentData = slices.map(function(slice, i) {
|
1392 | return {
|
1393 | value: visuals.FunnelChart.getFunnelSliceValue(slice),
|
1394 | percent: 0 === i ? 1 : visuals.FunnelChart.getFunnelSliceValue(slice) / baseline,
|
1395 | isTop: 0 === i
|
1396 | };
|
1397 | });
|
1398 | this.animatePercentBarComponents(percentData, options);
|
1399 | }, WebFunnelAnimator.prototype.animateToFunnelPercent = function(context, targetData, layout) {
|
1400 | return context.data(targetData).transition().duration(this.animationDuration).attr(layout);
|
1401 | }, WebFunnelAnimator.prototype.animatePercentBarComponents = function(data, options) {
|
1402 | var graphicsContext = options.percentGraphicsContext, layout = options.layout, zeroData = [ {
|
1403 | percent: 0,
|
1404 | value: 0,
|
1405 | isTop: !0
|
1406 | }, {
|
1407 | percent: 0,
|
1408 | value: 0,
|
1409 | isTop: !1
|
1410 | } ], mainLine = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.mainLine.selector).data(data);
|
1411 | this.animateToFunnelPercent(mainLine.exit(), zeroData, layout.percentBarLayout.mainLine).remove(),
|
1412 | mainLine.enter().append("line").classed(visuals.FunnelChart.Selectors.percentBar.mainLine["class"], !0).data(zeroData).attr(layout.percentBarLayout.mainLine),
|
1413 | this.animateToFunnelPercent(mainLine, data, layout.percentBarLayout.mainLine);
|
1414 | var leftTick = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.leftTick.selector).data(data);
|
1415 | this.animateToFunnelPercent(leftTick.exit(), zeroData, layout.percentBarLayout.leftTick).remove(),
|
1416 | leftTick.enter().append("line").classed(visuals.FunnelChart.Selectors.percentBar.leftTick["class"], !0).data(zeroData).attr(layout.percentBarLayout.leftTick),
|
1417 | this.animateToFunnelPercent(leftTick, data, layout.percentBarLayout.leftTick);
|
1418 | var rightTick = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.rightTick.selector).data(data);
|
1419 | this.animateToFunnelPercent(rightTick.exit(), zeroData, layout.percentBarLayout.rightTick).remove(),
|
1420 | rightTick.enter().append("line").classed(visuals.FunnelChart.Selectors.percentBar.rightTick["class"], !0).data(zeroData).attr(layout.percentBarLayout.rightTick),
|
1421 | this.animateToFunnelPercent(rightTick, data, layout.percentBarLayout.rightTick);
|
1422 | var text = graphicsContext.selectAll(visuals.FunnelChart.Selectors.percentBar.text.selector).data(data);
|
1423 | this.animateToFunnelPercent(text.exit(), zeroData, layout.percentBarLayout.text).remove(),
|
1424 | text.enter().append("text").classed(visuals.FunnelChart.Selectors.percentBar.text["class"], !0).data(zeroData).attr(layout.percentBarLayout.text),
|
1425 | this.animateToFunnelPercent(text, data, layout.percentBarLayout.text).text(function(fp) {
|
1426 | return powerbi.formattingService.formatValue(fp.percent, visuals.valueFormatter.getLocalizedString("Percentage1"));
|
1427 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(options.visualInitOptions);
|
1428 | }, WebFunnelAnimator;
|
1429 | }(visuals.BaseAnimator);
|
1430 | visuals.WebFunnelAnimator = WebFunnelAnimator;
|
1431 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1432 | }(powerbi || (powerbi = {}));
|
1433 |
|
1434 | var powerbi;
|
1435 |
|
1436 | !function(powerbi) {
|
1437 | var visuals;
|
1438 | !function(visuals) {
|
1439 | var WebTreemapAnimator = function(_super) {
|
1440 | function WebTreemapAnimator(options) {
|
1441 | _super.call(this, options);
|
1442 | }
|
1443 | return __extends(WebTreemapAnimator, _super), WebTreemapAnimator.prototype.animate = function(options) {
|
1444 | var result = {
|
1445 | failed: !0,
|
1446 | shapes: null,
|
1447 | highlightShapes: null,
|
1448 | majorLabels: null,
|
1449 | minorLabels: null
|
1450 | }, viewModel = options.viewModel, previousViewModel = this.previousViewModel;
|
1451 | 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))),
|
1452 | this.previousViewModel = viewModel, result;
|
1453 | }, WebTreemapAnimator.prototype.animateNormalToHighlighted = function(options) {
|
1454 | 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) {
|
1455 | return d.key + "highlight";
|
1456 | });
|
1457 | highlightShapes.enter().append("rect").attr("class", options.layout.highlightShapeClass).attr(options.layout.shapeLayout),
|
1458 | highlightShapes.style("fill", function(d) {
|
1459 | return visuals.Treemap.getFill(d, !0);
|
1460 | }).style("fill-opacity", function(d) {
|
1461 | return visuals.Treemap.getFillOpacity(d, hasSelection, hasHighlights, !0);
|
1462 | }).transition().duration(this.animationDuration).attr(options.layout.highlightShapeLayout),
|
1463 | highlightShapes.exit().remove();
|
1464 | var majorLabels = this.animateDefaultMajorLabels(options.labelGraphicsContext, options.majorLabeledNodes, options.labelSettings, options.layout), minorLabels = this.animateDefaultMinorLabels(options.labelGraphicsContext, options.minorLabeledNodes, options.labelSettings, options.layout);
|
1465 | return {
|
1466 | failed: !1,
|
1467 | shapes: shapes,
|
1468 | highlightShapes: highlightShapes,
|
1469 | majorLabels: majorLabels,
|
1470 | minorLabels: minorLabels
|
1471 | };
|
1472 | }, WebTreemapAnimator.prototype.animateHighlightedToHighlighted = function(options) {
|
1473 | var hasSelection = !1, hasHighlights = !0, shapes = this.animateDefaultShapes(options.shapeGraphicsContext, options.nodes, hasSelection, hasHighlights, options.layout);
|
1474 | options.shapeGraphicsContext.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(options.highlightNodes, function(d) {
|
1475 | return d.key + "highlight";
|
1476 | });
|
1477 | 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);
|
1478 | return {
|
1479 | failed: !1,
|
1480 | shapes: shapes,
|
1481 | highlightShapes: highlightShapes,
|
1482 | majorLabels: majorLabels,
|
1483 | minorLabels: minorLabels
|
1484 | };
|
1485 | }, WebTreemapAnimator.prototype.animateHighlightedToNormal = function(options) {
|
1486 | var hasSelection = options.interactivityService ? options.interactivityService.hasSelection() : !1, shapes = options.shapeGraphicsContext.selectAll("." + visuals.Treemap.TreemapNodeClassName).data(options.nodes, function(d) {
|
1487 | return d.key;
|
1488 | });
|
1489 | shapes.enter().append("rect").attr("class", options.layout.shapeClass), shapes.transition().duration(this.animationDuration).style("fill", function(d) {
|
1490 | return visuals.Treemap.getFill(d, !1);
|
1491 | }).style("fill-opacity", function(d) {
|
1492 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, d.selected, !d.selected);
|
1493 | }).attr(options.layout.shapeLayout).transition().duration(0).delay(this.animationDuration).style("fill-opacity", function(d) {
|
1494 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
1495 | }), shapes.exit().remove();
|
1496 | var highlightShapes = options.shapeGraphicsContext.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(options.nodes, function(d) {
|
1497 | return d.key + "highlight";
|
1498 | });
|
1499 | highlightShapes.enter().append("rect").attr("class", options.layout.highlightShapeClass),
|
1500 | highlightShapes.style("fill", function(d) {
|
1501 | return visuals.Treemap.getFill(d, !0);
|
1502 | }).style("fill-opacity", function(d) {
|
1503 | return visuals.ColumnUtil.getFillOpacity(d.selected, !0, d.selected, !d.selected);
|
1504 | }).transition().duration(this.animationDuration).attr(hasSelection ? options.layout.zeroShapeLayout : options.layout.shapeLayout).remove(),
|
1505 | highlightShapes.exit().remove();
|
1506 | var majorLabels = this.animateDefaultMajorLabels(options.labelGraphicsContext, options.majorLabeledNodes, options.labelSettings, options.layout), minorLabels = this.animateDefaultMinorLabels(options.labelGraphicsContext, options.minorLabeledNodes, options.labelSettings, options.layout);
|
1507 | return {
|
1508 | failed: !1,
|
1509 | shapes: shapes,
|
1510 | highlightShapes: highlightShapes,
|
1511 | majorLabels: majorLabels,
|
1512 | minorLabels: minorLabels
|
1513 | };
|
1514 | }, WebTreemapAnimator.prototype.animateDefaultShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
1515 | var isHighlightShape = !1, shapes = context.selectAll("." + visuals.Treemap.TreemapNodeClassName).data(nodes, function(d) {
|
1516 | return d.key;
|
1517 | });
|
1518 | return shapes.enter().append("rect").attr("class", layout.shapeClass), shapes.transition().duration(this.animationDuration).style("fill", function(d) {
|
1519 | return visuals.Treemap.getFill(d, isHighlightShape);
|
1520 | }).style("fill-opacity", function(d) {
|
1521 | return visuals.Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
1522 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
1523 | }, WebTreemapAnimator.prototype.animateDefaultHighlightShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
1524 | var isHighlightShape = !0, highlightShapes = context.selectAll("." + visuals.Treemap.HighlightNodeClassName).data(nodes, function(d) {
|
1525 | return d.key + "highlight";
|
1526 | });
|
1527 | return highlightShapes.enter().append("rect").attr("class", layout.highlightShapeClass),
|
1528 | highlightShapes.transition().duration(this.animationDuration).style("fill", function(d) {
|
1529 | return visuals.Treemap.getFill(d, isHighlightShape);
|
1530 | }).style("fill-opacity", function(d) {
|
1531 | return visuals.Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
1532 | }).attr(layout.highlightShapeLayout), highlightShapes.exit().remove(), highlightShapes;
|
1533 | }, WebTreemapAnimator.prototype.animateDefaultMajorLabels = function(context, nodes, labelSettings, layout) {
|
1534 | var labels = context.selectAll("." + visuals.Treemap.MajorLabelClassName).data(nodes, function(d) {
|
1535 | return d.key;
|
1536 | });
|
1537 | return labels.enter().append("text").attr("class", layout.majorLabelClass), labels.text(layout.majorLabelText).style("fill", function() {
|
1538 | return labelSettings.labelColor;
|
1539 | }).transition().duration(this.animationDuration).attr(layout.majorLabelLayout),
|
1540 | labels.exit().remove(), labels;
|
1541 | }, WebTreemapAnimator.prototype.animateDefaultMinorLabels = function(context, nodes, labelSettings, layout) {
|
1542 | var labels = context.selectAll("." + visuals.Treemap.MinorLabelClassName).data(nodes, function(d) {
|
1543 | return d.key;
|
1544 | });
|
1545 | return labels.enter().append("text").attr("class", layout.minorLabelClass), labels.text(layout.minorLabelText).style("fill", function() {
|
1546 | return labelSettings.labelColor;
|
1547 | }).transition().duration(this.animationDuration).attr(layout.minorLabelLayout),
|
1548 | labels.exit().remove(), labels;
|
1549 | }, WebTreemapAnimator;
|
1550 | }(visuals.BaseAnimator);
|
1551 | visuals.WebTreemapAnimator = WebTreemapAnimator;
|
1552 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1553 | }(powerbi || (powerbi = {}));
|
1554 |
|
1555 | var powerbi;
|
1556 |
|
1557 | !function(powerbi) {
|
1558 | var visuals;
|
1559 | !function(visuals) {
|
1560 | visuals.StandardObjectProperties = {
|
1561 | axisEnd: {
|
1562 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_End"),
|
1563 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_EndDescription"),
|
1564 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1565 | type: {
|
1566 | numeric: !0
|
1567 | },
|
1568 | suppressFormatPainterCopy: !0
|
1569 | },
|
1570 | axisScale: {
|
1571 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Scale"),
|
1572 | type: {
|
1573 | enumeration: visuals.axisScale.type
|
1574 | }
|
1575 | },
|
1576 | axisStart: {
|
1577 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Start"),
|
1578 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_StartDescription"),
|
1579 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1580 | type: {
|
1581 | numeric: !0
|
1582 | },
|
1583 | suppressFormatPainterCopy: !0
|
1584 | },
|
1585 | axisStyle: {
|
1586 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Style"),
|
1587 | type: {
|
1588 | enumeration: visuals.axisStyle.type
|
1589 | }
|
1590 | },
|
1591 | axisType: {
|
1592 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Type"),
|
1593 | type: {
|
1594 | enumeration: visuals.axisType.type
|
1595 | }
|
1596 | },
|
1597 | backColor: {
|
1598 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColor"),
|
1599 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColor_Desc"),
|
1600 | type: {
|
1601 | fill: {
|
1602 | solid: {
|
1603 | color: !0
|
1604 | }
|
1605 | }
|
1606 | }
|
1607 | },
|
1608 | dataColor: {
|
1609 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelsFill"),
|
1610 | description: powerbi.data.createDisplayNameGetter("Visual_LabelsFillDescription"),
|
1611 | type: {
|
1612 | fill: {
|
1613 | solid: {
|
1614 | color: !0
|
1615 | }
|
1616 | }
|
1617 | }
|
1618 | },
|
1619 | dataLabelColor: {
|
1620 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Color"),
|
1621 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Color_Description"),
|
1622 | type: {
|
1623 | fill: {
|
1624 | solid: {
|
1625 | color: !0
|
1626 | }
|
1627 | }
|
1628 | }
|
1629 | },
|
1630 | dataLabelDecimalPoints: {
|
1631 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Decimal_Points"),
|
1632 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1633 | type: {
|
1634 | numeric: !0
|
1635 | }
|
1636 | },
|
1637 | dataLabelDisplayUnits: {
|
1638 | displayName: powerbi.data.createDisplayNameGetter("Visual_DisplayUnits"),
|
1639 | description: powerbi.data.createDisplayNameGetter("Visual_DisplayUnitsDescription"),
|
1640 | type: {
|
1641 | formatting: {
|
1642 | labelDisplayUnits: !0
|
1643 | }
|
1644 | },
|
1645 | suppressFormatPainterCopy: !0
|
1646 | },
|
1647 | dataLabelHorizontalPosition: {
|
1648 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Horizontal_Position"),
|
1649 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Horizontal_Position_Description"),
|
1650 | type: {
|
1651 | enumeration: visuals.referenceLineDataLabelHorizontalPosition.type
|
1652 | }
|
1653 | },
|
1654 | dataLabelShow: {
|
1655 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label"),
|
1656 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Show_Description"),
|
1657 | type: {
|
1658 | bool: !0
|
1659 | }
|
1660 | },
|
1661 | dataLabelVerticalPosition: {
|
1662 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Vertical_Position"),
|
1663 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Data_Label_Vertical_Position_Description"),
|
1664 | type: {
|
1665 | enumeration: visuals.referenceLineDataLabelVerticalPosition.type
|
1666 | }
|
1667 | },
|
1668 | defaultColor: {
|
1669 | displayName: powerbi.data.createDisplayNameGetter("Visual_DefaultColor"),
|
1670 | type: {
|
1671 | fill: {
|
1672 | solid: {
|
1673 | color: !0
|
1674 | }
|
1675 | }
|
1676 | }
|
1677 | },
|
1678 | fill: {
|
1679 | displayName: powerbi.data.createDisplayNameGetter("Visual_Fill"),
|
1680 | type: {
|
1681 | fill: {
|
1682 | solid: {
|
1683 | color: !0
|
1684 | }
|
1685 | }
|
1686 | }
|
1687 | },
|
1688 | fontColor: {
|
1689 | displayName: powerbi.data.createDisplayNameGetter("Visual_FontColor"),
|
1690 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColor_Desc"),
|
1691 | type: {
|
1692 | fill: {
|
1693 | solid: {
|
1694 | color: !0
|
1695 | }
|
1696 | }
|
1697 | }
|
1698 | },
|
1699 | fontSize: {
|
1700 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
1701 | type: {
|
1702 | formatting: {
|
1703 | fontSize: !0
|
1704 | }
|
1705 | }
|
1706 | },
|
1707 | formatString: {
|
1708 | type: {
|
1709 | formatting: {
|
1710 | formatString: !0
|
1711 | }
|
1712 | }
|
1713 | },
|
1714 | image: {
|
1715 | type: {
|
1716 | image: {}
|
1717 | }
|
1718 | },
|
1719 | labelColor: {
|
1720 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendTitleColor"),
|
1721 | type: {
|
1722 | fill: {
|
1723 | solid: {
|
1724 | color: !0
|
1725 | }
|
1726 | }
|
1727 | }
|
1728 | },
|
1729 | labelDisplayUnits: {
|
1730 | displayName: powerbi.data.createDisplayNameGetter("Visual_DisplayUnits"),
|
1731 | description: powerbi.data.createDisplayNameGetter("Visual_DisplayUnitsDescription"),
|
1732 | type: {
|
1733 | formatting: {
|
1734 | labelDisplayUnits: !0
|
1735 | }
|
1736 | }
|
1737 | },
|
1738 | labelPrecision: {
|
1739 | displayName: powerbi.data.createDisplayNameGetter("Visual_Precision"),
|
1740 | description: powerbi.data.createDisplayNameGetter("Visual_PrecisionDescription"),
|
1741 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
1742 | type: {
|
1743 | numeric: !0
|
1744 | }
|
1745 | },
|
1746 | legendPosition: {
|
1747 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendPosition"),
|
1748 | description: powerbi.data.createDisplayNameGetter("Visual_LegendPositionDescription"),
|
1749 | type: {
|
1750 | enumeration: visuals.legendPosition.type
|
1751 | }
|
1752 | },
|
1753 | legendTitle: {
|
1754 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendName"),
|
1755 | description: powerbi.data.createDisplayNameGetter("Visual_LegendNameDescription"),
|
1756 | type: {
|
1757 | text: !0
|
1758 | }
|
1759 | },
|
1760 | lineColor: {
|
1761 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Color"),
|
1762 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Color_Description"),
|
1763 | type: {
|
1764 | fill: {
|
1765 | solid: {
|
1766 | color: !0
|
1767 | }
|
1768 | }
|
1769 | }
|
1770 | },
|
1771 | outline: {
|
1772 | displayName: powerbi.data.createDisplayNameGetter("Visual_Outline"),
|
1773 | type: {
|
1774 | enumeration: visuals.outline.type
|
1775 | }
|
1776 | },
|
1777 | outlineColor: {
|
1778 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineColor"),
|
1779 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineColor_Desc"),
|
1780 | type: {
|
1781 | fill: {
|
1782 | solid: {
|
1783 | color: !0
|
1784 | }
|
1785 | }
|
1786 | }
|
1787 | },
|
1788 | outlineWeight: {
|
1789 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight"),
|
1790 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight_Desc"),
|
1791 | type: {
|
1792 | numeric: !0
|
1793 | }
|
1794 | },
|
1795 | show: {
|
1796 | displayName: powerbi.data.createDisplayNameGetter("Visual_Show"),
|
1797 | type: {
|
1798 | bool: !0
|
1799 | }
|
1800 | },
|
1801 | showAllDataPoints: {
|
1802 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint_Show_All"),
|
1803 | type: {
|
1804 | bool: !0
|
1805 | }
|
1806 | },
|
1807 | showLegendTitle: {
|
1808 | displayName: powerbi.data.createDisplayNameGetter("Visual_LegendShowTitle"),
|
1809 | description: powerbi.data.createDisplayNameGetter("Visual_LegendShowTitleDescription"),
|
1810 | type: {
|
1811 | bool: !0
|
1812 | }
|
1813 | },
|
1814 | referenceLinePosition: {
|
1815 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Arrange"),
|
1816 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Arrange_Description"),
|
1817 | type: {
|
1818 | enumeration: visuals.referenceLinePosition.type
|
1819 | }
|
1820 | },
|
1821 | referenceLineStyle: {
|
1822 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Style"),
|
1823 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Style_Description"),
|
1824 | type: {
|
1825 | enumeration: visuals.lineStyle.type
|
1826 | }
|
1827 | },
|
1828 | transparency: {
|
1829 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background_Transparency"),
|
1830 | description: powerbi.data.createDisplayNameGetter("Visual_Background_TransparencyDescription"),
|
1831 | type: {
|
1832 | numeric: !0
|
1833 | }
|
1834 | },
|
1835 | yAxisPosition: {
|
1836 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_Position"),
|
1837 | description: powerbi.data.createDisplayNameGetter("Visual_YAxis_PositionDescription"),
|
1838 | type: {
|
1839 | enumeration: visuals.yAxisPosition.type
|
1840 | }
|
1841 | }
|
1842 | };
|
1843 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1844 | }(powerbi || (powerbi = {}));
|
1845 |
|
1846 | var powerbi;
|
1847 |
|
1848 | !function(powerbi) {
|
1849 | var visuals;
|
1850 | !function(visuals) {
|
1851 | visuals.animatedTextObjectDescs = {
|
1852 | general: {
|
1853 | properties: {
|
1854 | formatString: visuals.StandardObjectProperties.formatString
|
1855 | }
|
1856 | }
|
1857 | }, visuals.animatedNumberCapabilities = {
|
1858 | objects: visuals.animatedTextObjectDescs,
|
1859 | dataViewMappings: [ {
|
1860 | single: {
|
1861 | role: "Values"
|
1862 | }
|
1863 | } ],
|
1864 | supportsSelection: !1
|
1865 | };
|
1866 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1867 | }(powerbi || (powerbi = {}));
|
1868 |
|
1869 | var powerbi;
|
1870 |
|
1871 | !function(powerbi) {
|
1872 | var visuals;
|
1873 | !function(visuals) {
|
1874 | visuals.basicShapeCapabilities = {
|
1875 | objects: {
|
1876 | line: {
|
1877 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Line"),
|
1878 | properties: {
|
1879 | lineColor: {
|
1880 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_LineColor"),
|
1881 | type: {
|
1882 | fill: {
|
1883 | solid: {
|
1884 | color: !0
|
1885 | }
|
1886 | }
|
1887 | }
|
1888 | },
|
1889 | transparency: visuals.StandardObjectProperties.transparency,
|
1890 | weight: {
|
1891 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Weight"),
|
1892 | type: {
|
1893 | numeric: !0
|
1894 | }
|
1895 | },
|
1896 | roundEdge: {
|
1897 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_RoundEdges"),
|
1898 | type: {
|
1899 | numeric: !0
|
1900 | }
|
1901 | }
|
1902 | }
|
1903 | },
|
1904 | fill: {
|
1905 | displayName: powerbi.data.createDisplayNameGetter("Visual_Fill"),
|
1906 | properties: {
|
1907 | show: visuals.StandardObjectProperties.show,
|
1908 | fillColor: {
|
1909 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_FillColor"),
|
1910 | type: {
|
1911 | fill: {
|
1912 | solid: {
|
1913 | color: !0
|
1914 | }
|
1915 | }
|
1916 | }
|
1917 | },
|
1918 | transparency: visuals.StandardObjectProperties.transparency
|
1919 | }
|
1920 | },
|
1921 | rotation: {
|
1922 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Rotate"),
|
1923 | properties: {
|
1924 | angle: {
|
1925 | displayName: powerbi.data.createDisplayNameGetter("Visual_BasicShape_Rotate"),
|
1926 | type: {
|
1927 | numeric: !0
|
1928 | }
|
1929 | }
|
1930 | }
|
1931 | },
|
1932 | general: {
|
1933 | properties: {
|
1934 | shapeType: {
|
1935 | type: {
|
1936 | text: !0
|
1937 | },
|
1938 | suppressFormatPainterCopy: !0
|
1939 | }
|
1940 | }
|
1941 | }
|
1942 | },
|
1943 | suppressDefaultTitle: !0,
|
1944 | suppressDefaultPadding: !0,
|
1945 | canRotate: !1,
|
1946 | supportsSelection: !1
|
1947 | }, visuals.basicShapeProps = {
|
1948 | general: {
|
1949 | shapeType: {
|
1950 | objectName: "general",
|
1951 | propertyName: "shapeType"
|
1952 | }
|
1953 | },
|
1954 | line: {
|
1955 | transparency: {
|
1956 | objectName: "line",
|
1957 | propertyName: "transparency"
|
1958 | },
|
1959 | weight: {
|
1960 | objectName: "line",
|
1961 | propertyName: "weight"
|
1962 | },
|
1963 | roundEdge: {
|
1964 | objectName: "line",
|
1965 | propertyName: "roundEdge"
|
1966 | },
|
1967 | lineColor: {
|
1968 | objectName: "line",
|
1969 | propertyName: "lineColor"
|
1970 | }
|
1971 | },
|
1972 | fill: {
|
1973 | transparency: {
|
1974 | objectName: "fill",
|
1975 | propertyName: "transparency"
|
1976 | },
|
1977 | fillColor: {
|
1978 | objectName: "fill",
|
1979 | propertyName: "fillColor"
|
1980 | },
|
1981 | show: {
|
1982 | objectName: "fill",
|
1983 | propertyName: "show"
|
1984 | }
|
1985 | },
|
1986 | rotation: {
|
1987 | angle: {
|
1988 | objectName: "rotation",
|
1989 | propertyName: "angle"
|
1990 | }
|
1991 | }
|
1992 | };
|
1993 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
1994 | }(powerbi || (powerbi = {}));
|
1995 |
|
1996 | var powerbi;
|
1997 |
|
1998 | !function(powerbi) {
|
1999 | var visuals;
|
2000 | !function(visuals) {
|
2001 | function getColumnChartCapabilities(transposeAxes) {
|
2002 | return void 0 === transposeAxes && (transposeAxes = !1), {
|
2003 | dataRoles: [ {
|
2004 | name: "Category",
|
2005 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2006 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
2007 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription"),
|
2008 | cartesianKind: 0
|
2009 | }, {
|
2010 | name: "Series",
|
2011 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2012 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
2013 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
2014 | }, {
|
2015 | name: "Y",
|
2016 | kind: powerbi.VisualDataRoleKind.Measure,
|
2017 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Value"),
|
2018 | requiredTypes: [ {
|
2019 | numeric: !0
|
2020 | }, {
|
2021 | integer: !0
|
2022 | } ],
|
2023 | cartesianKind: 1
|
2024 | }, {
|
2025 | name: "Gradient",
|
2026 | kind: powerbi.VisualDataRoleKind.Measure,
|
2027 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
2028 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
2029 | requiredTypes: [ {
|
2030 | numeric: !0
|
2031 | }, {
|
2032 | integer: !0
|
2033 | } ]
|
2034 | } ],
|
2035 | objects: {
|
2036 | general: {
|
2037 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
2038 | properties: {
|
2039 | formatString: visuals.StandardObjectProperties.formatString
|
2040 | }
|
2041 | },
|
2042 | legend: {
|
2043 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
2044 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
2045 | properties: {
|
2046 | show: visuals.StandardObjectProperties.show,
|
2047 | position: visuals.StandardObjectProperties.legendPosition,
|
2048 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
2049 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
2050 | suppressFormatPainterCopy: !0
|
2051 | }),
|
2052 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2053 | fontSize: visuals.StandardObjectProperties.fontSize
|
2054 | }
|
2055 | },
|
2056 | categoryAxis: {
|
2057 | displayName: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_YAxis") : powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
2058 | properties: {
|
2059 | show: visuals.StandardObjectProperties.show,
|
2060 | position: visuals.StandardObjectProperties.yAxisPosition,
|
2061 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2062 | start: visuals.StandardObjectProperties.axisStart,
|
2063 | end: visuals.StandardObjectProperties.axisEnd,
|
2064 | axisType: visuals.StandardObjectProperties.axisType,
|
2065 | showAxisTitle: {
|
2066 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2067 | description: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription") : powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
2068 | type: {
|
2069 | bool: !0
|
2070 | }
|
2071 | },
|
2072 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2073 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2074 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2075 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2076 | }
|
2077 | },
|
2078 | valueAxis: {
|
2079 | displayName: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_XAxis") : powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
2080 | properties: {
|
2081 | show: visuals.StandardObjectProperties.show,
|
2082 | position: visuals.StandardObjectProperties.yAxisPosition,
|
2083 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2084 | start: visuals.StandardObjectProperties.axisStart,
|
2085 | end: visuals.StandardObjectProperties.axisEnd,
|
2086 | intersection: {
|
2087 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Intersection"),
|
2088 | type: {
|
2089 | numeric: !0
|
2090 | },
|
2091 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto")
|
2092 | },
|
2093 | showAxisTitle: {
|
2094 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2095 | description: transposeAxes ? powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription") : powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
2096 | type: {
|
2097 | bool: !0
|
2098 | }
|
2099 | },
|
2100 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2101 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2102 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2103 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2104 | }
|
2105 | },
|
2106 | y1AxisReferenceLine: {
|
2107 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line"),
|
2108 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
2109 | properties: {
|
2110 | show: visuals.StandardObjectProperties.show,
|
2111 | value: {
|
2112 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
2113 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
2114 | type: {
|
2115 | numeric: !0
|
2116 | }
|
2117 | },
|
2118 | lineColor: visuals.StandardObjectProperties.lineColor,
|
2119 | transparency: {
|
2120 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
2121 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
2122 | type: {
|
2123 | numeric: !0
|
2124 | }
|
2125 | },
|
2126 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
2127 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
2128 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
2129 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
2130 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
2131 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
2132 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
2133 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
2134 | }
|
2135 | },
|
2136 | dataPoint: {
|
2137 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
2138 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
2139 | properties: {
|
2140 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
2141 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
2142 | fill: visuals.StandardObjectProperties.fill,
|
2143 | fillRule: {
|
2144 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
2145 | type: {
|
2146 | fillRule: {}
|
2147 | },
|
2148 | rule: {
|
2149 | inputRole: "Gradient",
|
2150 | output: {
|
2151 | property: "fill",
|
2152 | selector: [ "Category" ]
|
2153 | }
|
2154 | }
|
2155 | }
|
2156 | }
|
2157 | },
|
2158 | trend: {
|
2159 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
2160 | properties: {
|
2161 | show: {
|
2162 | type: {
|
2163 | bool: !0
|
2164 | }
|
2165 | },
|
2166 | lineColor: {
|
2167 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
2168 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
2169 | type: {
|
2170 | fill: {
|
2171 | solid: {
|
2172 | color: !0
|
2173 | }
|
2174 | }
|
2175 | }
|
2176 | },
|
2177 | transparency: {
|
2178 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
2179 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
2180 | type: {
|
2181 | numeric: !0
|
2182 | }
|
2183 | },
|
2184 | style: {
|
2185 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
2186 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
2187 | type: {
|
2188 | enumeration: visuals.lineStyle.type
|
2189 | }
|
2190 | },
|
2191 | combineSeries: {
|
2192 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
2193 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
2194 | type: {
|
2195 | bool: !0
|
2196 | }
|
2197 | },
|
2198 | useHighlightValues: {
|
2199 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues"),
|
2200 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues_Description"),
|
2201 | type: {
|
2202 | bool: !0
|
2203 | }
|
2204 | }
|
2205 | }
|
2206 | },
|
2207 | labels: {
|
2208 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
2209 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
2210 | properties: {
|
2211 | show: visuals.StandardObjectProperties.show,
|
2212 | showSeries: {
|
2213 | displayName: powerbi.data.createDisplayNameGetter("Visual_Show"),
|
2214 | type: {
|
2215 | bool: !0
|
2216 | }
|
2217 | },
|
2218 | color: visuals.StandardObjectProperties.dataColor,
|
2219 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
2220 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
2221 | suppressFormatPainterCopy: !0
|
2222 | }),
|
2223 | showAll: {
|
2224 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelSeriesShowAll"),
|
2225 | type: {
|
2226 | bool: !0
|
2227 | }
|
2228 | },
|
2229 | fontSize: visuals.StandardObjectProperties.fontSize
|
2230 | }
|
2231 | },
|
2232 | plotArea: {
|
2233 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
2234 | properties: {
|
2235 | transparency: visuals.StandardObjectProperties.transparency,
|
2236 | image: visuals.StandardObjectProperties.image
|
2237 | }
|
2238 | }
|
2239 | },
|
2240 | dataViewMappings: [ {
|
2241 | conditions: [ {
|
2242 | Category: {
|
2243 | max: 1
|
2244 | },
|
2245 | Series: {
|
2246 | max: 0
|
2247 | },
|
2248 | Gradient: {
|
2249 | max: 0
|
2250 | }
|
2251 | }, {
|
2252 | Category: {
|
2253 | max: 1
|
2254 | },
|
2255 | Series: {
|
2256 | min: 1,
|
2257 | max: 1
|
2258 | },
|
2259 | Y: {
|
2260 | max: 1
|
2261 | },
|
2262 | Gradient: {
|
2263 | max: 0
|
2264 | }
|
2265 | }, {
|
2266 | Category: {
|
2267 | max: 1
|
2268 | },
|
2269 | Series: {
|
2270 | max: 0
|
2271 | },
|
2272 | Y: {
|
2273 | min: 0,
|
2274 | max: 1
|
2275 | },
|
2276 | Gradient: {
|
2277 | max: 1
|
2278 | }
|
2279 | } ],
|
2280 | categorical: {
|
2281 | categories: {
|
2282 | "for": {
|
2283 | "in": "Category"
|
2284 | },
|
2285 | dataReductionAlgorithm: {
|
2286 | top: {}
|
2287 | }
|
2288 | },
|
2289 | values: {
|
2290 | group: {
|
2291 | by: "Series",
|
2292 | select: [ {
|
2293 | "for": {
|
2294 | "in": "Y"
|
2295 | }
|
2296 | }, {
|
2297 | bind: {
|
2298 | to: "Gradient"
|
2299 | }
|
2300 | } ],
|
2301 | dataReductionAlgorithm: {
|
2302 | top: {}
|
2303 | }
|
2304 | }
|
2305 | },
|
2306 | rowCount: {
|
2307 | preferred: {
|
2308 | min: 2
|
2309 | },
|
2310 | supported: {
|
2311 | min: 0
|
2312 | }
|
2313 | }
|
2314 | }
|
2315 | }, {
|
2316 | conditions: [ {
|
2317 | Category: {
|
2318 | max: 1
|
2319 | },
|
2320 | Series: {
|
2321 | max: 0
|
2322 | },
|
2323 | Gradient: {
|
2324 | max: 0
|
2325 | }
|
2326 | }, {
|
2327 | Category: {
|
2328 | max: 1
|
2329 | },
|
2330 | Series: {
|
2331 | min: 1,
|
2332 | max: 1
|
2333 | },
|
2334 | Y: {
|
2335 | max: 1
|
2336 | },
|
2337 | Gradient: {
|
2338 | max: 0
|
2339 | }
|
2340 | }, {
|
2341 | Category: {
|
2342 | max: 1
|
2343 | },
|
2344 | Series: {
|
2345 | max: 0
|
2346 | },
|
2347 | Y: {
|
2348 | min: 0,
|
2349 | max: 1
|
2350 | },
|
2351 | Gradient: {
|
2352 | max: 1
|
2353 | }
|
2354 | } ],
|
2355 | requiredProperties: [ {
|
2356 | objectName: "trend",
|
2357 | propertyName: "show"
|
2358 | } ],
|
2359 | usage: {
|
2360 | regression: {
|
2361 | combineSeries: {
|
2362 | objectName: "trend",
|
2363 | propertyName: "combineSeries"
|
2364 | }
|
2365 | }
|
2366 | },
|
2367 | categorical: {
|
2368 | categories: {
|
2369 | "for": {
|
2370 | "in": "regression.X"
|
2371 | }
|
2372 | },
|
2373 | values: {
|
2374 | group: {
|
2375 | by: "regression.Series",
|
2376 | select: [ {
|
2377 | "for": {
|
2378 | "in": "regression.Y"
|
2379 | }
|
2380 | } ]
|
2381 | }
|
2382 | }
|
2383 | }
|
2384 | } ],
|
2385 | supportsHighlight: !0,
|
2386 | sorting: {
|
2387 | "default": {}
|
2388 | },
|
2389 | drilldown: {
|
2390 | roles: [ "Category" ]
|
2391 | }
|
2392 | };
|
2393 | }
|
2394 | visuals.getColumnChartCapabilities = getColumnChartCapabilities, visuals.columnChartProps = {
|
2395 | dataPoint: {
|
2396 | defaultColor: {
|
2397 | objectName: "dataPoint",
|
2398 | propertyName: "defaultColor"
|
2399 | },
|
2400 | fill: {
|
2401 | objectName: "dataPoint",
|
2402 | propertyName: "fill"
|
2403 | },
|
2404 | showAllDataPoints: {
|
2405 | objectName: "dataPoint",
|
2406 | propertyName: "showAllDataPoints"
|
2407 | }
|
2408 | },
|
2409 | general: {
|
2410 | formatString: {
|
2411 | objectName: "general",
|
2412 | propertyName: "formatString"
|
2413 | }
|
2414 | },
|
2415 | categoryAxis: {
|
2416 | axisType: {
|
2417 | objectName: "categoryAxis",
|
2418 | propertyName: "axisType"
|
2419 | }
|
2420 | },
|
2421 | legend: {
|
2422 | labelColor: {
|
2423 | objectName: "legend",
|
2424 | propertyName: "labelColor"
|
2425 | }
|
2426 | },
|
2427 | plotArea: {
|
2428 | image: {
|
2429 | objectName: "plotArea",
|
2430 | propertyName: "image"
|
2431 | },
|
2432 | transparency: {
|
2433 | objectName: "plotArea",
|
2434 | propertyName: "transparency"
|
2435 | }
|
2436 | }
|
2437 | };
|
2438 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
2439 | }(powerbi || (powerbi = {}));
|
2440 |
|
2441 | var powerbi;
|
2442 |
|
2443 | !function(powerbi) {
|
2444 | var visuals;
|
2445 | !function(visuals) {
|
2446 | visuals.comboChartCapabilities = {
|
2447 | dataRoles: [ {
|
2448 | name: "Category",
|
2449 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2450 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Category"),
|
2451 | description: powerbi.data.createDisplayNameGetter("Role_ComboChart_CategoryDescription"),
|
2452 | cartesianKind: 0
|
2453 | }, {
|
2454 | name: "Series",
|
2455 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2456 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Series")
|
2457 | }, {
|
2458 | name: "Y",
|
2459 | kind: powerbi.VisualDataRoleKind.Measure,
|
2460 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Y"),
|
2461 | description: powerbi.data.createDisplayNameGetter("Role_ComboChart_YDescription"),
|
2462 | requiredTypes: [ {
|
2463 | numeric: !0
|
2464 | }, {
|
2465 | integer: !0
|
2466 | } ],
|
2467 | cartesianKind: 1
|
2468 | }, {
|
2469 | name: "Y2",
|
2470 | kind: powerbi.VisualDataRoleKind.Measure,
|
2471 | displayName: powerbi.data.createDisplayNameGetter("Role_ComboChart_Y2"),
|
2472 | description: powerbi.data.createDisplayNameGetter("Role_ComboChart_Y2Description"),
|
2473 | requiredTypes: [ {
|
2474 | numeric: !0
|
2475 | }, {
|
2476 | integer: !0
|
2477 | } ],
|
2478 | cartesianKind: 1
|
2479 | } ],
|
2480 | objects: {
|
2481 | general: {
|
2482 | properties: {
|
2483 | formatString: visuals.StandardObjectProperties.formatString,
|
2484 | visualType1: {
|
2485 | type: {
|
2486 | text: !0
|
2487 | }
|
2488 | },
|
2489 | visualType2: {
|
2490 | type: {
|
2491 | text: !0
|
2492 | }
|
2493 | }
|
2494 | }
|
2495 | },
|
2496 | legend: {
|
2497 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
2498 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
2499 | properties: {
|
2500 | show: visuals.StandardObjectProperties.show,
|
2501 | position: visuals.StandardObjectProperties.legendPosition,
|
2502 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
2503 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
2504 | suppressFormatPainterCopy: !0
|
2505 | }),
|
2506 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2507 | fontSize: visuals.StandardObjectProperties.fontSize
|
2508 | }
|
2509 | },
|
2510 | categoryAxis: {
|
2511 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
2512 | properties: {
|
2513 | show: visuals.StandardObjectProperties.show,
|
2514 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2515 | start: visuals.StandardObjectProperties.axisStart,
|
2516 | end: visuals.StandardObjectProperties.axisEnd,
|
2517 | axisType: visuals.StandardObjectProperties.axisType,
|
2518 | showAxisTitle: {
|
2519 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2520 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
2521 | type: {
|
2522 | bool: !0
|
2523 | }
|
2524 | },
|
2525 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2526 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2527 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2528 | }
|
2529 | },
|
2530 | valueAxis: {
|
2531 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
2532 | properties: {
|
2533 | show: visuals.StandardObjectProperties.show,
|
2534 | axisLabel: {
|
2535 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_ColumnTitle"),
|
2536 | type: {
|
2537 | none: !0
|
2538 | }
|
2539 | },
|
2540 | position: visuals.StandardObjectProperties.yAxisPosition,
|
2541 | axisScale: visuals.StandardObjectProperties.axisScale,
|
2542 | start: visuals.StandardObjectProperties.axisStart,
|
2543 | end: visuals.StandardObjectProperties.axisEnd,
|
2544 | showAxisTitle: {
|
2545 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2546 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
2547 | type: {
|
2548 | bool: !0
|
2549 | }
|
2550 | },
|
2551 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
2552 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2553 | labelPrecision: visuals.StandardObjectProperties.labelPrecision,
|
2554 | secShow: {
|
2555 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_ShowSecondary"),
|
2556 | type: {
|
2557 | bool: !0
|
2558 | }
|
2559 | },
|
2560 | secAxisLabel: {
|
2561 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_LineTitle"),
|
2562 | type: {
|
2563 | none: !0
|
2564 | }
|
2565 | },
|
2566 | secPosition: {
|
2567 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_Position"),
|
2568 | type: {
|
2569 | enumeration: visuals.yAxisPosition.type
|
2570 | }
|
2571 | },
|
2572 | secAxisScale: visuals.StandardObjectProperties.axisScale,
|
2573 | secStart: {
|
2574 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Start"),
|
2575 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_StartDescription"),
|
2576 | type: {
|
2577 | numeric: !0
|
2578 | }
|
2579 | },
|
2580 | secEnd: {
|
2581 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_End"),
|
2582 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_EndDescription"),
|
2583 | type: {
|
2584 | numeric: !0
|
2585 | }
|
2586 | },
|
2587 | secShowAxisTitle: {
|
2588 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
2589 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
2590 | type: {
|
2591 | bool: !0
|
2592 | }
|
2593 | },
|
2594 | secAxisStyle: visuals.StandardObjectProperties.axisStyle,
|
2595 | secLabelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
2596 | secLabelPrecision: visuals.StandardObjectProperties.labelPrecision
|
2597 | }
|
2598 | },
|
2599 | dataPoint: {
|
2600 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
2601 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
2602 | properties: {
|
2603 | defaultColor: $.extend({}, visuals.StandardObjectProperties.defaultColor, {
|
2604 | displayName: powerbi.data.createDisplayNameGetter("Visual_DefaultColumnColor")
|
2605 | }),
|
2606 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
2607 | fill: visuals.StandardObjectProperties.fill,
|
2608 | fillRule: {
|
2609 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
2610 | type: {
|
2611 | fillRule: {}
|
2612 | },
|
2613 | rule: {
|
2614 | inputRole: "Gradient",
|
2615 | output: {
|
2616 | property: "fill",
|
2617 | selector: [ "Category" ]
|
2618 | }
|
2619 | }
|
2620 | }
|
2621 | }
|
2622 | },
|
2623 | labels: {
|
2624 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
2625 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
2626 | properties: {
|
2627 | show: visuals.StandardObjectProperties.show,
|
2628 | color: visuals.StandardObjectProperties.dataColor,
|
2629 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
2630 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
2631 | suppressFormatPainterCopy: !0
|
2632 | }),
|
2633 | fontSize: visuals.StandardObjectProperties.fontSize
|
2634 | }
|
2635 | },
|
2636 | plotArea: {
|
2637 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
2638 | properties: {
|
2639 | transparency: visuals.StandardObjectProperties.transparency,
|
2640 | image: visuals.StandardObjectProperties.image
|
2641 | }
|
2642 | },
|
2643 | trend: {
|
2644 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
2645 | properties: {
|
2646 | show: {
|
2647 | type: {
|
2648 | bool: !0
|
2649 | }
|
2650 | },
|
2651 | lineColor: {
|
2652 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
2653 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
2654 | type: {
|
2655 | fill: {
|
2656 | solid: {
|
2657 | color: !0
|
2658 | }
|
2659 | }
|
2660 | }
|
2661 | },
|
2662 | transparency: {
|
2663 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
2664 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
2665 | type: {
|
2666 | numeric: !0
|
2667 | }
|
2668 | },
|
2669 | style: {
|
2670 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
2671 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
2672 | type: {
|
2673 | enumeration: visuals.lineStyle.type
|
2674 | }
|
2675 | },
|
2676 | combineSeries: {
|
2677 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
2678 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
2679 | type: {
|
2680 | bool: !0
|
2681 | }
|
2682 | },
|
2683 | useHighlightValues: {
|
2684 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues"),
|
2685 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues_Description"),
|
2686 | type: {
|
2687 | bool: !0
|
2688 | }
|
2689 | }
|
2690 | }
|
2691 | }
|
2692 | },
|
2693 | dataViewMappings: [ {
|
2694 | conditions: [ {
|
2695 | Category: {
|
2696 | max: 1
|
2697 | },
|
2698 | Series: {
|
2699 | max: 0
|
2700 | }
|
2701 | }, {
|
2702 | Category: {
|
2703 | max: 1
|
2704 | },
|
2705 | Series: {
|
2706 | min: 1,
|
2707 | max: 1
|
2708 | },
|
2709 | Y: {
|
2710 | max: 1
|
2711 | }
|
2712 | } ],
|
2713 | categorical: {
|
2714 | categories: {
|
2715 | "for": {
|
2716 | "in": "Category"
|
2717 | },
|
2718 | dataReductionAlgorithm: {
|
2719 | top: {}
|
2720 | }
|
2721 | },
|
2722 | values: {
|
2723 | group: {
|
2724 | by: "Series",
|
2725 | select: [ {
|
2726 | "for": {
|
2727 | "in": "Y"
|
2728 | }
|
2729 | } ],
|
2730 | dataReductionAlgorithm: {
|
2731 | top: {}
|
2732 | }
|
2733 | }
|
2734 | },
|
2735 | rowCount: {
|
2736 | preferred: {
|
2737 | min: 2
|
2738 | },
|
2739 | supported: {
|
2740 | min: 0
|
2741 | }
|
2742 | }
|
2743 | }
|
2744 | }, {
|
2745 | conditions: [ {
|
2746 | Category: {
|
2747 | max: 1
|
2748 | },
|
2749 | Series: {
|
2750 | max: 0
|
2751 | },
|
2752 | Y2: {
|
2753 | min: 1
|
2754 | }
|
2755 | }, {
|
2756 | Category: {
|
2757 | max: 1
|
2758 | },
|
2759 | Series: {
|
2760 | min: 1,
|
2761 | max: 1
|
2762 | },
|
2763 | Y: {
|
2764 | max: 1
|
2765 | },
|
2766 | Y2: {
|
2767 | min: 1
|
2768 | }
|
2769 | } ],
|
2770 | categorical: {
|
2771 | categories: {
|
2772 | "for": {
|
2773 | "in": "Category"
|
2774 | },
|
2775 | dataReductionAlgorithm: {
|
2776 | top: {}
|
2777 | }
|
2778 | },
|
2779 | values: {
|
2780 | select: [ {
|
2781 | "for": {
|
2782 | "in": "Y2"
|
2783 | }
|
2784 | } ]
|
2785 | },
|
2786 | rowCount: {
|
2787 | preferred: {
|
2788 | min: 2
|
2789 | },
|
2790 | supported: {
|
2791 | min: 0
|
2792 | }
|
2793 | }
|
2794 | }
|
2795 | }, {
|
2796 | conditions: [ {
|
2797 | Category: {
|
2798 | max: 1
|
2799 | },
|
2800 | Series: {
|
2801 | max: 0
|
2802 | }
|
2803 | }, {
|
2804 | Category: {
|
2805 | max: 1
|
2806 | },
|
2807 | Series: {
|
2808 | min: 1,
|
2809 | max: 1
|
2810 | },
|
2811 | Y: {
|
2812 | max: 1
|
2813 | }
|
2814 | } ],
|
2815 | requiredProperties: [ {
|
2816 | objectName: "trend",
|
2817 | propertyName: "show"
|
2818 | } ],
|
2819 | usage: {
|
2820 | regression: {
|
2821 | combineSeries: {
|
2822 | objectName: "trend",
|
2823 | propertyName: "combineSeries"
|
2824 | }
|
2825 | }
|
2826 | },
|
2827 | categorical: {
|
2828 | categories: {
|
2829 | "for": {
|
2830 | "in": "regression.X"
|
2831 | }
|
2832 | },
|
2833 | values: {
|
2834 | group: {
|
2835 | by: "regression.Series",
|
2836 | select: [ {
|
2837 | "for": {
|
2838 | "in": "regression.Y"
|
2839 | }
|
2840 | } ]
|
2841 | }
|
2842 | }
|
2843 | }
|
2844 | } ],
|
2845 | supportsHighlight: !0,
|
2846 | sorting: {
|
2847 | "default": {}
|
2848 | },
|
2849 | drilldown: {
|
2850 | roles: [ "Category" ]
|
2851 | }
|
2852 | }, visuals.comboChartProps = {
|
2853 | general: {
|
2854 | formatString: {
|
2855 | objectName: "general",
|
2856 | propertyName: "formatString"
|
2857 | }
|
2858 | },
|
2859 | valueAxis: {
|
2860 | secShow: {
|
2861 | objectName: "valueAxis",
|
2862 | propertyName: "secShow"
|
2863 | }
|
2864 | },
|
2865 | legend: {
|
2866 | labelColor: {
|
2867 | objectName: "legend",
|
2868 | propertyName: "labelColor"
|
2869 | }
|
2870 | },
|
2871 | dataPoint: {
|
2872 | showAllDataPoints: {
|
2873 | objectName: "dataPoint",
|
2874 | propertyName: "showAllDataPoints"
|
2875 | }
|
2876 | }
|
2877 | };
|
2878 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
2879 | }(powerbi || (powerbi = {}));
|
2880 |
|
2881 | var powerbi;
|
2882 |
|
2883 | !function(powerbi) {
|
2884 | var visuals;
|
2885 | !function(visuals) {
|
2886 | visuals.donutChartCapabilities = {
|
2887 | dataRoles: [ {
|
2888 | name: "Category",
|
2889 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2890 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
2891 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
2892 | }, {
|
2893 | name: "Series",
|
2894 | kind: powerbi.VisualDataRoleKind.Grouping,
|
2895 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Details"),
|
2896 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_DetailsDonutChartDescription")
|
2897 | }, {
|
2898 | name: "Y",
|
2899 | kind: powerbi.VisualDataRoleKind.Measure,
|
2900 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
2901 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
2902 | requiredTypes: [ {
|
2903 | numeric: !0
|
2904 | }, {
|
2905 | integer: !0
|
2906 | } ]
|
2907 | } ],
|
2908 | objects: {
|
2909 | general: {
|
2910 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
2911 | properties: {
|
2912 | formatString: visuals.StandardObjectProperties.formatString
|
2913 | }
|
2914 | },
|
2915 | legend: {
|
2916 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
2917 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
2918 | properties: {
|
2919 | show: visuals.StandardObjectProperties.show,
|
2920 | position: visuals.StandardObjectProperties.legendPosition,
|
2921 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
2922 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
2923 | suppressFormatPainterCopy: !0
|
2924 | }),
|
2925 | labelColor: visuals.StandardObjectProperties.labelColor,
|
2926 | fontSize: visuals.StandardObjectProperties.fontSize
|
2927 | }
|
2928 | },
|
2929 | dataPoint: {
|
2930 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
2931 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
2932 | properties: {
|
2933 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
2934 | fill: visuals.StandardObjectProperties.fill
|
2935 | }
|
2936 | },
|
2937 | labels: {
|
2938 | displayName: powerbi.data.createDisplayNameGetter("Visual_DetailLabels"),
|
2939 | properties: {
|
2940 | show: visuals.StandardObjectProperties.show,
|
2941 | color: visuals.StandardObjectProperties.dataColor,
|
2942 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
2943 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
2944 | suppressFormatPainterCopy: !0
|
2945 | }),
|
2946 | fontSize: $.extend({}, visuals.StandardObjectProperties.fontSize, {
|
2947 | suppressFormatPainterCopy: !0
|
2948 | }),
|
2949 | labelStyle: {
|
2950 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelStyle"),
|
2951 | type: {
|
2952 | enumeration: visuals.labelStyle.type
|
2953 | }
|
2954 | }
|
2955 | }
|
2956 | }
|
2957 | },
|
2958 | dataViewMappings: [ {
|
2959 | conditions: [ {
|
2960 | Category: {
|
2961 | max: 1
|
2962 | },
|
2963 | Series: {
|
2964 | max: 0
|
2965 | }
|
2966 | }, {
|
2967 | Category: {
|
2968 | max: 1
|
2969 | },
|
2970 | Series: {
|
2971 | min: 1,
|
2972 | max: 1
|
2973 | },
|
2974 | Y: {
|
2975 | max: 1
|
2976 | }
|
2977 | } ],
|
2978 | categorical: {
|
2979 | categories: {
|
2980 | "for": {
|
2981 | "in": "Category"
|
2982 | },
|
2983 | dataReductionAlgorithm: {
|
2984 | top: {}
|
2985 | }
|
2986 | },
|
2987 | values: {
|
2988 | group: {
|
2989 | by: "Series",
|
2990 | select: [ {
|
2991 | bind: {
|
2992 | to: "Y"
|
2993 | }
|
2994 | } ],
|
2995 | dataReductionAlgorithm: {
|
2996 | top: {}
|
2997 | }
|
2998 | }
|
2999 | },
|
3000 | rowCount: {
|
3001 | preferred: {
|
3002 | min: 2
|
3003 | },
|
3004 | supported: {
|
3005 | min: 1
|
3006 | }
|
3007 | }
|
3008 | }
|
3009 | } ],
|
3010 | sorting: {
|
3011 | "default": {}
|
3012 | },
|
3013 | supportsHighlight: !0,
|
3014 | drilldown: {
|
3015 | roles: [ "Category" ]
|
3016 | }
|
3017 | }, visuals.donutChartProps = {
|
3018 | general: {
|
3019 | formatString: {
|
3020 | objectName: "general",
|
3021 | propertyName: "formatString"
|
3022 | }
|
3023 | },
|
3024 | dataPoint: {
|
3025 | defaultColor: {
|
3026 | objectName: "dataPoint",
|
3027 | propertyName: "defaultColor"
|
3028 | },
|
3029 | fill: {
|
3030 | objectName: "dataPoint",
|
3031 | propertyName: "fill"
|
3032 | }
|
3033 | },
|
3034 | legend: {
|
3035 | show: {
|
3036 | objectName: "legend",
|
3037 | propertyName: "show"
|
3038 | },
|
3039 | position: {
|
3040 | objectName: "legend",
|
3041 | propertyName: "position"
|
3042 | },
|
3043 | showTitle: {
|
3044 | objectName: "legend",
|
3045 | propertyName: "showTitle"
|
3046 | },
|
3047 | titleText: {
|
3048 | objectName: "legend",
|
3049 | propertyName: "titleText"
|
3050 | },
|
3051 | labelColor: {
|
3052 | objectName: "legend",
|
3053 | propertyName: "labelColor"
|
3054 | }
|
3055 | }
|
3056 | };
|
3057 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3058 | }(powerbi || (powerbi = {}));
|
3059 |
|
3060 | var powerbi;
|
3061 |
|
3062 | !function(powerbi) {
|
3063 | var visuals;
|
3064 | !function(visuals) {
|
3065 | visuals.dataDotChartCapabilities = {
|
3066 | dataRoles: [ {
|
3067 | name: "Category",
|
3068 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3069 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
3070 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription")
|
3071 | }, {
|
3072 | name: "Y",
|
3073 | kind: powerbi.VisualDataRoleKind.Measure,
|
3074 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Value"),
|
3075 | requiredTypes: [ {
|
3076 | numeric: !0
|
3077 | }, {
|
3078 | integer: !0
|
3079 | } ]
|
3080 | } ],
|
3081 | objects: {
|
3082 | general: {
|
3083 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3084 | properties: {
|
3085 | formatString: visuals.StandardObjectProperties.formatString
|
3086 | }
|
3087 | }
|
3088 | },
|
3089 | dataViewMappings: [ {
|
3090 | conditions: [ {
|
3091 | Category: {
|
3092 | max: 1
|
3093 | },
|
3094 | Y: {
|
3095 | max: 1
|
3096 | }
|
3097 | } ],
|
3098 | categorical: {
|
3099 | categories: {
|
3100 | "for": {
|
3101 | "in": "Category"
|
3102 | },
|
3103 | dataReductionAlgorithm: {
|
3104 | top: {}
|
3105 | }
|
3106 | },
|
3107 | values: {
|
3108 | select: [ {
|
3109 | "for": {
|
3110 | "in": "Y"
|
3111 | },
|
3112 | dataReductionAlgorithm: {
|
3113 | top: {}
|
3114 | }
|
3115 | } ]
|
3116 | }
|
3117 | }
|
3118 | } ]
|
3119 | };
|
3120 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3121 | }(powerbi || (powerbi = {}));
|
3122 |
|
3123 | var powerbi;
|
3124 |
|
3125 | !function(powerbi) {
|
3126 | var visuals;
|
3127 | !function(visuals) {
|
3128 | visuals.filledMapCapabilities = {
|
3129 | dataRoles: [ {
|
3130 | name: "Category",
|
3131 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3132 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Location"),
|
3133 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LocationFilledMapDescription"),
|
3134 | preferredTypes: [ {
|
3135 | geography: {
|
3136 | address: !0
|
3137 | }
|
3138 | }, {
|
3139 | geography: {
|
3140 | city: !0
|
3141 | }
|
3142 | }, {
|
3143 | geography: {
|
3144 | continent: !0
|
3145 | }
|
3146 | }, {
|
3147 | geography: {
|
3148 | country: !0
|
3149 | }
|
3150 | }, {
|
3151 | geography: {
|
3152 | county: !0
|
3153 | }
|
3154 | }, {
|
3155 | geography: {
|
3156 | place: !0
|
3157 | }
|
3158 | }, {
|
3159 | geography: {
|
3160 | postalCode: !0
|
3161 | }
|
3162 | }, {
|
3163 | geography: {
|
3164 | region: !0
|
3165 | }
|
3166 | }, {
|
3167 | geography: {
|
3168 | stateOrProvince: !0
|
3169 | }
|
3170 | } ]
|
3171 | }, {
|
3172 | name: "Series",
|
3173 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3174 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
3175 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
3176 | }, {
|
3177 | name: "X",
|
3178 | kind: powerbi.VisualDataRoleKind.Measure,
|
3179 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Longitude"),
|
3180 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LongitudeFilledMapDescription"),
|
3181 | preferredTypes: [ {
|
3182 | geography: {
|
3183 | longitude: !0
|
3184 | }
|
3185 | } ]
|
3186 | }, {
|
3187 | name: "Y",
|
3188 | kind: powerbi.VisualDataRoleKind.Measure,
|
3189 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Latitude"),
|
3190 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LatitudeFilledMapDescription"),
|
3191 | preferredTypes: [ {
|
3192 | geography: {
|
3193 | latitude: !0
|
3194 | }
|
3195 | } ]
|
3196 | }, {
|
3197 | name: "Size",
|
3198 | kind: powerbi.VisualDataRoleKind.Measure,
|
3199 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
3200 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
3201 | requiredTypes: [ {
|
3202 | numeric: !0
|
3203 | }, {
|
3204 | integer: !0
|
3205 | } ]
|
3206 | } ],
|
3207 | objects: {
|
3208 | general: {
|
3209 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3210 | properties: {
|
3211 | formatString: visuals.StandardObjectProperties.formatString
|
3212 | }
|
3213 | },
|
3214 | legend: {
|
3215 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
3216 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
3217 | properties: {
|
3218 | show: visuals.StandardObjectProperties.show,
|
3219 | position: visuals.StandardObjectProperties.legendPosition,
|
3220 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
3221 | titleText: visuals.StandardObjectProperties.legendTitle,
|
3222 | fontSize: visuals.StandardObjectProperties.fontSize
|
3223 | }
|
3224 | },
|
3225 | dataPoint: {
|
3226 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3227 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
3228 | properties: {
|
3229 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
3230 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
3231 | fill: visuals.StandardObjectProperties.fill,
|
3232 | fillRule: {
|
3233 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
3234 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
3235 | type: {
|
3236 | fillRule: {}
|
3237 | },
|
3238 | rule: {
|
3239 | inputRole: "Size",
|
3240 | output: {
|
3241 | property: "fill",
|
3242 | selector: [ "Category" ]
|
3243 | }
|
3244 | }
|
3245 | }
|
3246 | }
|
3247 | },
|
3248 | labels: {
|
3249 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
3250 | properties: {
|
3251 | show: visuals.StandardObjectProperties.show,
|
3252 | color: visuals.StandardObjectProperties.dataColor,
|
3253 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
3254 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
3255 | }
|
3256 | },
|
3257 | categoryLabels: {
|
3258 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
3259 | properties: {
|
3260 | show: visuals.StandardObjectProperties.show
|
3261 | }
|
3262 | }
|
3263 | },
|
3264 | dataViewMappings: [ {
|
3265 | conditions: [ {
|
3266 | Category: {
|
3267 | max: 1
|
3268 | },
|
3269 | Series: {
|
3270 | max: 1
|
3271 | },
|
3272 | X: {
|
3273 | max: 1
|
3274 | },
|
3275 | Y: {
|
3276 | max: 1
|
3277 | },
|
3278 | Size: {
|
3279 | max: 1
|
3280 | }
|
3281 | }, {
|
3282 | Category: {
|
3283 | max: 1
|
3284 | },
|
3285 | Series: {
|
3286 | max: 0
|
3287 | },
|
3288 | X: {
|
3289 | max: 1
|
3290 | },
|
3291 | Y: {
|
3292 | max: 1
|
3293 | },
|
3294 | Size: {
|
3295 | max: 1
|
3296 | }
|
3297 | } ],
|
3298 | categorical: {
|
3299 | categories: {
|
3300 | "for": {
|
3301 | "in": "Category"
|
3302 | },
|
3303 | dataReductionAlgorithm: {
|
3304 | top: {}
|
3305 | }
|
3306 | },
|
3307 | values: {
|
3308 | group: {
|
3309 | by: "Series",
|
3310 | select: [ {
|
3311 | bind: {
|
3312 | to: "X"
|
3313 | }
|
3314 | }, {
|
3315 | bind: {
|
3316 | to: "Y"
|
3317 | }
|
3318 | }, {
|
3319 | bind: {
|
3320 | to: "Size"
|
3321 | }
|
3322 | } ],
|
3323 | dataReductionAlgorithm: {
|
3324 | top: {}
|
3325 | }
|
3326 | }
|
3327 | },
|
3328 | rowCount: {
|
3329 | preferred: {
|
3330 | min: 2
|
3331 | }
|
3332 | },
|
3333 | dataVolume: 4
|
3334 | }
|
3335 | } ],
|
3336 | sorting: {
|
3337 | custom: {}
|
3338 | },
|
3339 | drilldown: {
|
3340 | roles: [ "Category" ]
|
3341 | }
|
3342 | }, visuals.filledMapProps = {
|
3343 | general: {
|
3344 | formatString: {
|
3345 | objectName: "general",
|
3346 | propertyName: "formatString"
|
3347 | }
|
3348 | },
|
3349 | dataPoint: {
|
3350 | defaultColor: {
|
3351 | objectName: "dataPoint",
|
3352 | propertyName: "defaultColor"
|
3353 | },
|
3354 | fill: {
|
3355 | objectName: "dataPoint",
|
3356 | propertyName: "fill"
|
3357 | },
|
3358 | showAllDataPoints: {
|
3359 | objectName: "dataPoint",
|
3360 | propertyName: "showAllDataPoints"
|
3361 | }
|
3362 | },
|
3363 | legend: {
|
3364 | show: {
|
3365 | objectName: "legend",
|
3366 | propertyName: "show"
|
3367 | },
|
3368 | position: {
|
3369 | objectName: "legend",
|
3370 | propertyName: "position"
|
3371 | },
|
3372 | showTitle: {
|
3373 | objectName: "legend",
|
3374 | propertyName: "showTitle"
|
3375 | },
|
3376 | titleText: {
|
3377 | objectName: "legend",
|
3378 | propertyName: "titleText"
|
3379 | }
|
3380 | },
|
3381 | labels: {
|
3382 | show: {
|
3383 | objectName: "labels",
|
3384 | propertyName: "show"
|
3385 | },
|
3386 | color: {
|
3387 | objectName: "labels",
|
3388 | propertyName: "color"
|
3389 | },
|
3390 | labelDisplayUnits: {
|
3391 | objectName: "labels",
|
3392 | propertyName: "labelDisplayUnits"
|
3393 | },
|
3394 | labelPrecision: {
|
3395 | objectName: "labels",
|
3396 | propertyName: "labelPrecision"
|
3397 | }
|
3398 | },
|
3399 | categoryLabels: {
|
3400 | show: {
|
3401 | objectName: "categoryLabels",
|
3402 | propertyName: "show"
|
3403 | }
|
3404 | }
|
3405 | };
|
3406 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3407 | }(powerbi || (powerbi = {}));
|
3408 |
|
3409 | var powerbi;
|
3410 |
|
3411 | !function(powerbi) {
|
3412 | var visuals;
|
3413 | !function(visuals) {
|
3414 | visuals.funnelChartCapabilities = {
|
3415 | dataRoles: [ {
|
3416 | name: "Category",
|
3417 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3418 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Group"),
|
3419 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GroupFunnelDescription")
|
3420 | }, {
|
3421 | name: "Y",
|
3422 | kind: powerbi.VisualDataRoleKind.Measure,
|
3423 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
3424 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
3425 | requiredTypes: [ {
|
3426 | numeric: !0
|
3427 | }, {
|
3428 | integer: !0
|
3429 | } ]
|
3430 | }, {
|
3431 | name: "Gradient",
|
3432 | kind: powerbi.VisualDataRoleKind.Measure,
|
3433 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
3434 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
3435 | requiredTypes: [ {
|
3436 | numeric: !0
|
3437 | }, {
|
3438 | integer: !0
|
3439 | } ]
|
3440 | } ],
|
3441 | dataViewMappings: [ {
|
3442 | conditions: [ {
|
3443 | Category: {
|
3444 | max: 0
|
3445 | },
|
3446 | Gradient: {
|
3447 | max: 0
|
3448 | }
|
3449 | }, {
|
3450 | Category: {
|
3451 | max: 1
|
3452 | },
|
3453 | Y: {
|
3454 | max: 1
|
3455 | },
|
3456 | Gradient: {
|
3457 | max: 1
|
3458 | }
|
3459 | } ],
|
3460 | categorical: {
|
3461 | categories: {
|
3462 | "for": {
|
3463 | "in": "Category"
|
3464 | },
|
3465 | dataReductionAlgorithm: {
|
3466 | top: {}
|
3467 | }
|
3468 | },
|
3469 | values: {
|
3470 | select: [ {
|
3471 | "for": {
|
3472 | "in": "Y"
|
3473 | }
|
3474 | }, {
|
3475 | bind: {
|
3476 | to: "Gradient"
|
3477 | }
|
3478 | } ],
|
3479 | dataReductionAlgorithm: {
|
3480 | top: {}
|
3481 | }
|
3482 | },
|
3483 | rowCount: {
|
3484 | preferred: {
|
3485 | min: 1
|
3486 | }
|
3487 | }
|
3488 | }
|
3489 | } ],
|
3490 | objects: {
|
3491 | general: {
|
3492 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3493 | properties: {
|
3494 | formatString: visuals.StandardObjectProperties.formatString
|
3495 | }
|
3496 | },
|
3497 | dataPoint: {
|
3498 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3499 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
3500 | properties: {
|
3501 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
3502 | fill: visuals.StandardObjectProperties.fill,
|
3503 | fillRule: {
|
3504 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
3505 | type: {
|
3506 | fillRule: {}
|
3507 | },
|
3508 | rule: {
|
3509 | inputRole: "Gradient",
|
3510 | output: {
|
3511 | property: "fill",
|
3512 | selector: [ "Category" ]
|
3513 | }
|
3514 | }
|
3515 | }
|
3516 | }
|
3517 | },
|
3518 | labels: {
|
3519 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
3520 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
3521 | properties: {
|
3522 | show: visuals.StandardObjectProperties.show,
|
3523 | color: visuals.StandardObjectProperties.dataColor,
|
3524 | labelPosition: {
|
3525 | displayName: powerbi.data.createDisplayNameGetter("Visual_Position"),
|
3526 | type: {
|
3527 | enumeration: visuals.labelPosition.type
|
3528 | },
|
3529 | suppressFormatPainterCopy: !0
|
3530 | },
|
3531 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
3532 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
3533 | suppressFormatPainterCopy: !0
|
3534 | }),
|
3535 | fontSize: visuals.StandardObjectProperties.fontSize
|
3536 | }
|
3537 | },
|
3538 | percentBarLabel: {
|
3539 | displayName: powerbi.data.createDisplayNameGetter("Visual_PercentBarLabel"),
|
3540 | description: powerbi.data.createDisplayNameGetter("Visual_PercentBarLabelDescription"),
|
3541 | properties: {
|
3542 | show: visuals.StandardObjectProperties.show,
|
3543 | color: visuals.StandardObjectProperties.dataColor,
|
3544 | fontSize: visuals.StandardObjectProperties.fontSize
|
3545 | }
|
3546 | }
|
3547 | },
|
3548 | supportsHighlight: !0,
|
3549 | sorting: {
|
3550 | "default": {}
|
3551 | },
|
3552 | drilldown: {
|
3553 | roles: [ "Category" ]
|
3554 | }
|
3555 | }, visuals.funnelChartProps = {
|
3556 | general: {
|
3557 | formatString: {
|
3558 | objectName: "general",
|
3559 | propertyName: "formatString"
|
3560 | }
|
3561 | },
|
3562 | dataPoint: {
|
3563 | defaultColor: {
|
3564 | objectName: "dataPoint",
|
3565 | propertyName: "defaultColor"
|
3566 | },
|
3567 | fill: {
|
3568 | objectName: "dataPoint",
|
3569 | propertyName: "fill"
|
3570 | }
|
3571 | }
|
3572 | };
|
3573 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3574 | }(powerbi || (powerbi = {}));
|
3575 |
|
3576 | var powerbi;
|
3577 |
|
3578 | !function(powerbi) {
|
3579 | var visuals;
|
3580 | !function(visuals) {
|
3581 | visuals.gaugeRoleNames = {
|
3582 | y: "Y",
|
3583 | minValue: "MinValue",
|
3584 | maxValue: "MaxValue",
|
3585 | targetValue: "TargetValue"
|
3586 | }, visuals.gaugeCapabilities = {
|
3587 | dataRoles: [ {
|
3588 | name: visuals.gaugeRoleNames.y,
|
3589 | kind: powerbi.VisualDataRoleKind.Measure,
|
3590 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Value"),
|
3591 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValueDescription"),
|
3592 | requiredTypes: [ {
|
3593 | numeric: !0
|
3594 | }, {
|
3595 | integer: !0
|
3596 | } ]
|
3597 | }, {
|
3598 | name: visuals.gaugeRoleNames.minValue,
|
3599 | kind: powerbi.VisualDataRoleKind.Measure,
|
3600 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_MinValue"),
|
3601 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_MinValueDescription"),
|
3602 | requiredTypes: [ {
|
3603 | numeric: !0
|
3604 | }, {
|
3605 | integer: !0
|
3606 | } ]
|
3607 | }, {
|
3608 | name: visuals.gaugeRoleNames.maxValue,
|
3609 | kind: powerbi.VisualDataRoleKind.Measure,
|
3610 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_MaxValue"),
|
3611 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_MaxValueDescription"),
|
3612 | requiredTypes: [ {
|
3613 | numeric: !0
|
3614 | }, {
|
3615 | integer: !0
|
3616 | } ]
|
3617 | }, {
|
3618 | name: visuals.gaugeRoleNames.targetValue,
|
3619 | kind: powerbi.VisualDataRoleKind.Measure,
|
3620 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_TargetValue"),
|
3621 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_TargetValueDescription"),
|
3622 | requiredTypes: [ {
|
3623 | numeric: !0
|
3624 | }, {
|
3625 | integer: !0
|
3626 | } ]
|
3627 | } ],
|
3628 | objects: {
|
3629 | general: {
|
3630 | properties: {
|
3631 | formatString: visuals.StandardObjectProperties.formatString
|
3632 | }
|
3633 | },
|
3634 | axis: {
|
3635 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis"),
|
3636 | properties: {
|
3637 | min: {
|
3638 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Min"),
|
3639 | type: {
|
3640 | numeric: !0
|
3641 | }
|
3642 | },
|
3643 | max: {
|
3644 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Max"),
|
3645 | type: {
|
3646 | numeric: !0
|
3647 | }
|
3648 | },
|
3649 | target: {
|
3650 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Target"),
|
3651 | type: {
|
3652 | numeric: !0
|
3653 | }
|
3654 | }
|
3655 | }
|
3656 | },
|
3657 | labels: {
|
3658 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
3659 | properties: {
|
3660 | show: visuals.StandardObjectProperties.show,
|
3661 | color: visuals.StandardObjectProperties.dataColor,
|
3662 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
3663 | labelPrecision: visuals.StandardObjectProperties.labelPrecision,
|
3664 | fontSize: visuals.StandardObjectProperties.fontSize
|
3665 | }
|
3666 | },
|
3667 | calloutValue: {
|
3668 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_CalloutValue"),
|
3669 | properties: {
|
3670 | show: visuals.StandardObjectProperties.show,
|
3671 | color: visuals.StandardObjectProperties.dataColor,
|
3672 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
3673 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
3674 | }
|
3675 | },
|
3676 | dataPoint: {
|
3677 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3678 | properties: {
|
3679 | fill: visuals.StandardObjectProperties.fill,
|
3680 | target: {
|
3681 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gauge_Axis_Target"),
|
3682 | type: {
|
3683 | fill: {
|
3684 | solid: {
|
3685 | color: !0
|
3686 | }
|
3687 | }
|
3688 | }
|
3689 | }
|
3690 | }
|
3691 | }
|
3692 | },
|
3693 | dataViewMappings: [ {
|
3694 | conditions: [ {
|
3695 | Y: {
|
3696 | max: 1
|
3697 | },
|
3698 | MinValue: {
|
3699 | max: 1
|
3700 | },
|
3701 | MaxValue: {
|
3702 | max: 1
|
3703 | },
|
3704 | TargetValue: {
|
3705 | max: 1
|
3706 | }
|
3707 | } ],
|
3708 | categorical: {
|
3709 | values: {
|
3710 | select: [ {
|
3711 | bind: {
|
3712 | to: "Y"
|
3713 | }
|
3714 | }, {
|
3715 | bind: {
|
3716 | to: "MinValue"
|
3717 | }
|
3718 | }, {
|
3719 | bind: {
|
3720 | to: "MaxValue"
|
3721 | }
|
3722 | }, {
|
3723 | bind: {
|
3724 | to: "TargetValue"
|
3725 | }
|
3726 | } ]
|
3727 | }
|
3728 | }
|
3729 | } ],
|
3730 | supportsSelection: !1
|
3731 | }, visuals.gaugeProps = {
|
3732 | dataPoint: {
|
3733 | fill: {
|
3734 | objectName: "dataPoint",
|
3735 | propertyName: "fill"
|
3736 | },
|
3737 | target: {
|
3738 | objectName: "dataPoint",
|
3739 | propertyName: "target"
|
3740 | }
|
3741 | }
|
3742 | };
|
3743 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3744 | }(powerbi || (powerbi = {}));
|
3745 |
|
3746 | var powerbi;
|
3747 |
|
3748 | !function(powerbi) {
|
3749 | var visuals;
|
3750 | !function(visuals) {
|
3751 | visuals.imageVisualCapabilities = {
|
3752 | objects: {
|
3753 | general: {
|
3754 | properties: {
|
3755 | imageUrl: {
|
3756 | type: {
|
3757 | misc: {
|
3758 | imageUrl: !0
|
3759 | }
|
3760 | }
|
3761 | }
|
3762 | }
|
3763 | },
|
3764 | imageScaling: {
|
3765 | displayName: powerbi.data.createDisplayNameGetter("Visual_Image_Scaling_Type"),
|
3766 | properties: {
|
3767 | imageScalingType: {
|
3768 | displayName: powerbi.data.createDisplayNameGetter("Visual_Image_Scaling_Type"),
|
3769 | type: {
|
3770 | enumeration: visuals.imageScalingType.type
|
3771 | }
|
3772 | }
|
3773 | }
|
3774 | }
|
3775 | },
|
3776 | suppressDefaultTitle: !0,
|
3777 | supportsSelection: !1
|
3778 | };
|
3779 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3780 | }(powerbi || (powerbi = {}));
|
3781 |
|
3782 | var powerbi;
|
3783 |
|
3784 | !function(powerbi) {
|
3785 | var visuals;
|
3786 | !function(visuals) {
|
3787 | visuals.scriptVisualCapabilities = {
|
3788 | dataRoles: [ {
|
3789 | name: "Values",
|
3790 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
3791 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values")
|
3792 | } ],
|
3793 | dataViewMappings: [ {
|
3794 | scriptResult: {
|
3795 | dataInput: {
|
3796 | table: {
|
3797 | rows: {
|
3798 | "for": {
|
3799 | "in": "Values"
|
3800 | },
|
3801 | dataReductionAlgorithm: {
|
3802 | top: {}
|
3803 | }
|
3804 | }
|
3805 | }
|
3806 | },
|
3807 | script: {
|
3808 | source: {
|
3809 | objectName: "script",
|
3810 | propertyName: "source"
|
3811 | },
|
3812 | provider: {
|
3813 | objectName: "script",
|
3814 | propertyName: "provider"
|
3815 | }
|
3816 | }
|
3817 | }
|
3818 | } ],
|
3819 | objects: {
|
3820 | script: {
|
3821 | properties: {
|
3822 | provider: {
|
3823 | type: {
|
3824 | text: !0
|
3825 | }
|
3826 | },
|
3827 | source: {
|
3828 | type: {
|
3829 | scripting: {
|
3830 | source: !0
|
3831 | }
|
3832 | }
|
3833 | }
|
3834 | }
|
3835 | }
|
3836 | }
|
3837 | };
|
3838 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3839 | }(powerbi || (powerbi = {}));
|
3840 |
|
3841 | var powerbi;
|
3842 |
|
3843 | !function(powerbi) {
|
3844 | var visuals;
|
3845 | !function(visuals) {
|
3846 | var samples;
|
3847 | !function(samples) {
|
3848 | samples.consoleWriterCapabilities = {
|
3849 | dataRoles: [ {
|
3850 | name: "Category",
|
3851 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3852 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
3853 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription")
|
3854 | }, {
|
3855 | name: "Y",
|
3856 | kind: powerbi.VisualDataRoleKind.Measure,
|
3857 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y"),
|
3858 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_YDescription")
|
3859 | } ],
|
3860 | dataViewMappings: [ {
|
3861 | categorical: {
|
3862 | categories: {
|
3863 | "for": {
|
3864 | "in": "Category"
|
3865 | }
|
3866 | }
|
3867 | }
|
3868 | } ]
|
3869 | };
|
3870 | }(samples = visuals.samples || (visuals.samples = {}));
|
3871 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3872 | }(powerbi || (powerbi = {}));
|
3873 |
|
3874 | var powerbi;
|
3875 |
|
3876 | !function(powerbi) {
|
3877 | var visuals;
|
3878 | !function(visuals) {
|
3879 | var samples;
|
3880 | !function(samples) {
|
3881 | var ConsoleWriter = function() {
|
3882 | function ConsoleWriter() {}
|
3883 | return ConsoleWriter.converter = function(dataView) {
|
3884 | return window.console.log("converter"), window.console.log(dataView), {};
|
3885 | }, ConsoleWriter.prototype.init = function(options) {
|
3886 | var div = d3.select(options.element.get(0)).append("div");
|
3887 | 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");
|
3888 | var anchor = div.append("a");
|
3889 | anchor.attr("href", "http://microsoft.github.io/PowerBI-visuals/modules/powerbi.html").text("Online help"),
|
3890 | window.console.log("init"), window.console.log(options);
|
3891 | }, ConsoleWriter.prototype.onResizing = function(viewport) {}, ConsoleWriter.prototype.update = function(options) {
|
3892 | window.console.log("update"), window.console.log(options);
|
3893 | }, ConsoleWriter;
|
3894 | }();
|
3895 | samples.ConsoleWriter = ConsoleWriter;
|
3896 | }(samples = visuals.samples || (visuals.samples = {}));
|
3897 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
3898 | }(powerbi || (powerbi = {}));
|
3899 |
|
3900 | var powerbi;
|
3901 |
|
3902 | !function(powerbi) {
|
3903 | var visuals;
|
3904 | !function(visuals) {
|
3905 | visuals.lineChartCapabilities = {
|
3906 | dataRoles: [ {
|
3907 | name: "Category",
|
3908 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3909 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
3910 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription"),
|
3911 | cartesianKind: 0
|
3912 | }, {
|
3913 | name: "Series",
|
3914 | kind: powerbi.VisualDataRoleKind.Grouping,
|
3915 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
3916 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
3917 | }, {
|
3918 | name: "Y",
|
3919 | kind: powerbi.VisualDataRoleKind.Measure,
|
3920 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
3921 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
3922 | requiredTypes: [ {
|
3923 | numeric: !0
|
3924 | }, {
|
3925 | integer: !0
|
3926 | } ],
|
3927 | cartesianKind: 1
|
3928 | } ],
|
3929 | objects: {
|
3930 | general: {
|
3931 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
3932 | properties: {
|
3933 | formatString: visuals.StandardObjectProperties.formatString
|
3934 | }
|
3935 | },
|
3936 | legend: {
|
3937 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
3938 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
3939 | properties: {
|
3940 | show: visuals.StandardObjectProperties.show,
|
3941 | position: visuals.StandardObjectProperties.legendPosition,
|
3942 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
3943 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
3944 | suppressFormatPainterCopy: !0
|
3945 | }),
|
3946 | labelColor: visuals.StandardObjectProperties.labelColor,
|
3947 | fontSize: visuals.StandardObjectProperties.fontSize
|
3948 | }
|
3949 | },
|
3950 | dataPoint: {
|
3951 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
3952 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
3953 | properties: {
|
3954 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
3955 | fill: visuals.StandardObjectProperties.fill
|
3956 | }
|
3957 | },
|
3958 | trend: {
|
3959 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
3960 | properties: {
|
3961 | show: visuals.StandardObjectProperties.show,
|
3962 | lineColor: {
|
3963 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
3964 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
3965 | type: {
|
3966 | fill: {
|
3967 | solid: {
|
3968 | color: !0
|
3969 | }
|
3970 | }
|
3971 | }
|
3972 | },
|
3973 | transparency: {
|
3974 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
3975 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
3976 | type: {
|
3977 | numeric: !0
|
3978 | }
|
3979 | },
|
3980 | style: {
|
3981 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
3982 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
3983 | type: {
|
3984 | enumeration: visuals.lineStyle.type
|
3985 | }
|
3986 | },
|
3987 | combineSeries: {
|
3988 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
3989 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
3990 | type: {
|
3991 | bool: !0
|
3992 | }
|
3993 | },
|
3994 | useHighlightValues: {
|
3995 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues"),
|
3996 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_UseHighlightValues_Description"),
|
3997 | type: {
|
3998 | bool: !0
|
3999 | }
|
4000 | }
|
4001 | }
|
4002 | },
|
4003 | categoryAxis: {
|
4004 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
4005 | properties: {
|
4006 | show: visuals.StandardObjectProperties.show,
|
4007 | axisScale: visuals.StandardObjectProperties.axisScale,
|
4008 | start: visuals.StandardObjectProperties.axisStart,
|
4009 | end: visuals.StandardObjectProperties.axisEnd,
|
4010 | axisType: visuals.StandardObjectProperties.axisType,
|
4011 | showAxisTitle: {
|
4012 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
4013 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
4014 | type: {
|
4015 | bool: !0
|
4016 | }
|
4017 | },
|
4018 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
4019 | labelColor: visuals.StandardObjectProperties.labelColor,
|
4020 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
4021 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
4022 | }
|
4023 | },
|
4024 | valueAxis: {
|
4025 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
4026 | properties: {
|
4027 | show: visuals.StandardObjectProperties.show,
|
4028 | position: visuals.StandardObjectProperties.yAxisPosition,
|
4029 | axisScale: visuals.StandardObjectProperties.axisScale,
|
4030 | start: visuals.StandardObjectProperties.axisStart,
|
4031 | end: visuals.StandardObjectProperties.axisEnd,
|
4032 | showAxisTitle: {
|
4033 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
4034 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
4035 | type: {
|
4036 | bool: !0
|
4037 | }
|
4038 | },
|
4039 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
4040 | labelColor: visuals.StandardObjectProperties.labelColor,
|
4041 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
4042 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
4043 | }
|
4044 | },
|
4045 | y1AxisReferenceLine: {
|
4046 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line"),
|
4047 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
4048 | properties: {
|
4049 | show: visuals.StandardObjectProperties.show,
|
4050 | value: {
|
4051 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
4052 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
4053 | type: {
|
4054 | numeric: !0
|
4055 | }
|
4056 | },
|
4057 | lineColor: visuals.StandardObjectProperties.lineColor,
|
4058 | transparency: {
|
4059 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
4060 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
4061 | type: {
|
4062 | numeric: !0
|
4063 | }
|
4064 | },
|
4065 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
4066 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
4067 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
4068 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
4069 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
4070 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
4071 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
4072 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
4073 | }
|
4074 | },
|
4075 | labels: {
|
4076 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
4077 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
4078 | properties: {
|
4079 | show: visuals.StandardObjectProperties.show,
|
4080 | showSeries: {
|
4081 | displayName: powerbi.data.createDisplayNameGetter("Visual_Show"),
|
4082 | type: {
|
4083 | bool: !0
|
4084 | }
|
4085 | },
|
4086 | color: visuals.StandardObjectProperties.dataColor,
|
4087 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
4088 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
4089 | suppressFormatPainterCopy: !0
|
4090 | }),
|
4091 | showAll: {
|
4092 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelSeriesShowAll"),
|
4093 | type: {
|
4094 | bool: !0
|
4095 | }
|
4096 | },
|
4097 | fontSize: visuals.StandardObjectProperties.fontSize,
|
4098 | labelDensity: {
|
4099 | displayName: powerbi.data.createDisplayNameGetter("Visual_LabelDensity"),
|
4100 | type: {
|
4101 | formatting: {
|
4102 | labelDensity: !0
|
4103 | }
|
4104 | }
|
4105 | }
|
4106 | }
|
4107 | },
|
4108 | plotArea: {
|
4109 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
4110 | properties: {
|
4111 | transparency: visuals.StandardObjectProperties.transparency,
|
4112 | image: visuals.StandardObjectProperties.image
|
4113 | }
|
4114 | }
|
4115 | },
|
4116 | dataViewMappings: [ {
|
4117 | conditions: [ {
|
4118 | Category: {
|
4119 | max: 1
|
4120 | },
|
4121 | Series: {
|
4122 | max: 0
|
4123 | }
|
4124 | }, {
|
4125 | Category: {
|
4126 | max: 1
|
4127 | },
|
4128 | Series: {
|
4129 | min: 1,
|
4130 | max: 1
|
4131 | },
|
4132 | Y: {
|
4133 | max: 1
|
4134 | }
|
4135 | } ],
|
4136 | categorical: {
|
4137 | categories: {
|
4138 | "for": {
|
4139 | "in": "Category"
|
4140 | },
|
4141 | dataReductionAlgorithm: {
|
4142 | top: {}
|
4143 | }
|
4144 | },
|
4145 | values: {
|
4146 | group: {
|
4147 | by: "Series",
|
4148 | select: [ {
|
4149 | "for": {
|
4150 | "in": "Y"
|
4151 | }
|
4152 | } ],
|
4153 | dataReductionAlgorithm: {
|
4154 | top: {}
|
4155 | }
|
4156 | }
|
4157 | }
|
4158 | }
|
4159 | }, {
|
4160 | conditions: [ {
|
4161 | Category: {
|
4162 | max: 1
|
4163 | },
|
4164 | Series: {
|
4165 | max: 0
|
4166 | }
|
4167 | }, {
|
4168 | Category: {
|
4169 | max: 1
|
4170 | },
|
4171 | Series: {
|
4172 | min: 1,
|
4173 | max: 1
|
4174 | },
|
4175 | Y: {
|
4176 | max: 1
|
4177 | }
|
4178 | } ],
|
4179 | requiredProperties: [ {
|
4180 | objectName: "trend",
|
4181 | propertyName: "show"
|
4182 | } ],
|
4183 | usage: {
|
4184 | regression: {
|
4185 | combineSeries: {
|
4186 | objectName: "trend",
|
4187 | propertyName: "combineSeries"
|
4188 | }
|
4189 | }
|
4190 | },
|
4191 | categorical: {
|
4192 | categories: {
|
4193 | "for": {
|
4194 | "in": "regression.X"
|
4195 | }
|
4196 | },
|
4197 | values: {
|
4198 | group: {
|
4199 | by: "regression.Series",
|
4200 | select: [ {
|
4201 | "for": {
|
4202 | "in": "regression.Y"
|
4203 | }
|
4204 | } ]
|
4205 | }
|
4206 | }
|
4207 | }
|
4208 | } ],
|
4209 | sorting: {
|
4210 | "default": {}
|
4211 | }
|
4212 | }, visuals.lineChartProps = {
|
4213 | general: {
|
4214 | formatString: {
|
4215 | objectName: "general",
|
4216 | propertyName: "formatString"
|
4217 | }
|
4218 | },
|
4219 | dataPoint: {
|
4220 | defaultColor: {
|
4221 | objectName: "dataPoint",
|
4222 | propertyName: "defaultColor"
|
4223 | },
|
4224 | fill: {
|
4225 | objectName: "dataPoint",
|
4226 | propertyName: "fill"
|
4227 | }
|
4228 | },
|
4229 | trend: {
|
4230 | show: {
|
4231 | objectName: "trend",
|
4232 | propertyName: "show"
|
4233 | }
|
4234 | },
|
4235 | categoryAxis: {
|
4236 | axisType: {
|
4237 | objectName: "categoryAxis",
|
4238 | propertyName: "axisType"
|
4239 | }
|
4240 | },
|
4241 | legend: {
|
4242 | labelColor: {
|
4243 | objectName: "legend",
|
4244 | propertyName: "labelColor"
|
4245 | }
|
4246 | },
|
4247 | labels: {
|
4248 | labelDensity: {
|
4249 | objectName: "labels",
|
4250 | propertyName: "labelDensity"
|
4251 | }
|
4252 | },
|
4253 | plotArea: {
|
4254 | image: {
|
4255 | objectName: "plotArea",
|
4256 | propertyName: "image"
|
4257 | },
|
4258 | transparency: {
|
4259 | objectName: "plotArea",
|
4260 | propertyName: "transparency"
|
4261 | }
|
4262 | }
|
4263 | };
|
4264 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4265 | }(powerbi || (powerbi = {}));
|
4266 |
|
4267 | var powerbi;
|
4268 |
|
4269 | !function(powerbi) {
|
4270 | var visuals;
|
4271 | !function(visuals) {
|
4272 | visuals.mapCapabilities = {
|
4273 | dataRoles: [ {
|
4274 | name: "Category",
|
4275 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4276 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Location"),
|
4277 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LocationMapDescription"),
|
4278 | preferredTypes: [ {
|
4279 | geography: {
|
4280 | address: !0
|
4281 | }
|
4282 | }, {
|
4283 | geography: {
|
4284 | city: !0
|
4285 | }
|
4286 | }, {
|
4287 | geography: {
|
4288 | continent: !0
|
4289 | }
|
4290 | }, {
|
4291 | geography: {
|
4292 | country: !0
|
4293 | }
|
4294 | }, {
|
4295 | geography: {
|
4296 | county: !0
|
4297 | }
|
4298 | }, {
|
4299 | geography: {
|
4300 | place: !0
|
4301 | }
|
4302 | }, {
|
4303 | geography: {
|
4304 | postalCode: !0
|
4305 | }
|
4306 | }, {
|
4307 | geography: {
|
4308 | region: !0
|
4309 | }
|
4310 | }, {
|
4311 | geography: {
|
4312 | stateOrProvince: !0
|
4313 | }
|
4314 | } ]
|
4315 | }, {
|
4316 | name: "Series",
|
4317 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4318 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
4319 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
4320 | }, {
|
4321 | name: "X",
|
4322 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
4323 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Longitude"),
|
4324 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LongitudeMapDescription"),
|
4325 | preferredTypes: [ {
|
4326 | geography: {
|
4327 | longitude: !0
|
4328 | }
|
4329 | } ]
|
4330 | }, {
|
4331 | name: "Y",
|
4332 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
4333 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Latitude"),
|
4334 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LatitudeMapDescription"),
|
4335 | preferredTypes: [ {
|
4336 | geography: {
|
4337 | latitude: !0
|
4338 | }
|
4339 | } ]
|
4340 | }, {
|
4341 | name: "Size",
|
4342 | kind: powerbi.VisualDataRoleKind.Measure,
|
4343 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Size"),
|
4344 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_SizeDescription"),
|
4345 | requiredTypes: [ {
|
4346 | numeric: !0
|
4347 | }, {
|
4348 | integer: !0
|
4349 | } ]
|
4350 | }, {
|
4351 | name: "Gradient",
|
4352 | kind: powerbi.VisualDataRoleKind.Measure,
|
4353 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
4354 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
4355 | requiredTypes: [ {
|
4356 | numeric: !0
|
4357 | }, {
|
4358 | integer: !0
|
4359 | } ]
|
4360 | } ],
|
4361 | objects: {
|
4362 | general: {
|
4363 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
4364 | properties: {
|
4365 | formatString: visuals.StandardObjectProperties.formatString
|
4366 | }
|
4367 | },
|
4368 | legend: {
|
4369 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
4370 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
4371 | properties: {
|
4372 | show: visuals.StandardObjectProperties.show,
|
4373 | position: visuals.StandardObjectProperties.legendPosition,
|
4374 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
4375 | titleText: visuals.StandardObjectProperties.legendTitle,
|
4376 | fontSize: visuals.StandardObjectProperties.fontSize
|
4377 | }
|
4378 | },
|
4379 | dataPoint: {
|
4380 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
4381 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
4382 | properties: {
|
4383 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
4384 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
4385 | fill: visuals.StandardObjectProperties.fill,
|
4386 | fillRule: {
|
4387 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
4388 | type: {
|
4389 | fillRule: {}
|
4390 | },
|
4391 | rule: {
|
4392 | inputRole: "Gradient",
|
4393 | output: {
|
4394 | property: "fill",
|
4395 | selector: [ "Category" ]
|
4396 | }
|
4397 | }
|
4398 | }
|
4399 | }
|
4400 | },
|
4401 | categoryLabels: {
|
4402 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
4403 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
4404 | properties: {
|
4405 | show: visuals.StandardObjectProperties.show,
|
4406 | color: visuals.StandardObjectProperties.dataColor,
|
4407 | fontSize: visuals.StandardObjectProperties.fontSize
|
4408 | }
|
4409 | }
|
4410 | },
|
4411 | dataViewMappings: [ {
|
4412 | conditions: [ {
|
4413 | Category: {
|
4414 | min: 1,
|
4415 | max: 1
|
4416 | },
|
4417 | Series: {
|
4418 | max: 1
|
4419 | },
|
4420 | X: {
|
4421 | max: 1,
|
4422 | kind: powerbi.VisualDataRoleKind.Measure
|
4423 | },
|
4424 | Y: {
|
4425 | max: 1,
|
4426 | kind: powerbi.VisualDataRoleKind.Measure
|
4427 | },
|
4428 | Size: {
|
4429 | max: 1
|
4430 | },
|
4431 | Gradient: {
|
4432 | max: 0
|
4433 | }
|
4434 | }, {
|
4435 | Category: {
|
4436 | min: 1,
|
4437 | max: 1
|
4438 | },
|
4439 | Series: {
|
4440 | max: 0
|
4441 | },
|
4442 | X: {
|
4443 | max: 1,
|
4444 | kind: powerbi.VisualDataRoleKind.Measure
|
4445 | },
|
4446 | Y: {
|
4447 | max: 1,
|
4448 | kind: powerbi.VisualDataRoleKind.Measure
|
4449 | },
|
4450 | Size: {
|
4451 | max: 1
|
4452 | },
|
4453 | Gradient: {
|
4454 | max: 1
|
4455 | }
|
4456 | } ],
|
4457 | categorical: {
|
4458 | categories: {
|
4459 | "for": {
|
4460 | "in": "Category"
|
4461 | },
|
4462 | dataReductionAlgorithm: {
|
4463 | top: {}
|
4464 | }
|
4465 | },
|
4466 | values: {
|
4467 | group: {
|
4468 | by: "Series",
|
4469 | select: [ {
|
4470 | bind: {
|
4471 | to: "X"
|
4472 | }
|
4473 | }, {
|
4474 | bind: {
|
4475 | to: "Y"
|
4476 | }
|
4477 | }, {
|
4478 | bind: {
|
4479 | to: "Size"
|
4480 | }
|
4481 | }, {
|
4482 | bind: {
|
4483 | to: "Gradient"
|
4484 | }
|
4485 | } ],
|
4486 | dataReductionAlgorithm: {
|
4487 | top: {}
|
4488 | }
|
4489 | }
|
4490 | },
|
4491 | rowCount: {
|
4492 | preferred: {
|
4493 | min: 2
|
4494 | }
|
4495 | },
|
4496 | dataVolume: 4
|
4497 | }
|
4498 | }, {
|
4499 | conditions: [ {
|
4500 | Category: {
|
4501 | max: 0
|
4502 | },
|
4503 | Series: {
|
4504 | max: 1
|
4505 | },
|
4506 | X: {
|
4507 | max: 1,
|
4508 | kind: powerbi.VisualDataRoleKind.Grouping
|
4509 | },
|
4510 | Y: {
|
4511 | max: 1,
|
4512 | kind: powerbi.VisualDataRoleKind.Grouping
|
4513 | },
|
4514 | Size: {
|
4515 | max: 1
|
4516 | },
|
4517 | Gradient: {
|
4518 | max: 0
|
4519 | }
|
4520 | }, {
|
4521 | Category: {
|
4522 | max: 0
|
4523 | },
|
4524 | Series: {
|
4525 | max: 0
|
4526 | },
|
4527 | X: {
|
4528 | max: 1,
|
4529 | kind: powerbi.VisualDataRoleKind.Grouping
|
4530 | },
|
4531 | Y: {
|
4532 | max: 1,
|
4533 | kind: powerbi.VisualDataRoleKind.Grouping
|
4534 | },
|
4535 | Size: {
|
4536 | max: 1
|
4537 | },
|
4538 | Gradient: {
|
4539 | max: 1
|
4540 | }
|
4541 | } ],
|
4542 | categorical: {
|
4543 | categories: {
|
4544 | select: [ {
|
4545 | bind: {
|
4546 | to: "X"
|
4547 | }
|
4548 | }, {
|
4549 | bind: {
|
4550 | to: "Y"
|
4551 | }
|
4552 | } ],
|
4553 | dataReductionAlgorithm: {
|
4554 | top: {}
|
4555 | }
|
4556 | },
|
4557 | values: {
|
4558 | group: {
|
4559 | by: "Series",
|
4560 | select: [ {
|
4561 | bind: {
|
4562 | to: "Size"
|
4563 | }
|
4564 | }, {
|
4565 | bind: {
|
4566 | to: "Gradient"
|
4567 | }
|
4568 | } ],
|
4569 | dataReductionAlgorithm: {
|
4570 | top: {}
|
4571 | }
|
4572 | }
|
4573 | },
|
4574 | rowCount: {
|
4575 | preferred: {
|
4576 | min: 2
|
4577 | }
|
4578 | },
|
4579 | dataVolume: 4
|
4580 | }
|
4581 | } ],
|
4582 | sorting: {
|
4583 | custom: {}
|
4584 | },
|
4585 | drilldown: {
|
4586 | roles: [ "Category" ]
|
4587 | }
|
4588 | }, visuals.mapProps = {
|
4589 | general: {
|
4590 | formatString: {
|
4591 | objectName: "general",
|
4592 | propertyName: "formatString"
|
4593 | }
|
4594 | },
|
4595 | dataPoint: {
|
4596 | defaultColor: {
|
4597 | objectName: "dataPoint",
|
4598 | propertyName: "defaultColor"
|
4599 | },
|
4600 | fill: {
|
4601 | objectName: "dataPoint",
|
4602 | propertyName: "fill"
|
4603 | },
|
4604 | showAllDataPoints: {
|
4605 | objectName: "dataPoint",
|
4606 | propertyName: "showAllDataPoints"
|
4607 | }
|
4608 | },
|
4609 | legend: {
|
4610 | show: {
|
4611 | objectName: "legend",
|
4612 | propertyName: "show"
|
4613 | },
|
4614 | position: {
|
4615 | objectName: "legend",
|
4616 | propertyName: "position"
|
4617 | },
|
4618 | showTitle: {
|
4619 | objectName: "legend",
|
4620 | propertyName: "showTitle"
|
4621 | },
|
4622 | titleText: {
|
4623 | objectName: "legend",
|
4624 | propertyName: "titleText"
|
4625 | }
|
4626 | }
|
4627 | };
|
4628 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4629 | }(powerbi || (powerbi = {}));
|
4630 |
|
4631 | var powerbi;
|
4632 |
|
4633 | !function(powerbi) {
|
4634 | var visuals;
|
4635 | !function(visuals) {
|
4636 | visuals.multiRowCardCapabilities = {
|
4637 | dataRoles: [ {
|
4638 | name: "Values",
|
4639 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
4640 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Fields"),
|
4641 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_FieldsDescription")
|
4642 | } ],
|
4643 | objects: {
|
4644 | general: {
|
4645 | properties: {
|
4646 | formatString: visuals.StandardObjectProperties.formatString
|
4647 | }
|
4648 | },
|
4649 | cardTitle: {
|
4650 | displayName: powerbi.data.createDisplayNameGetter("Visual_CardTitle"),
|
4651 | description: powerbi.data.createDisplayNameGetter("Visual_CardTitleDescription"),
|
4652 | properties: {
|
4653 | color: visuals.StandardObjectProperties.dataColor,
|
4654 | fontSize: visuals.StandardObjectProperties.fontSize
|
4655 | }
|
4656 | },
|
4657 | dataLabels: {
|
4658 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
4659 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
4660 | properties: {
|
4661 | color: visuals.StandardObjectProperties.dataColor,
|
4662 | fontSize: visuals.StandardObjectProperties.fontSize
|
4663 | }
|
4664 | },
|
4665 | categoryLabels: {
|
4666 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
4667 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
4668 | properties: {
|
4669 | show: visuals.StandardObjectProperties.show,
|
4670 | color: visuals.StandardObjectProperties.dataColor,
|
4671 | fontSize: visuals.StandardObjectProperties.fontSize
|
4672 | }
|
4673 | },
|
4674 | card: {
|
4675 | displayName: powerbi.data.createDisplayNameGetter("Card_ToolTip"),
|
4676 | properties: {
|
4677 | outline: {
|
4678 | displayName: powerbi.data.createDisplayNameGetter("Visual_Outline"),
|
4679 | type: {
|
4680 | enumeration: visuals.outline.type
|
4681 | }
|
4682 | },
|
4683 | outlineColor: {
|
4684 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineColor"),
|
4685 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineColor_Desc"),
|
4686 | type: {
|
4687 | fill: {
|
4688 | solid: {
|
4689 | color: !0
|
4690 | }
|
4691 | }
|
4692 | }
|
4693 | },
|
4694 | outlineWeight: {
|
4695 | displayName: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight"),
|
4696 | description: powerbi.data.createDisplayNameGetter("Visual_OutlineWeight_Desc"),
|
4697 | type: {
|
4698 | numeric: !0
|
4699 | }
|
4700 | },
|
4701 | barShow: {
|
4702 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarShow"),
|
4703 | description: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarShow_Desc"),
|
4704 | type: {
|
4705 | bool: !0
|
4706 | }
|
4707 | },
|
4708 | barColor: {
|
4709 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarColor"),
|
4710 | type: {
|
4711 | fill: {
|
4712 | solid: {
|
4713 | color: !0
|
4714 | }
|
4715 | }
|
4716 | }
|
4717 | },
|
4718 | barWeight: {
|
4719 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarWeight"),
|
4720 | description: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_BarWeight_Desc"),
|
4721 | type: {
|
4722 | numeric: !0
|
4723 | }
|
4724 | },
|
4725 | cardPadding: {
|
4726 | displayName: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_CardPadding"),
|
4727 | description: powerbi.data.createDisplayNameGetter("Visual_MultiRowCard_CardBackground"),
|
4728 | type: {
|
4729 | numeric: !0
|
4730 | }
|
4731 | },
|
4732 | cardBackground: {
|
4733 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background"),
|
4734 | type: {
|
4735 | fill: {
|
4736 | solid: {
|
4737 | color: !0
|
4738 | }
|
4739 | }
|
4740 | }
|
4741 | }
|
4742 | }
|
4743 | }
|
4744 | },
|
4745 | dataViewMappings: [ {
|
4746 | table: {
|
4747 | rows: {
|
4748 | "for": {
|
4749 | "in": "Values"
|
4750 | },
|
4751 | dataReductionAlgorithm: {
|
4752 | window: {}
|
4753 | }
|
4754 | },
|
4755 | rowCount: {
|
4756 | preferred: {
|
4757 | min: 1
|
4758 | }
|
4759 | }
|
4760 | }
|
4761 | } ],
|
4762 | sorting: {
|
4763 | "default": {}
|
4764 | },
|
4765 | suppressDefaultTitle: !0,
|
4766 | supportsSelection: !1,
|
4767 | disableVisualDetails: !0
|
4768 | }, visuals.multiRowCardProps = {
|
4769 | card: {
|
4770 | outline: {
|
4771 | objectName: "card",
|
4772 | propertyName: "outline"
|
4773 | },
|
4774 | outlineColor: {
|
4775 | objectName: "card",
|
4776 | propertyName: "outlineColor"
|
4777 | },
|
4778 | outlineWeight: {
|
4779 | objectName: "card",
|
4780 | propertyName: "outlineWeight"
|
4781 | },
|
4782 | barShow: {
|
4783 | objectName: "card",
|
4784 | propertyName: "barShow"
|
4785 | },
|
4786 | barColor: {
|
4787 | objectName: "card",
|
4788 | propertyName: "barColor"
|
4789 | },
|
4790 | barWeight: {
|
4791 | objectName: "card",
|
4792 | propertyName: "barWeight"
|
4793 | },
|
4794 | cardPadding: {
|
4795 | objectName: "card",
|
4796 | propertyName: "cardPadding"
|
4797 | },
|
4798 | cardBackground: {
|
4799 | objectName: "card",
|
4800 | propertyName: "cardBackground"
|
4801 | }
|
4802 | }
|
4803 | };
|
4804 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4805 | }(powerbi || (powerbi = {}));
|
4806 |
|
4807 | var powerbi;
|
4808 |
|
4809 | !function(powerbi) {
|
4810 | var visuals;
|
4811 | !function(visuals) {
|
4812 | visuals.textboxCapabilities = {
|
4813 | objects: {
|
4814 | general: {
|
4815 | properties: {
|
4816 | paragraphs: {
|
4817 | type: {
|
4818 | paragraphs: {}
|
4819 | },
|
4820 | suppressFormatPainterCopy: !0
|
4821 | }
|
4822 | }
|
4823 | }
|
4824 | },
|
4825 | suppressDefaultTitle: !0,
|
4826 | supportsSelection: !1
|
4827 | };
|
4828 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4829 | }(powerbi || (powerbi = {}));
|
4830 |
|
4831 | var powerbi;
|
4832 |
|
4833 | !function(powerbi) {
|
4834 | var visuals;
|
4835 | !function(visuals) {
|
4836 | visuals.cheerMeterCapabilities = {
|
4837 | dataRoles: [ {
|
4838 | name: "Category",
|
4839 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4840 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Axis"),
|
4841 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_AxisDescription")
|
4842 | }, {
|
4843 | name: "Y",
|
4844 | kind: powerbi.VisualDataRoleKind.Measure,
|
4845 | requiredTypes: [ {
|
4846 | numeric: !0
|
4847 | }, {
|
4848 | integer: !0
|
4849 | } ],
|
4850 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y"),
|
4851 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_YDescription")
|
4852 | } ],
|
4853 | dataViewMappings: [ {
|
4854 | categorical: {
|
4855 | categories: {
|
4856 | "for": {
|
4857 | "in": "Category"
|
4858 | }
|
4859 | }
|
4860 | }
|
4861 | } ],
|
4862 | dataPoint: {
|
4863 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
4864 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
4865 | properties: {
|
4866 | fill: visuals.StandardObjectProperties.fill
|
4867 | }
|
4868 | }
|
4869 | };
|
4870 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
4871 | }(powerbi || (powerbi = {}));
|
4872 |
|
4873 | var powerbi;
|
4874 |
|
4875 | !function(powerbi) {
|
4876 | var visuals;
|
4877 | !function(visuals) {
|
4878 | visuals.scatterChartCapabilities = {
|
4879 | dataRoles: [ {
|
4880 | name: "Category",
|
4881 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4882 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Details"),
|
4883 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_DetailsScatterChartDescription")
|
4884 | }, {
|
4885 | name: "Series",
|
4886 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4887 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Legend"),
|
4888 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_LegendDescription")
|
4889 | }, {
|
4890 | name: "X",
|
4891 | kind: powerbi.VisualDataRoleKind.Measure,
|
4892 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_X"),
|
4893 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_XScatterChartDescription"),
|
4894 | requiredTypes: [ {
|
4895 | numeric: !0
|
4896 | }, {
|
4897 | integer: !0
|
4898 | } ],
|
4899 | cartesianKind: 0
|
4900 | }, {
|
4901 | name: "Y",
|
4902 | kind: powerbi.VisualDataRoleKind.Measure,
|
4903 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y"),
|
4904 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_YScatterChartDescription"),
|
4905 | requiredTypes: [ {
|
4906 | numeric: !0
|
4907 | }, {
|
4908 | integer: !0
|
4909 | } ],
|
4910 | cartesianKind: 1
|
4911 | }, {
|
4912 | name: "Size",
|
4913 | kind: powerbi.VisualDataRoleKind.Measure,
|
4914 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Size"),
|
4915 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_SizeDescription"),
|
4916 | requiredTypes: [ {
|
4917 | numeric: !0
|
4918 | }, {
|
4919 | integer: !0
|
4920 | } ]
|
4921 | }, {
|
4922 | name: "Gradient",
|
4923 | kind: powerbi.VisualDataRoleKind.Measure,
|
4924 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
4925 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
4926 | requiredTypes: [ {
|
4927 | numeric: !0
|
4928 | }, {
|
4929 | integer: !0
|
4930 | } ]
|
4931 | }, {
|
4932 | name: "Play",
|
4933 | kind: powerbi.VisualDataRoleKind.Grouping,
|
4934 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Play")
|
4935 | } ],
|
4936 | objects: {
|
4937 | dataPoint: {
|
4938 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
4939 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
4940 | properties: {
|
4941 | defaultColor: visuals.StandardObjectProperties.defaultColor,
|
4942 | showAllDataPoints: visuals.StandardObjectProperties.showAllDataPoints,
|
4943 | fill: visuals.StandardObjectProperties.fill,
|
4944 | fillRule: {
|
4945 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
4946 | type: {
|
4947 | fillRule: {}
|
4948 | },
|
4949 | rule: {
|
4950 | inputRole: "Gradient",
|
4951 | output: {
|
4952 | property: "fill",
|
4953 | selector: [ "Category" ]
|
4954 | }
|
4955 | }
|
4956 | }
|
4957 | }
|
4958 | },
|
4959 | general: {
|
4960 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
4961 | properties: {
|
4962 | formatString: visuals.StandardObjectProperties.formatString
|
4963 | }
|
4964 | },
|
4965 | trend: {
|
4966 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line"),
|
4967 | properties: {
|
4968 | show: visuals.StandardObjectProperties.show,
|
4969 | lineColor: {
|
4970 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color"),
|
4971 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Color_Description"),
|
4972 | type: {
|
4973 | fill: {
|
4974 | solid: {
|
4975 | color: !0
|
4976 | }
|
4977 | }
|
4978 | }
|
4979 | },
|
4980 | transparency: {
|
4981 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency"),
|
4982 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Transparency_Description"),
|
4983 | type: {
|
4984 | numeric: !0
|
4985 | }
|
4986 | },
|
4987 | style: {
|
4988 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style"),
|
4989 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Style_Description"),
|
4990 | type: {
|
4991 | enumeration: visuals.lineStyle.type
|
4992 | }
|
4993 | },
|
4994 | combineSeries: {
|
4995 | displayName: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series"),
|
4996 | description: powerbi.data.createDisplayNameGetter("Visual_Trend_Line_Combine_Series_Description"),
|
4997 | type: {
|
4998 | bool: !0
|
4999 | }
|
5000 | }
|
5001 | }
|
5002 | },
|
5003 | categoryAxis: {
|
5004 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
5005 | properties: {
|
5006 | show: visuals.StandardObjectProperties.show,
|
5007 | axisScale: visuals.StandardObjectProperties.axisScale,
|
5008 | start: visuals.StandardObjectProperties.axisStart,
|
5009 | end: visuals.StandardObjectProperties.axisEnd,
|
5010 | showAxisTitle: {
|
5011 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
5012 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
5013 | type: {
|
5014 | bool: !0
|
5015 | }
|
5016 | },
|
5017 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
5018 | labelColor: visuals.StandardObjectProperties.labelColor,
|
5019 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
5020 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
5021 | }
|
5022 | },
|
5023 | valueAxis: {
|
5024 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
5025 | properties: {
|
5026 | show: visuals.StandardObjectProperties.show,
|
5027 | position: visuals.StandardObjectProperties.yAxisPosition,
|
5028 | axisScale: visuals.StandardObjectProperties.axisScale,
|
5029 | start: visuals.StandardObjectProperties.axisStart,
|
5030 | end: visuals.StandardObjectProperties.axisEnd,
|
5031 | showAxisTitle: {
|
5032 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
5033 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
5034 | type: {
|
5035 | bool: !0
|
5036 | }
|
5037 | },
|
5038 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
5039 | labelColor: visuals.StandardObjectProperties.labelColor,
|
5040 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
5041 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
5042 | }
|
5043 | },
|
5044 | xAxisReferenceLine: {
|
5045 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_X"),
|
5046 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
5047 | properties: {
|
5048 | show: visuals.StandardObjectProperties.show,
|
5049 | value: {
|
5050 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
5051 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
5052 | type: {
|
5053 | numeric: !0
|
5054 | }
|
5055 | },
|
5056 | lineColor: visuals.StandardObjectProperties.lineColor,
|
5057 | transparency: {
|
5058 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
5059 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
5060 | type: {
|
5061 | numeric: !0
|
5062 | }
|
5063 | },
|
5064 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
5065 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
5066 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
5067 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
5068 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
5069 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
5070 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
5071 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
5072 | }
|
5073 | },
|
5074 | y1AxisReferenceLine: {
|
5075 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Y"),
|
5076 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
5077 | properties: {
|
5078 | show: visuals.StandardObjectProperties.show,
|
5079 | value: {
|
5080 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
5081 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
5082 | type: {
|
5083 | numeric: !0
|
5084 | }
|
5085 | },
|
5086 | lineColor: visuals.StandardObjectProperties.lineColor,
|
5087 | transparency: {
|
5088 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
5089 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
5090 | type: {
|
5091 | numeric: !0
|
5092 | }
|
5093 | },
|
5094 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
5095 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
5096 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
5097 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
5098 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
5099 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
5100 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
5101 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
5102 | }
|
5103 | },
|
5104 | legend: {
|
5105 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
5106 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
5107 | properties: {
|
5108 | show: visuals.StandardObjectProperties.show,
|
5109 | position: visuals.StandardObjectProperties.legendPosition,
|
5110 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
5111 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
5112 | suppressFormatPainterCopy: !0
|
5113 | }),
|
5114 | labelColor: visuals.StandardObjectProperties.labelColor,
|
5115 | fontSize: visuals.StandardObjectProperties.fontSize
|
5116 | }
|
5117 | },
|
5118 | categoryLabels: {
|
5119 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
5120 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
5121 | properties: {
|
5122 | show: visuals.StandardObjectProperties.show,
|
5123 | color: visuals.StandardObjectProperties.dataColor,
|
5124 | fontSize: visuals.StandardObjectProperties.fontSize
|
5125 | }
|
5126 | },
|
5127 | colorBorder: {
|
5128 | displayName: powerbi.data.createDisplayNameGetter("Visual_ColorBorder"),
|
5129 | properties: {
|
5130 | show: visuals.StandardObjectProperties.show
|
5131 | }
|
5132 | },
|
5133 | fillPoint: {
|
5134 | displayName: powerbi.data.createDisplayNameGetter("Visual_FillPoint"),
|
5135 | properties: {
|
5136 | show: visuals.StandardObjectProperties.show
|
5137 | }
|
5138 | },
|
5139 | colorByCategory: {
|
5140 | displayName: powerbi.data.createDisplayNameGetter("Visual_ColorByCategory"),
|
5141 | properties: {
|
5142 | show: visuals.StandardObjectProperties.show
|
5143 | }
|
5144 | },
|
5145 | currentFrameIndex: {
|
5146 | properties: {
|
5147 | index: {
|
5148 | type: {
|
5149 | numeric: !0
|
5150 | }
|
5151 | }
|
5152 | }
|
5153 | },
|
5154 | plotArea: {
|
5155 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
5156 | properties: {
|
5157 | transparency: visuals.StandardObjectProperties.transparency,
|
5158 | image: visuals.StandardObjectProperties.image
|
5159 | }
|
5160 | }
|
5161 | },
|
5162 | dataViewMappings: [ {
|
5163 | conditions: [ {
|
5164 | Category: {
|
5165 | max: 1
|
5166 | },
|
5167 | Series: {
|
5168 | max: 1
|
5169 | },
|
5170 | X: {
|
5171 | max: 1
|
5172 | },
|
5173 | Y: {
|
5174 | max: 1
|
5175 | },
|
5176 | Size: {
|
5177 | max: 1
|
5178 | },
|
5179 | Gradient: {
|
5180 | max: 0
|
5181 | },
|
5182 | Play: {
|
5183 | max: 0
|
5184 | }
|
5185 | }, {
|
5186 | Category: {
|
5187 | max: 1
|
5188 | },
|
5189 | Series: {
|
5190 | max: 0
|
5191 | },
|
5192 | X: {
|
5193 | max: 1
|
5194 | },
|
5195 | Y: {
|
5196 | max: 1
|
5197 | },
|
5198 | Size: {
|
5199 | max: 1
|
5200 | },
|
5201 | Gradient: {
|
5202 | max: 1
|
5203 | },
|
5204 | Play: {
|
5205 | max: 0
|
5206 | }
|
5207 | } ],
|
5208 | categorical: {
|
5209 | categories: {
|
5210 | "for": {
|
5211 | "in": "Category"
|
5212 | }
|
5213 | },
|
5214 | values: {
|
5215 | group: {
|
5216 | by: "Series",
|
5217 | select: [ {
|
5218 | bind: {
|
5219 | to: "X"
|
5220 | }
|
5221 | }, {
|
5222 | bind: {
|
5223 | to: "Y"
|
5224 | }
|
5225 | }, {
|
5226 | bind: {
|
5227 | to: "Size"
|
5228 | }
|
5229 | }, {
|
5230 | bind: {
|
5231 | to: "Gradient"
|
5232 | }
|
5233 | } ]
|
5234 | }
|
5235 | },
|
5236 | rowCount: {
|
5237 | preferred: {
|
5238 | min: 2
|
5239 | }
|
5240 | },
|
5241 | dataReductionAlgorithm: {
|
5242 | sample: {}
|
5243 | },
|
5244 | dataVolume: 4
|
5245 | }
|
5246 | }, {
|
5247 | conditions: [ {
|
5248 | Category: {
|
5249 | max: 1
|
5250 | },
|
5251 | Series: {
|
5252 | max: 1
|
5253 | },
|
5254 | X: {
|
5255 | max: 1
|
5256 | },
|
5257 | Y: {
|
5258 | max: 1
|
5259 | },
|
5260 | Size: {
|
5261 | max: 1
|
5262 | },
|
5263 | Gradient: {
|
5264 | max: 0
|
5265 | },
|
5266 | Play: {
|
5267 | min: 1,
|
5268 | max: 1
|
5269 | }
|
5270 | }, {
|
5271 | Category: {
|
5272 | max: 1
|
5273 | },
|
5274 | Series: {
|
5275 | max: 0
|
5276 | },
|
5277 | X: {
|
5278 | max: 1
|
5279 | },
|
5280 | Y: {
|
5281 | max: 1
|
5282 | },
|
5283 | Size: {
|
5284 | max: 1
|
5285 | },
|
5286 | Gradient: {
|
5287 | max: 1
|
5288 | },
|
5289 | Play: {
|
5290 | min: 1,
|
5291 | max: 1
|
5292 | }
|
5293 | } ],
|
5294 | matrix: {
|
5295 | rows: {
|
5296 | select: [ {
|
5297 | bind: {
|
5298 | to: "Play"
|
5299 | }
|
5300 | }, {
|
5301 | bind: {
|
5302 | to: "Category"
|
5303 | }
|
5304 | } ],
|
5305 | dataReductionAlgorithm: {
|
5306 | bottom: {
|
5307 | count: 5e3
|
5308 | }
|
5309 | }
|
5310 | },
|
5311 | columns: {
|
5312 | "for": {
|
5313 | "in": "Series"
|
5314 | },
|
5315 | dataReductionAlgorithm: {
|
5316 | top: {
|
5317 | count: 60
|
5318 | }
|
5319 | }
|
5320 | },
|
5321 | values: {
|
5322 | select: [ {
|
5323 | bind: {
|
5324 | to: "X"
|
5325 | }
|
5326 | }, {
|
5327 | bind: {
|
5328 | to: "Y"
|
5329 | }
|
5330 | }, {
|
5331 | bind: {
|
5332 | to: "Size"
|
5333 | }
|
5334 | } ]
|
5335 | }
|
5336 | }
|
5337 | }, {
|
5338 | conditions: [ {
|
5339 | Category: {
|
5340 | max: 1
|
5341 | },
|
5342 | Series: {
|
5343 | max: 1
|
5344 | },
|
5345 | X: {
|
5346 | max: 1
|
5347 | },
|
5348 | Y: {
|
5349 | max: 1
|
5350 | },
|
5351 | Size: {
|
5352 | max: 0
|
5353 | },
|
5354 | Gradient: {
|
5355 | max: 0
|
5356 | },
|
5357 | Play: {
|
5358 | max: 0
|
5359 | }
|
5360 | }, {
|
5361 | Category: {
|
5362 | max: 1
|
5363 | },
|
5364 | Series: {
|
5365 | max: 0
|
5366 | },
|
5367 | X: {
|
5368 | max: 1
|
5369 | },
|
5370 | Y: {
|
5371 | max: 1
|
5372 | },
|
5373 | Size: {
|
5374 | max: 0
|
5375 | },
|
5376 | Gradient: {
|
5377 | max: 1
|
5378 | },
|
5379 | Play: {
|
5380 | max: 0
|
5381 | }
|
5382 | } ],
|
5383 | requiredProperties: [ {
|
5384 | objectName: "trend",
|
5385 | propertyName: "show"
|
5386 | } ],
|
5387 | usage: {
|
5388 | regression: {
|
5389 | combineSeries: {
|
5390 | objectName: "trend",
|
5391 | propertyName: "combineSeries"
|
5392 | }
|
5393 | }
|
5394 | },
|
5395 | categorical: {
|
5396 | categories: {
|
5397 | "for": {
|
5398 | "in": "regression.X"
|
5399 | }
|
5400 | },
|
5401 | values: {
|
5402 | group: {
|
5403 | by: "regression.Series",
|
5404 | select: [ {
|
5405 | "for": {
|
5406 | "in": "regression.Y"
|
5407 | }
|
5408 | } ]
|
5409 | }
|
5410 | },
|
5411 | dataReductionAlgorithm: {
|
5412 | sample: {}
|
5413 | },
|
5414 | dataVolume: 4
|
5415 | }
|
5416 | } ],
|
5417 | sorting: {
|
5418 | custom: {},
|
5419 | implicit: {
|
5420 | clauses: [ {
|
5421 | role: "Play",
|
5422 | direction: 1
|
5423 | } ]
|
5424 | }
|
5425 | },
|
5426 | drilldown: {
|
5427 | roles: [ "Category" ]
|
5428 | }
|
5429 | }, visuals.scatterChartProps = {
|
5430 | general: {
|
5431 | formatString: {
|
5432 | objectName: "general",
|
5433 | propertyName: "formatString"
|
5434 | }
|
5435 | },
|
5436 | dataPoint: {
|
5437 | defaultColor: {
|
5438 | objectName: "dataPoint",
|
5439 | propertyName: "defaultColor"
|
5440 | },
|
5441 | fill: {
|
5442 | objectName: "dataPoint",
|
5443 | propertyName: "fill"
|
5444 | }
|
5445 | },
|
5446 | trend: {
|
5447 | show: {
|
5448 | objectName: "trend",
|
5449 | propertyName: "show"
|
5450 | }
|
5451 | },
|
5452 | colorBorder: {
|
5453 | show: {
|
5454 | objectName: "colorBorder",
|
5455 | propertyName: "show"
|
5456 | }
|
5457 | },
|
5458 | fillPoint: {
|
5459 | show: {
|
5460 | objectName: "fillPoint",
|
5461 | propertyName: "show"
|
5462 | }
|
5463 | },
|
5464 | colorByCategory: {
|
5465 | show: {
|
5466 | objectName: "colorByCategory",
|
5467 | propertyName: "show"
|
5468 | }
|
5469 | },
|
5470 | currentFrameIndex: {
|
5471 | index: {
|
5472 | objectName: "currentFrameIndex",
|
5473 | propertyName: "index"
|
5474 | }
|
5475 | },
|
5476 | legend: {
|
5477 | labelColor: {
|
5478 | objectName: "legend",
|
5479 | propertyName: "labelColor"
|
5480 | }
|
5481 | },
|
5482 | plotArea: {
|
5483 | image: {
|
5484 | objectName: "plotArea",
|
5485 | propertyName: "image"
|
5486 | },
|
5487 | transparency: {
|
5488 | objectName: "plotArea",
|
5489 | propertyName: "transparency"
|
5490 | }
|
5491 | }
|
5492 | };
|
5493 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5494 | }(powerbi || (powerbi = {}));
|
5495 |
|
5496 | var powerbi;
|
5497 |
|
5498 | !function(powerbi) {
|
5499 | var visuals;
|
5500 | !function(visuals) {
|
5501 | visuals.slicerCapabilities = {
|
5502 | dataRoles: [ {
|
5503 | name: "Values",
|
5504 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5505 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Field"),
|
5506 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_FieldDescription")
|
5507 | } ],
|
5508 | objects: {
|
5509 | general: {
|
5510 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
5511 | properties: {
|
5512 | filter: {
|
5513 | type: {
|
5514 | filter: {}
|
5515 | }
|
5516 | },
|
5517 | defaultValue: {
|
5518 | type: {
|
5519 | expression: {
|
5520 | defaultValue: !0
|
5521 | }
|
5522 | }
|
5523 | },
|
5524 | formatString: visuals.StandardObjectProperties.formatString,
|
5525 | outlineColor: visuals.StandardObjectProperties.outlineColor,
|
5526 | outlineWeight: visuals.StandardObjectProperties.outlineWeight,
|
5527 | orientation: {
|
5528 | displayName: powerbi.data.createDisplayNameGetter("Slicer_Orientation"),
|
5529 | type: {
|
5530 | enumeration: visuals.slicerOrientation.type
|
5531 | }
|
5532 | },
|
5533 | count: {
|
5534 | type: {
|
5535 | integer: !0
|
5536 | }
|
5537 | }
|
5538 | }
|
5539 | },
|
5540 | selection: {
|
5541 | displayName: powerbi.data.createDisplayNameGetter("Visual_SelectionControls"),
|
5542 | properties: {
|
5543 | selectAllCheckboxEnabled: {
|
5544 | displayName: powerbi.data.createDisplayNameGetter("Visual_SelectAll"),
|
5545 | type: {
|
5546 | bool: !0
|
5547 | }
|
5548 | },
|
5549 | singleSelect: {
|
5550 | displayName: powerbi.data.createDisplayNameGetter("Visual_SingleSelect"),
|
5551 | type: {
|
5552 | bool: !0
|
5553 | }
|
5554 | }
|
5555 | }
|
5556 | },
|
5557 | header: {
|
5558 | displayName: powerbi.data.createDisplayNameGetter("Visual_Header"),
|
5559 | properties: {
|
5560 | show: visuals.StandardObjectProperties.show,
|
5561 | fontColor: visuals.StandardObjectProperties.fontColor,
|
5562 | background: {
|
5563 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background"),
|
5564 | type: {
|
5565 | fill: {
|
5566 | solid: {
|
5567 | color: !0
|
5568 | }
|
5569 | }
|
5570 | }
|
5571 | },
|
5572 | outline: visuals.StandardObjectProperties.outline,
|
5573 | textSize: {
|
5574 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
5575 | type: {
|
5576 | numeric: !0
|
5577 | }
|
5578 | }
|
5579 | }
|
5580 | },
|
5581 | items: {
|
5582 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Items"),
|
5583 | properties: {
|
5584 | fontColor: visuals.StandardObjectProperties.fontColor,
|
5585 | background: {
|
5586 | displayName: powerbi.data.createDisplayNameGetter("Visual_Background"),
|
5587 | type: {
|
5588 | fill: {
|
5589 | solid: {
|
5590 | color: !0
|
5591 | }
|
5592 | }
|
5593 | }
|
5594 | },
|
5595 | outline: visuals.StandardObjectProperties.outline,
|
5596 | textSize: {
|
5597 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
5598 | type: {
|
5599 | numeric: !0
|
5600 | }
|
5601 | }
|
5602 | }
|
5603 | }
|
5604 | },
|
5605 | dataViewMappings: [ {
|
5606 | conditions: [ {
|
5607 | Values: {
|
5608 | max: 1
|
5609 | }
|
5610 | } ],
|
5611 | categorical: {
|
5612 | categories: {
|
5613 | "for": {
|
5614 | "in": "Values"
|
5615 | },
|
5616 | dataReductionAlgorithm: {
|
5617 | window: {}
|
5618 | }
|
5619 | },
|
5620 | includeEmptyGroups: !0
|
5621 | }
|
5622 | } ],
|
5623 | sorting: {
|
5624 | "default": {}
|
5625 | },
|
5626 | suppressDefaultTitle: !0,
|
5627 | disableVisualDetails: !0
|
5628 | }, visuals.slicerProps = {
|
5629 | general: {
|
5630 | outlineColor: {
|
5631 | objectName: "general",
|
5632 | propertyName: "outlineColor"
|
5633 | },
|
5634 | outlineWeight: {
|
5635 | objectName: "general",
|
5636 | propertyName: "outlineWeight"
|
5637 | },
|
5638 | orientation: {
|
5639 | objectName: "general",
|
5640 | propertyName: "orientation"
|
5641 | },
|
5642 | count: {
|
5643 | objectName: "general",
|
5644 | propertyName: "count"
|
5645 | }
|
5646 | },
|
5647 | selection: {
|
5648 | selectAllCheckboxEnabled: {
|
5649 | objectName: "selection",
|
5650 | propertyName: "selectAllCheckboxEnabled"
|
5651 | },
|
5652 | singleSelect: {
|
5653 | objectName: "selection",
|
5654 | propertyName: "singleSelect"
|
5655 | }
|
5656 | },
|
5657 | header: {
|
5658 | show: {
|
5659 | objectName: "header",
|
5660 | propertyName: "show"
|
5661 | },
|
5662 | fontColor: {
|
5663 | objectName: "header",
|
5664 | propertyName: "fontColor"
|
5665 | },
|
5666 | background: {
|
5667 | objectName: "header",
|
5668 | propertyName: "background"
|
5669 | },
|
5670 | outline: {
|
5671 | objectName: "header",
|
5672 | propertyName: "outline"
|
5673 | },
|
5674 | textSize: {
|
5675 | objectName: "header",
|
5676 | propertyName: "textSize"
|
5677 | }
|
5678 | },
|
5679 | items: {
|
5680 | fontColor: {
|
5681 | objectName: "items",
|
5682 | propertyName: "fontColor"
|
5683 | },
|
5684 | background: {
|
5685 | objectName: "items",
|
5686 | propertyName: "background"
|
5687 | },
|
5688 | outline: {
|
5689 | objectName: "items",
|
5690 | propertyName: "outline"
|
5691 | },
|
5692 | textSize: {
|
5693 | objectName: "items",
|
5694 | propertyName: "textSize"
|
5695 | }
|
5696 | },
|
5697 | selectedPropertyIdentifier: {
|
5698 | objectName: "general",
|
5699 | propertyName: "selected"
|
5700 | },
|
5701 | filterPropertyIdentifier: {
|
5702 | objectName: "general",
|
5703 | propertyName: "filter"
|
5704 | },
|
5705 | formatString: {
|
5706 | objectName: "general",
|
5707 | propertyName: "formatString"
|
5708 | },
|
5709 | defaultValue: {
|
5710 | objectName: "general",
|
5711 | propertyName: "defaultValue"
|
5712 | }
|
5713 | };
|
5714 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5715 | }(powerbi || (powerbi = {}));
|
5716 |
|
5717 | var powerbi;
|
5718 |
|
5719 | !function(powerbi) {
|
5720 | var visuals;
|
5721 | !function(visuals) {
|
5722 | visuals.tableCapabilities = {
|
5723 | dataRoles: [ {
|
5724 | name: "Values",
|
5725 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure,
|
5726 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values")
|
5727 | } ],
|
5728 | objects: {
|
5729 | general: {
|
5730 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
5731 | properties: {
|
5732 | formatString: visuals.StandardObjectProperties.formatString,
|
5733 | columnWidth: {
|
5734 | type: {
|
5735 | numeric: !0
|
5736 | }
|
5737 | },
|
5738 | totals: {
|
5739 | type: {
|
5740 | bool: !0
|
5741 | },
|
5742 | displayName: powerbi.data.createDisplayNameGetter("Visual_Totals"),
|
5743 | suppressFormatPainterCopy: !0
|
5744 | },
|
5745 | autoSizeColumnWidth: {
|
5746 | type: {
|
5747 | bool: !0
|
5748 | },
|
5749 | displayName: powerbi.data.createDisplayNameGetter("Visual_Adjust_Column_Width"),
|
5750 | suppressFormatPainterCopy: !0
|
5751 | },
|
5752 | textSize: {
|
5753 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
5754 | type: {
|
5755 | numeric: !0
|
5756 | }
|
5757 | }
|
5758 | }
|
5759 | },
|
5760 | grid: {
|
5761 | displayName: powerbi.data.createDisplayNameGetter("Visual_Grid"),
|
5762 | properties: {
|
5763 | outlineColor: visuals.StandardObjectProperties.outlineColor,
|
5764 | outlineWeight: visuals.StandardObjectProperties.outlineWeight,
|
5765 | gridVertical: {
|
5766 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical"),
|
5767 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Desc"),
|
5768 | type: {
|
5769 | bool: !0
|
5770 | }
|
5771 | },
|
5772 | gridVerticalColor: {
|
5773 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color"),
|
5774 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color_Desc"),
|
5775 | type: {
|
5776 | fill: {
|
5777 | solid: {
|
5778 | color: !0
|
5779 | }
|
5780 | }
|
5781 | }
|
5782 | },
|
5783 | gridVerticalWeight: {
|
5784 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight"),
|
5785 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight_Desc"),
|
5786 | type: {
|
5787 | numeric: !0
|
5788 | }
|
5789 | },
|
5790 | gridHorizontal: {
|
5791 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal"),
|
5792 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Desc"),
|
5793 | type: {
|
5794 | bool: !0
|
5795 | }
|
5796 | },
|
5797 | gridHorizontalColor: {
|
5798 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color"),
|
5799 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color_Desc"),
|
5800 | type: {
|
5801 | fill: {
|
5802 | solid: {
|
5803 | color: !0
|
5804 | }
|
5805 | }
|
5806 | }
|
5807 | },
|
5808 | gridHorizontalWeight: {
|
5809 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight"),
|
5810 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight_Desc"),
|
5811 | type: {
|
5812 | numeric: !0
|
5813 | }
|
5814 | },
|
5815 | rowPadding: {
|
5816 | displayName: powerbi.data.createDisplayNameGetter("Visual_RowPadding"),
|
5817 | description: powerbi.data.createDisplayNameGetter("Visual_RowPadding_Desc"),
|
5818 | type: {
|
5819 | numeric: !0
|
5820 | }
|
5821 | },
|
5822 | imageHeight: {
|
5823 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight"),
|
5824 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight_Desc"),
|
5825 | type: {
|
5826 | numeric: !0
|
5827 | }
|
5828 | }
|
5829 | }
|
5830 | },
|
5831 | columnHeaders: {
|
5832 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ColumnHeaders"),
|
5833 | properties: {
|
5834 | outline: visuals.StandardObjectProperties.outline,
|
5835 | fontColor: visuals.StandardObjectProperties.fontColor,
|
5836 | backColor: visuals.StandardObjectProperties.backColor
|
5837 | }
|
5838 | },
|
5839 | values: {
|
5840 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_Values"),
|
5841 | properties: {
|
5842 | outline: visuals.StandardObjectProperties.outline,
|
5843 | backColor: {
|
5844 | type: {
|
5845 | fill: {
|
5846 | solid: {
|
5847 | color: !0
|
5848 | }
|
5849 | }
|
5850 | }
|
5851 | },
|
5852 | fontColorPrimary: {
|
5853 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary"),
|
5854 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary_Desc"),
|
5855 | type: {
|
5856 | fill: {
|
5857 | solid: {
|
5858 | color: !0
|
5859 | }
|
5860 | }
|
5861 | }
|
5862 | },
|
5863 | backColorPrimary: {
|
5864 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary"),
|
5865 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary_Desc"),
|
5866 | type: {
|
5867 | fill: {
|
5868 | solid: {
|
5869 | color: !0
|
5870 | }
|
5871 | }
|
5872 | }
|
5873 | },
|
5874 | fontColorSecondary: {
|
5875 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary"),
|
5876 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary_Desc"),
|
5877 | type: {
|
5878 | fill: {
|
5879 | solid: {
|
5880 | color: !0
|
5881 | }
|
5882 | }
|
5883 | }
|
5884 | },
|
5885 | backColorSecondary: {
|
5886 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary"),
|
5887 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary_Desc"),
|
5888 | type: {
|
5889 | fill: {
|
5890 | solid: {
|
5891 | color: !0
|
5892 | }
|
5893 | }
|
5894 | }
|
5895 | },
|
5896 | urlIcon: {
|
5897 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_UrlIcon"),
|
5898 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_UrlIcon_Desc"),
|
5899 | type: {
|
5900 | bool: !0
|
5901 | }
|
5902 | }
|
5903 | }
|
5904 | },
|
5905 | total: {
|
5906 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_TotalGrand"),
|
5907 | properties: {
|
5908 | outline: visuals.StandardObjectProperties.outline,
|
5909 | fontColor: visuals.StandardObjectProperties.fontColor,
|
5910 | backColor: visuals.StandardObjectProperties.backColor
|
5911 | }
|
5912 | }
|
5913 | },
|
5914 | dataViewMappings: [ {
|
5915 | table: {
|
5916 | rows: {
|
5917 | "for": {
|
5918 | "in": "Values"
|
5919 | },
|
5920 | dataReductionAlgorithm: {
|
5921 | window: {
|
5922 | count: 500
|
5923 | }
|
5924 | }
|
5925 | },
|
5926 | rowCount: {
|
5927 | preferred: {
|
5928 | min: 1
|
5929 | }
|
5930 | }
|
5931 | }
|
5932 | } ],
|
5933 | sorting: {
|
5934 | custom: {}
|
5935 | },
|
5936 | suppressDefaultTitle: !0,
|
5937 | supportsSelection: !1,
|
5938 | disableVisualDetails: !0
|
5939 | };
|
5940 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
5941 | }(powerbi || (powerbi = {}));
|
5942 |
|
5943 | var powerbi;
|
5944 |
|
5945 | !function(powerbi) {
|
5946 | var visuals;
|
5947 | !function(visuals) {
|
5948 | visuals.matrixRoleNames = {
|
5949 | rows: "Rows",
|
5950 | columns: "Columns",
|
5951 | values: "Values"
|
5952 | }, visuals.matrixCapabilities = {
|
5953 | dataRoles: [ {
|
5954 | name: visuals.matrixRoleNames.rows,
|
5955 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5956 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Rows"),
|
5957 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_RowsDescription")
|
5958 | }, {
|
5959 | name: visuals.matrixRoleNames.columns,
|
5960 | kind: powerbi.VisualDataRoleKind.Grouping,
|
5961 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Columns"),
|
5962 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ColumnsDescription")
|
5963 | }, {
|
5964 | name: visuals.matrixRoleNames.values,
|
5965 | kind: powerbi.VisualDataRoleKind.Measure,
|
5966 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values")
|
5967 | } ],
|
5968 | objects: {
|
5969 | general: {
|
5970 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
5971 | properties: {
|
5972 | formatString: visuals.StandardObjectProperties.formatString,
|
5973 | columnWidth: {
|
5974 | type: {
|
5975 | numeric: !0
|
5976 | }
|
5977 | },
|
5978 | rowSubtotals: {
|
5979 | type: {
|
5980 | bool: !0
|
5981 | },
|
5982 | displayName: powerbi.data.createDisplayNameGetter("Visual_TotalRow"),
|
5983 | suppressFormatPainterCopy: !0
|
5984 | },
|
5985 | columnSubtotals: {
|
5986 | type: {
|
5987 | bool: !0
|
5988 | },
|
5989 | displayName: powerbi.data.createDisplayNameGetter("Visual_TotalColumn"),
|
5990 | suppressFormatPainterCopy: !0
|
5991 | },
|
5992 | autoSizeColumnWidth: {
|
5993 | type: {
|
5994 | bool: !0
|
5995 | },
|
5996 | displayName: powerbi.data.createDisplayNameGetter("Visual_Adjust_Column_Width"),
|
5997 | suppressFormatPainterCopy: !0
|
5998 | },
|
5999 | textSize: {
|
6000 | displayName: powerbi.data.createDisplayNameGetter("Visual_TextSize"),
|
6001 | type: {
|
6002 | numeric: !0
|
6003 | }
|
6004 | }
|
6005 | }
|
6006 | },
|
6007 | grid: {
|
6008 | displayName: powerbi.data.createDisplayNameGetter("Visual_Grid"),
|
6009 | properties: {
|
6010 | outlineColor: visuals.StandardObjectProperties.outlineColor,
|
6011 | outlineWeight: visuals.StandardObjectProperties.outlineWeight,
|
6012 | gridVertical: {
|
6013 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical"),
|
6014 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Desc"),
|
6015 | type: {
|
6016 | bool: !0
|
6017 | }
|
6018 | },
|
6019 | gridVerticalColor: {
|
6020 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color"),
|
6021 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Color_Desc"),
|
6022 | type: {
|
6023 | fill: {
|
6024 | solid: {
|
6025 | color: !0
|
6026 | }
|
6027 | }
|
6028 | }
|
6029 | },
|
6030 | gridVerticalWeight: {
|
6031 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight"),
|
6032 | description: powerbi.data.createDisplayNameGetter("Visual_GridVertical_Weight_Desc"),
|
6033 | type: {
|
6034 | numeric: !0
|
6035 | }
|
6036 | },
|
6037 | gridHorizontal: {
|
6038 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal"),
|
6039 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Desc"),
|
6040 | type: {
|
6041 | bool: !0
|
6042 | }
|
6043 | },
|
6044 | gridHorizontalColor: {
|
6045 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color"),
|
6046 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Color_Desc"),
|
6047 | type: {
|
6048 | fill: {
|
6049 | solid: {
|
6050 | color: !0
|
6051 | }
|
6052 | }
|
6053 | }
|
6054 | },
|
6055 | gridHorizontalWeight: {
|
6056 | displayName: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight"),
|
6057 | description: powerbi.data.createDisplayNameGetter("Visual_GridHorizontal_Weight_Desc"),
|
6058 | type: {
|
6059 | numeric: !0
|
6060 | }
|
6061 | },
|
6062 | rowPadding: {
|
6063 | displayName: powerbi.data.createDisplayNameGetter("Visual_RowPadding"),
|
6064 | description: powerbi.data.createDisplayNameGetter("Visual_RowPadding_Desc"),
|
6065 | type: {
|
6066 | numeric: !0
|
6067 | }
|
6068 | },
|
6069 | imageHeight: {
|
6070 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight"),
|
6071 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_ImageHeight_Desc"),
|
6072 | type: {
|
6073 | numeric: !0
|
6074 | }
|
6075 | }
|
6076 | }
|
6077 | },
|
6078 | columnHeaders: {
|
6079 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_ColumnHeaders"),
|
6080 | properties: {
|
6081 | outline: visuals.StandardObjectProperties.outline,
|
6082 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6083 | backColor: visuals.StandardObjectProperties.backColor
|
6084 | }
|
6085 | },
|
6086 | rowHeaders: {
|
6087 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_RowHeaders"),
|
6088 | properties: {
|
6089 | outline: visuals.StandardObjectProperties.outline,
|
6090 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6091 | backColor: visuals.StandardObjectProperties.backColor
|
6092 | }
|
6093 | },
|
6094 | values: {
|
6095 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_Values"),
|
6096 | properties: {
|
6097 | outline: visuals.StandardObjectProperties.outline,
|
6098 | fontColorPrimary: {
|
6099 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary"),
|
6100 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorPrimary_Desc"),
|
6101 | type: {
|
6102 | fill: {
|
6103 | solid: {
|
6104 | color: !0
|
6105 | }
|
6106 | }
|
6107 | }
|
6108 | },
|
6109 | backColorPrimary: {
|
6110 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary"),
|
6111 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorPrimary_Desc"),
|
6112 | type: {
|
6113 | fill: {
|
6114 | solid: {
|
6115 | color: !0
|
6116 | }
|
6117 | }
|
6118 | }
|
6119 | },
|
6120 | fontColorSecondary: {
|
6121 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary"),
|
6122 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_FontColorSecondary_Desc"),
|
6123 | type: {
|
6124 | fill: {
|
6125 | solid: {
|
6126 | color: !0
|
6127 | }
|
6128 | }
|
6129 | }
|
6130 | },
|
6131 | backColorSecondary: {
|
6132 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary"),
|
6133 | description: powerbi.data.createDisplayNameGetter("Visual_Tablix_BackColorSecondary_Desc"),
|
6134 | type: {
|
6135 | fill: {
|
6136 | solid: {
|
6137 | color: !0
|
6138 | }
|
6139 | }
|
6140 | }
|
6141 | }
|
6142 | }
|
6143 | },
|
6144 | subTotals: {
|
6145 | displayName: powerbi.data.createDisplayNameGetter("Visual_Tablix_TotalSub"),
|
6146 | properties: {
|
6147 | outline: visuals.StandardObjectProperties.outline,
|
6148 | fontColor: visuals.StandardObjectProperties.fontColor,
|
6149 | backColor: visuals.StandardObjectProperties.backColor
|
6150 | }
|
6151 | }
|
6152 | },
|
6153 | dataViewMappings: [ {
|
6154 | conditions: [ {
|
6155 | Rows: {
|
6156 | max: 0
|
6157 | },
|
6158 | Columns: {
|
6159 | max: 0
|
6160 | },
|
6161 | Values: {
|
6162 | min: 1
|
6163 | }
|
6164 | }, {
|
6165 | Rows: {
|
6166 | min: 1
|
6167 | },
|
6168 | Columns: {
|
6169 | min: 0
|
6170 | },
|
6171 | Values: {
|
6172 | min: 0
|
6173 | }
|
6174 | }, {
|
6175 | Rows: {
|
6176 | min: 0
|
6177 | },
|
6178 | Columns: {
|
6179 | min: 1
|
6180 | },
|
6181 | Values: {
|
6182 | min: 0
|
6183 | }
|
6184 | } ],
|
6185 | matrix: {
|
6186 | rows: {
|
6187 | "for": {
|
6188 | "in": "Rows"
|
6189 | },
|
6190 | dataReductionAlgorithm: {
|
6191 | window: {
|
6192 | count: 500
|
6193 | }
|
6194 | }
|
6195 | },
|
6196 | columns: {
|
6197 | "for": {
|
6198 | "in": "Columns"
|
6199 | },
|
6200 | dataReductionAlgorithm: {
|
6201 | top: {
|
6202 | count: 100
|
6203 | }
|
6204 | }
|
6205 | },
|
6206 | values: {
|
6207 | "for": {
|
6208 | "in": "Values"
|
6209 | }
|
6210 | }
|
6211 | }
|
6212 | } ],
|
6213 | filterMappings: {
|
6214 | measureFilter: {
|
6215 | targetRoles: [ visuals.matrixRoleNames.rows ]
|
6216 | }
|
6217 | },
|
6218 | sorting: {
|
6219 | custom: {}
|
6220 | },
|
6221 | suppressDefaultTitle: !0,
|
6222 | supportsSelection: !1,
|
6223 | disableVisualDetails: !0
|
6224 | };
|
6225 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6226 | }(powerbi || (powerbi = {}));
|
6227 |
|
6228 | var powerbi;
|
6229 |
|
6230 | !function(powerbi) {
|
6231 | var visuals;
|
6232 | !function(visuals) {
|
6233 | visuals.treemapCapabilities = {
|
6234 | dataRoles: [ {
|
6235 | name: "Group",
|
6236 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6237 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Group"),
|
6238 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GroupTreemapDescription")
|
6239 | }, {
|
6240 | name: "Details",
|
6241 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6242 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Details")
|
6243 | }, {
|
6244 | name: "Values",
|
6245 | kind: powerbi.VisualDataRoleKind.Measure,
|
6246 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Values"),
|
6247 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_ValuesDescription"),
|
6248 | requiredTypes: [ {
|
6249 | numeric: !0
|
6250 | }, {
|
6251 | integer: !0
|
6252 | } ]
|
6253 | }, {
|
6254 | name: "Gradient",
|
6255 | kind: powerbi.VisualDataRoleKind.Measure,
|
6256 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Gradient"),
|
6257 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_GradientDescription"),
|
6258 | requiredTypes: [ {
|
6259 | numeric: !0
|
6260 | }, {
|
6261 | integer: !0
|
6262 | } ]
|
6263 | } ],
|
6264 | objects: {
|
6265 | general: {
|
6266 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
6267 | properties: {
|
6268 | formatString: visuals.StandardObjectProperties.formatString
|
6269 | }
|
6270 | },
|
6271 | legend: {
|
6272 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
6273 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
6274 | properties: {
|
6275 | show: visuals.StandardObjectProperties.show,
|
6276 | position: visuals.StandardObjectProperties.legendPosition,
|
6277 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
6278 | titleText: visuals.StandardObjectProperties.legendTitle,
|
6279 | labelColor: visuals.StandardObjectProperties.labelColor,
|
6280 | fontSize: visuals.StandardObjectProperties.fontSize
|
6281 | }
|
6282 | },
|
6283 | dataPoint: {
|
6284 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
6285 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
6286 | properties: {
|
6287 | fill: {
|
6288 | type: {
|
6289 | fill: {
|
6290 | solid: {
|
6291 | color: !0
|
6292 | }
|
6293 | }
|
6294 | }
|
6295 | },
|
6296 | fillRule: {
|
6297 | displayName: powerbi.data.createDisplayNameGetter("Visual_Gradient"),
|
6298 | type: {
|
6299 | fillRule: {}
|
6300 | },
|
6301 | rule: {
|
6302 | inputRole: "Gradient",
|
6303 | output: {
|
6304 | property: "fill",
|
6305 | selector: [ "Group" ]
|
6306 | }
|
6307 | }
|
6308 | }
|
6309 | }
|
6310 | },
|
6311 | labels: {
|
6312 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
6313 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
6314 | properties: {
|
6315 | show: visuals.StandardObjectProperties.show,
|
6316 | color: visuals.StandardObjectProperties.dataColor,
|
6317 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
6318 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
6319 | }
|
6320 | },
|
6321 | categoryLabels: {
|
6322 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabels"),
|
6323 | description: powerbi.data.createDisplayNameGetter("Visual_CategoryLabelsDescription"),
|
6324 | properties: {
|
6325 | show: visuals.StandardObjectProperties.show
|
6326 | }
|
6327 | }
|
6328 | },
|
6329 | dataViewMappings: [ {
|
6330 | conditions: [ {
|
6331 | Group: {
|
6332 | max: 1
|
6333 | },
|
6334 | Details: {
|
6335 | max: 0
|
6336 | },
|
6337 | Gradient: {
|
6338 | max: 1
|
6339 | }
|
6340 | }, {
|
6341 | Group: {
|
6342 | max: 1
|
6343 | },
|
6344 | Details: {
|
6345 | min: 1,
|
6346 | max: 1
|
6347 | },
|
6348 | Values: {
|
6349 | max: 1
|
6350 | },
|
6351 | Gradient: {
|
6352 | max: 0
|
6353 | }
|
6354 | } ],
|
6355 | categorical: {
|
6356 | categories: {
|
6357 | "for": {
|
6358 | "in": "Group"
|
6359 | },
|
6360 | dataReductionAlgorithm: {
|
6361 | top: {}
|
6362 | }
|
6363 | },
|
6364 | values: {
|
6365 | group: {
|
6366 | by: "Details",
|
6367 | select: [ {
|
6368 | bind: {
|
6369 | to: "Values"
|
6370 | }
|
6371 | }, {
|
6372 | bind: {
|
6373 | to: "Gradient"
|
6374 | }
|
6375 | } ],
|
6376 | dataReductionAlgorithm: {
|
6377 | top: {}
|
6378 | }
|
6379 | }
|
6380 | },
|
6381 | rowCount: {
|
6382 | preferred: {
|
6383 | min: 2
|
6384 | }
|
6385 | }
|
6386 | }
|
6387 | } ],
|
6388 | supportsHighlight: !0,
|
6389 | sorting: {
|
6390 | custom: {},
|
6391 | implicit: {
|
6392 | clauses: [ {
|
6393 | role: "Values",
|
6394 | direction: 2
|
6395 | } ]
|
6396 | }
|
6397 | },
|
6398 | drilldown: {
|
6399 | roles: [ "Group" ]
|
6400 | }
|
6401 | }, visuals.treemapProps = {
|
6402 | general: {
|
6403 | formatString: {
|
6404 | objectName: "general",
|
6405 | propertyName: "formatString"
|
6406 | }
|
6407 | },
|
6408 | dataPoint: {
|
6409 | fill: {
|
6410 | objectName: "dataPoint",
|
6411 | propertyName: "fill"
|
6412 | }
|
6413 | },
|
6414 | legend: {
|
6415 | show: {
|
6416 | objectName: "legend",
|
6417 | propertyName: "show"
|
6418 | },
|
6419 | position: {
|
6420 | objectName: "legend",
|
6421 | propertyName: "position"
|
6422 | },
|
6423 | showTitle: {
|
6424 | objectName: "legend",
|
6425 | propertyName: "showTitle"
|
6426 | },
|
6427 | titleText: {
|
6428 | objectName: "legend",
|
6429 | propertyName: "titleText"
|
6430 | },
|
6431 | labelColor: {
|
6432 | objectName: "legend",
|
6433 | propertyName: "labelColor"
|
6434 | }
|
6435 | },
|
6436 | labels: {
|
6437 | show: {
|
6438 | objectName: "labels",
|
6439 | propertyName: "show"
|
6440 | },
|
6441 | color: {
|
6442 | objectName: "labels",
|
6443 | propertyName: "color"
|
6444 | },
|
6445 | labelDisplayUnits: {
|
6446 | objectName: "labels",
|
6447 | propertyName: "labelDisplayUnits"
|
6448 | },
|
6449 | labelPrecision: {
|
6450 | objectName: "labels",
|
6451 | propertyName: "labelPrecision"
|
6452 | }
|
6453 | },
|
6454 | categoryLabels: {
|
6455 | show: {
|
6456 | objectName: "categoryLabels",
|
6457 | propertyName: "show"
|
6458 | }
|
6459 | }
|
6460 | };
|
6461 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6462 | }(powerbi || (powerbi = {}));
|
6463 |
|
6464 | var powerbi;
|
6465 |
|
6466 | !function(powerbi) {
|
6467 | var visuals;
|
6468 | !function(visuals) {
|
6469 | visuals.cardCapabilities = {
|
6470 | dataRoles: [ {
|
6471 | name: "Values",
|
6472 | kind: powerbi.VisualDataRoleKind.Measure,
|
6473 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Fields"),
|
6474 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_FieldsDescription")
|
6475 | } ],
|
6476 | objects: {
|
6477 | general: {
|
6478 | properties: {
|
6479 | formatString: visuals.StandardObjectProperties.formatString
|
6480 | }
|
6481 | },
|
6482 | labels: {
|
6483 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointLabel"),
|
6484 | properties: {
|
6485 | color: visuals.StandardObjectProperties.dataColor,
|
6486 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
6487 | labelPrecision: visuals.StandardObjectProperties.labelPrecision,
|
6488 | fontSize: visuals.StandardObjectProperties.fontSize
|
6489 | }
|
6490 | },
|
6491 | categoryLabels: {
|
6492 | displayName: powerbi.data.createDisplayNameGetter("Visual_CategoryLabel"),
|
6493 | properties: {
|
6494 | show: visuals.StandardObjectProperties.show,
|
6495 | color: visuals.StandardObjectProperties.dataColor,
|
6496 | fontSize: visuals.StandardObjectProperties.fontSize
|
6497 | }
|
6498 | },
|
6499 | wordWrap: {
|
6500 | displayName: powerbi.data.createDisplayNameGetter("Visual_WordWrap"),
|
6501 | properties: {
|
6502 | show: visuals.StandardObjectProperties.show
|
6503 | }
|
6504 | }
|
6505 | },
|
6506 | dataViewMappings: [ {
|
6507 | conditions: [ {
|
6508 | Values: {
|
6509 | max: 1
|
6510 | }
|
6511 | } ],
|
6512 | single: {
|
6513 | role: "Values"
|
6514 | }
|
6515 | } ],
|
6516 | suppressDefaultTitle: !0,
|
6517 | supportsSelection: !1
|
6518 | }, visuals.cardProps = {
|
6519 | categoryLabels: {
|
6520 | show: {
|
6521 | objectName: "categoryLabels",
|
6522 | propertyName: "show"
|
6523 | },
|
6524 | color: {
|
6525 | objectName: "categoryLabels",
|
6526 | propertyName: "color"
|
6527 | },
|
6528 | fontSize: {
|
6529 | objectName: "categoryLabels",
|
6530 | propertyName: "fontSize"
|
6531 | }
|
6532 | },
|
6533 | labels: {
|
6534 | color: {
|
6535 | objectName: "labels",
|
6536 | propertyName: "color"
|
6537 | },
|
6538 | labelPrecision: {
|
6539 | objectName: "labels",
|
6540 | propertyName: "labelPrecision"
|
6541 | },
|
6542 | labelDisplayUnits: {
|
6543 | objectName: "labels",
|
6544 | propertyName: "labelDisplayUnits"
|
6545 | },
|
6546 | fontSize: {
|
6547 | objectName: "labels",
|
6548 | propertyName: "fontSize"
|
6549 | }
|
6550 | },
|
6551 | wordWrap: {
|
6552 | show: {
|
6553 | objectName: "wordWrap",
|
6554 | propertyName: "show"
|
6555 | }
|
6556 | }
|
6557 | };
|
6558 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6559 | }(powerbi || (powerbi = {}));
|
6560 |
|
6561 | var powerbi;
|
6562 |
|
6563 | !function(powerbi) {
|
6564 | var visuals;
|
6565 | !function(visuals) {
|
6566 | visuals.waterfallChartCapabilities = {
|
6567 | dataRoles: [ {
|
6568 | name: "Category",
|
6569 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6570 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Category"),
|
6571 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_CategoryWaterfallDescription")
|
6572 | }, {
|
6573 | name: "Y",
|
6574 | kind: powerbi.VisualDataRoleKind.Measure,
|
6575 | requiredTypes: [ {
|
6576 | numeric: !0
|
6577 | }, {
|
6578 | integer: !0
|
6579 | } ],
|
6580 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_Y")
|
6581 | } ],
|
6582 | objects: {
|
6583 | general: {
|
6584 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
6585 | properties: {
|
6586 | formatString: visuals.StandardObjectProperties.formatString
|
6587 | }
|
6588 | },
|
6589 | legend: {
|
6590 | displayName: powerbi.data.createDisplayNameGetter("Visual_Legend"),
|
6591 | description: powerbi.data.createDisplayNameGetter("Visual_LegendDescription"),
|
6592 | properties: {
|
6593 | show: visuals.StandardObjectProperties.show,
|
6594 | position: visuals.StandardObjectProperties.legendPosition,
|
6595 | showTitle: visuals.StandardObjectProperties.showLegendTitle,
|
6596 | titleText: $.extend({}, visuals.StandardObjectProperties.legendTitle, {
|
6597 | suppressFormatPainterCopy: !0
|
6598 | }),
|
6599 | labelColor: visuals.StandardObjectProperties.labelColor,
|
6600 | fontSize: visuals.StandardObjectProperties.fontSize
|
6601 | }
|
6602 | },
|
6603 | labels: {
|
6604 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabels"),
|
6605 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointsLabelsDescription"),
|
6606 | properties: {
|
6607 | show: visuals.StandardObjectProperties.show,
|
6608 | color: visuals.StandardObjectProperties.dataColor,
|
6609 | labelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits,
|
6610 | labelPrecision: $.extend({}, visuals.StandardObjectProperties.labelPrecision, {
|
6611 | suppressFormatPainterCopy: !0
|
6612 | }),
|
6613 | fontSize: visuals.StandardObjectProperties.fontSize
|
6614 | }
|
6615 | },
|
6616 | sentimentColors: {
|
6617 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_SentimentColors"),
|
6618 | properties: {
|
6619 | increaseFill: {
|
6620 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_IncreaseLabel"),
|
6621 | type: {
|
6622 | fill: {
|
6623 | solid: {
|
6624 | color: !0
|
6625 | }
|
6626 | }
|
6627 | }
|
6628 | },
|
6629 | decreaseFill: {
|
6630 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_DecreaseLabel"),
|
6631 | type: {
|
6632 | fill: {
|
6633 | solid: {
|
6634 | color: !0
|
6635 | }
|
6636 | }
|
6637 | }
|
6638 | },
|
6639 | totalFill: {
|
6640 | displayName: powerbi.data.createDisplayNameGetter("Waterfall_TotalLabel"),
|
6641 | type: {
|
6642 | fill: {
|
6643 | solid: {
|
6644 | color: !0
|
6645 | }
|
6646 | }
|
6647 | }
|
6648 | }
|
6649 | }
|
6650 | },
|
6651 | categoryAxis: {
|
6652 | displayName: powerbi.data.createDisplayNameGetter("Visual_XAxis"),
|
6653 | properties: {
|
6654 | show: visuals.StandardObjectProperties.show,
|
6655 | showAxisTitle: {
|
6656 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
6657 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_XTitleDescription"),
|
6658 | type: {
|
6659 | bool: !0
|
6660 | }
|
6661 | },
|
6662 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
6663 | labelColor: visuals.StandardObjectProperties.labelColor
|
6664 | }
|
6665 | },
|
6666 | valueAxis: {
|
6667 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis"),
|
6668 | properties: {
|
6669 | show: visuals.StandardObjectProperties.show,
|
6670 | position: visuals.StandardObjectProperties.yAxisPosition,
|
6671 | start: visuals.StandardObjectProperties.axisStart,
|
6672 | end: visuals.StandardObjectProperties.axisEnd,
|
6673 | showAxisTitle: {
|
6674 | displayName: powerbi.data.createDisplayNameGetter("Visual_Axis_Title"),
|
6675 | description: powerbi.data.createDisplayNameGetter("Visual_Axis_YTitleDescription"),
|
6676 | type: {
|
6677 | bool: !0
|
6678 | }
|
6679 | },
|
6680 | axisStyle: visuals.StandardObjectProperties.axisStyle,
|
6681 | labelColor: visuals.StandardObjectProperties.labelColor,
|
6682 | labelDisplayUnits: visuals.StandardObjectProperties.labelDisplayUnits,
|
6683 | labelPrecision: visuals.StandardObjectProperties.labelPrecision
|
6684 | }
|
6685 | },
|
6686 | y1AxisReferenceLine: {
|
6687 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line"),
|
6688 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Description"),
|
6689 | properties: {
|
6690 | show: visuals.StandardObjectProperties.show,
|
6691 | value: {
|
6692 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value"),
|
6693 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Value_Description"),
|
6694 | type: {
|
6695 | numeric: !0
|
6696 | }
|
6697 | },
|
6698 | lineColor: visuals.StandardObjectProperties.lineColor,
|
6699 | transparency: {
|
6700 | displayName: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency"),
|
6701 | description: powerbi.data.createDisplayNameGetter("Visual_Reference_Line_Transparency_Description"),
|
6702 | type: {
|
6703 | numeric: !0
|
6704 | }
|
6705 | },
|
6706 | style: visuals.StandardObjectProperties.referenceLineStyle,
|
6707 | position: visuals.StandardObjectProperties.referenceLinePosition,
|
6708 | dataLabelShow: visuals.StandardObjectProperties.dataLabelShow,
|
6709 | dataLabelColor: visuals.StandardObjectProperties.dataLabelColor,
|
6710 | dataLabelDecimalPoints: visuals.StandardObjectProperties.dataLabelDecimalPoints,
|
6711 | dataLabelHorizontalPosition: visuals.StandardObjectProperties.dataLabelHorizontalPosition,
|
6712 | dataLabelVerticalPosition: visuals.StandardObjectProperties.dataLabelVerticalPosition,
|
6713 | dataLabelDisplayUnits: visuals.StandardObjectProperties.dataLabelDisplayUnits
|
6714 | }
|
6715 | },
|
6716 | plotArea: {
|
6717 | displayName: powerbi.data.createDisplayNameGetter("Visual_Plot"),
|
6718 | properties: {
|
6719 | transparency: visuals.StandardObjectProperties.transparency,
|
6720 | image: visuals.StandardObjectProperties.image
|
6721 | }
|
6722 | }
|
6723 | },
|
6724 | dataViewMappings: [ {
|
6725 | conditions: [ {
|
6726 | Category: {
|
6727 | max: 1
|
6728 | },
|
6729 | Y: {
|
6730 | max: 1
|
6731 | }
|
6732 | } ],
|
6733 | categorical: {
|
6734 | categories: {
|
6735 | "for": {
|
6736 | "in": "Category"
|
6737 | },
|
6738 | dataReductionAlgorithm: {
|
6739 | top: {}
|
6740 | }
|
6741 | },
|
6742 | values: {
|
6743 | select: [ {
|
6744 | bind: {
|
6745 | to: "Y"
|
6746 | }
|
6747 | } ]
|
6748 | }
|
6749 | }
|
6750 | } ],
|
6751 | drilldown: {
|
6752 | roles: [ "Category" ]
|
6753 | }
|
6754 | }, visuals.waterfallChartProps = {
|
6755 | general: {
|
6756 | formatString: {
|
6757 | objectName: "general",
|
6758 | propertyName: "formatString"
|
6759 | }
|
6760 | },
|
6761 | sentimentColors: {
|
6762 | increaseFill: {
|
6763 | objectName: "sentimentColors",
|
6764 | propertyName: "increaseFill"
|
6765 | },
|
6766 | decreaseFill: {
|
6767 | objectName: "sentimentColors",
|
6768 | propertyName: "decreaseFill"
|
6769 | },
|
6770 | totalFill: {
|
6771 | objectName: "sentimentColors",
|
6772 | propertyName: "totalFill"
|
6773 | }
|
6774 | },
|
6775 | legend: {
|
6776 | labelColor: {
|
6777 | objectName: "legend",
|
6778 | propertyName: "labelColor"
|
6779 | }
|
6780 | }
|
6781 | };
|
6782 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6783 | }(powerbi || (powerbi = {}));
|
6784 |
|
6785 | var powerbi;
|
6786 |
|
6787 | !function(powerbi) {
|
6788 | var visuals;
|
6789 | !function(visuals) {
|
6790 | visuals.KPIStatusWithHistoryCapabilities = {
|
6791 | dataRoles: [ {
|
6792 | name: "Indicator",
|
6793 | kind: powerbi.VisualDataRoleKind.Measure,
|
6794 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Indicator"),
|
6795 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_IndicatorDescription")
|
6796 | }, {
|
6797 | name: "TrendLine",
|
6798 | kind: powerbi.VisualDataRoleKind.Grouping,
|
6799 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_TrendLine"),
|
6800 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Trendline_Description")
|
6801 | }, {
|
6802 | name: "Goal",
|
6803 | kind: powerbi.VisualDataRoleKind.Measure,
|
6804 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Goal"),
|
6805 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_GoalDescription")
|
6806 | } ],
|
6807 | dataViewMappings: [ {
|
6808 | conditions: [ {
|
6809 | Indicator: {
|
6810 | max: 1
|
6811 | },
|
6812 | TrendLine: {
|
6813 | max: 1
|
6814 | },
|
6815 | Goal: {
|
6816 | max: 2
|
6817 | }
|
6818 | } ],
|
6819 | categorical: {
|
6820 | categories: {
|
6821 | "for": {
|
6822 | "in": "TrendLine"
|
6823 | },
|
6824 | dataReductionAlgorithm: {
|
6825 | top: {}
|
6826 | }
|
6827 | },
|
6828 | values: {
|
6829 | select: [ {
|
6830 | bind: {
|
6831 | to: "Indicator"
|
6832 | }
|
6833 | }, {
|
6834 | bind: {
|
6835 | to: "Goal"
|
6836 | }
|
6837 | } ]
|
6838 | }
|
6839 | }
|
6840 | } ],
|
6841 | objects: {
|
6842 | general: {
|
6843 | properties: {
|
6844 | formatString: visuals.StandardObjectProperties.formatString
|
6845 | }
|
6846 | },
|
6847 | indicator: {
|
6848 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Indicator"),
|
6849 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_IndicatorDescription"),
|
6850 | properties: {
|
6851 | indicatorDisplayUnits: {
|
6852 | displayName: powerbi.data.createDisplayNameGetter("Visual_DisplayUnits"),
|
6853 | description: powerbi.data.createDisplayNameGetter("Visual_DisplayUnitsDescription"),
|
6854 | type: {
|
6855 | formatting: {
|
6856 | labelDisplayUnits: !0
|
6857 | }
|
6858 | }
|
6859 | },
|
6860 | indicatorPrecision: {
|
6861 | displayName: powerbi.data.createDisplayNameGetter("Visual_Precision"),
|
6862 | description: powerbi.data.createDisplayNameGetter("Visual_PrecisionDescription"),
|
6863 | placeHolderText: powerbi.data.createDisplayNameGetter("Visual_Precision_Auto"),
|
6864 | type: {
|
6865 | numeric: !0
|
6866 | }
|
6867 | },
|
6868 | kpiFormat: {
|
6869 | displayName: powerbi.data.createDisplayNameGetter("TaskPane_Format"),
|
6870 | type: {
|
6871 | text: !0
|
6872 | }
|
6873 | }
|
6874 | }
|
6875 | },
|
6876 | trendline: {
|
6877 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_TrendLine"),
|
6878 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Trendline_Description"),
|
6879 | properties: {
|
6880 | show: visuals.StandardObjectProperties.show
|
6881 | }
|
6882 | },
|
6883 | goals: {
|
6884 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Goals"),
|
6885 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Goals"),
|
6886 | properties: {
|
6887 | showGoal: {
|
6888 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Show_Goal"),
|
6889 | type: {
|
6890 | bool: !0
|
6891 | }
|
6892 | },
|
6893 | showDistance: {
|
6894 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Show_Distance"),
|
6895 | type: {
|
6896 | bool: !0
|
6897 | }
|
6898 | }
|
6899 | }
|
6900 | },
|
6901 | status: {
|
6902 | displayName: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Status"),
|
6903 | description: powerbi.data.createDisplayNameGetter("Role_DisplayName_KPI_Status"),
|
6904 | properties: {
|
6905 | direction: {
|
6906 | displayName: powerbi.data.createDisplayNameGetter("Visual_KPI_Direction"),
|
6907 | type: {
|
6908 | enumeration: visuals.kpiDirection.type
|
6909 | }
|
6910 | }
|
6911 | }
|
6912 | }
|
6913 | }
|
6914 | };
|
6915 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6916 | }(powerbi || (powerbi = {}));
|
6917 |
|
6918 | var powerbi;
|
6919 |
|
6920 | !function(powerbi) {
|
6921 | var visuals;
|
6922 | !function(visuals) {
|
6923 | var capabilities;
|
6924 | !function(capabilities) {
|
6925 | capabilities.animatedNumber = powerbi.visuals.animatedNumberCapabilities, capabilities.areaChart = powerbi.visuals.lineChartCapabilities,
|
6926 | capabilities.barChart = powerbi.visuals.getColumnChartCapabilities(!0), capabilities.card = powerbi.visuals.cardCapabilities,
|
6927 | capabilities.multiRowCard = powerbi.visuals.multiRowCardCapabilities, capabilities.clusteredBarChart = powerbi.visuals.getColumnChartCapabilities(!0),
|
6928 | capabilities.clusteredColumnChart = powerbi.visuals.getColumnChartCapabilities(),
|
6929 | capabilities.columnChart = powerbi.visuals.getColumnChartCapabilities(), capabilities.comboChart = powerbi.visuals.comboChartCapabilities,
|
6930 | capabilities.dataDotChart = powerbi.visuals.dataDotChartCapabilities, capabilities.dataDotClusteredColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
6931 | capabilities.dataDotStackedColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
6932 | capabilities.donutChart = powerbi.visuals.donutChartCapabilities, capabilities.funnel = powerbi.visuals.funnelChartCapabilities,
|
6933 | capabilities.gauge = powerbi.visuals.gaugeCapabilities, capabilities.hundredPercentStackedBarChart = powerbi.visuals.getColumnChartCapabilities(!0),
|
6934 | capabilities.hundredPercentStackedColumnChart = powerbi.visuals.getColumnChartCapabilities(),
|
6935 | capabilities.image = powerbi.visuals.imageVisualCapabilities, capabilities.lineChart = powerbi.visuals.lineChartCapabilities,
|
6936 | capabilities.lineStackedColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
6937 | capabilities.lineClusteredColumnComboChart = powerbi.visuals.comboChartCapabilities,
|
6938 | capabilities.map = powerbi.visuals.mapCapabilities, capabilities.filledMap = powerbi.visuals.filledMapCapabilities,
|
6939 | capabilities.treemap = powerbi.visuals.treemapCapabilities, capabilities.pieChart = powerbi.visuals.donutChartCapabilities,
|
6940 | capabilities.scatterChart = powerbi.visuals.scatterChartCapabilities, capabilities.table = powerbi.visuals.tableCapabilities,
|
6941 | capabilities.matrix = powerbi.visuals.matrixCapabilities, capabilities.slicer = powerbi.visuals.slicerCapabilities,
|
6942 | capabilities.textbox = powerbi.visuals.textboxCapabilities, capabilities.waterfallChart = powerbi.visuals.waterfallChartCapabilities,
|
6943 | capabilities.cheerMeter = powerbi.visuals.cheerMeterCapabilities, capabilities.scriptVisual = powerbi.visuals.scriptVisualCapabilities,
|
6944 | capabilities.kpi = powerbi.visuals.KPIStatusWithHistoryCapabilities;
|
6945 | }(capabilities = visuals.capabilities || (visuals.capabilities = {}));
|
6946 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6947 | }(powerbi || (powerbi = {}));
|
6948 |
|
6949 | var powerbi;
|
6950 |
|
6951 | !function(powerbi) {
|
6952 | var visuals;
|
6953 | !function(visuals) {
|
6954 | var ColumnChartWebBehavior = function() {
|
6955 | function ColumnChartWebBehavior() {}
|
6956 | return ColumnChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
6957 | this.options = options;
|
6958 | var eventGroup = options.eventGroup;
|
6959 | eventGroup.on("click", function() {
|
6960 | var d = ColumnChartWebBehavior.getDatumForLastInputEvent();
|
6961 | selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
6962 | }), eventGroup.on("contextmenu", function() {
|
6963 | if (!d3.event.ctrlKey) {
|
6964 | d3.event.preventDefault();
|
6965 | var d = ColumnChartWebBehavior.getDatumForLastInputEvent(), position = visuals.InteractivityUtils.getPositionOfLastInputEvent();
|
6966 | selectionHandler.handleContextMenu(d, position);
|
6967 | }
|
6968 | });
|
6969 | }, ColumnChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
6970 | var options = this.options;
|
6971 | options.bars.style("fill-opacity", function(d) {
|
6972 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && options.hasHighlights);
|
6973 | });
|
6974 | }, ColumnChartWebBehavior.getDatumForLastInputEvent = function() {
|
6975 | var target = d3.event.target;
|
6976 | return d3.select(target).datum();
|
6977 | }, ColumnChartWebBehavior;
|
6978 | }();
|
6979 | visuals.ColumnChartWebBehavior = ColumnChartWebBehavior;
|
6980 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
6981 | }(powerbi || (powerbi = {}));
|
6982 |
|
6983 | var powerbi;
|
6984 |
|
6985 | !function(powerbi) {
|
6986 | var visuals;
|
6987 | !function(visuals) {
|
6988 | var DataDotChartWebBehavior = function() {
|
6989 | function DataDotChartWebBehavior() {}
|
6990 | return DataDotChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
6991 | var dots = this.dots = options.dots, dotLabels = options.dotLabels;
|
6992 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(dots, selectionHandler),
|
6993 | dotLabels && visuals.InteractivityUtils.registerStandardInteractivityHandlers(dotLabels, selectionHandler);
|
6994 | }, DataDotChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
6995 | this.dots.style("fill-opacity", function(d) {
|
6996 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
6997 | });
|
6998 | }, DataDotChartWebBehavior;
|
6999 | }();
|
7000 | visuals.DataDotChartWebBehavior = DataDotChartWebBehavior;
|
7001 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7002 | }(powerbi || (powerbi = {}));
|
7003 |
|
7004 | var powerbi;
|
7005 |
|
7006 | !function(powerbi) {
|
7007 | var visuals;
|
7008 | !function(visuals) {
|
7009 | var DonutChartWebBehavior = function() {
|
7010 | function DonutChartWebBehavior() {}
|
7011 | return DonutChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7012 | var slices = this.slices = options.slices, highlightSlices = this.highlightSlices = options.highlightSlices, clearCatcher = options.clearCatcher;
|
7013 | this.hasHighlights = options.hasHighlights;
|
7014 | var clickHandler = function(d) {
|
7015 | selectionHandler.handleSelection(d.data, d3.event.ctrlKey);
|
7016 | }, contextMenuHandler = function(d) {
|
7017 | if (!d3.event.ctrlKey) {
|
7018 | var position = visuals.InteractivityUtils.getPositionOfLastInputEvent();
|
7019 | selectionHandler.handleContextMenu(d.data, position), d3.event.preventDefault();
|
7020 | }
|
7021 | };
|
7022 | slices.on("click", clickHandler), slices.on("contextmenu", contextMenuHandler),
|
7023 | highlightSlices.on("click", clickHandler), highlightSlices.on("contextmenu", contextMenuHandler),
|
7024 | clearCatcher.on("click", function() {
|
7025 | selectionHandler.handleClearSelection();
|
7026 | });
|
7027 | }, DonutChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7028 | var hasHighlights = this.hasHighlights;
|
7029 | this.slices.style("fill-opacity", function(d) {
|
7030 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, hasHighlights && !d.data.selected);
|
7031 | }), this.highlightSlices.style("fill-opacity", function(d) {
|
7032 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, hasHighlights);
|
7033 | });
|
7034 | }, DonutChartWebBehavior;
|
7035 | }();
|
7036 | visuals.DonutChartWebBehavior = DonutChartWebBehavior;
|
7037 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7038 | }(powerbi || (powerbi = {}));
|
7039 |
|
7040 | var powerbi;
|
7041 |
|
7042 | !function(powerbi) {
|
7043 | var visuals;
|
7044 | !function(visuals) {
|
7045 | var FunnelWebBehavior = function() {
|
7046 | function FunnelWebBehavior() {}
|
7047 | return FunnelWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7048 | var bars = this.bars = options.bars, interactors = this.interactors = options.interactors, clearCatcher = options.clearCatcher;
|
7049 | this.hasHighlights = options.hasHighlights, visuals.InteractivityUtils.registerStandardInteractivityHandlers(bars, selectionHandler),
|
7050 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(interactors, selectionHandler),
|
7051 | clearCatcher.on("click", function() {
|
7052 | selectionHandler.handleClearSelection();
|
7053 | });
|
7054 | }, FunnelWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7055 | var hasHighlights = this.hasHighlights;
|
7056 | this.bars.style("fill-opacity", function(d) {
|
7057 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && hasHighlights);
|
7058 | });
|
7059 | }, FunnelWebBehavior;
|
7060 | }();
|
7061 | visuals.FunnelWebBehavior = FunnelWebBehavior;
|
7062 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7063 | }(powerbi || (powerbi = {}));
|
7064 |
|
7065 | var powerbi;
|
7066 |
|
7067 | !function(powerbi) {
|
7068 | var visuals;
|
7069 | !function(visuals) {
|
7070 | var LineChartWebBehavior = function() {
|
7071 | function LineChartWebBehavior() {}
|
7072 | return LineChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7073 | this.lines = options.lines;
|
7074 | var interactivityLines = options.interactivityLines, dots = this.dots = options.dots, areas = this.areas = options.areas, tooltipOverlay = this.tooltipOverlay = options.tooltipOverlay;
|
7075 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(interactivityLines, selectionHandler),
|
7076 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(dots, selectionHandler),
|
7077 | areas && visuals.InteractivityUtils.registerStandardInteractivityHandlers(areas, selectionHandler),
|
7078 | tooltipOverlay && tooltipOverlay.on("click", function() {
|
7079 | return selectionHandler.handleClearSelection();
|
7080 | });
|
7081 | }, LineChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7082 | this.lines.style("stroke-opacity", function(d) {
|
7083 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7084 | }), this.dots.style("fill-opacity", function(d) {
|
7085 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7086 | }), this.areas && this.areas.style("fill-opacity", function(d) {
|
7087 | return hasSelection && !d.selected ? visuals.LineChart.DimmedAreaFillOpacity : visuals.LineChart.AreaFillOpacity;
|
7088 | });
|
7089 | }, LineChartWebBehavior;
|
7090 | }();
|
7091 | visuals.LineChartWebBehavior = LineChartWebBehavior;
|
7092 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7093 | }(powerbi || (powerbi = {}));
|
7094 |
|
7095 | var powerbi;
|
7096 |
|
7097 | !function(powerbi) {
|
7098 | var visuals;
|
7099 | !function(visuals) {
|
7100 | var MapBehavior = function() {
|
7101 | function MapBehavior() {
|
7102 | this.mapPointerEventsDisabled = !1, this.mapPointerTimeoutSet = !1, this.viewChangedSinceLastClearMouseDown = !1,
|
7103 | this.receivedZoomOrPanEvent = !1;
|
7104 | }
|
7105 | return MapBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7106 | var _this = this, bubbles = this.bubbles = options.bubbles, slices = this.slices = options.slices, shapes = this.shapes = options.shapes, clearCatcher = options.clearCatcher, clickHandler = function() {
|
7107 | var target = d3.event.target, d = d3.select(target).datum();
|
7108 | bubbles && bubbles.style("pointer-events", "all"), shapes && shapes.style("pointer-events", "all"),
|
7109 | selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
7110 | };
|
7111 | this.mapPointerEventsDisabled || (bubbles && bubbles.style("pointer-events", "all"),
|
7112 | slices && slices.style("pointer-events", "all"), shapes && shapes.style("pointer-events", "all")),
|
7113 | bubbles && (options.bubbleEventGroup.on("click", clickHandler), options.bubbleEventGroup.on("mousewheel", function() {
|
7114 | _this.mapPointerEventsDisabled || bubbles.style("pointer-events", "none"), _this.mapPointerEventsDisabled = !0,
|
7115 | _this.mapPointerTimeoutSet || (_this.mapPointerTimeoutSet = !0, setTimeout(function() {
|
7116 | bubbles && bubbles.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1,
|
7117 | _this.mapPointerTimeoutSet = !1;
|
7118 | }, 200));
|
7119 | }), visuals.InteractivityUtils.registerGroupContextMenuHandler(options.bubbleEventGroup, selectionHandler)),
|
7120 | slices && (options.sliceEventGroup.on("click", function() {
|
7121 | slices.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1;
|
7122 | var target = d3.event.target, d = d3.select(target).datum();
|
7123 | selectionHandler.handleSelection(d.data, d3.event.ctrlKey);
|
7124 | }), options.sliceEventGroup.on("mousewheel", function() {
|
7125 | _this.mapPointerEventsDisabled || slices.style("pointer-events", "none"), _this.mapPointerEventsDisabled = !0,
|
7126 | _this.mapPointerTimeoutSet || (_this.mapPointerTimeoutSet = !0, setTimeout(function() {
|
7127 | slices && slices.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1,
|
7128 | _this.mapPointerTimeoutSet = !1;
|
7129 | }, 200));
|
7130 | }), options.sliceEventGroup.on("contextmenu", function() {
|
7131 | if (!d3.event.ctrlKey) {
|
7132 | d3.event.preventDefault();
|
7133 | var position = visuals.InteractivityUtils.getPositionOfLastInputEvent(), target = d3.event.target, d = d3.select(target).datum();
|
7134 | selectionHandler.handleContextMenu(d.data, position);
|
7135 | }
|
7136 | })), shapes && (options.shapeEventGroup.on("click", clickHandler), options.shapeEventGroup.on("mousewheel", function() {
|
7137 | _this.mapPointerEventsDisabled || shapes.style("pointer-events", "none"), _this.mapPointerEventsDisabled = !0,
|
7138 | _this.mapPointerTimeoutSet || (_this.mapPointerTimeoutSet = !0, setTimeout(function() {
|
7139 | shapes && shapes.style("pointer-events", "all"), _this.mapPointerEventsDisabled = !1,
|
7140 | _this.mapPointerTimeoutSet = !1;
|
7141 | }, 200));
|
7142 | }), visuals.InteractivityUtils.registerGroupContextMenuHandler(options.shapeEventGroup, selectionHandler)),
|
7143 | clearCatcher.on("mouseup", function() {
|
7144 | _this.viewChangedSinceLastClearMouseDown || (selectionHandler.handleClearSelection(),
|
7145 | _this.receivedZoomOrPanEvent = !0);
|
7146 | }), clearCatcher.on("mousedown", function() {
|
7147 | _this.viewChangedSinceLastClearMouseDown = !1;
|
7148 | }), clearCatcher.on("mousewheel", function() {
|
7149 | _this.receivedZoomOrPanEvent = !0;
|
7150 | });
|
7151 | }, MapBehavior.prototype.renderSelection = function(hasSelection) {
|
7152 | this.bubbles && this.bubbles.style({
|
7153 | "fill-opacity": function(d) {
|
7154 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7155 | },
|
7156 | "stroke-opacity": function(d) {
|
7157 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7158 | }
|
7159 | }), this.slices && this.slices.style({
|
7160 | "fill-opacity": function(d) {
|
7161 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
7162 | },
|
7163 | "stroke-opacity": function(d) {
|
7164 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
7165 | }
|
7166 | }), this.shapes && this.shapes.style({
|
7167 | "fill-opacity": function(d) {
|
7168 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7169 | },
|
7170 | "stroke-opacity": function(d) {
|
7171 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
7172 | }
|
7173 | });
|
7174 | }, MapBehavior.prototype.viewChanged = function() {
|
7175 | this.viewChangedSinceLastClearMouseDown = !0;
|
7176 | }, MapBehavior.prototype.resetZoomPan = function() {
|
7177 | this.receivedZoomOrPanEvent = !1;
|
7178 | }, MapBehavior.prototype.hasReceivedZoomOrPanEvent = function() {
|
7179 | return this.receivedZoomOrPanEvent;
|
7180 | }, MapBehavior;
|
7181 | }();
|
7182 | visuals.MapBehavior = MapBehavior;
|
7183 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7184 | }(powerbi || (powerbi = {}));
|
7185 |
|
7186 | var powerbi;
|
7187 |
|
7188 | !function(powerbi) {
|
7189 | var visuals;
|
7190 | !function(visuals) {
|
7191 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, ScatterChartWebBehavior = function() {
|
7192 | function ScatterChartWebBehavior() {}
|
7193 | return ScatterChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7194 | var bubbles = this.bubbles = options.dataPointsSelection, data = options.data, eventGroup = options.eventGroup;
|
7195 | !this.playOptions || !this.playOptions.traceLineRenderer || options.playOptions && options.playOptions.traceLineRenderer || this.playOptions.traceLineRenderer.remove(),
|
7196 | this.playOptions = options.playOptions, this.shouldEnableFill = (!data.sizeRange || !data.sizeRange.min) && data.fillPoint,
|
7197 | this.colorBorder = data.colorBorder, eventGroup ? visuals.InteractivityUtils.registerGroupInteractivityHandlers(eventGroup, selectionHandler) : visuals.InteractivityUtils.registerStandardInteractivityHandlers(bubbles, selectionHandler);
|
7198 | }, ScatterChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7199 | var shouldEnableFill = this.shouldEnableFill, colorBorder = this.colorBorder;
|
7200 | if (this.bubbles.style("fill-opacity", function(d) {
|
7201 | return visuals.ScatterChart.getMarkerFillOpacity(null != d.size, shouldEnableFill, hasSelection, d.selected);
|
7202 | }), this.bubbles.style("stroke-opacity", function(d) {
|
7203 | return visuals.ScatterChart.getMarkerStrokeOpacity(null != d.size, colorBorder, hasSelection, d.selected);
|
7204 | }), this.playOptions && this.bubbles) {
|
7205 | var selectedPoints = this.bubbles.filter(function(d) {
|
7206 | return d.selected;
|
7207 | }).data(), traceLineRenderer = this.playOptions.traceLineRenderer;
|
7208 | selectedPoints && selectedPoints.length > 0 && null != traceLineRenderer ? traceLineRenderer.render(selectedPoints, !0) : traceLineRenderer.remove();
|
7209 | }
|
7210 | }, ScatterChartWebBehavior;
|
7211 | }();
|
7212 | visuals.ScatterChartWebBehavior = ScatterChartWebBehavior;
|
7213 | var ScatterChartMobileBehavior = function() {
|
7214 | function ScatterChartMobileBehavior() {}
|
7215 | return ScatterChartMobileBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7216 | this.setOptions(options), options.visualInitOptions && options.visualInitOptions.interactivity.isInteractiveLegend && (this.makeDataPointsSelectable(options.dataPointsSelection),
|
7217 | this.makeRootSelectable(options.root), this.makeDragable(options.root), this.disableDefaultTouchInteractions(options.root),
|
7218 | this.selectRoot());
|
7219 | }, ScatterChartMobileBehavior.prototype.renderSelection = function(HasSelection) {},
|
7220 | ScatterChartMobileBehavior.prototype.setSelectionHandler = function(selectionHandler) {},
|
7221 | ScatterChartMobileBehavior.prototype.makeDataPointsSelectable = function() {
|
7222 | for (var _this = this, selection = [], _i = 0; _i < arguments.length; _i++) selection[_i - 0] = arguments[_i];
|
7223 | for (var i = 0, len = selection.length; len > i; i++) {
|
7224 | var sel = selection[i];
|
7225 | sel.on("click", function(d, i) {
|
7226 | _this.select(i);
|
7227 | });
|
7228 | }
|
7229 | }, ScatterChartMobileBehavior.prototype.makeRootSelectable = function(selection) {
|
7230 | var _this = this;
|
7231 | selection.on("click", function(d, i) {
|
7232 | _this.selectRoot();
|
7233 | });
|
7234 | }, ScatterChartMobileBehavior.prototype.makeDragable = function() {
|
7235 | for (var _this = this, selection = [], _i = 0; _i < arguments.length; _i++) selection[_i - 0] = arguments[_i];
|
7236 | for (var i = 0, len = selection.length; len > i; i++) {
|
7237 | var sel = selection[i], drag = d3.behavior.drag().on("drag", function(d) {
|
7238 | _this.drag(0);
|
7239 | }).on("dragend", function(d) {
|
7240 | _this.drag(1);
|
7241 | });
|
7242 | sel.call(drag);
|
7243 | }
|
7244 | }, ScatterChartMobileBehavior.prototype.disableDefaultTouchInteractions = function(selection) {
|
7245 | selection.style("touch-action", "none");
|
7246 | }, ScatterChartMobileBehavior.prototype.setOptions = function(options) {
|
7247 | this.data = options.data, this.mainGraphicsContext = options.plotContext, this.xAxisProperties = options.xAxisProperties,
|
7248 | this.yAxisProperties = options.yAxisProperties, this.host = options.host;
|
7249 | }, ScatterChartMobileBehavior.prototype.select = function(index) {
|
7250 | this.selectDotByIndex(index);
|
7251 | }, ScatterChartMobileBehavior.prototype.selectRoot = function() {
|
7252 | var marker = jsCommon.PerformanceUtil.create("selectRoot");
|
7253 | this.onClick(), marker.end();
|
7254 | }, ScatterChartMobileBehavior.prototype.drag = function(t) {
|
7255 | switch (t) {
|
7256 | case 0:
|
7257 | this.onDrag();
|
7258 | break;
|
7259 |
|
7260 | case 1:
|
7261 | this.onClick();
|
7262 | }
|
7263 | }, ScatterChartMobileBehavior.prototype.onDrag = function() {
|
7264 | var xy = this.getMouseCoordinates();
|
7265 | this.moveCrosshairToXY(xy.x, xy.y);
|
7266 | var selectedIndex = this.findClosestDotIndex(xy.x, xy.y);
|
7267 | this.selectDot(selectedIndex), this.updateLegend(selectedIndex);
|
7268 | }, ScatterChartMobileBehavior.prototype.onClick = function() {
|
7269 | var xy = this.getMouseCoordinates(), selectedIndex = this.findClosestDotIndex(xy.x, xy.y);
|
7270 | -1 !== selectedIndex && this.selectDotByIndex(selectedIndex);
|
7271 | }, ScatterChartMobileBehavior.prototype.getMouseCoordinates = function() {
|
7272 | var mainGfxContext = this.mainGraphicsContext, x = 0, y = parseInt(mainGfxContext.attr("height"), 10);
|
7273 | y = y || 0;
|
7274 | try {
|
7275 | var mouse = d3.mouse(mainGfxContext.node());
|
7276 | x = mouse[0], y = mouse[1];
|
7277 | } catch (e) {}
|
7278 | return {
|
7279 | x: x,
|
7280 | y: y
|
7281 | };
|
7282 | }, ScatterChartMobileBehavior.prototype.selectDotByIndex = function(index) {
|
7283 | this.selectDot(index), this.moveCrosshairToIndexDot(index), this.updateLegend(index);
|
7284 | }, ScatterChartMobileBehavior.prototype.selectDot = function(dotIndex) {
|
7285 | var _this = this, root = this.mainGraphicsContext;
|
7286 | root.selectAll(ScatterChartMobileBehavior.ScatterChartCircleTagName + ScatterChartMobileBehavior.DotClassSelector).classed({
|
7287 | selected: !1,
|
7288 | notSelected: !0
|
7289 | }), root.selectAll(ScatterChartMobileBehavior.ScatterChartCircleTagName + ScatterChartMobileBehavior.DotClassSelector).filter(function(d, i) {
|
7290 | var dataPoints = _this.data.dataPoints, currentPoint = dataPoints[dotIndex];
|
7291 | return d.x === currentPoint.x && d.y === currentPoint.y;
|
7292 | }).classed({
|
7293 | selected: !0,
|
7294 | notSelected: !1
|
7295 | });
|
7296 | }, ScatterChartMobileBehavior.prototype.moveCrosshairToIndexDot = function(index) {
|
7297 | var dataPoints = this.data.dataPoints, root = this.mainGraphicsContext, x = this.xAxisProperties.scale(dataPoints[index].x), y = this.yAxisProperties.scale(dataPoints[index].y);
|
7298 | if (null == this.crosshair) {
|
7299 | var width = +root.attr("width"), height = +root.attr("height");
|
7300 | this.crosshair = this.drawCrosshair(root, x, y, width, height), this.crosshairHorizontal = this.crosshair.select(ScatterChartMobileBehavior.Horizontal.selector),
|
7301 | this.crosshairVertical = this.crosshair.select(ScatterChartMobileBehavior.Vertical.selector);
|
7302 | } else this.moveCrosshairToXY(x, y);
|
7303 | }, ScatterChartMobileBehavior.prototype.moveCrosshairToXY = function(x, y) {
|
7304 | this.crosshairHorizontal.attr({
|
7305 | y1: y,
|
7306 | y2: y
|
7307 | }), this.crosshairVertical.attr({
|
7308 | x1: x,
|
7309 | x2: x
|
7310 | });
|
7311 | }, ScatterChartMobileBehavior.prototype.drawCrosshair = function(addTo, x, y, width, height) {
|
7312 | var crosshair = addTo.append("g");
|
7313 | return crosshair.classed(ScatterChartMobileBehavior.CrosshairClassName, !0), crosshair.append("line").classed(ScatterChartMobileBehavior.Horizontal["class"], !0).attr({
|
7314 | x1: 0,
|
7315 | x2: width,
|
7316 | y1: y,
|
7317 | y2: y
|
7318 | }), crosshair.append("line").classed(ScatterChartMobileBehavior.Vertical["class"], !0).attr({
|
7319 | x1: x,
|
7320 | x2: x,
|
7321 | y1: height,
|
7322 | y2: 0
|
7323 | }), crosshair;
|
7324 | }, ScatterChartMobileBehavior.prototype.findClosestDotIndex = function(x, y) {
|
7325 | var selectedIndex = -1, minDistance = Number.MAX_VALUE, dataPoints = this.data.dataPoints, xAxisPropertiesScale = this.xAxisProperties.scale, yAxisPropertiesScale = this.yAxisProperties.scale;
|
7326 | for (var i in dataPoints) {
|
7327 | var currentPoint = dataPoints[i], circleX = xAxisPropertiesScale(currentPoint.x), circleY = yAxisPropertiesScale(currentPoint.y), horizontalDistance = circleX - x, verticalDistance = circleY - y, distanceSqrd = horizontalDistance * horizontalDistance + verticalDistance * verticalDistance;
|
7328 | minDistance === Number.MAX_VALUE ? (selectedIndex = i, minDistance = distanceSqrd) : minDistance && minDistance > distanceSqrd && (selectedIndex = i,
|
7329 | minDistance = distanceSqrd);
|
7330 | }
|
7331 | return selectedIndex;
|
7332 | }, ScatterChartMobileBehavior.prototype.updateLegend = function(dotIndex) {
|
7333 | if (null == this.lastDotIndex || this.lastDotIndex !== dotIndex) {
|
7334 | var legendItems = this.createLegendDataPoints(dotIndex);
|
7335 | this.host.updateLegend(legendItems), this.lastDotIndex = dotIndex;
|
7336 | }
|
7337 | }, ScatterChartMobileBehavior.prototype.createLegendDataPoints = function(dotIndex) {
|
7338 | 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();
|
7339 | return category !== blank ? title = category : null != point.radius.sizeMeasure ? title = visuals.valueFormatter.format(point.radius.sizeMeasure.source.groupName) : legendDataPoints.length >= dotIndex && legendDataPoints[dotIndex].label !== blank && (title = legendDataPoints[dotIndex].label),
|
7340 | null != data.xCol && legendItems.push({
|
7341 | category: title,
|
7342 | color: point.fill,
|
7343 | identity: visuals.SelectionIdBuilder.builder().withMeasure(data.xCol.queryName).createSelectionId(),
|
7344 | selected: point.selected,
|
7345 | icon: visuals.LegendIcon.Box,
|
7346 | label: visuals.valueFormatter.format(this.data.axesLabels.x),
|
7347 | measure: visuals.valueFormatter.format(point.x, visuals.valueFormatter.getFormatString(data.xCol, formatStringProp)),
|
7348 | iconOnlyOnLabel: !0
|
7349 | }), null != data.yCol && legendItems.push({
|
7350 | category: title,
|
7351 | color: point.fill,
|
7352 | identity: visuals.SelectionIdBuilder.builder().withMeasure(data.yCol.queryName).createSelectionId(),
|
7353 | selected: point.selected,
|
7354 | icon: visuals.LegendIcon.Box,
|
7355 | label: visuals.valueFormatter.format(data.axesLabels.y),
|
7356 | measure: visuals.valueFormatter.format(point.y, visuals.valueFormatter.getFormatString(data.yCol, formatStringProp)),
|
7357 | iconOnlyOnLabel: !0
|
7358 | }), null != data.size && legendItems.push({
|
7359 | category: title,
|
7360 | color: point.fill,
|
7361 | identity: visuals.SelectionIdBuilder.builder().withMeasure(data.size.queryName).createSelectionId(),
|
7362 | selected: point.selected,
|
7363 | icon: visuals.LegendIcon.Box,
|
7364 | label: visuals.valueFormatter.format(data.size.displayName),
|
7365 | measure: visuals.valueFormatter.format(point.radius.sizeMeasure.values[point.radius.index], visuals.valueFormatter.getFormatString(data.size, formatStringProp)),
|
7366 | iconOnlyOnLabel: !0
|
7367 | }), {
|
7368 | dataPoints: legendItems
|
7369 | };
|
7370 | }, ScatterChartMobileBehavior.CrosshairClassName = "crosshair", ScatterChartMobileBehavior.ScatterChartCircleTagName = "circle",
|
7371 | ScatterChartMobileBehavior.DotClassName = "dot", ScatterChartMobileBehavior.DotClassSelector = "." + ScatterChartMobileBehavior.DotClassName,
|
7372 | ScatterChartMobileBehavior.Horizontal = createClassAndSelector("horizontal"), ScatterChartMobileBehavior.Vertical = createClassAndSelector("vertical"),
|
7373 | ScatterChartMobileBehavior;
|
7374 | }();
|
7375 | visuals.ScatterChartMobileBehavior = ScatterChartMobileBehavior;
|
7376 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7377 | }(powerbi || (powerbi = {}));
|
7378 |
|
7379 | var powerbi;
|
7380 |
|
7381 | !function(powerbi) {
|
7382 | var visuals;
|
7383 | !function(visuals) {
|
7384 | var HorizontalSlicerWebBehavior = function() {
|
7385 | function HorizontalSlicerWebBehavior() {}
|
7386 | return HorizontalSlicerWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7387 | this.itemLabels = options.itemLabels, this.dataPoints = options.dataPoints, this.interactivityService = options.interactivityService,
|
7388 | this.slicerSettings = options.settings, visuals.SlicerWebBehavior.bindSlicerEvents(options.slicerContainer, this.itemLabels, options.clear, selectionHandler, this.slicerSettings, this.interactivityService);
|
7389 | }, HorizontalSlicerWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7390 | visuals.SlicerWebBehavior.setSelectionOnSlicerItems(this.itemLabels, this.itemLabels, hasSelection, this.interactivityService, this.slicerSettings);
|
7391 | }, HorizontalSlicerWebBehavior;
|
7392 | }();
|
7393 | visuals.HorizontalSlicerWebBehavior = HorizontalSlicerWebBehavior;
|
7394 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7395 | }(powerbi || (powerbi = {}));
|
7396 |
|
7397 | var powerbi;
|
7398 |
|
7399 | !function(powerbi) {
|
7400 | var visuals;
|
7401 | !function(visuals) {
|
7402 | var VerticalSlicerWebBehavior = function() {
|
7403 | function VerticalSlicerWebBehavior() {}
|
7404 | return VerticalSlicerWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7405 | var slicers = options.itemContainers;
|
7406 | this.itemLabels = options.itemLabels, this.itemInputs = options.itemInputs, this.dataPoints = options.dataPoints,
|
7407 | this.interactivityService = options.interactivityService, this.settings = options.settings,
|
7408 | visuals.SlicerWebBehavior.bindSlicerEvents(options.slicerContainer, slicers, options.clear, selectionHandler, this.settings, this.interactivityService);
|
7409 | }, VerticalSlicerWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7410 | visuals.SlicerWebBehavior.setSelectionOnSlicerItems(this.itemInputs, this.itemLabels, hasSelection, this.interactivityService, this.settings);
|
7411 | }, VerticalSlicerWebBehavior;
|
7412 | }();
|
7413 | visuals.VerticalSlicerWebBehavior = VerticalSlicerWebBehavior;
|
7414 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7415 | }(powerbi || (powerbi = {}));
|
7416 |
|
7417 | var powerbi;
|
7418 |
|
7419 | !function(powerbi) {
|
7420 | var visuals;
|
7421 | !function(visuals) {
|
7422 | var SlicerWebBehavior = function() {
|
7423 | function SlicerWebBehavior() {}
|
7424 | return SlicerWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7425 | this.behavior = this.createWebBehavior(options), this.behavior.bindEvents(options.behaviorOptions, selectionHandler);
|
7426 | }, SlicerWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7427 | this.behavior.renderSelection(hasSelection);
|
7428 | }, SlicerWebBehavior.bindSlicerEvents = function(slicerContainer, slicers, slicerClear, selectionHandler, slicerSettings, interactivityService) {
|
7429 | SlicerWebBehavior.bindSlicerItemSelectionEvent(slicers, selectionHandler, slicerSettings, interactivityService),
|
7430 | SlicerWebBehavior.bindSlicerClearEvent(slicerClear, selectionHandler), SlicerWebBehavior.styleSlicerContainer(slicerContainer, interactivityService);
|
7431 | }, SlicerWebBehavior.setSelectionOnSlicerItems = function(selectableItems, itemLabel, hasSelection, interactivityService, slicerSettings) {
|
7432 | if (hasSelection || interactivityService.isSelectionModeInverted()) SlicerWebBehavior.styleSlicerItems(selectableItems, hasSelection, interactivityService.isSelectionModeInverted()); else {
|
7433 | selectableItems.filter(".selected").classed("selected", !1), selectableItems.filter(".partiallySelected").classed("partiallySelected", !1);
|
7434 | var input = selectableItems.selectAll("input");
|
7435 | input && input.property("checked", !1), itemLabel.style("color", slicerSettings.slicerText.color);
|
7436 | }
|
7437 | }, SlicerWebBehavior.styleSlicerItems = function(slicerItems, hasSelection, isSelectionInverted) {
|
7438 | slicerItems.each(function(d) {
|
7439 | var slicerItem = this, shouldCheck = !1;
|
7440 | d.isSelectAllDataPoint ? hasSelection ? (slicerItem.classList.add("partiallySelected"),
|
7441 | shouldCheck = !1) : (slicerItem.classList.remove("partiallySelected"), shouldCheck = isSelectionInverted) : shouldCheck = jsCommon.LogicExtensions.XOR(d.selected, isSelectionInverted),
|
7442 | shouldCheck ? slicerItem.classList.add("selected") : slicerItem.classList.remove("selected");
|
7443 | var input = slicerItem.getElementsByTagName("input")[0];
|
7444 | input && (input.checked = shouldCheck);
|
7445 | });
|
7446 | }, SlicerWebBehavior.bindSlicerItemSelectionEvent = function(slicers, selectionHandler, slicerSettings, interactivityService) {
|
7447 | SlicerWebBehavior.isTouch = !1, slicers.on("touchstart", function(d) {
|
7448 | SlicerWebBehavior.isTouch = !0;
|
7449 | }), slicers.on("pointerdown", function(d) {
|
7450 | var e = d3.event;
|
7451 | e && "touch" === e.pointerType && (SlicerWebBehavior.isTouch = !0);
|
7452 | }), slicers.on("click", function(d) {
|
7453 | d3.event.preventDefault(), d.isSelectAllDataPoint ? selectionHandler.toggleSelectionModeInversion() : selectionHandler.handleSelection(d, SlicerWebBehavior.isTouch || SlicerWebBehavior.isMultiSelect(d3.event, slicerSettings, interactivityService)),
|
7454 | selectionHandler.persistSelectionFilter(visuals.slicerProps.filterPropertyIdentifier),
|
7455 | SlicerWebBehavior.isTouch = !1;
|
7456 | });
|
7457 | }, SlicerWebBehavior.bindSlicerClearEvent = function(slicerClear, selectionHandler) {
|
7458 | slicerClear && slicerClear.on("click", function(d) {
|
7459 | selectionHandler.handleClearSelection(), selectionHandler.persistSelectionFilter(visuals.slicerProps.filterPropertyIdentifier);
|
7460 | });
|
7461 | }, SlicerWebBehavior.styleSlicerContainer = function(slicerContainer, interactivityService) {
|
7462 | var hasSelection = interactivityService.hasSelection() && void 0 === interactivityService.isDefaultValueEnabled() || interactivityService.isDefaultValueEnabled() === !1;
|
7463 | slicerContainer.classed("hasSelection", hasSelection);
|
7464 | }, SlicerWebBehavior.isMultiSelect = function(event, settings, interactivityService) {
|
7465 | return interactivityService.isSelectionModeInverted() || !settings.selection.singleSelect || event.ctrlKey;
|
7466 | }, SlicerWebBehavior.prototype.createWebBehavior = function(options) {
|
7467 | var behavior, orientation = options.orientation;
|
7468 | switch (orientation) {
|
7469 | case 1:
|
7470 | behavior = new visuals.HorizontalSlicerWebBehavior();
|
7471 | break;
|
7472 |
|
7473 | case 0:
|
7474 | default:
|
7475 | behavior = new visuals.VerticalSlicerWebBehavior();
|
7476 | }
|
7477 | return behavior;
|
7478 | }, SlicerWebBehavior;
|
7479 | }();
|
7480 | visuals.SlicerWebBehavior = SlicerWebBehavior;
|
7481 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7482 | }(powerbi || (powerbi = {}));
|
7483 |
|
7484 | var powerbi;
|
7485 |
|
7486 | !function(powerbi) {
|
7487 | var visuals;
|
7488 | !function(visuals) {
|
7489 | var LegendBehavior = function() {
|
7490 | function LegendBehavior() {}
|
7491 | return LegendBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7492 | var legendItems = options.legendItems;
|
7493 | this.legendIcons = options.legendIcons;
|
7494 | var clearCatcher = options.clearCatcher;
|
7495 | visuals.InteractivityUtils.registerStandardSelectionHandler(legendItems, selectionHandler),
|
7496 | clearCatcher.on("click", function() {
|
7497 | selectionHandler.handleClearSelection();
|
7498 | });
|
7499 | }, LegendBehavior.prototype.renderSelection = function(hasSelection) {
|
7500 | hasSelection ? this.legendIcons.style({
|
7501 | fill: function(d) {
|
7502 | return d.selected ? d.color : LegendBehavior.dimmedLegendColor;
|
7503 | }
|
7504 | }) : this.legendIcons.style({
|
7505 | fill: function(d) {
|
7506 | return d.color;
|
7507 | }
|
7508 | });
|
7509 | }, LegendBehavior.dimmedLegendColor = "#A6A6A6", LegendBehavior;
|
7510 | }();
|
7511 | visuals.LegendBehavior = LegendBehavior;
|
7512 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7513 | }(powerbi || (powerbi = {}));
|
7514 |
|
7515 | var powerbi;
|
7516 |
|
7517 | !function(powerbi) {
|
7518 | var visuals;
|
7519 | !function(visuals) {
|
7520 | var TreemapWebBehavior = function() {
|
7521 | function TreemapWebBehavior() {}
|
7522 | return TreemapWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7523 | var shapes = this.shapes = options.shapes, highlightShapes = this.highlightShapes = options.highlightShapes, majorLabels = options.majorLabels, minorLabels = options.minorLabels;
|
7524 | this.hasHighlights = options.hasHighlights, visuals.InteractivityUtils.registerStandardInteractivityHandlers(shapes, selectionHandler),
|
7525 | visuals.InteractivityUtils.registerStandardInteractivityHandlers(highlightShapes, selectionHandler),
|
7526 | majorLabels && visuals.InteractivityUtils.registerStandardInteractivityHandlers(majorLabels, selectionHandler),
|
7527 | minorLabels && visuals.InteractivityUtils.registerStandardInteractivityHandlers(minorLabels, selectionHandler);
|
7528 | }, TreemapWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7529 | var hasHighlights = this.hasHighlights;
|
7530 | this.shapes.style("fill", function(d) {
|
7531 | return visuals.Treemap.getFill(d, !1);
|
7532 | }).style("fill-opacity", function(d) {
|
7533 | return visuals.Treemap.getFillOpacity(d, hasSelection, !d.selected && hasHighlights, !1);
|
7534 | }), this.highlightShapes.style("fill", function(d) {
|
7535 | return visuals.Treemap.getFill(d, !0);
|
7536 | }).style("fill-opacity", function(d) {
|
7537 | return visuals.Treemap.getFillOpacity(d, hasSelection, !d.selected && hasHighlights, !0);
|
7538 | });
|
7539 | }, TreemapWebBehavior;
|
7540 | }();
|
7541 | visuals.TreemapWebBehavior = TreemapWebBehavior;
|
7542 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7543 | }(powerbi || (powerbi = {}));
|
7544 |
|
7545 | var powerbi;
|
7546 |
|
7547 | !function(powerbi) {
|
7548 | var visuals;
|
7549 | !function(visuals) {
|
7550 | var WaterfallChartWebBehavior = function() {
|
7551 | function WaterfallChartWebBehavior() {}
|
7552 | return WaterfallChartWebBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7553 | var bars = this.bars = options.bars;
|
7554 | bars.on("click", function(d) {
|
7555 | d.isTotal || selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
7556 | }), bars.on("contextmenu", function(d) {
|
7557 | if (!d3.event.ctrlKey && (d3.event.preventDefault(), !d.isTotal)) {
|
7558 | var position = visuals.InteractivityUtils.getPositionOfLastInputEvent();
|
7559 | selectionHandler.handleContextMenu(d, position);
|
7560 | }
|
7561 | });
|
7562 | }, WaterfallChartWebBehavior.prototype.renderSelection = function(hasSelection) {
|
7563 | this.bars.style("fill-opacity", function(d) {
|
7564 | return d.isTotal ? visuals.ColumnUtil.DefaultOpacity : visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, !1);
|
7565 | });
|
7566 | }, WaterfallChartWebBehavior;
|
7567 | }();
|
7568 | visuals.WaterfallChartWebBehavior = WaterfallChartWebBehavior;
|
7569 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7570 | }(powerbi || (powerbi = {}));
|
7571 |
|
7572 | var powerbi;
|
7573 |
|
7574 | !function(powerbi) {
|
7575 | var visuals;
|
7576 | !function(visuals) {
|
7577 | var LabelsBehavior = function() {
|
7578 | function LabelsBehavior() {}
|
7579 | return LabelsBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7580 | this.labelItems = options.labelItems, visuals.InteractivityUtils.registerStandardSelectionHandler(this.labelItems, selectionHandler);
|
7581 | }, LabelsBehavior.prototype.renderSelection = function(hasSelection) {
|
7582 | hasSelection ? this.labelItems.style({
|
7583 | opacity: function(d) {
|
7584 | return d.selected ? LabelsBehavior.DefaultLabelOpacity : LabelsBehavior.DimmedLabelOpacity;
|
7585 | }
|
7586 | }) : this.labelItems.style({
|
7587 | opacity: LabelsBehavior.DefaultLabelOpacity
|
7588 | });
|
7589 | }, LabelsBehavior.DefaultLabelOpacity = 1, LabelsBehavior.DimmedLabelOpacity = .6,
|
7590 | LabelsBehavior;
|
7591 | }();
|
7592 | visuals.LabelsBehavior = LabelsBehavior;
|
7593 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7594 | }(powerbi || (powerbi = {}));
|
7595 |
|
7596 | var powerbi;
|
7597 |
|
7598 | !function(powerbi) {
|
7599 | var visuals;
|
7600 | !function(visuals) {
|
7601 | var CartesianChartBehavior = function() {
|
7602 | function CartesianChartBehavior(behaviors) {
|
7603 | this.behaviors = behaviors;
|
7604 | }
|
7605 | return CartesianChartBehavior.prototype.bindEvents = function(options, selectionHandler) {
|
7606 | for (var behaviors = this.behaviors, i = 0, ilen = behaviors.length; ilen > i; i++) behaviors[i].bindEvents(options.layerOptions[i], selectionHandler);
|
7607 | options.clearCatcher.on("click", function() {
|
7608 | selectionHandler.handleClearSelection();
|
7609 | });
|
7610 | }, CartesianChartBehavior.prototype.renderSelection = function(hasSelection) {
|
7611 | for (var _i = 0, _a = this.behaviors; _i < _a.length; _i++) {
|
7612 | var behavior = _a[_i];
|
7613 | behavior.renderSelection(hasSelection);
|
7614 | }
|
7615 | }, CartesianChartBehavior;
|
7616 | }();
|
7617 | visuals.CartesianChartBehavior = CartesianChartBehavior;
|
7618 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
7619 | }(powerbi || (powerbi = {}));
|
7620 |
|
7621 | var powerbi;
|
7622 |
|
7623 | !function(powerbi) {
|
7624 | var visuals;
|
7625 | !function(visuals) {
|
7626 | visuals.emptyDomain = [ 0, 0 ];
|
7627 | var AxisHelper;
|
7628 | !function(AxisHelper) {
|
7629 | function getRecommendedNumberOfTicksForXAxis(availableWidth) {
|
7630 | return 300 > availableWidth ? 3 : 500 > availableWidth ? 5 : 8;
|
7631 | }
|
7632 | function getRecommendedNumberOfTicksForYAxis(availableWidth) {
|
7633 | return 150 > availableWidth ? 3 : 300 > availableWidth ? 5 : 8;
|
7634 | }
|
7635 | function getBestNumberOfTicks(min, max, valuesMetadata, maxTickCount, isDateTime) {
|
7636 | 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);
|
7637 | }
|
7638 | function hasNonIntegerData(valuesMetadata) {
|
7639 | for (var i = 0, len = valuesMetadata.length; len > i; i++) {
|
7640 | var currentMetadata = valuesMetadata[i];
|
7641 | if (currentMetadata && currentMetadata.type && !currentMetadata.type.integer) return !0;
|
7642 | }
|
7643 | return !1;
|
7644 | }
|
7645 | function getRecommendedTickValues(maxTicks, scale, axisType, isScalar, minTickInterval) {
|
7646 | return !isScalar || isOrdinalScale(scale) ? getRecommendedTickValuesForAnOrdinalRange(maxTicks, scale.domain()) : isDateTime(axisType) ? getRecommendedTickValuesForADateTimeRange(maxTicks, scale.domain()) : getRecommendedTickValuesForAQuantitativeRange(maxTicks, scale, minTickInterval);
|
7647 | }
|
7648 | function getRecommendedTickValuesForAnOrdinalRange(maxTicks, labels) {
|
7649 | var tickLabels = [];
|
7650 | if (0 >= maxTicks) return tickLabels;
|
7651 | var len = labels.length;
|
7652 | if (maxTicks > len) return labels;
|
7653 | for (var i = 0, step = Math.ceil(len / maxTicks); len > i; i += step) tickLabels.push(labels[i]);
|
7654 | return tickLabels;
|
7655 | }
|
7656 | function getRecommendedTickValuesForAQuantitativeRange(maxTicks, scale, minInterval) {
|
7657 | var tickLabels = [];
|
7658 | if (0 === maxTicks) return tickLabels;
|
7659 | var quantitiveScale = scale;
|
7660 | if (quantitiveScale.ticks) {
|
7661 | if (tickLabels = quantitiveScale.ticks(maxTicks), tickLabels.length > maxTicks && maxTicks > 1 && (tickLabels = quantitiveScale.ticks(maxTicks - 1)),
|
7662 | tickLabels.length < MinTickCount && (tickLabels = quantitiveScale.ticks(maxTicks + 1)),
|
7663 | tickLabels = createTrueZeroTickLabel(tickLabels), minInterval && tickLabels.length > 1) {
|
7664 | for (var tickInterval = tickLabels[1] - tickLabels[0]; tickInterval > 0 && minInterval > tickInterval; ) {
|
7665 | for (var i = 1; i < tickLabels.length; i++) tickLabels.splice(i, 1);
|
7666 | tickInterval = 2 * tickInterval;
|
7667 | }
|
7668 | 1 === tickLabels.length && tickLabels.push(tickLabels[0] + minInterval);
|
7669 | }
|
7670 | return tickLabels;
|
7671 | }
|
7672 | return tickLabels;
|
7673 | }
|
7674 | function createTrueZeroTickLabel(ticks, epsilon) {
|
7675 | if (void 0 === epsilon && (epsilon = 1e-5), !ticks || ticks.length < 2) return ticks;
|
7676 | var closeZero = epsilon * Math.abs(ticks[1] - ticks[0]);
|
7677 | return ticks.map(function(tick) {
|
7678 | return Math.abs(tick) <= closeZero ? 0 : tick;
|
7679 | });
|
7680 | }
|
7681 | function getRecommendedTickValuesForADateTimeRange(maxTicks, dataDomain) {
|
7682 | var tickLabels = [];
|
7683 | if (0 === dataDomain[0] && 0 === dataDomain[1]) return [];
|
7684 | var dateTimeTickLabels = powerbi.DateTimeSequence.calculate(new Date(dataDomain[0]), new Date(dataDomain[1]), maxTicks).sequence;
|
7685 | return tickLabels = dateTimeTickLabels.map(function(d) {
|
7686 | return d.getTime();
|
7687 | }), tickLabels = ensureValuesInRange(tickLabels, dataDomain[0], dataDomain[1]);
|
7688 | }
|
7689 | function normalizeLinearDomain(domain) {
|
7690 | return isNaN(domain.min) || isNaN(domain.max) ? (domain.min = visuals.emptyDomain[0],
|
7691 | domain.max = visuals.emptyDomain[1]) : domain.min === domain.max ? (domain.min = domain.min < 0 ? 1.2 * domain.min : .8 * domain.min,
|
7692 | 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),
|
7693 | domain;
|
7694 | }
|
7695 | function getMargin(availableWidth, availableHeight, xMargin, yMargin) {
|
7696 | return 0 === getRecommendedNumberOfTicksForXAxis(availableWidth - xMargin) || 0 === getRecommendedNumberOfTicksForYAxis(availableHeight - yMargin) ? {
|
7697 | top: 0,
|
7698 | right: xMargin,
|
7699 | bottom: yMargin,
|
7700 | left: 0
|
7701 | } : {
|
7702 | top: 20,
|
7703 | right: 30,
|
7704 | bottom: 40,
|
7705 | left: 30
|
7706 | };
|
7707 | }
|
7708 | function getTickLabelMargins(viewport, yMarginLimit, textWidthMeasurer, textHeightMeasurer, axes, bottomMarginLimit, properties, scrollbarVisible, showOnRight, renderXAxis, renderY1Axis, renderY2Axis) {
|
7709 | 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;
|
7710 | if (void 0 !== xAxisProperties.outerPadding ? xLabelOuterPadding = xAxisProperties.outerPadding : void 0 !== xAxisProperties.xLabelMaxWidth && (xLabelOuterPadding = Math.max(0, (viewport.width - xAxisProperties.xLabelMaxWidth * xLabels.length) / 2)),
|
7711 | 0 !== getRecommendedNumberOfTicksForXAxis(viewport.width) || 0 !== getRecommendedNumberOfTicksForYAxis(viewport.height)) {
|
7712 | var rotation = void 0;
|
7713 | if (rotation = scrollbarVisible ? LabelLayoutStrategy.DefaultRotationWithScrollbar : LabelLayoutStrategy.DefaultRotation,
|
7714 | renderY1Axis) for (var i = 0, len = y1Labels.length; len > i; i++) properties.text = y1Labels[i],
|
7715 | maxWidthY1 = Math.max(maxWidthY1, textWidthMeasurer(properties));
|
7716 | if (y2AxisProperties && renderY2Axis) for (var y2Labels = y2AxisProperties.values, i = 0, len = y2Labels.length; len > i; i++) properties.text = y2Labels[i],
|
7717 | maxWidthY2 = Math.max(maxWidthY2, textWidthMeasurer(properties));
|
7718 | var textHeight = textHeightMeasurer(properties), maxNumLines = Math.floor(bottomMarginLimit / textHeight), xScale = xAxisProperties.scale, xDomain = xScale.domain();
|
7719 | if (renderXAxis && xLabels.length > 0) {
|
7720 | for (var i = 0, len = xLabels.length; len > i; i++) {
|
7721 | var height = void 0;
|
7722 | properties.text = xLabels[i];
|
7723 | var width = textWidthMeasurer(properties);
|
7724 | if (xAxisProperties.willLabelsWordBreak) {
|
7725 | var wordBreaks = jsCommon.WordBreaker.splitByWidth(properties.text, properties, textWidthMeasurer, xAxisProperties.xLabelMaxWidth, maxNumLines);
|
7726 | height = wordBreaks.length * textHeight, width = xAxisProperties.xLabelMaxWidth;
|
7727 | } else !xAxisProperties.willLabelsFit && scaleIsOrdinal ? (height = width * rotation.sine,
|
7728 | width *= rotation.cosine) : height = TextHeightConstant;
|
7729 | if (0 === i) {
|
7730 | if (scaleIsOrdinal) leftOverflow = xAxisProperties.willLabelsFit ? width / 2 - ordinalLabelOffset - xLabelOuterPadding : width - ordinalLabelOffset - xLabelOuterPadding,
|
7731 | leftOverflow = Math.max(leftOverflow, 0); else if (xDomain.length > 1) {
|
7732 | var xPos = xScale(xDomain[0]);
|
7733 | leftOverflow = width / 2 - xPos, leftOverflow = Math.max(leftOverflow, 0);
|
7734 | }
|
7735 | } else if (i === len - 1) if (scaleIsOrdinal) (xAxisProperties.willLabelsFit || xAxisProperties.willLabelsWordBreak) && (rightOverflow = width / 2 - ordinalLabelOffset - xLabelOuterPadding,
|
7736 | rightOverflow = Math.max(rightOverflow, 0)); else if (xDomain.length > 1) {
|
7737 | var xPos = xScale(xDomain[1]);
|
7738 | rightOverflow = width / 2 - (viewport.width - xPos), rightOverflow = Math.max(rightOverflow, 0);
|
7739 | }
|
7740 | xMax = Math.max(xMax, height);
|
7741 | }
|
7742 | leftOverflow = Math.min(leftOverflow, XLabelMaxAllowedOverflow), rightOverflow = Math.min(rightOverflow, XLabelMaxAllowedOverflow);
|
7743 | }
|
7744 | }
|
7745 | var rightMargin = 0, leftMargin = 0, bottomMargin = Math.min(Math.ceil(xMax), bottomMarginLimit);
|
7746 | return showOnRight ? (leftMargin = Math.min(Math.max(leftOverflow, maxWidthY2), yMarginLimit),
|
7747 | rightMargin = Math.min(Math.max(rightOverflow, maxWidthY1), yMarginLimit)) : (leftMargin = Math.min(Math.max(leftOverflow, maxWidthY1), yMarginLimit),
|
7748 | rightMargin = Math.min(Math.max(rightOverflow, maxWidthY2), yMarginLimit)), {
|
7749 | xMax: Math.ceil(bottomMargin),
|
7750 | yLeft: Math.ceil(leftMargin),
|
7751 | yRight: Math.ceil(rightMargin)
|
7752 | };
|
7753 | }
|
7754 | function columnDataTypeHasValue(dataType) {
|
7755 | return dataType && (dataType.bool || dataType.numeric || dataType.text || dataType.dateTime);
|
7756 | }
|
7757 | function createOrdinalType() {
|
7758 | return powerbi.ValueType.fromDescriptor({
|
7759 | text: !0
|
7760 | });
|
7761 | }
|
7762 | function isOrdinal(type) {
|
7763 | return !(!type || !type.text && !type.bool);
|
7764 | }
|
7765 | function isOrdinalScale(scale) {
|
7766 | return "undefined" == typeof scale.invert;
|
7767 | }
|
7768 | function isDateTime(type) {
|
7769 | return !(!type || !type.dateTime);
|
7770 | }
|
7771 | function invertScale(scale, x) {
|
7772 | return isOrdinalScale(scale) ? invertOrdinalScale(scale, x) : scale.invert(x);
|
7773 | }
|
7774 | function extent(scale) {
|
7775 | return isOrdinalScale(scale) ? scale.rangeExtent() : scale.range();
|
7776 | }
|
7777 | function invertOrdinalScale(scale, x) {
|
7778 | var leftEdges = scale.range();
|
7779 | if (leftEdges.length < 2) return 0;
|
7780 | var j, width = scale.rangeBand(), halfInnerPadding = (leftEdges[1] - leftEdges[0] - width) / 2;
|
7781 | for (j = 0; x > leftEdges[j] + width + halfInnerPadding && j < leftEdges.length - 1; j++) ;
|
7782 | return scale.domain()[j];
|
7783 | }
|
7784 | function findClosestXAxisIndex(categoryValue, categoryAxisValues) {
|
7785 | var closestValueIndex = -1, minDistance = Number.MAX_VALUE;
|
7786 | for (var i in categoryAxisValues) {
|
7787 | var distance = Math.abs(categoryValue - categoryAxisValues[i].categoryValue);
|
7788 | minDistance > distance && (minDistance = distance, closestValueIndex = parseInt(i, 10));
|
7789 | }
|
7790 | return closestValueIndex;
|
7791 | }
|
7792 | function lookupOrdinalIndex(scale, pixelValue) {
|
7793 | var closestValueIndex = -1, minDistance = Number.MAX_VALUE, domain = scale.domain();
|
7794 | if (domain.length < 2) return 0;
|
7795 | var halfWidth = (scale(1) - scale(0)) / 2;
|
7796 | for (var idx in domain) {
|
7797 | var leftEdgeInPixels = scale(idx), midPoint = leftEdgeInPixels + halfWidth, distance = Math.abs(pixelValue - midPoint);
|
7798 | minDistance > distance && (minDistance = distance, closestValueIndex = parseInt(idx, 10));
|
7799 | }
|
7800 | return closestValueIndex;
|
7801 | }
|
7802 | function diffScaled(scale, value1, value2) {
|
7803 | var value = scale(value1) - scale(value2);
|
7804 | return 0 === value ? 0 : 0 > value ? Math.min(value, -1) : Math.max(value, 1);
|
7805 | }
|
7806 | function createDomain(data, axisType, isScalar, forcedScalarDomain, ensureDomain) {
|
7807 | if (isScalar && !isOrdinal(axisType)) {
|
7808 | var userMin = void 0, userMax = void 0;
|
7809 | return forcedScalarDomain && 2 === forcedScalarDomain.length && (userMin = forcedScalarDomain[0],
|
7810 | userMax = forcedScalarDomain[1]), createScalarDomain(data, userMin, userMax, axisType, ensureDomain);
|
7811 | }
|
7812 | return createOrdinalDomain(data);
|
7813 | }
|
7814 | function ensureValuesInRange(values, min, max) {
|
7815 | var filteredValues = values.filter(function(v) {
|
7816 | return v >= min && max >= v;
|
7817 | });
|
7818 | return filteredValues.length < 2 && (filteredValues = [ min, max ]), filteredValues;
|
7819 | }
|
7820 | function getCategoryValueType(metadataColumn, isScalar) {
|
7821 | return metadataColumn && columnDataTypeHasValue(metadataColumn.type) ? metadataColumn.type : isScalar ? powerbi.ValueType.fromDescriptor({
|
7822 | numeric: !0
|
7823 | }) : powerbi.ValueType.fromDescriptor({
|
7824 | text: !0
|
7825 | });
|
7826 | }
|
7827 | function createAxis(options) {
|
7828 | 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);
|
7829 | if (categoryThickness && isScalar && dataDomain && 2 === dataDomain.length) {
|
7830 | var oldSpan = dataDomain[1] - dataDomain[0], newSpan = scaleDomain[1] - scaleDomain[0];
|
7831 | oldSpan > 0 && newSpan > 0 && (categoryThickness = categoryThickness * oldSpan / newSpan);
|
7832 | }
|
7833 | var tickValues;
|
7834 | if (isScalar && 1 === bestTickCount) tickValues = [ dataDomain[0] ]; else {
|
7835 | var minTickInterval = isScalar ? getMinTickValueInterval(formatString, dataType, is100Pct) : void 0;
|
7836 | tickValues = getRecommendedTickValues(bestTickCount, scale, dataType, isScalar, minTickInterval);
|
7837 | }
|
7838 | options.scaleType && options.scaleType === visuals.axisScale.log && isLogScaleAllowed && (tickValues = tickValues.filter(function(d) {
|
7839 | return AxisHelper.powerOfTen(d);
|
7840 | }));
|
7841 | 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 = [];
|
7842 | metaDataColumn && (formattedTickValues = formatAxisTickValues(axis, tickValues, formatter, dataType, getValueFn));
|
7843 | var xLabelMaxWidth;
|
7844 | return !isScalar && categoryThickness ? xLabelMaxWidth = Math.max(1, categoryThickness - 2 * visuals.CartesianChart.TickLabelPadding) : (xLabelMaxWidth = tickValues.length > 1 ? getScalarLabelMaxWidth(scale, tickValues) : pixelSpan,
|
7845 | xLabelMaxWidth -= 2 * ScalarTickLabelPadding), {
|
7846 | scale: scale,
|
7847 | axis: axis,
|
7848 | formatter: formatter,
|
7849 | values: formattedTickValues,
|
7850 | axisType: dataType,
|
7851 | axisLabel: null,
|
7852 | isCategoryAxis: isCategoryAxis,
|
7853 | xLabelMaxWidth: xLabelMaxWidth,
|
7854 | categoryThickness: categoryThickness,
|
7855 | outerPadding: outerPadding,
|
7856 | usingDefaultDomain: scaleResult.usingDefaultDomain,
|
7857 | isLogScaleAllowed: isLogScaleAllowed,
|
7858 | dataDomain: dataDomain
|
7859 | };
|
7860 | }
|
7861 | function getScalarLabelMaxWidth(scale, tickValues) {
|
7862 | return scale && !_.isEmpty(tickValues) ? Math.abs(scale(tickValues[1]) - scale(tickValues[0])) : 1;
|
7863 | }
|
7864 | function createScale(options) {
|
7865 | var scale, 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, dataType = AxisHelper.getCategoryValueType(metaDataColumn, isScalar), maxTicks = isVertical ? getRecommendedNumberOfTicksForYAxis(pixelSpan) : getRecommendedNumberOfTicksForXAxis(pixelSpan), scalarDomain = dataDomain ? dataDomain.slice() : null, bestTickCount = maxTicks, usingDefaultDomain = !1;
|
7866 | if (null == dataDomain || 2 === dataDomain.length && null == dataDomain[0] && null == dataDomain[1] || 2 !== dataDomain.length && isScalar) usingDefaultDomain = !0,
|
7867 | dataDomain = dataType.dateTime || !isOrdinal(dataType) ? visuals.emptyDomain : [],
|
7868 | scale = isOrdinal(dataType) ? createOrdinalScale(pixelSpan, dataDomain, categoryThickness ? outerPadding / categoryThickness : 0) : createNumericalScale(options.scaleType, pixelSpan, dataDomain, dataType, outerPadding, bestTickCount); else {
|
7869 | if (isScalar && dataDomain.length > 0) {
|
7870 | bestTickCount = void 0 !== forcedTickCount ? 0 !== maxTicks ? forcedTickCount : 0 : AxisHelper.getBestNumberOfTicks(dataDomain[0], dataDomain[dataDomain.length - 1], [ metaDataColumn ], maxTicks, dataType.dateTime);
|
7871 | var normalizedRange = normalizeLinearDomain({
|
7872 | min: dataDomain[0],
|
7873 | max: dataDomain[dataDomain.length - 1]
|
7874 | });
|
7875 | scalarDomain = [ normalizedRange.min, normalizedRange.max ];
|
7876 | }
|
7877 | 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),
|
7878 | bestTickCount = 0 === maxTicks ? 0 : Math.min(scalarDomain.length, (pixelSpan - 2 * outerPadding) / visuals.CartesianChart.MinOrdinalRectThickness));
|
7879 | }
|
7880 | return isVertical && isScalar && scale.range(scale.range().reverse()), visuals.ColumnUtil.normalizeInfinityInScale(scale),
|
7881 | {
|
7882 | scale: scale,
|
7883 | bestTickCount: bestTickCount,
|
7884 | usingDefaultDomain: usingDefaultDomain
|
7885 | };
|
7886 | }
|
7887 | function createFormatter(scaleDomain, dataDomain, dataType, isScalar, formatString, bestTickCount, tickValues, getValueFn, useTickIntervalForDisplayUnits, axisDisplayUnits, axisPrecision) {
|
7888 | void 0 === useTickIntervalForDisplayUnits && (useTickIntervalForDisplayUnits = !1);
|
7889 | var formatter;
|
7890 | if (dataType.dateTime) if (isScalar) {
|
7891 | var value = new Date(scaleDomain[0]), value2 = new Date(scaleDomain[1]);
|
7892 | 1 === bestTickCount && (value = value2 = new Date(dataDomain[0])), formatter = visuals.valueFormatter.create({
|
7893 | format: formatString,
|
7894 | value: value,
|
7895 | value2: value2,
|
7896 | tickCount: bestTickCount
|
7897 | });
|
7898 | } else formatter = visuals.valueFormatter.createDefaultFormatter(formatString, !0); else if (useTickIntervalForDisplayUnits && isScalar && tickValues.length > 1) {
|
7899 | var value1 = axisDisplayUnits ? axisDisplayUnits : tickValues[1] - tickValues[0], options = {
|
7900 | format: formatString,
|
7901 | value: value1,
|
7902 | value2: 0,
|
7903 | allowFormatBeautification: !0
|
7904 | };
|
7905 | axisPrecision ? options.precision = axisPrecision : options.detectAxisPrecision = !0,
|
7906 | formatter = visuals.valueFormatter.create(options);
|
7907 | } else formatter = visuals.valueFormatter.createDefaultFormatter(formatString, !0);
|
7908 | return formatter;
|
7909 | }
|
7910 | function formatAxisTickValues(axis, tickValues, formatter, dataType, getValueFn) {
|
7911 | var formattedTickValues = [];
|
7912 | return getValueFn || (getValueFn = function(data) {
|
7913 | return data;
|
7914 | }), formatter ? (axis.tickFormat(function(d) {
|
7915 | return formatter.format(getValueFn(d, dataType));
|
7916 | }), formattedTickValues = tickValues.map(function(d) {
|
7917 | return formatter.format(getValueFn(d, dataType));
|
7918 | })) : formattedTickValues = tickValues.map(function(d) {
|
7919 | return getValueFn(d, dataType);
|
7920 | }), formattedTickValues;
|
7921 | }
|
7922 | function getMinTickValueInterval(formatString, columnType, is100Pct) {
|
7923 | var isCustomFormat = formatString && !powerbi.NumberFormat.isStandardFormat(formatString);
|
7924 | if (isCustomFormat) {
|
7925 | var precision = powerbi.NumberFormat.getCustomFormatMetadata(formatString, !0).precision;
|
7926 | return formatString.indexOf("%") > -1 && (precision += 2), Math.pow(10, -precision);
|
7927 | }
|
7928 | return is100Pct ? .01 : columnType.integer ? 1 : 0;
|
7929 | }
|
7930 | function createScalarDomain(data, userMin, userMax, axisType, ensureDomain) {
|
7931 | if (0 === data.length) return null;
|
7932 | var defaultMinX = d3.min(data, function(kv) {
|
7933 | return d3.min(kv.data, function(d) {
|
7934 | return d.categoryValue;
|
7935 | });
|
7936 | }), defaultMaxX = d3.max(data, function(kv) {
|
7937 | return d3.max(kv.data, function(d) {
|
7938 | return d.categoryValue;
|
7939 | });
|
7940 | });
|
7941 | return combineDomain([ userMin, userMax ], [ defaultMinX, defaultMaxX ], ensureDomain);
|
7942 | }
|
7943 | function createValueDomain(data, includeZero) {
|
7944 | if (0 === data.length) return null;
|
7945 | var minY = d3.min(data, function(kv) {
|
7946 | return d3.min(kv.data, function(d) {
|
7947 | return d.value;
|
7948 | });
|
7949 | }), maxY = d3.max(data, function(kv) {
|
7950 | return d3.max(kv.data, function(d) {
|
7951 | return d.value;
|
7952 | });
|
7953 | });
|
7954 | return includeZero ? [ Math.min(minY, 0), Math.max(maxY, 0) ] : [ minY, maxY ];
|
7955 | }
|
7956 | function createOrdinalDomain(data) {
|
7957 | if (_.isEmpty(data)) return [];
|
7958 | for (var domain = [], firstSeries = data[0], _i = 0, _a = firstSeries.data; _i < _a.length; _i++) {
|
7959 | var dp = _a[_i];
|
7960 | dp.highlight || domain.push(dp.categoryIndex);
|
7961 | }
|
7962 | return domain;
|
7963 | }
|
7964 | function createOrdinalScale(pixelSpan, dataDomain, outerPaddingRatio) {
|
7965 | void 0 === outerPaddingRatio && (outerPaddingRatio = 0);
|
7966 | var scale = d3.scale.ordinal().rangeBands([ 0, pixelSpan ], visuals.CartesianChart.InnerPaddingRatio, outerPaddingRatio).domain(dataDomain);
|
7967 | return scale;
|
7968 | }
|
7969 | function isLogScalePossible(domain, axisType) {
|
7970 | return null == domain ? !1 : isDateTime(axisType) ? !1 : domain[0] > 0 && domain[1] > 0 || domain[0] < 0 && domain[1] < 0;
|
7971 | }
|
7972 | function createNumericalScale(axisScaleType, pixelSpan, dataDomain, dataType, outerPadding, niceCount, shouldClamp) {
|
7973 | return void 0 === outerPadding && (outerPadding = 0), axisScaleType === visuals.axisScale.log && isLogScalePossible(dataDomain, dataType) ? createLogScale(pixelSpan, dataDomain, outerPadding, niceCount) : createLinearScale(pixelSpan, dataDomain, outerPadding, niceCount, shouldClamp);
|
7974 | }
|
7975 | function createLogScale(pixelSpan, dataDomain, outerPadding, niceCount) {
|
7976 | void 0 === outerPadding && (outerPadding = 0);
|
7977 | var scale = d3.scale.log().range([ outerPadding, pixelSpan - outerPadding ]).domain([ dataDomain[0], dataDomain[1] ]).clamp(!0);
|
7978 | return niceCount && scale.nice(niceCount), scale;
|
7979 | }
|
7980 | function createLinearScale(pixelSpan, dataDomain, outerPadding, niceCount, shouldClamp) {
|
7981 | void 0 === outerPadding && (outerPadding = 0);
|
7982 | var scale = d3.scale.linear().range([ outerPadding, pixelSpan - outerPadding ]).domain([ dataDomain[0], dataDomain[1] ]).clamp(shouldClamp);
|
7983 | return niceCount && scale.nice(niceCount), scale;
|
7984 | }
|
7985 | function getRangeForColumn(sizeColumn) {
|
7986 | var result = {};
|
7987 | return sizeColumn && (result.min = null == sizeColumn.min ? null == sizeColumn.minLocal ? d3.min(sizeColumn.values) : sizeColumn.minLocal : sizeColumn.min,
|
7988 | result.max = null == sizeColumn.max ? null == sizeColumn.maxLocal ? d3.max(sizeColumn.values) : sizeColumn.maxLocal : sizeColumn.max),
|
7989 | result;
|
7990 | }
|
7991 | function applyCustomizedDomain(customizedDomain, forcedDomain) {
|
7992 | var domain = [ void 0, void 0 ];
|
7993 | return forcedDomain && 2 === forcedDomain.length && (domain = [ forcedDomain[0], forcedDomain[1] ]),
|
7994 | customizedDomain && 2 === customizedDomain.length && (null != customizedDomain[0] && (domain[0] = customizedDomain[0]),
|
7995 | 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;
|
7996 | }
|
7997 | function combineDomain(forcedDomain, domain, ensureDomain) {
|
7998 | var combinedDomain = domain ? [ domain[0], domain[1] ] : [];
|
7999 | ensureDomain && ((null == combinedDomain[0] || ensureDomain.min < combinedDomain[0]) && (combinedDomain[0] = ensureDomain.min),
|
8000 | (null == combinedDomain[1] || ensureDomain.max > combinedDomain[1]) && (combinedDomain[1] = ensureDomain.max));
|
8001 | var domainBeforeForced = [ combinedDomain[0], combinedDomain[1] ];
|
8002 | return forcedDomain && 2 === forcedDomain.length && (null != forcedDomain[0] && (combinedDomain[0] = forcedDomain[0]),
|
8003 | null != forcedDomain[1] && (combinedDomain[1] = forcedDomain[1]), combinedDomain[0] > combinedDomain[1] && (combinedDomain = domainBeforeForced)),
|
8004 | combinedDomain;
|
8005 | }
|
8006 | function createAxisLabel(properties, label, unitType, y2) {
|
8007 | void 0 === y2 && (y2 = !1);
|
8008 | var propertyName = y2 ? "secAxisStyle" : "axisStyle";
|
8009 | if (!properties || !properties[propertyName]) return label;
|
8010 | var modifiedLabel;
|
8011 | return modifiedLabel = properties[propertyName] === visuals.axisStyle.showBoth ? label + " (" + unitType + ")" : properties[propertyName] === visuals.axisStyle.showUnitOnly ? unitType : label;
|
8012 | }
|
8013 | function scaleShouldClamp(combinedDomain, domain) {
|
8014 | return !combinedDomain || !domain || combinedDomain.length < 2 || domain.length < 2 ? !1 : combinedDomain[0] !== domain[0] || combinedDomain[1] !== domain[1];
|
8015 | }
|
8016 | function normalizeNonFiniteNumber(value) {
|
8017 | return isNaN(value) ? null : value === Number.POSITIVE_INFINITY ? Number.MAX_VALUE : value === Number.NEGATIVE_INFINITY ? -Number.MAX_VALUE : value;
|
8018 | }
|
8019 | function powerOfTen(d) {
|
8020 | var value = Math.abs(d), log10 = Math.log(value) / Math.LN10;
|
8021 | return log10 = Math.ceil(log10 - 1e-12), value / Math.pow(10, log10) === 1;
|
8022 | }
|
8023 | var XLabelMaxAllowedOverflow = 35, TextHeightConstant = 10, MinTickCount = 2, DefaultBestTickCount = 3, LeftPadding = 10, ScalarTickLabelPadding = 3;
|
8024 | AxisHelper.getRecommendedNumberOfTicksForXAxis = getRecommendedNumberOfTicksForXAxis,
|
8025 | AxisHelper.getRecommendedNumberOfTicksForYAxis = getRecommendedNumberOfTicksForYAxis,
|
8026 | AxisHelper.getBestNumberOfTicks = getBestNumberOfTicks, AxisHelper.hasNonIntegerData = hasNonIntegerData,
|
8027 | AxisHelper.getRecommendedTickValues = getRecommendedTickValues, AxisHelper.getRecommendedTickValuesForAnOrdinalRange = getRecommendedTickValuesForAnOrdinalRange,
|
8028 | AxisHelper.getRecommendedTickValuesForAQuantitativeRange = getRecommendedTickValuesForAQuantitativeRange,
|
8029 | AxisHelper.getMargin = getMargin, AxisHelper.getTickLabelMargins = getTickLabelMargins,
|
8030 | AxisHelper.columnDataTypeHasValue = columnDataTypeHasValue, AxisHelper.createOrdinalType = createOrdinalType,
|
8031 | AxisHelper.isOrdinal = isOrdinal, AxisHelper.isOrdinalScale = isOrdinalScale, AxisHelper.isDateTime = isDateTime,
|
8032 | AxisHelper.invertScale = invertScale, AxisHelper.extent = extent, AxisHelper.invertOrdinalScale = invertOrdinalScale,
|
8033 | AxisHelper.findClosestXAxisIndex = findClosestXAxisIndex, AxisHelper.lookupOrdinalIndex = lookupOrdinalIndex,
|
8034 | AxisHelper.diffScaled = diffScaled, AxisHelper.createDomain = createDomain, AxisHelper.ensureValuesInRange = ensureValuesInRange,
|
8035 | AxisHelper.getCategoryValueType = getCategoryValueType, AxisHelper.createAxis = createAxis,
|
8036 | AxisHelper.createScale = createScale, AxisHelper.createFormatter = createFormatter,
|
8037 | AxisHelper.getMinTickValueInterval = getMinTickValueInterval, AxisHelper.createValueDomain = createValueDomain;
|
8038 | var LabelLayoutStrategy;
|
8039 | !function(LabelLayoutStrategy) {
|
8040 | function willLabelsFit(axisProperties, availableWidth, textMeasurer, properties) {
|
8041 | var labels = axisProperties.values;
|
8042 | if (0 === labels.length) return !1;
|
8043 | var labelMaxWidth = void 0 !== axisProperties.xLabelMaxWidth ? axisProperties.xLabelMaxWidth : availableWidth / labels.length;
|
8044 | return !labels.some(function(d) {
|
8045 | return properties.text = d, textMeasurer(properties) > labelMaxWidth;
|
8046 | });
|
8047 | }
|
8048 | function willLabelsWordBreak(axisProperties, margin, availableWidth, textWidthMeasurer, textHeightMeasurer, textTruncator, properties) {
|
8049 | 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));
|
8050 | if (0 === labels.length) return !1;
|
8051 | var mustRotate = labels.some(function(label) {
|
8052 | return properties.text = label, !jsCommon.WordBreaker.hasBreakers(label) && textWidthMeasurer(properties) > labelMaxWidth;
|
8053 | });
|
8054 | if (mustRotate) return !1;
|
8055 | var moreWordBreakChars = labels.filter(function(label, index) {
|
8056 | 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(" ");
|
8057 | properties.text = label;
|
8058 | var rotateChars = textTruncator(properties, rotatedLength);
|
8059 | return visuals.TextUtil.removeEllipses(wordBreakChars).length >= visuals.TextUtil.removeEllipses(rotateChars).length;
|
8060 | });
|
8061 | return moreWordBreakChars.length >= Math.floor(labels.length / 2);
|
8062 | }
|
8063 | function rotate(labelSelection, maxBottomMargin, textTruncator, textProperties, needRotate, needEllipsis, axisProperties, margin, scrollbarVisible) {
|
8064 | var rotatedLength, defaultRotation;
|
8065 | defaultRotation = scrollbarVisible ? LabelLayoutStrategy.DefaultRotationWithScrollbar : LabelLayoutStrategy.DefaultRotation,
|
8066 | needRotate && (rotatedLength = maxBottomMargin / defaultRotation.sine), labelSelection.each(function() {
|
8067 | var axisLabel = d3.select(this), labelText = axisLabel.text();
|
8068 | if (textProperties.text = labelText, needRotate) {
|
8069 | var textContentIndex = axisProperties.values.indexOf(this.textContent), allowedLengthProjectedOnXAxis = margin.left + axisProperties.outerPadding + axisProperties.categoryThickness * (textContentIndex + .5);
|
8070 | scrollbarVisible || (allowedLengthProjectedOnXAxis -= LeftPadding);
|
8071 | var allowedLength = allowedLengthProjectedOnXAxis / defaultRotation.cosine;
|
8072 | (scrollbarVisible || needEllipsis || rotatedLength > allowedLength) && (labelText = textTruncator(textProperties, Math.min(allowedLength, rotatedLength)),
|
8073 | axisLabel.text(labelText)), axisLabel.style("text-anchor", "end").attr({
|
8074 | dx: "-0.5em",
|
8075 | dy: defaultRotation.dy,
|
8076 | transform: defaultRotation.transform
|
8077 | });
|
8078 | } else {
|
8079 | var newLabelText = textTruncator(textProperties, axisProperties.xLabelMaxWidth);
|
8080 | newLabelText !== labelText && axisLabel.text(newLabelText), axisLabel.style("text-anchor", "middle").attr({
|
8081 | dx: "0em",
|
8082 | dy: "1em",
|
8083 | transform: "rotate(0)"
|
8084 | });
|
8085 | }
|
8086 | });
|
8087 | }
|
8088 | function wordBreak(text, axisProperties, maxHeight) {
|
8089 | var allowedLength = axisProperties.xLabelMaxWidth;
|
8090 | text.each(function() {
|
8091 | var node = d3.select(this);
|
8092 | node.style("text-anchor", "middle").attr({
|
8093 | dx: "0em",
|
8094 | dy: "1em",
|
8095 | transform: "rotate(0)"
|
8096 | }), powerbi.TextMeasurementService.wordBreak(this, allowedLength, maxHeight);
|
8097 | });
|
8098 | }
|
8099 | function clip(text, availableWidth, svgEllipsis) {
|
8100 | 0 !== text.size() && text.each(function() {
|
8101 | var text = d3.select(this);
|
8102 | svgEllipsis(text[0][0], availableWidth);
|
8103 | });
|
8104 | }
|
8105 | LabelLayoutStrategy.willLabelsFit = willLabelsFit, LabelLayoutStrategy.willLabelsWordBreak = willLabelsWordBreak,
|
8106 | LabelLayoutStrategy.DefaultRotation = {
|
8107 | sine: Math.sin(Math.PI * (35 / 180)),
|
8108 | cosine: Math.cos(Math.PI * (35 / 180)),
|
8109 | tangent: Math.tan(Math.PI * (35 / 180)),
|
8110 | transform: "rotate(-35)",
|
8111 | dy: "-0.5em"
|
8112 | }, LabelLayoutStrategy.DefaultRotationWithScrollbar = {
|
8113 | sine: Math.sin(.5 * Math.PI),
|
8114 | cosine: Math.cos(.5 * Math.PI),
|
8115 | tangent: Math.tan(.5 * Math.PI),
|
8116 | transform: "rotate(-90)",
|
8117 | dy: "-0.8em"
|
8118 | }, LabelLayoutStrategy.rotate = rotate, LabelLayoutStrategy.wordBreak = wordBreak,
|
8119 | LabelLayoutStrategy.clip = clip;
|
8120 | }(LabelLayoutStrategy = AxisHelper.LabelLayoutStrategy || (AxisHelper.LabelLayoutStrategy = {})),
|
8121 | AxisHelper.createOrdinalScale = createOrdinalScale, AxisHelper.isLogScalePossible = isLogScalePossible,
|
8122 | AxisHelper.createNumericalScale = createNumericalScale, AxisHelper.createLinearScale = createLinearScale,
|
8123 | AxisHelper.getRangeForColumn = getRangeForColumn, AxisHelper.applyCustomizedDomain = applyCustomizedDomain,
|
8124 | AxisHelper.combineDomain = combineDomain, AxisHelper.createAxisLabel = createAxisLabel,
|
8125 | AxisHelper.scaleShouldClamp = scaleShouldClamp, AxisHelper.normalizeNonFiniteNumber = normalizeNonFiniteNumber,
|
8126 | AxisHelper.powerOfTen = powerOfTen;
|
8127 | }(AxisHelper = visuals.AxisHelper || (visuals.AxisHelper = {}));
|
8128 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8129 | }(powerbi || (powerbi = {}));
|
8130 |
|
8131 | var powerbi;
|
8132 |
|
8133 | !function(powerbi) {
|
8134 | var visuals;
|
8135 | !function(visuals) {
|
8136 | var ShapeFactory;
|
8137 | !function(ShapeFactory) {
|
8138 | function createRectangle(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8139 | 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 = {
|
8140 | x: x,
|
8141 | y: y,
|
8142 | width: width,
|
8143 | height: height,
|
8144 | rx: data.roundEdge,
|
8145 | ry: data.roundEdge
|
8146 | }, scale = getScale(width, height, degrees);
|
8147 | createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, "rect", attrs);
|
8148 | }
|
8149 | function createOval(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8150 | 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 = {
|
8151 | cx: widthForCircle,
|
8152 | cy: heightForCircle,
|
8153 | rx: radiusXForCircle,
|
8154 | ry: radiusYForCircle
|
8155 | }, scale = getScale(viewportWidth, viewportHeight, degrees);
|
8156 | createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, "ellipse", attrs);
|
8157 | }
|
8158 | function createLine(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8159 | var x1, y1, x2, y2, ratio, width = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue - ShapeFactoryConsts.SmallPaddingConstValue, height = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - ShapeFactoryConsts.SmallPaddingConstValue;
|
8160 | 45 >= degrees ? (ratio = degrees / 90, x1 = viewportWidth / 2 + width * ratio, y1 = ShapeFactoryConsts.SmallPaddingConstValue,
|
8161 | x2 = viewportWidth / 2 - width * ratio, y2 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue) : 135 >= degrees ? (ratio = (degrees - 45) / 90,
|
8162 | x1 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue, y1 = ShapeFactoryConsts.SmallPaddingConstValue + height * ratio,
|
8163 | x2 = ShapeFactoryConsts.SmallPaddingConstValue, y2 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - height * ratio) : 225 >= degrees ? (ratio = (degrees - 135) / 90,
|
8164 | x1 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue - width * ratio,
|
8165 | y1 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue, x2 = ShapeFactoryConsts.SmallPaddingConstValue + width * ratio,
|
8166 | y2 = ShapeFactoryConsts.SmallPaddingConstValue) : 315 >= degrees ? (ratio = (degrees - 225) / 90,
|
8167 | x1 = ShapeFactoryConsts.SmallPaddingConstValue, y1 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue - height * ratio,
|
8168 | x2 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue, y2 = ShapeFactoryConsts.SmallPaddingConstValue + height * ratio) : 360 >= degrees && (ratio = (degrees - 315) / 90,
|
8169 | x1 = ShapeFactoryConsts.SmallPaddingConstValue + width * ratio, y1 = ShapeFactoryConsts.SmallPaddingConstValue,
|
8170 | x2 = viewportWidth - ShapeFactoryConsts.SmallPaddingConstValue - width * ratio,
|
8171 | y2 = viewportHeight - ShapeFactoryConsts.SmallPaddingConstValue), selectedElement.append("svg").attr({
|
8172 | width: viewportWidth,
|
8173 | height: viewportHeight
|
8174 | }).append("line").attr({
|
8175 | x1: x1,
|
8176 | y1: y1,
|
8177 | x2: x2,
|
8178 | y2: y2
|
8179 | }).style({
|
8180 | "vector-effect": "non-scaling-stroke",
|
8181 | "stroke-width": data.lineWeight + "px",
|
8182 | "stroke-opacity": (100 - data.lineTransparency) / 100,
|
8183 | stroke: data.lineColor
|
8184 | });
|
8185 | }
|
8186 | function createUpArrow(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8187 | var lineWeight = data.lineWeight, viewportHeightWeight = viewportHeight - lineWeight, viewportWidthWeight = viewportWidth - lineWeight, arrowPoints = [ {
|
8188 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowLeftHeadPoint.x).toString(),
|
8189 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowLeftHeadPoint.y).toString()
|
8190 | }, {
|
8191 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowMiddleHeadPoint.x).toString(),
|
8192 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowMiddleHeadPoint.y).toString()
|
8193 | }, {
|
8194 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowRightHeadPoint.x).toString(),
|
8195 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowRightHeadPoint.y).toString()
|
8196 | }, {
|
8197 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowRightMiddleHeadPoint.x).toString(),
|
8198 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowRightMiddleHeadPoint.y).toString()
|
8199 | }, {
|
8200 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowBottomRightPoint.x).toString(),
|
8201 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowBottomRightPoint.y).toString()
|
8202 | }, {
|
8203 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowBottomLeftPoint.x).toString(),
|
8204 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowBottomLeftPoint.y).toString()
|
8205 | }, {
|
8206 | x: (viewportWidthWeight * ShapeFactoryConsts.ArrowLeftMiddleHeadPoint.x).toString(),
|
8207 | y: (viewportHeightWeight * ShapeFactoryConsts.ArrowLeftMiddleHeadPoint.y).toString()
|
8208 | } ];
|
8209 | createPathFromArray(data, arrowPoints, selectedElement, viewportHeight, viewportWidth, degrees);
|
8210 | }
|
8211 | function createTriangle(data, viewportHeight, viewportWidth, selectedElement, degrees) {
|
8212 | var lineWeight = data.lineWeight;
|
8213 | lineWeight > 3 && (lineWeight -= 3);
|
8214 | 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;
|
8215 | 10 > firstPointX && (firstPointX = ShapeFactoryConsts.SmallPaddingConstValue), 10 > secondPointY && (secondPointY = ShapeFactoryConsts.SmallPaddingConstValue);
|
8216 | var trianglePoints = [ {
|
8217 | x: firstPointX,
|
8218 | y: firstPointY
|
8219 | }, {
|
8220 | x: secondPointX,
|
8221 | y: secondPointY
|
8222 | }, {
|
8223 | x: thirdPointX,
|
8224 | y: thirdPointY
|
8225 | } ];
|
8226 | createPathFromArray(data, trianglePoints, selectedElement, viewportHeight, viewportWidth, degrees);
|
8227 | }
|
8228 | function createPathFromArray(data, points, selectedElement, viewportHeight, viewportWidth, degrees) {
|
8229 | var lineFunction = d3.svg.line().x(function(d) {
|
8230 | return d.x;
|
8231 | }).y(function(d) {
|
8232 | return d.y;
|
8233 | }).interpolate("linear"), attrs = {
|
8234 | d: lineFunction(points) + " Z"
|
8235 | }, scale = getScale(viewportWidth, viewportHeight, degrees);
|
8236 | createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, "path", attrs);
|
8237 | }
|
8238 | function createShape(data, viewportHeight, viewportWidth, selectedElement, degrees, scale, shapeType, shapeAttrs) {
|
8239 | selectedElement.append("div").style({
|
8240 | transform: "rotate(" + degrees + "deg) scale(" + scale + ")",
|
8241 | "transform-origin": "center",
|
8242 | "-webkit-transform": "rotate(" + degrees + "deg) scale(" + scale + ")",
|
8243 | "-webkit-transform-origin": "center",
|
8244 | width: viewportWidth + "px",
|
8245 | height: viewportHeight + "px"
|
8246 | }).append("svg").attr({
|
8247 | width: viewportWidth,
|
8248 | height: viewportHeight
|
8249 | }).append(shapeType).attr(shapeAttrs).style({
|
8250 | "vector-effect": "non-scaling-stroke",
|
8251 | "stroke-width": data.lineWeight + "px",
|
8252 | stroke: data.lineColor,
|
8253 | "stroke-opacity": (100 - data.lineTransparency) / 100,
|
8254 | fill: data.fillColor,
|
8255 | "fill-opacity": data.showFill === !0 ? (100 - data.shapeTransparency) / 100 : 0
|
8256 | });
|
8257 | }
|
8258 | function getScale(width, height, degrees) {
|
8259 | 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;
|
8260 | return width >= height ? (90 > degrees ? radians += offsetAngle : 180 > degrees ? radians -= offsetAngle : 270 > degrees ? radians += offsetAngle : radians -= offsetAngle,
|
8261 | originalHeight / Math.abs(Math.sin(radians)) / originalFactor) : (90 > degrees ? radians -= offsetAngle : 180 > degrees ? radians += offsetAngle : 270 > degrees ? radians -= offsetAngle : radians += offsetAngle,
|
8262 | originalWidth / Math.abs(Math.cos(radians)) / originalFactor);
|
8263 | }
|
8264 | var ShapeFactoryConsts;
|
8265 | !function(ShapeFactoryConsts) {
|
8266 | ShapeFactoryConsts.PaddingConstRatio = .01, ShapeFactoryConsts.TrianglePaddingConstRatio = .15,
|
8267 | ShapeFactoryConsts.TriangleEndPaddingConstRatio = .85, ShapeFactoryConsts.ShapeConstRatio = 1 - 2 * ShapeFactoryConsts.PaddingConstRatio,
|
8268 | ShapeFactoryConsts.SmallPaddingConstValue = 10, ShapeFactoryConsts.OvalRadiusConst = 2,
|
8269 | ShapeFactoryConsts.OvalRadiusConstPadding = .2, ShapeFactoryConsts.ArrowLeftHeadPoint = {
|
8270 | x: .05,
|
8271 | y: .42
|
8272 | }, ShapeFactoryConsts.ArrowMiddleHeadPoint = {
|
8273 | x: .5,
|
8274 | y: .016
|
8275 | }, ShapeFactoryConsts.ArrowRightHeadPoint = {
|
8276 | x: .95,
|
8277 | y: .42
|
8278 | }, ShapeFactoryConsts.ArrowRightMiddleHeadPoint = {
|
8279 | x: .764,
|
8280 | y: .42
|
8281 | }, ShapeFactoryConsts.ArrowBottomRightPoint = {
|
8282 | x: .764,
|
8283 | y: .993
|
8284 | }, ShapeFactoryConsts.ArrowBottomLeftPoint = {
|
8285 | x: .246,
|
8286 | y: .993
|
8287 | }, ShapeFactoryConsts.ArrowLeftMiddleHeadPoint = {
|
8288 | x: .246,
|
8289 | y: .42
|
8290 | };
|
8291 | }(ShapeFactoryConsts = ShapeFactory.ShapeFactoryConsts || (ShapeFactory.ShapeFactoryConsts = {})),
|
8292 | ShapeFactory.createRectangle = createRectangle, ShapeFactory.createOval = createOval,
|
8293 | ShapeFactory.createLine = createLine, ShapeFactory.createUpArrow = createUpArrow,
|
8294 | ShapeFactory.createTriangle = createTriangle;
|
8295 | }(ShapeFactory = visuals.ShapeFactory || (visuals.ShapeFactory = {}));
|
8296 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8297 | }(powerbi || (powerbi = {}));
|
8298 |
|
8299 | var powerbi;
|
8300 |
|
8301 | !function(powerbi) {
|
8302 | var visuals;
|
8303 | !function(visuals) {
|
8304 | var CartesianHelper;
|
8305 | !function(CartesianHelper) {
|
8306 | function getCategoryAxisProperties(dataViewMetadata, axisTitleOnByDefault) {
|
8307 | var toReturn = {};
|
8308 | if (!dataViewMetadata) return toReturn;
|
8309 | var objects = dataViewMetadata.objects;
|
8310 | if (objects) {
|
8311 | var categoryAxisObject = objects.categoryAxis;
|
8312 | categoryAxisObject && (toReturn = {
|
8313 | show: categoryAxisObject.show,
|
8314 | axisType: categoryAxisObject.axisType,
|
8315 | axisScale: categoryAxisObject.axisScale,
|
8316 | start: categoryAxisObject.start,
|
8317 | end: categoryAxisObject.end,
|
8318 | showAxisTitle: null == categoryAxisObject.showAxisTitle ? axisTitleOnByDefault : categoryAxisObject.showAxisTitle,
|
8319 | axisStyle: categoryAxisObject.axisStyle,
|
8320 | labelColor: categoryAxisObject.labelColor,
|
8321 | labelDisplayUnits: categoryAxisObject.labelDisplayUnits,
|
8322 | labelPrecision: categoryAxisObject.labelPrecision,
|
8323 | duration: categoryAxisObject.duration
|
8324 | });
|
8325 | }
|
8326 | return toReturn;
|
8327 | }
|
8328 | function getValueAxisProperties(dataViewMetadata, axisTitleOnByDefault) {
|
8329 | var toReturn = {};
|
8330 | if (!dataViewMetadata) return toReturn;
|
8331 | var objects = dataViewMetadata.objects;
|
8332 | if (objects) {
|
8333 | var valueAxisObject = objects.valueAxis;
|
8334 | valueAxisObject && (toReturn = {
|
8335 | show: valueAxisObject.show,
|
8336 | position: valueAxisObject.position,
|
8337 | axisScale: valueAxisObject.axisScale,
|
8338 | start: valueAxisObject.start,
|
8339 | end: valueAxisObject.end,
|
8340 | showAxisTitle: null == valueAxisObject.showAxisTitle ? axisTitleOnByDefault : valueAxisObject.showAxisTitle,
|
8341 | axisStyle: valueAxisObject.axisStyle,
|
8342 | labelColor: valueAxisObject.labelColor,
|
8343 | labelDisplayUnits: valueAxisObject.labelDisplayUnits,
|
8344 | labelPrecision: valueAxisObject.labelPrecision,
|
8345 | secShow: valueAxisObject.secShow,
|
8346 | secPosition: valueAxisObject.secPosition,
|
8347 | secAxisScale: valueAxisObject.secAxisScale,
|
8348 | secStart: valueAxisObject.secStart,
|
8349 | secEnd: valueAxisObject.secEnd,
|
8350 | secShowAxisTitle: valueAxisObject.secShowAxisTitle,
|
8351 | secAxisStyle: valueAxisObject.secAxisStyle,
|
8352 | secLabelColor: valueAxisObject.secLabelColor,
|
8353 | secLabelDisplayUnits: valueAxisObject.secLabelDisplayUnits,
|
8354 | secLabelPrecision: valueAxisObject.secLabelPrecision
|
8355 | });
|
8356 | }
|
8357 | return toReturn;
|
8358 | }
|
8359 | function isScalar(isScalar, xAxisCardProperties) {
|
8360 | return isScalar && (isScalar = xAxisCardProperties && xAxisCardProperties.axisType ? xAxisCardProperties.axisType === visuals.axisType.scalar : !0),
|
8361 | isScalar;
|
8362 | }
|
8363 | function getPrecision(precision) {
|
8364 | return null != precision ? 0 > precision ? 0 : precision : null;
|
8365 | }
|
8366 | function lookupXValue(data, index, type, isScalar) {
|
8367 | var isDateTime = visuals.AxisHelper.isDateTime(type);
|
8368 | if (isScalar) return isDateTime ? new Date(index) : index;
|
8369 | if (type.text) return data.categories[index];
|
8370 | if (data && data.series && data.series.length > 0) {
|
8371 | var firstSeries = data.series[0];
|
8372 | if (firstSeries) {
|
8373 | var seriesValues = firstSeries.data;
|
8374 | if (seriesValues) {
|
8375 | data.hasHighlights && (index = 2 * index);
|
8376 | var dataAtIndex = seriesValues[index];
|
8377 | if (dataAtIndex) return isDateTime && null != dataAtIndex.categoryValue ? new Date(dataAtIndex.categoryValue) : dataAtIndex.categoryValue;
|
8378 | }
|
8379 | }
|
8380 | }
|
8381 | return index;
|
8382 | }
|
8383 | function findMaxCategoryIndex(series) {
|
8384 | if (_.isEmpty(series)) return 0;
|
8385 | for (var maxCategoryIndex = 0, _i = 0, series_1 = series; _i < series_1.length; _i++) {
|
8386 | var singleSeries = series_1[_i];
|
8387 | if (!_.isEmpty(singleSeries.data)) {
|
8388 | var lastIndex = singleSeries.data[singleSeries.data.length - 1].categoryIndex;
|
8389 | maxCategoryIndex = Math.max(lastIndex, maxCategoryIndex);
|
8390 | }
|
8391 | }
|
8392 | return maxCategoryIndex;
|
8393 | }
|
8394 | CartesianHelper.getCategoryAxisProperties = getCategoryAxisProperties, CartesianHelper.getValueAxisProperties = getValueAxisProperties,
|
8395 | CartesianHelper.isScalar = isScalar, CartesianHelper.getPrecision = getPrecision,
|
8396 | CartesianHelper.lookupXValue = lookupXValue, CartesianHelper.findMaxCategoryIndex = findMaxCategoryIndex;
|
8397 | }(CartesianHelper = visuals.CartesianHelper || (visuals.CartesianHelper = {}));
|
8398 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8399 | }(powerbi || (powerbi = {}));
|
8400 |
|
8401 | var powerbi;
|
8402 |
|
8403 | !function(powerbi) {
|
8404 | var visuals;
|
8405 | !function(visuals) {
|
8406 | var SQExprShortSerializer = powerbi.data.SQExprShortSerializer, ColorHelper = function() {
|
8407 | function ColorHelper(colors, fillProp, defaultDataPointColor) {
|
8408 | this.colors = colors, this.fillProp = fillProp, this.defaultDataPointColor = defaultDataPointColor,
|
8409 | this.defaultColorScale = colors.getNewColorScale();
|
8410 | }
|
8411 | return ColorHelper.prototype.getColorForSeriesValue = function(objects, fieldIds, value) {
|
8412 | return this.fillProp && powerbi.DataViewObjects.getFillColor(objects, this.fillProp) || this.defaultDataPointColor || this.getColorScaleForSeries(fieldIds).getColor(value).value;
|
8413 | }, ColorHelper.prototype.getColorScaleForSeries = function(fieldIds) {
|
8414 | return this.colors.getColorScaleByKey(SQExprShortSerializer.serializeArray(fieldIds || []));
|
8415 | }, ColorHelper.prototype.getColorForMeasure = function(objects, measureKey) {
|
8416 | var scaleColor = this.defaultColorScale.getColor(measureKey).value;
|
8417 | return this.fillProp && powerbi.DataViewObjects.getFillColor(objects, this.fillProp) || this.defaultDataPointColor || scaleColor;
|
8418 | }, ColorHelper.normalizeSelector = function(selector, isSingleSeries) {
|
8419 | return selector && (isSingleSeries || selector.data) ? {
|
8420 | data: selector.data
|
8421 | } : selector;
|
8422 | }, ColorHelper;
|
8423 | }();
|
8424 | visuals.ColorHelper = ColorHelper;
|
8425 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8426 | }(powerbi || (powerbi = {}));
|
8427 |
|
8428 | var powerbi;
|
8429 |
|
8430 | !function(powerbi) {
|
8431 | var visuals;
|
8432 | !function(visuals) {
|
8433 | var ColumnUtil, rectName = "rect";
|
8434 | !function(ColumnUtil) {
|
8435 | function applyUserMinMax(isScalar, dataView, xAxisCardProperties) {
|
8436 | if (isScalar) {
|
8437 | var min = xAxisCardProperties.start, max = xAxisCardProperties.end;
|
8438 | return ColumnUtil.transformDomain(dataView, min, max);
|
8439 | }
|
8440 | return dataView;
|
8441 | }
|
8442 | function transformDomain(dataView, min, max) {
|
8443 | if (!dataView.categories || !dataView.values || 0 === dataView.categories.length || 0 === dataView.values.length) return dataView;
|
8444 | if ("number" != typeof min && "number" != typeof max) return dataView;
|
8445 | var category = dataView.categories[0], categoryValues = category.values, categoryObjects = category.objects;
|
8446 | if (!categoryValues || !categoryObjects) return dataView;
|
8447 | var newcategoryValues = [], newValues = [], newObjects = [];
|
8448 | if ("number" != typeof min && (min = categoryValues[0]), "number" != typeof max && (max = categoryValues[categoryValues.length - 1]),
|
8449 | min > max) return dataView;
|
8450 | for (var j = 0, len = dataView.values.length; len > j; j++) newValues.push([]);
|
8451 | for (var t = 0, len = categoryValues.length; len > t; t++) if (categoryValues[t] >= min && categoryValues[t] <= max && (newcategoryValues.push(categoryValues[t]),
|
8452 | categoryObjects && newObjects.push(categoryObjects[t]), dataView.values)) for (var k = 0; k < dataView.values.length; k++) newValues[k].push(dataView.values[k].values[t]);
|
8453 | 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]);
|
8454 | resultDataViewCategories0.values = newcategoryValues, resultDataViewCategories0.objects && (resultDataViewCategories0.objects = newObjects);
|
8455 | for (var t = 0, len = dataView.values.length; len > t; t++) {
|
8456 | var measureArray = resultDataViewValues[t] = powerbi.Prototype.inherit(resultDataViewValues[t]);
|
8457 | measureArray.values = newValues[t];
|
8458 | }
|
8459 | return resultDataView;
|
8460 | }
|
8461 | function getCategoryAxis(data, size, layout, isVertical, forcedXMin, forcedXMax, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
8462 | var categoryThickness = layout.categoryThickness, isScalar = layout.isScalar, outerPaddingRatio = layout.outerPaddingRatio, domain = visuals.AxisHelper.createDomain(data.series, data.categoryMetadata ? data.categoryMetadata.type : powerbi.ValueType.fromDescriptor({
|
8463 | text: !0
|
8464 | }), isScalar, [ forcedXMin, forcedXMax ], ensureXDomain), axisProperties = visuals.AxisHelper.createAxis({
|
8465 | pixelSpan: size,
|
8466 | dataDomain: domain,
|
8467 | metaDataColumn: data.categoryMetadata,
|
8468 | formatString: visuals.valueFormatter.getFormatString(data.categoryMetadata, visuals.columnChartProps.general.formatString),
|
8469 | outerPadding: categoryThickness * outerPaddingRatio,
|
8470 | isCategoryAxis: !0,
|
8471 | isScalar: isScalar,
|
8472 | isVertical: isVertical,
|
8473 | categoryThickness: categoryThickness,
|
8474 | useTickIntervalForDisplayUnits: !0,
|
8475 | getValueFn: function(index, type) {
|
8476 | return visuals.CartesianHelper.lookupXValue(data, index, type, isScalar);
|
8477 | },
|
8478 | scaleType: axisScaleType,
|
8479 | axisDisplayUnits: axisDisplayUnits,
|
8480 | axisPrecision: axisPrecision
|
8481 | });
|
8482 | return layout.categoryThickness = axisProperties.categoryThickness, axisProperties;
|
8483 | }
|
8484 | function applyInteractivity(columns, onDragStart) {
|
8485 | onDragStart && columns.attr("draggable", "true").on("dragstart", onDragStart);
|
8486 | }
|
8487 | function getFillOpacity(selected, highlight, hasSelection, hasPartialHighlights) {
|
8488 | return hasPartialHighlights && !highlight || hasSelection && !selected ? ColumnUtil.DimmedOpacity : ColumnUtil.DefaultOpacity;
|
8489 | }
|
8490 | function getClosestColumnIndex(coordinate, columnsCenters) {
|
8491 | for (var currentIndex = 0, distance = Number.MAX_VALUE, i = 0, ilen = columnsCenters.length; ilen > i; i++) {
|
8492 | var currentDistance = Math.abs(coordinate - columnsCenters[i]);
|
8493 | distance > currentDistance && (distance = currentDistance, currentIndex = i);
|
8494 | }
|
8495 | return currentIndex;
|
8496 | }
|
8497 | function setChosenColumnOpacity(mainGraphicsContext, columnGroupSelector, selectedColumnIndex, lastColumnIndex) {
|
8498 | var series = mainGraphicsContext.selectAll(visuals.ColumnChart.SeriesClasses.selector), lastColumnUndefined = "undefined" == typeof lastColumnIndex;
|
8499 | series.selectAll(rectName + columnGroupSelector).filter(function(d) {
|
8500 | return d.categoryIndex !== selectedColumnIndex && (lastColumnUndefined || d.categoryIndex === lastColumnIndex);
|
8501 | }).transition().style("fill-opacity", ColumnUtil.DimmedOpacity), series.selectAll(rectName + columnGroupSelector).filter(function(d) {
|
8502 | return d.categoryIndex === selectedColumnIndex;
|
8503 | }).style("fill-opacity", ColumnUtil.DefaultOpacity);
|
8504 | }
|
8505 | function drawSeries(data, graphicsContext, axisOptions) {
|
8506 | var colGroupSelection = graphicsContext.selectAll(visuals.ColumnChart.SeriesClasses.selector), series = colGroupSelection.data(data.series, function(d) {
|
8507 | return d.key;
|
8508 | });
|
8509 | return series.enter().append("g").classed(visuals.ColumnChart.SeriesClasses["class"], !0),
|
8510 | series.style({
|
8511 | fill: function(d) {
|
8512 | return d.color;
|
8513 | }
|
8514 | }), series.exit().remove(), series;
|
8515 | }
|
8516 | function drawDefaultShapes(data, series, layout, itemCS, filterZeros, hasSelection) {
|
8517 | var dataSelector;
|
8518 | dataSelector = filterZeros ? function(d) {
|
8519 | var filteredData = _.filter(d.data, function(datapoint) {
|
8520 | return !!datapoint.value;
|
8521 | });
|
8522 | return filteredData;
|
8523 | } : function(d) {
|
8524 | return d.data;
|
8525 | };
|
8526 | var shapeSelection = series.selectAll(itemCS.selector), shapes = shapeSelection.data(dataSelector, function(d) {
|
8527 | return d.key;
|
8528 | });
|
8529 | return shapes.enter().append(rectName).attr("class", function(d) {
|
8530 | return itemCS["class"].concat(d.highlight ? " highlight" : "");
|
8531 | }), shapes.style("fill-opacity", function(d) {
|
8532 | return ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, data.hasHighlights);
|
8533 | }).style("fill", function(d) {
|
8534 | return d.color !== data.series[d.seriesIndex].color ? d.color : null;
|
8535 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
8536 | }
|
8537 | function drawDefaultLabels(series, context, layout, viewPort, isAnimator, animationDuration) {
|
8538 | if (void 0 === isAnimator && (isAnimator = !1), series) {
|
8539 | for (var seriesData = series.data(), dataPoints = [], i = 0, len = seriesData.length; len > i; i++) Array.prototype.push.apply(dataPoints, seriesData[i].data);
|
8540 | return visuals.dataLabelUtils.drawDefaultLabelsForDataPointChart(dataPoints, context, layout, viewPort, isAnimator, animationDuration);
|
8541 | }
|
8542 | visuals.dataLabelUtils.cleanDataLabels(context);
|
8543 | }
|
8544 | function normalizeInfinityInScale(scale) {
|
8545 | 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);
|
8546 | scale.domain(scaledDomain);
|
8547 | }
|
8548 | function calculatePosition(d, axisOptions) {
|
8549 | var xScale = axisOptions.xScale, yScale = axisOptions.yScale, scaledY0 = yScale(0), scaledX0 = xScale(0);
|
8550 | switch (d.chartType) {
|
8551 | case visuals.ColumnChartType.stackedBar:
|
8552 | case visuals.ColumnChartType.hundredPercentStackedBar:
|
8553 | return scaledX0 + Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.valueAbsolute)) + visuals.AxisHelper.diffScaled(xScale, d.position - d.valueAbsolute, 0) + visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8554 |
|
8555 | case visuals.ColumnChartType.clusteredBar:
|
8556 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.max(0, d.value), 0) + visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8557 |
|
8558 | case visuals.ColumnChartType.stackedColumn:
|
8559 | case visuals.ColumnChartType.hundredPercentStackedColumn:
|
8560 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, d.position, 0) - visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8561 |
|
8562 | case visuals.ColumnChartType.clusteredColumn:
|
8563 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, Math.max(0, d.value), 0) - visuals.dataLabelUtils.defaultColumnLabelMargin;
|
8564 | }
|
8565 | }
|
8566 | ColumnUtil.DimmedOpacity = .4, ColumnUtil.DefaultOpacity = 1, ColumnUtil.applyUserMinMax = applyUserMinMax,
|
8567 | ColumnUtil.transformDomain = transformDomain, ColumnUtil.getCategoryAxis = getCategoryAxis,
|
8568 | ColumnUtil.applyInteractivity = applyInteractivity, ColumnUtil.getFillOpacity = getFillOpacity,
|
8569 | ColumnUtil.getClosestColumnIndex = getClosestColumnIndex, ColumnUtil.setChosenColumnOpacity = setChosenColumnOpacity,
|
8570 | ColumnUtil.drawSeries = drawSeries, ColumnUtil.drawDefaultShapes = drawDefaultShapes,
|
8571 | ColumnUtil.drawDefaultLabels = drawDefaultLabels, ColumnUtil.normalizeInfinityInScale = normalizeInfinityInScale,
|
8572 | ColumnUtil.calculatePosition = calculatePosition;
|
8573 | }(ColumnUtil = visuals.ColumnUtil || (visuals.ColumnUtil = {}));
|
8574 | var ClusteredUtil;
|
8575 | !function(ClusteredUtil) {
|
8576 | function clearColumns(mainGraphicsContext, itemCS) {
|
8577 | var cols = mainGraphicsContext.selectAll(itemCS.selector).data([]);
|
8578 | cols.exit().remove();
|
8579 | }
|
8580 | ClusteredUtil.clearColumns = clearColumns;
|
8581 | }(ClusteredUtil = visuals.ClusteredUtil || (visuals.ClusteredUtil = {}));
|
8582 | var StackedUtil;
|
8583 | !function(StackedUtil) {
|
8584 | function getSize(scale, size, zeroVal) {
|
8585 | return void 0 === zeroVal && (zeroVal = 0), visuals.AxisHelper.diffScaled(scale, zeroVal, size);
|
8586 | }
|
8587 | function calcValueDomain(data, is100pct) {
|
8588 | var defaultNumberRange = {
|
8589 | min: 0,
|
8590 | max: 10
|
8591 | };
|
8592 | if (0 === data.length) return defaultNumberRange;
|
8593 | var min = d3.min(data, function(d) {
|
8594 | return d3.min(d.data, function(e) {
|
8595 | return e.position - e.valueAbsolute;
|
8596 | });
|
8597 | }), max = d3.max(data, function(d) {
|
8598 | return d3.max(d.data, function(e) {
|
8599 | return e.position;
|
8600 | });
|
8601 | });
|
8602 | return is100pct && (min = powerbi.Double.roundToPrecision(min, PctRoundingError),
|
8603 | max = powerbi.Double.roundToPrecision(max, PctRoundingError)), {
|
8604 | min: min,
|
8605 | max: max
|
8606 | };
|
8607 | }
|
8608 | function getStackedMultiplier(dataView, rowIdx, seriesCount, categoryCount, converterStrategy) {
|
8609 | for (var pos = 0, neg = 0, i = 0; seriesCount > i; i++) {
|
8610 | var value = converterStrategy.getValueBySeriesAndCategory(i, rowIdx);
|
8611 | value = visuals.AxisHelper.normalizeNonFiniteNumber(value), value > 0 ? pos += value : 0 > value && (neg -= value);
|
8612 | }
|
8613 | var absTotal = pos + neg;
|
8614 | return {
|
8615 | pos: pos ? pos / absTotal / pos : 1,
|
8616 | neg: neg ? neg / absTotal / neg : 1
|
8617 | };
|
8618 | }
|
8619 | function clearColumns(mainGraphicsContext, itemCS) {
|
8620 | var bars = mainGraphicsContext.selectAll(itemCS.selector).data([]);
|
8621 | bars.exit().remove();
|
8622 | }
|
8623 | var PctRoundingError = 1e-4;
|
8624 | StackedUtil.getSize = getSize, StackedUtil.calcValueDomain = calcValueDomain, StackedUtil.getStackedMultiplier = getStackedMultiplier,
|
8625 | StackedUtil.clearColumns = clearColumns;
|
8626 | }(StackedUtil = visuals.StackedUtil || (visuals.StackedUtil = {}));
|
8627 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8628 | }(powerbi || (powerbi = {}));
|
8629 |
|
8630 | var powerbi;
|
8631 |
|
8632 | !function(powerbi) {
|
8633 | var visuals;
|
8634 | !function(visuals) {
|
8635 | var converterHelper, DataRoleHelper = powerbi.data.DataRoleHelper;
|
8636 | !function(converterHelper) {
|
8637 | function categoryIsAlsoSeriesRole(dataView, seriesRoleName, categoryRoleName) {
|
8638 | if (dataView.categories && dataView.categories.length > 0) {
|
8639 | var category = dataView.categories[0];
|
8640 | return category.source && DataRoleHelper.hasRole(category.source, seriesRoleName) && DataRoleHelper.hasRole(category.source, categoryRoleName);
|
8641 | }
|
8642 | return !1;
|
8643 | }
|
8644 | function getPivotedCategories(dataView, formatStringProp) {
|
8645 | if (dataView.categories && dataView.categories.length > 0) {
|
8646 | var category = dataView.categories[0], categoryValues = category.values;
|
8647 | return category.values.length > 0 ? {
|
8648 | categories: categoryValues,
|
8649 | categoryFormatter: visuals.valueFormatter.create({
|
8650 | format: visuals.valueFormatter.getFormatString(category.source, formatStringProp),
|
8651 | value: categoryValues[0],
|
8652 | value2: categoryValues[categoryValues.length - 1],
|
8653 | displayUnitSystemType: powerbi.DisplayUnitSystemType.Verbose
|
8654 | }),
|
8655 | categoryIdentities: category.identity,
|
8656 | categoryObjects: category.objects
|
8657 | } : {
|
8658 | categories: [],
|
8659 | categoryFormatter: {
|
8660 | format: visuals.valueFormatter.format
|
8661 | }
|
8662 | };
|
8663 | }
|
8664 | return defaultCategories();
|
8665 | }
|
8666 | function getSeriesName(source) {
|
8667 | return void 0 !== source.groupName ? source.groupName : source.queryName;
|
8668 | }
|
8669 | function getFormattedLegendLabel(source, values, formatStringProp) {
|
8670 | var sourceForFormat = source, nameForFormat = source.displayName;
|
8671 | return void 0 !== source.groupName && (sourceForFormat = values.source, nameForFormat = source.groupName),
|
8672 | visuals.valueFormatter.format(nameForFormat, visuals.valueFormatter.getFormatString(sourceForFormat, formatStringProp));
|
8673 | }
|
8674 | function defaultCategories() {
|
8675 | return {
|
8676 | categories: [ null ],
|
8677 | categoryFormatter: {
|
8678 | format: visuals.valueFormatter.format
|
8679 | }
|
8680 | };
|
8681 | }
|
8682 | function createAxesLabels(categoryAxisProperties, valueAxisProperties, category, values) {
|
8683 | var xAxisLabel = null, yAxisLabel = null;
|
8684 | if (categoryAxisProperties && category && category.displayName && (xAxisLabel = category.displayName),
|
8685 | valueAxisProperties) {
|
8686 | var valuesNames = [];
|
8687 | values && (valuesNames = values.map(function(v) {
|
8688 | return v ? v.displayName : "";
|
8689 | }).filter(function(value, index, self) {
|
8690 | return "" !== value && self.indexOf(value) === index;
|
8691 | }), yAxisLabel = visuals.valueFormatter.formatListAnd(valuesNames));
|
8692 | }
|
8693 | return {
|
8694 | xAxisLabel: xAxisLabel,
|
8695 | yAxisLabel: yAxisLabel
|
8696 | };
|
8697 | }
|
8698 | function isImageUrlColumn(column) {
|
8699 | var misc = getMiscellaneousTypeDescriptor(column);
|
8700 | return null != misc && misc.imageUrl === !0;
|
8701 | }
|
8702 | function isWebUrlColumn(column) {
|
8703 | var misc = getMiscellaneousTypeDescriptor(column);
|
8704 | return null != misc && misc.webUrl === !0;
|
8705 | }
|
8706 | function getMiscellaneousTypeDescriptor(column) {
|
8707 | return column && column.type && column.type.misc;
|
8708 | }
|
8709 | function hasImageUrlColumn(dataView) {
|
8710 | return dataView && dataView.metadata && !_.isEmpty(dataView.metadata.columns) ? _.any(dataView.metadata.columns, function(column) {
|
8711 | return isImageUrlColumn(column) === !0;
|
8712 | }) : !1;
|
8713 | }
|
8714 | function formatFromMetadataColumn(value, column, formatStringProp) {
|
8715 | var formatString = visuals.valueFormatter.getFormatString(column, formatStringProp, !0);
|
8716 | return !formatString && column && (formatString = column.format), visuals.valueFormatter.format(value, formatString);
|
8717 | }
|
8718 | converterHelper.categoryIsAlsoSeriesRole = categoryIsAlsoSeriesRole, converterHelper.getPivotedCategories = getPivotedCategories,
|
8719 | converterHelper.getSeriesName = getSeriesName, converterHelper.getFormattedLegendLabel = getFormattedLegendLabel,
|
8720 | converterHelper.createAxesLabels = createAxesLabels, converterHelper.isImageUrlColumn = isImageUrlColumn,
|
8721 | converterHelper.isWebUrlColumn = isWebUrlColumn, converterHelper.hasImageUrlColumn = hasImageUrlColumn,
|
8722 | converterHelper.formatFromMetadataColumn = formatFromMetadataColumn;
|
8723 | }(converterHelper = visuals.converterHelper || (visuals.converterHelper = {}));
|
8724 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
8725 | }(powerbi || (powerbi = {}));
|
8726 |
|
8727 | var powerbi;
|
8728 |
|
8729 | !function(powerbi) {
|
8730 | var visuals;
|
8731 | !function(visuals) {
|
8732 | var dataLabelUtils, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, LabelStyle = visuals.labelStyle;
|
8733 | !function(dataLabelUtils) {
|
8734 | function updateLabelSettingsFromLabelsObject(labelsObj, labelSettings) {
|
8735 | labelsObj && (void 0 !== labelsObj.show && (labelSettings.show = labelsObj.show),
|
8736 | void 0 !== labelsObj.showSeries && (labelSettings.show = labelsObj.showSeries),
|
8737 | void 0 !== labelsObj.color && (labelSettings.labelColor = labelsObj.color.solid.color),
|
8738 | void 0 !== labelsObj.labelDisplayUnits && (labelSettings.displayUnits = labelsObj.labelDisplayUnits),
|
8739 | void 0 !== labelsObj.labelPrecision && (labelSettings.precision = labelsObj.labelPrecision >= 0 ? labelsObj.labelPrecision : dataLabelUtils.defaultLabelPrecision),
|
8740 | void 0 !== labelsObj.fontSize && (labelSettings.fontSize = labelsObj.fontSize),
|
8741 | void 0 !== labelsObj.showAll && (labelSettings.showLabelPerSeries = labelsObj.showAll),
|
8742 | void 0 !== labelsObj.labelStyle && (labelSettings.labelStyle = labelsObj.labelStyle));
|
8743 | }
|
8744 | function updateLineChartLabelSettingsFromLabelsObject(labelsObj, labelSettings) {
|
8745 | updateLabelSettingsFromLabelsObject(labelsObj, labelSettings), labelsObj && void 0 !== labelsObj.labelDensity && (labelSettings.labelDensity = labelsObj.labelDensity);
|
8746 | }
|
8747 | function getDefaultLabelSettings(show, labelColor, fontSize) {
|
8748 | return void 0 === show && (show = !1), {
|
8749 | show: show,
|
8750 | position: 0,
|
8751 | displayUnits: 0,
|
8752 | precision: dataLabelUtils.defaultLabelPrecision,
|
8753 | labelColor: labelColor || dataLabelUtils.defaultLabelColor,
|
8754 | formatterOptions: null,
|
8755 | fontSize: fontSize || dataLabelUtils.DefaultFontSizeInPt
|
8756 | };
|
8757 | }
|
8758 | function getDefaultCardLabelSettings(labelColor, categoryLabelColor, fontSize) {
|
8759 | var labelSettings = getDefaultLabelSettings(!0, labelColor, fontSize);
|
8760 | return labelSettings.showCategory = !0, labelSettings.categoryLabelColor = categoryLabelColor,
|
8761 | labelSettings;
|
8762 | }
|
8763 | function getDefaultTreemapLabelSettings() {
|
8764 | return {
|
8765 | show: !1,
|
8766 | displayUnits: 0,
|
8767 | precision: dataLabelUtils.defaultLabelPrecision,
|
8768 | labelColor: dataLabelUtils.defaultInsideLabelColor,
|
8769 | showCategory: !0,
|
8770 | formatterOptions: null
|
8771 | };
|
8772 | }
|
8773 | function getDefaultSunburstLabelSettings() {
|
8774 | return {
|
8775 | show: !1,
|
8776 | labelColor: dataLabelUtils.defaultInsideLabelColor,
|
8777 | fontSize: dataLabelUtils.DefaultFontSizeInPt,
|
8778 | displayUnits: 0,
|
8779 | precision: dataLabelUtils.defaultLabelPrecision,
|
8780 | showCategory: !0
|
8781 | };
|
8782 | }
|
8783 | function getDefaultColumnLabelSettings(isLabelPositionInside) {
|
8784 | var labelSettings = getDefaultLabelSettings(!1, void 0);
|
8785 | return labelSettings.position = null, labelSettings.labelColor = void 0, labelSettings;
|
8786 | }
|
8787 | function getDefaultPointLabelSettings() {
|
8788 | return {
|
8789 | show: !1,
|
8790 | position: 0,
|
8791 | displayUnits: 0,
|
8792 | precision: dataLabelUtils.defaultLabelPrecision,
|
8793 | labelColor: dataLabelUtils.defaultLabelColor,
|
8794 | formatterOptions: null,
|
8795 | fontSize: dataLabelUtils.DefaultFontSizeInPt
|
8796 | };
|
8797 | }
|
8798 | function getDefaultLineChartLabelSettings(isComboChart) {
|
8799 | return {
|
8800 | show: !1,
|
8801 | position: 0,
|
8802 | displayUnits: 0,
|
8803 | precision: dataLabelUtils.defaultLabelPrecision,
|
8804 | labelColor: dataLabelUtils.defaultLabelColor,
|
8805 | formatterOptions: null,
|
8806 | fontSize: dataLabelUtils.DefaultFontSizeInPt,
|
8807 | labelDensity: isComboChart ? visuals.NewDataLabelUtils.LabelDensityMax : visuals.NewDataLabelUtils.LabelDensityMin
|
8808 | };
|
8809 | }
|
8810 | function getDefaultMapLabelSettings() {
|
8811 | return {
|
8812 | show: !1,
|
8813 | showCategory: !1,
|
8814 | position: 0,
|
8815 | displayUnits: 0,
|
8816 | precision: dataLabelUtils.defaultLabelPrecision,
|
8817 | labelColor: dataLabelUtils.defaultInsideLabelColor,
|
8818 | formatterOptions: null,
|
8819 | fontSize: dataLabelUtils.DefaultFontSizeInPt
|
8820 | };
|
8821 | }
|
8822 | function getDefaultDonutLabelSettings() {
|
8823 | var labelSettings = dataLabelUtils.getDefaultLabelSettings(!0, dataLabelUtils.defaultLabelColor, dataLabelUtils.DefaultFontSizeInPt);
|
8824 | return labelSettings.labelStyle = LabelStyle.category, labelSettings;
|
8825 | }
|
8826 | function getDefaultGaugeLabelSettings() {
|
8827 | return {
|
8828 | show: !0,
|
8829 | displayUnits: 0,
|
8830 | precision: dataLabelUtils.defaultLabelPrecision,
|
8831 | labelColor: null,
|
8832 | position: null,
|
8833 | fontSize: dataLabelUtils.minLabelFontSize,
|
8834 | formatterOptions: null
|
8835 | };
|
8836 | }
|
8837 | function getDefaultFunnelLabelSettings() {
|
8838 | return {
|
8839 | show: !0,
|
8840 | position: powerbi.visuals.labelPosition.insideCenter,
|
8841 | displayUnits: 0,
|
8842 | precision: dataLabelUtils.defaultLabelPrecision,
|
8843 | labelColor: dataLabelUtils.defaultLabelColor,
|
8844 | formatterOptions: null,
|
8845 | fontSize: dataLabelUtils.DefaultFontSizeInPt
|
8846 | };
|
8847 | }
|
8848 | function getDefaultKpiLabelSettings() {
|
8849 | return {
|
8850 | show: !1,
|
8851 | displayUnits: 0,
|
8852 | precision: dataLabelUtils.defaultLabelPrecision,
|
8853 | labelColor: dataLabelUtils.defaultLabelColor,
|
8854 | position: null,
|
8855 | showCategory: !0,
|
8856 | formatterOptions: null
|
8857 | };
|
8858 | }
|
8859 | function getLabelPrecision(precision, format) {
|
8860 | if (precision !== dataLabelUtils.defaultLabelPrecision) return precision;
|
8861 | if ("g" !== format && "G" !== format) {
|
8862 | if (format) {
|
8863 | var positiveFormat = format.split(";")[0], formatMetadata = powerbi.NumberFormat.getCustomFormatMetadata(positiveFormat, !0);
|
8864 | if (formatMetadata.hasDots) return formatMetadata.precision;
|
8865 | }
|
8866 | return defaultCountLabelPrecision;
|
8867 | }
|
8868 | }
|
8869 | function drawDefaultLabelsForDataPointChart(data, context, layout, viewport, isAnimator, animationDuration, hasSelection) {
|
8870 | void 0 === isAnimator && (isAnimator = !1);
|
8871 | var dataLabelManager = new powerbi.DataLabelManager(), filteredData = dataLabelManager.hideCollidedLabels(viewport, data, layout), hasAnimation = isAnimator && !!animationDuration, labels = selectLabels(filteredData, context, !1, hasAnimation);
|
8872 | return labels ? (hasAnimation ? (labels.text(function(d) {
|
8873 | return d.labeltext;
|
8874 | }).transition().duration(animationDuration).style(layout.style).style("opacity", hasSelection ? function(d) {
|
8875 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
8876 | } : 1).attr({
|
8877 | x: function(d) {
|
8878 | return d.labelX;
|
8879 | },
|
8880 | y: function(d) {
|
8881 | return d.labelY;
|
8882 | }
|
8883 | }), labels.exit().transition().duration(animationDuration).style("opacity", 0).remove()) : (labels.attr({
|
8884 | x: function(d) {
|
8885 | return d.labelX;
|
8886 | },
|
8887 | y: function(d) {
|
8888 | return d.labelY;
|
8889 | }
|
8890 | }).text(function(d) {
|
8891 | return d.labeltext;
|
8892 | }).style(layout.style), labels.exit().remove()), labels) : void 0;
|
8893 | }
|
8894 | function drawDefaultLabelsForFunnelChart(data, context, layout, isAnimator, animationDuration) {
|
8895 | void 0 === isAnimator && (isAnimator = !1);
|
8896 | var filteredData = data.filter(layout.filter), labels = selectLabels(filteredData, context);
|
8897 | return labels ? (labels.attr(layout.labelLayout).text(layout.labelText).style(layout.style),
|
8898 | isAnimator && animationDuration && labels.transition().duration(animationDuration),
|
8899 | labels.exit().remove(), labels) : void 0;
|
8900 | }
|
8901 | function selectLabels(filteredData, context, isDonut, forAnimation) {
|
8902 | if (void 0 === isDonut && (isDonut = !1), void 0 === forAnimation && (forAnimation = !1),
|
8903 | 0 === filteredData.length) return cleanDataLabels(context, !0), null;
|
8904 | context.select(labelGraphicsContextClass.selector).empty() && context.append("g").classed(labelGraphicsContextClass["class"], !0);
|
8905 | var hasKey = null != filteredData[0].key, hasDataPointIdentity = null != filteredData[0].identity, getIdentifier = hasKey ? function(d) {
|
8906 | return d.key;
|
8907 | } : hasDataPointIdentity ? function(d) {
|
8908 | return d.identity.getKey();
|
8909 | } : void 0, labels = isDonut ? context.select(labelGraphicsContextClass.selector).selectAll(labelsClass.selector).data(filteredData, function(d) {
|
8910 | return d.data.identity.getKey();
|
8911 | }) : 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);
|
8912 | return forAnimation && newLabels.style("opacity", 0), labels;
|
8913 | }
|
8914 | function cleanDataLabels(context, removeLines) {
|
8915 | void 0 === removeLines && (removeLines = !1);
|
8916 | var empty = [], labels = context.selectAll(labelsClass.selector).data(empty);
|
8917 | if (labels.exit().remove(), context.selectAll(labelGraphicsContextClass.selector).remove(),
|
8918 | removeLines) {
|
8919 | var lines = context.selectAll(lineClass.selector).data(empty);
|
8920 | lines.exit().remove(), context.selectAll(linesGraphicsContextClass.selector).remove();
|
8921 | }
|
8922 | }
|
8923 | function setHighlightedLabelsOpacity(context, hasSelection, hasHighlights) {
|
8924 | context.selectAll(labelsClass.selector).style("fill-opacity", function(d) {
|
8925 | var labelOpacity = visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, !d.highlight && hasSelection, !d.selected && hasHighlights) < 1 ? 0 : 1;
|
8926 | return labelOpacity;
|
8927 | });
|
8928 | }
|
8929 | function getLabelFormattedText(options) {
|
8930 | var properties = {
|
8931 | text: options.formatter ? options.formatter.format(options.label) : powerbi.formattingService.formatValue(options.label, options.format),
|
8932 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
8933 | fontSize: PixelConverter.fromPoint(options.fontSize),
|
8934 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
8935 | };
|
8936 | return powerbi.TextMeasurementService.getTailoredTextOrDefault(properties, options.maxWidth ? options.maxWidth : dataLabelUtils.maxLabelWidth);
|
8937 | }
|
8938 | function getLabelLayoutXYForWaterfall(xAxisProperties, categoryWidth, yAxisProperties, dataDomain) {
|
8939 | return {
|
8940 | x: function(d) {
|
8941 | return xAxisProperties.scale(d.categoryIndex) + categoryWidth / 2;
|
8942 | },
|
8943 | y: function(d) {
|
8944 | return getWaterfallLabelYPosition(yAxisProperties.scale, d, dataDomain);
|
8945 | }
|
8946 | };
|
8947 | }
|
8948 | function getWaterfallLabelYPosition(scale, d, dataDomain) {
|
8949 | var yValue = scale(0) - scale(Math.abs(d.value)), yPos = scale(d.position), scaleMinDomain = scale(dataDomain[0]), endPosition = scale(d.position + d.value);
|
8950 | if (d.value < 0) {
|
8951 | var properties = {
|
8952 | text: d.labeltext,
|
8953 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
8954 | fontSize: dataLabelUtils.LabelTextProperties.fontSize,
|
8955 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
8956 | }, outsideBelowPosition = yPos + yValue + powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
8957 | if (scaleMinDomain > outsideBelowPosition) return outsideBelowPosition;
|
8958 | } else {
|
8959 | var outsideAbovePosition = yPos - yValue - dataLabelUtils.labelMargin;
|
8960 | if (outsideAbovePosition > 0) return outsideAbovePosition;
|
8961 | }
|
8962 | return d.isLabelInside = !0, getWaterfallInsideLabelYPosition(yPos, endPosition, scaleMinDomain);
|
8963 | }
|
8964 | function getWaterfallInsideLabelYPosition(startPosition, endPosition, scaleMinDomain) {
|
8965 | return startPosition = 0 > startPosition ? 0 : startPosition, startPosition = startPosition > scaleMinDomain ? scaleMinDomain : startPosition,
|
8966 | endPosition = 0 > endPosition ? 0 : endPosition, endPosition = endPosition > scaleMinDomain ? scaleMinDomain : endPosition,
|
8967 | Math.abs(endPosition - startPosition) / 2 + Math.min(startPosition, endPosition);
|
8968 | }
|
8969 | function doesDataLabelFitInShape(d, yAxisProperties, layout) {
|
8970 | if (null == d || null === d.value) return !1;
|
8971 | var properties = {
|
8972 | text: layout.labelText(d),
|
8973 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
8974 | fontSize: dataLabelUtils.LabelTextProperties.fontSize,
|
8975 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
8976 | }, outsidePosition = visuals.WaterfallChart.getRectTop(yAxisProperties.scale, d.position, d.value) - dataLabelUtils.labelMargin;
|
8977 | if (outsidePosition > 0) return !0;
|
8978 | 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));
|
8979 | return !(textWidth > shapeWidth || textHeight > shapeHeight);
|
8980 | }
|
8981 | function getMapLabelLayout(labelSettings) {
|
8982 | return {
|
8983 | labelText: function(d) {
|
8984 | return getLabelFormattedText({
|
8985 | label: d.labeltext,
|
8986 | fontSize: labelSettings.fontSize
|
8987 | });
|
8988 | },
|
8989 | labelLayout: {
|
8990 | x: function(d) {
|
8991 | return d.x;
|
8992 | },
|
8993 | y: function(d) {
|
8994 | var margin = d.radius + dataLabelUtils.labelMargin;
|
8995 | return 0 === labelSettings.position ? d.y - margin : d.y + margin;
|
8996 | }
|
8997 | },
|
8998 | filter: function(d) {
|
8999 | return null != d && null != d.labeltext;
|
9000 | },
|
9001 | style: {
|
9002 | fill: function(d) {
|
9003 | return d.labelFill;
|
9004 | },
|
9005 | "font-size": PixelConverter.fromPoint(labelSettings.fontSize)
|
9006 | }
|
9007 | };
|
9008 | }
|
9009 | function getColumnChartLabelLayout(data, labelLayoutXY, isColumn, isHundredPercent, axisFormatter, axisOptions, interactivityService, visualWidth) {
|
9010 | var formatOverride = isHundredPercent ? dataLabelUtils.hundredPercentFormat : null, formattersCache = createColumnFormatterCacheManager(), hasSelection = interactivityService ? interactivityService.hasSelection() : !1;
|
9011 | return {
|
9012 | labelText: function(d) {
|
9013 | var formatString = null != formatOverride ? formatOverride : d.labelFormatString, value2 = getDisplayUnitValueFromAxisFormatter(axisFormatter, d.labelSettings), formatter = formattersCache.getOrCreate(formatString, d.labelSettings, value2);
|
9014 | return getLabelFormattedText({
|
9015 | label: formatter.format(d.value),
|
9016 | maxWidth: dataLabelUtils.maxLabelWidth
|
9017 | });
|
9018 | },
|
9019 | labelLayout: labelLayoutXY,
|
9020 | filter: function(d) {
|
9021 | return dataLabelUtils.getColumnChartLabelFilter(d, hasSelection, data.hasHighlights, axisOptions, visualWidth);
|
9022 | },
|
9023 | style: {
|
9024 | fill: function(d) {
|
9025 | return d.labelFill;
|
9026 | },
|
9027 | "text-anchor": isColumn ? "middle" : "start"
|
9028 | }
|
9029 | };
|
9030 | }
|
9031 | function validateLabelsSize(d, axisOptions, visualWidth) {
|
9032 | var shapeWidth, shapeHeight, xScale = axisOptions.xScale, yScale = axisOptions.yScale, columnWidth = axisOptions.columnWidth, properties = {
|
9033 | text: d.labeltext,
|
9034 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9035 | fontSize: dataLabelUtils.LabelTextProperties.fontSize,
|
9036 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9037 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties), inside = !1, outsidePosition = visuals.ColumnUtil.calculatePosition(d, axisOptions);
|
9038 | switch (d.chartType) {
|
9039 | case visuals.ColumnChartType.stackedBar:
|
9040 | case visuals.ColumnChartType.hundredPercentStackedBar:
|
9041 | (!d.lastSeries || outsidePosition + textWidth > visualWidth || d.chartType === visuals.ColumnChartType.hundredPercentStackedBar) && (shapeWidth = -visuals.StackedUtil.getSize(xScale, d.valueAbsolute),
|
9042 | shapeHeight = columnWidth, inside = !0);
|
9043 | break;
|
9044 |
|
9045 | case visuals.ColumnChartType.clusteredBar:
|
9046 | outsidePosition + textWidth > visualWidth && (shapeWidth = Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.value)),
|
9047 | shapeHeight = columnWidth, inside = !0);
|
9048 | break;
|
9049 |
|
9050 | case visuals.ColumnChartType.stackedColumn:
|
9051 | case visuals.ColumnChartType.hundredPercentStackedColumn:
|
9052 | (!d.lastSeries || 0 >= outsidePosition || d.chartType === visuals.ColumnChartType.hundredPercentStackedColumn) && (shapeWidth = columnWidth,
|
9053 | shapeHeight = visuals.StackedUtil.getSize(yScale, d.valueAbsolute), inside = !0);
|
9054 | break;
|
9055 |
|
9056 | case visuals.ColumnChartType.clusteredColumn:
|
9057 | 0 >= outsidePosition && (shapeWidth = columnWidth, shapeHeight = Math.abs(visuals.AxisHelper.diffScaled(yScale, 0, d.value)),
|
9058 | inside = !0);
|
9059 | break;
|
9060 |
|
9061 | default:
|
9062 | return !0;
|
9063 | }
|
9064 | return !inside || !(textWidth > shapeWidth || textHeight > shapeHeight);
|
9065 | }
|
9066 | function getColumnChartLabelFilter(d, hasSelection, hasHighlights, axisOptions, visualWidth) {
|
9067 | 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);
|
9068 | return null != d && null != d.value && validateLabelsSize(d, axisOptions, visualWidth) && 1 === shapesOpacity;
|
9069 | }
|
9070 | function getScatterChartLabelLayout(xScale, yScale, labelSettings, viewport, sizeRange) {
|
9071 | return {
|
9072 | labelText: function(d) {
|
9073 | return getLabelFormattedText({
|
9074 | label: d.formattedCategory.getValue(),
|
9075 | maxWidth: 2 * dataLabelUtils.maxLabelWidth
|
9076 | });
|
9077 | },
|
9078 | labelLayout: {
|
9079 | x: function(d) {
|
9080 | return xScale(d.x);
|
9081 | },
|
9082 | y: function(d) {
|
9083 | var margin = visuals.ScatterChart.getBubbleRadius(d.radius, sizeRange, viewport) + dataLabelUtils.labelMargin;
|
9084 | return 0 === labelSettings.position ? yScale(d.y) - margin : yScale(d.y) + margin;
|
9085 | }
|
9086 | },
|
9087 | filter: function(d) {
|
9088 | return null != d && null != d.formattedCategory.getValue();
|
9089 | },
|
9090 | style: {
|
9091 | fill: function(d) {
|
9092 | return d.labelFill;
|
9093 | }
|
9094 | }
|
9095 | };
|
9096 | }
|
9097 | function getLineChartLabelLayout(xScale, yScale, labelSettings, isScalar, axisFormatter) {
|
9098 | var formattersCache = createColumnFormatterCacheManager();
|
9099 | return {
|
9100 | labelText: function(d) {
|
9101 | var value2 = getDisplayUnitValueFromAxisFormatter(axisFormatter, d.labelSettings), formatter = formattersCache.getOrCreate(d.labelFormatString, d.labelSettings, value2);
|
9102 | return getLabelFormattedText({
|
9103 | label: formatter.format(d.value)
|
9104 | });
|
9105 | },
|
9106 | labelLayout: {
|
9107 | x: function(d) {
|
9108 | return xScale(isScalar ? d.categoryValue : d.categoryIndex);
|
9109 | },
|
9110 | y: function(d) {
|
9111 | return 0 === labelSettings.position ? yScale(d.value) - dataLabelUtils.labelMargin : yScale(d.value) + dataLabelUtils.labelMargin;
|
9112 | }
|
9113 | },
|
9114 | filter: function(d) {
|
9115 | return null != d && null != d.value;
|
9116 | },
|
9117 | style: {
|
9118 | fill: function(d) {
|
9119 | return d.labelFill;
|
9120 | },
|
9121 | "font-size": function(d) {
|
9122 | return PixelConverter.fromPoint(d.labelSettings.fontSize);
|
9123 | }
|
9124 | }
|
9125 | };
|
9126 | }
|
9127 | function getFunnelChartLabelLayout(data, axisOptions, textMinimumPadding, labelSettings, currentViewport) {
|
9128 | var categoryScale = axisOptions.categoryScale, valueScale = axisOptions.valueScale, marginLeft = axisOptions.margin.left, innerTextHeightRate = .7, rangeBand = axisOptions.categoryScale.rangeBand(), pixelSpan = axisOptions.maxWidth / 2, formatString = visuals.valueFormatter.getFormatString(data.valuesMetadata[0], visuals.funnelChartProps.general.formatString), textMeasurer = powerbi.TextMeasurementService.measureSvgTextWidth, value2 = null;
|
9129 | if (0 === labelSettings.displayUnits) {
|
9130 | var minY = d3.min(data.slices, function(d) {
|
9131 | return d.value;
|
9132 | }), maxY = d3.max(data.slices, function(d) {
|
9133 | return d.value;
|
9134 | });
|
9135 | value2 = Math.max(Math.abs(minY), Math.abs(maxY));
|
9136 | }
|
9137 | var formattersCache = createColumnFormatterCacheManager();
|
9138 | return {
|
9139 | labelText: function(d) {
|
9140 | var barWidth = Math.abs(categoryScale(d.value) - categoryScale(0)), insideAvailableSpace = Math.abs(categoryScale(d.value) - categoryScale(0)) - 2 * textMinimumPadding, outsideAvailableSpace = pixelSpan - barWidth / 2 - textMinimumPadding, labelFormatString = null != formatString ? formatString : d.labelFormatString, maximumTextSize = Math.max(insideAvailableSpace, outsideAvailableSpace), formatter = formattersCache.getOrCreate(labelFormatString, labelSettings, value2), labelText = formatter.format(visuals.FunnelChart.getFunnelSliceValue(d, !0));
|
9141 | return getLabelFormattedText({
|
9142 | label: labelText,
|
9143 | maxWidth: maximumTextSize,
|
9144 | fontSize: labelSettings.fontSize
|
9145 | });
|
9146 | },
|
9147 | labelLayout: {
|
9148 | y: function(d, i) {
|
9149 | var properties = {
|
9150 | text: d.labeltext,
|
9151 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9152 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
9153 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9154 | }, labelHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
9155 | return categoryScale(d.categoryOrMeasureIndex) + rangeBand / 2 + labelHeight / 2;
|
9156 | },
|
9157 | x: function(d) {
|
9158 | var barWidth = Math.abs(valueScale(d.value) - valueScale(0)), insideAvailableSpace = Math.abs(valueScale(d.value) - valueScale(0)) - 2 * textMinimumPadding, outsideAvailableSpace = pixelSpan - barWidth / 2 - textMinimumPadding, maximumTextSize = Math.max(insideAvailableSpace, outsideAvailableSpace), labelFormatString = null != formatString ? formatString : d.labelFormatString, formatter = formattersCache.getOrCreate(labelFormatString, labelSettings, value2), labelText = formatter.format(visuals.FunnelChart.getFunnelSliceValue(d, !0)), properties = {
|
9159 | text: getLabelFormattedText({
|
9160 | label: labelText,
|
9161 | maxWidth: maximumTextSize
|
9162 | }),
|
9163 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9164 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
9165 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9166 | }, textLength = textMeasurer(properties), labelPositionValue = labelSettings.position;
|
9167 | switch (labelPositionValue === visuals.labelPosition.outsideEnd && textLength > outsideAvailableSpace || 0 === d.value ? labelPositionValue = visuals.labelPosition.insideCenter : labelPositionValue === visuals.labelPosition.insideCenter && textLength > insideAvailableSpace && (labelPositionValue = visuals.labelPosition.outsideEnd),
|
9168 | labelPositionValue) {
|
9169 | case visuals.labelPosition.outsideEnd:
|
9170 | return marginLeft + pixelSpan + barWidth / 2 + textMinimumPadding + textLength / 2;
|
9171 |
|
9172 | default:
|
9173 | return d.labelFill = 0 !== d.value ? dataLabelUtils.defaultInsideLabelColor : d.labelFill,
|
9174 | marginLeft + pixelSpan;
|
9175 | }
|
9176 | },
|
9177 | dy: "-0.15em"
|
9178 | },
|
9179 | filter: function(d) {
|
9180 | if (null == d || null == d.value || data.hasHighlights !== !!d.highlight) return !1;
|
9181 | var properties = {
|
9182 | text: d.labeltext,
|
9183 | fontFamily: dataLabelUtils.LabelTextProperties.fontFamily,
|
9184 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
9185 | fontWeight: dataLabelUtils.LabelTextProperties.fontWeight
|
9186 | }, labelHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties) * innerTextHeightRate;
|
9187 | return rangeBand > labelHeight;
|
9188 | },
|
9189 | style: {
|
9190 | fill: function(d) {
|
9191 | return d.labelFill;
|
9192 | },
|
9193 | "fill-opacity": function(d) {
|
9194 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, !1, !1);
|
9195 | },
|
9196 | "font-size": function(d) {
|
9197 | return PixelConverter.fromPoint(labelSettings.fontSize);
|
9198 | }
|
9199 | }
|
9200 | };
|
9201 | }
|
9202 | function enumerateDataLabels(options) {
|
9203 | if (options.dataLabelsSettings) {
|
9204 | var instance = {
|
9205 | objectName: "labels",
|
9206 | selector: options.selector,
|
9207 | properties: {}
|
9208 | };
|
9209 | if (options.show && options.selector ? instance.properties.showSeries = options.dataLabelsSettings.show : options.show && (instance.properties.show = options.dataLabelsSettings.show),
|
9210 | instance.properties.color = options.dataLabelsSettings.labelColor || dataLabelUtils.defaultLabelColor,
|
9211 | options.displayUnits && (instance.properties.labelDisplayUnits = options.dataLabelsSettings.displayUnits),
|
9212 | options.precision) {
|
9213 | var precision = options.dataLabelsSettings.precision;
|
9214 | instance.properties.labelPrecision = precision === dataLabelUtils.defaultLabelPrecision ? null : precision;
|
9215 | }
|
9216 | if (options.position && (instance.properties.labelPosition = options.dataLabelsSettings.position,
|
9217 | options.positionObject && (instance.validValues = {
|
9218 | labelPosition: options.positionObject
|
9219 | })), options.labelStyle && (instance.properties.labelStyle = options.dataLabelsSettings.labelStyle),
|
9220 | options.fontSize && (instance.properties.fontSize = options.dataLabelsSettings.fontSize),
|
9221 | options.labelDensity) {
|
9222 | var lineChartSettings = options.dataLabelsSettings;
|
9223 | lineChartSettings && (instance.properties.labelDensity = lineChartSettings.labelDensity);
|
9224 | }
|
9225 | return options.showAll && (instance.properties.showAll = options.dataLabelsSettings.showLabelPerSeries),
|
9226 | options.enumeration.pushInstance(instance);
|
9227 | }
|
9228 | }
|
9229 | function enumerateCategoryLabels(enumeration, dataLabelsSettings, withFill, isShowCategory, fontSize) {
|
9230 | void 0 === isShowCategory && (isShowCategory = !1);
|
9231 | var labelSettings = dataLabelsSettings ? dataLabelsSettings : getDefaultPointLabelSettings(), instance = {
|
9232 | objectName: "categoryLabels",
|
9233 | selector: null,
|
9234 | properties: {
|
9235 | show: isShowCategory ? labelSettings.showCategory : labelSettings.show,
|
9236 | fontSize: dataLabelsSettings ? dataLabelsSettings.fontSize : dataLabelUtils.DefaultFontSizeInPt
|
9237 | }
|
9238 | };
|
9239 | withFill && (instance.properties.color = labelSettings.categoryLabelColor ? labelSettings.categoryLabelColor : labelSettings.labelColor),
|
9240 | fontSize && (instance.properties.fontSize = fontSize), enumeration.pushInstance(instance);
|
9241 | }
|
9242 | function getDisplayUnitValueFromAxisFormatter(axisFormatter, labelSettings) {
|
9243 | return axisFormatter && axisFormatter.displayUnit && 0 === labelSettings.displayUnits ? axisFormatter.displayUnit.value : null;
|
9244 | }
|
9245 | function createColumnFormatterCacheManager() {
|
9246 | return {
|
9247 | cache: {
|
9248 | defaultFormatter: null
|
9249 | },
|
9250 | getOrCreate: function(formatString, labelSetting, value2) {
|
9251 | if (formatString) {
|
9252 | var cacheKeyObject = {
|
9253 | formatString: formatString,
|
9254 | displayUnits: labelSetting.displayUnits,
|
9255 | precision: getLabelPrecision(labelSetting.precision, formatString),
|
9256 | value2: value2
|
9257 | }, cacheKey = JSON.stringify(cacheKeyObject);
|
9258 | return this.cache[cacheKey] || (this.cache[cacheKey] = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, cacheKeyObject.precision))),
|
9259 | this.cache[cacheKey];
|
9260 | }
|
9261 | return this.cache.defaultFormatter || (this.cache.defaultFormatter = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, labelSetting.precision))),
|
9262 | this.cache.defaultFormatter;
|
9263 | }
|
9264 | };
|
9265 | }
|
9266 | function getOptionsForLabelFormatter(labelSetting, formatString, value2, precision) {
|
9267 | return {
|
9268 | displayUnitSystemType: powerbi.DisplayUnitSystemType.DataLabels,
|
9269 | format: formatString,
|
9270 | precision: precision,
|
9271 | value: labelSetting.displayUnits,
|
9272 | value2: value2,
|
9273 | allowFormatBeautification: !0
|
9274 | };
|
9275 | }
|
9276 | function isTextWidthOverflows(textWidth, maxTextWidth) {
|
9277 | return textWidth > maxTextWidth;
|
9278 | }
|
9279 | function isTextHeightOverflows(textHeight, innerChordLength) {
|
9280 | return textHeight > innerChordLength;
|
9281 | }
|
9282 | dataLabelUtils.minLabelFontSize = 8, dataLabelUtils.labelMargin = 8, dataLabelUtils.maxLabelWidth = 50,
|
9283 | dataLabelUtils.defaultColumnLabelMargin = 5, dataLabelUtils.defaultColumnHalfLabelHeight = 4,
|
9284 | dataLabelUtils.DefaultDy = "-0.15em", dataLabelUtils.DefaultFontSizeInPt = 9, dataLabelUtils.StandardFontFamily = "wf_segoe-ui_normal",
|
9285 | dataLabelUtils.LabelTextProperties = {
|
9286 | fontFamily: "wf_standard-font",
|
9287 | fontSize: PixelConverter.fromPoint(dataLabelUtils.DefaultFontSizeInPt),
|
9288 | fontWeight: "normal"
|
9289 | }, dataLabelUtils.defaultLabelColor = "#777777", dataLabelUtils.defaultInsideLabelColor = "#ffffff",
|
9290 | dataLabelUtils.hundredPercentFormat = "0.00 %;-0.00 %;0.00 %", dataLabelUtils.defaultLabelPrecision = void 0;
|
9291 | var defaultCountLabelPrecision = 0, labelGraphicsContextClass = createClassAndSelector("labels"), linesGraphicsContextClass = createClassAndSelector("lines"), labelsClass = createClassAndSelector("data-labels"), lineClass = createClassAndSelector("line-label");
|
9292 | dataLabelUtils.updateLabelSettingsFromLabelsObject = updateLabelSettingsFromLabelsObject,
|
9293 | dataLabelUtils.updateLineChartLabelSettingsFromLabelsObject = updateLineChartLabelSettingsFromLabelsObject,
|
9294 | dataLabelUtils.getDefaultLabelSettings = getDefaultLabelSettings, dataLabelUtils.getDefaultCardLabelSettings = getDefaultCardLabelSettings,
|
9295 | dataLabelUtils.getDefaultTreemapLabelSettings = getDefaultTreemapLabelSettings,
|
9296 | dataLabelUtils.getDefaultSunburstLabelSettings = getDefaultSunburstLabelSettings,
|
9297 | dataLabelUtils.getDefaultColumnLabelSettings = getDefaultColumnLabelSettings, dataLabelUtils.getDefaultPointLabelSettings = getDefaultPointLabelSettings,
|
9298 | dataLabelUtils.getDefaultLineChartLabelSettings = getDefaultLineChartLabelSettings,
|
9299 | dataLabelUtils.getDefaultMapLabelSettings = getDefaultMapLabelSettings, dataLabelUtils.getDefaultDonutLabelSettings = getDefaultDonutLabelSettings,
|
9300 | dataLabelUtils.getDefaultGaugeLabelSettings = getDefaultGaugeLabelSettings, dataLabelUtils.getDefaultFunnelLabelSettings = getDefaultFunnelLabelSettings,
|
9301 | dataLabelUtils.getDefaultKpiLabelSettings = getDefaultKpiLabelSettings, dataLabelUtils.getLabelPrecision = getLabelPrecision,
|
9302 | dataLabelUtils.drawDefaultLabelsForDataPointChart = drawDefaultLabelsForDataPointChart,
|
9303 | dataLabelUtils.drawDefaultLabelsForFunnelChart = drawDefaultLabelsForFunnelChart,
|
9304 | dataLabelUtils.cleanDataLabels = cleanDataLabels, dataLabelUtils.setHighlightedLabelsOpacity = setHighlightedLabelsOpacity,
|
9305 | dataLabelUtils.getLabelFormattedText = getLabelFormattedText, dataLabelUtils.getLabelLayoutXYForWaterfall = getLabelLayoutXYForWaterfall,
|
9306 | dataLabelUtils.doesDataLabelFitInShape = doesDataLabelFitInShape, dataLabelUtils.getMapLabelLayout = getMapLabelLayout,
|
9307 | dataLabelUtils.getColumnChartLabelLayout = getColumnChartLabelLayout, dataLabelUtils.getColumnChartLabelFilter = getColumnChartLabelFilter,
|
9308 | dataLabelUtils.getScatterChartLabelLayout = getScatterChartLabelLayout, dataLabelUtils.getLineChartLabelLayout = getLineChartLabelLayout,
|
9309 | dataLabelUtils.getFunnelChartLabelLayout = getFunnelChartLabelLayout, dataLabelUtils.enumerateDataLabels = enumerateDataLabels,
|
9310 | dataLabelUtils.enumerateCategoryLabels = enumerateCategoryLabels, dataLabelUtils.createColumnFormatterCacheManager = createColumnFormatterCacheManager,
|
9311 | dataLabelUtils.getOptionsForLabelFormatter = getOptionsForLabelFormatter, dataLabelUtils.isTextWidthOverflows = isTextWidthOverflows,
|
9312 | dataLabelUtils.isTextHeightOverflows = isTextHeightOverflows;
|
9313 | }(dataLabelUtils = visuals.dataLabelUtils || (visuals.dataLabelUtils = {}));
|
9314 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9315 | }(powerbi || (powerbi = {}));
|
9316 |
|
9317 | var powerbi;
|
9318 |
|
9319 | !function(powerbi) {
|
9320 | var visuals;
|
9321 | !function(visuals) {
|
9322 | var DonutLabelUtils;
|
9323 | !function(DonutLabelUtils) {
|
9324 | function getLabelLeaderLineForDonutChart(donutArcDescriptor, donutProperties, parentPoint, sliceArc) {
|
9325 | void 0 === sliceArc && (sliceArc = 0);
|
9326 | var textPoint, midPoint, chartPoint, innerLinePointMultiplier = 2.05;
|
9327 | if (sliceArc) {
|
9328 | var arc = sliceArc, outerRadius = donutProperties.radius * donutProperties.outerArcRadiusRatio, innerRadius = donutProperties.radius / 2 * donutProperties.innerArcRadiusRatio;
|
9329 | midPoint = [ Math.cos(arc) * outerRadius, Math.sin(arc) * outerRadius ], chartPoint = [ Math.cos(arc) * innerRadius, Math.sin(arc) * innerRadius ];
|
9330 | } else midPoint = donutProperties.outerArc.centroid(donutArcDescriptor), chartPoint = donutProperties.arc.centroid(donutArcDescriptor);
|
9331 | var textPointX = parentPoint.x, lineMargin = visuals.NewDataLabelUtils.maxLabelOffset / 2;
|
9332 | return textPointX += 0 > textPointX ? -lineMargin : lineMargin, textPoint = [ textPointX, parentPoint.y ],
|
9333 | chartPoint[0] *= innerLinePointMultiplier, chartPoint[1] *= innerLinePointMultiplier,
|
9334 | [ chartPoint, midPoint, textPoint ];
|
9335 | }
|
9336 | function getLabelLeaderLinesSizeForDonutChart(leaderLinePoints) {
|
9337 | if (leaderLinePoints && leaderLinePoints.length > 2) {
|
9338 | var diagonalLineSize = {
|
9339 | width: Math.abs(leaderLinePoints[1][0] - leaderLinePoints[0][0]),
|
9340 | height: Math.abs(leaderLinePoints[1][1] - leaderLinePoints[0][1])
|
9341 | }, horizontalLineSize = {
|
9342 | width: Math.abs(leaderLinePoints[2][0] - leaderLinePoints[1][0]),
|
9343 | height: DonutLabelUtils.LineStrokeWidth
|
9344 | };
|
9345 | return [ diagonalLineSize, horizontalLineSize ];
|
9346 | }
|
9347 | return null;
|
9348 | }
|
9349 | function getXPositionForDonutLabel(textPointX) {
|
9350 | var margin = 0 > textPointX ? -visuals.NewDataLabelUtils.maxLabelOffset : visuals.NewDataLabelUtils.maxLabelOffset;
|
9351 | return textPointX += margin;
|
9352 | }
|
9353 | function getSpaceAvailableForDonutLabels(labelXPos, viewport) {
|
9354 | return viewport.width / 2 - Math.abs(labelXPos) - visuals.NewDataLabelUtils.maxLabelOffset;
|
9355 | }
|
9356 | DonutLabelUtils.LineStrokeWidth = 1, DonutLabelUtils.DiagonalLineIndex = 0, DonutLabelUtils.HorizontalLineIndex = 1,
|
9357 | DonutLabelUtils.getLabelLeaderLineForDonutChart = getLabelLeaderLineForDonutChart,
|
9358 | DonutLabelUtils.getLabelLeaderLinesSizeForDonutChart = getLabelLeaderLinesSizeForDonutChart,
|
9359 | DonutLabelUtils.getXPositionForDonutLabel = getXPositionForDonutLabel, DonutLabelUtils.getSpaceAvailableForDonutLabels = getSpaceAvailableForDonutLabels;
|
9360 | }(DonutLabelUtils = visuals.DonutLabelUtils || (visuals.DonutLabelUtils = {}));
|
9361 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9362 | }(powerbi || (powerbi = {}));
|
9363 |
|
9364 | var powerbi;
|
9365 |
|
9366 | !function(powerbi) {
|
9367 | var visuals;
|
9368 | !function(visuals) {
|
9369 | var NewDataLabelUtils, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter;
|
9370 | !function(NewDataLabelUtils) {
|
9371 | function drawDefaultLabels(context, dataLabels, numeric, twoRows, hasTooltip) {
|
9372 | void 0 === numeric && (numeric = !1), void 0 === twoRows && (twoRows = !1), void 0 === hasTooltip && (hasTooltip = !1);
|
9373 | var filteredDataLabels = _.filter(dataLabels, function(d) {
|
9374 | return d.isVisible;
|
9375 | }), labels = context.selectAll(labelsClass.selector).data(filteredDataLabels, labelKeyFunction);
|
9376 | labels.enter().append("text").classed(labelsClass["class"], !0);
|
9377 | var labelAttr = {
|
9378 | x: function(d) {
|
9379 | return d.boundingBox.left + d.boundingBox.width / 2;
|
9380 | },
|
9381 | y: function(d) {
|
9382 | return d.hasBackground ? d.boundingBox.top + d.boundingBox.height - NewDataLabelUtils.verticalLabelBackgroundPadding : d.boundingBox.top + d.boundingBox.height;
|
9383 | },
|
9384 | dy: "-0.15em"
|
9385 | };
|
9386 | numeric && (labelAttr.dy = void 0), labels.text(function(d) {
|
9387 | return d.text;
|
9388 | }).attr(labelAttr).style({
|
9389 | fill: function(d) {
|
9390 | return d.fill;
|
9391 | },
|
9392 | "font-size": function(d) {
|
9393 | return PixelConverter.fromPoint(d.fontSize || NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
9394 | },
|
9395 | "text-anchor": function(d) {
|
9396 | return d.textAnchor;
|
9397 | }
|
9398 | }), labels.exit().remove();
|
9399 | var filteredCategoryLabels = _.filter(twoRows ? dataLabels : [], function(d) {
|
9400 | return d.isVisible && !_.isEmpty(d.secondRowText);
|
9401 | }), secondLineLabels = context.selectAll(secondLineLabelClass.selector).data(filteredCategoryLabels, function(d, index) {
|
9402 | return d.identity ? d.identity.getKeyWithoutHighlight() : index;
|
9403 | });
|
9404 | return secondLineLabels.enter().append("text").classed(secondLineLabelClass["class"], !0),
|
9405 | labelAttr = {
|
9406 | x: function(d) {
|
9407 | return d.boundingBox.left + d.boundingBox.width / 2;
|
9408 | },
|
9409 | y: function(d) {
|
9410 | var boundingBoxHeight = void 0 !== d.text ? d.boundingBox.height / 2 : d.boundingBox.height;
|
9411 | return d.hasBackground ? d.boundingBox.top + boundingBoxHeight - NewDataLabelUtils.verticalLabelBackgroundPadding : d.boundingBox.top + boundingBoxHeight;
|
9412 | },
|
9413 | dy: "-0.15em"
|
9414 | }, numeric && (labelAttr.dy = void 0), secondLineLabels.text(function(d) {
|
9415 | return d.secondRowText;
|
9416 | }).attr(labelAttr).style({
|
9417 | fill: function(d) {
|
9418 | return d.fill;
|
9419 | },
|
9420 | "font-size": function(d) {
|
9421 | return PixelConverter.fromPoint(d.fontSize || NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
9422 | },
|
9423 | "text-anchor": function(d) {
|
9424 | return d.textAnchor;
|
9425 | }
|
9426 | }), secondLineLabels.exit().remove(), hasTooltip && (labels.append("title").text(function(d) {
|
9427 | return d.tooltip;
|
9428 | }), secondLineLabels.append("title").text(function(d) {
|
9429 | return d.tooltip;
|
9430 | }), labels.style("pointer-events", "all"), secondLineLabels.style("pointer-events", "all")),
|
9431 | labels;
|
9432 | }
|
9433 | function animateDefaultLabels(context, dataLabels, duration, numeric, easeType) {
|
9434 | void 0 === numeric && (numeric = !1), void 0 === easeType && (easeType = "cubic-in-out");
|
9435 | var labels = context.selectAll(labelsClass.selector).data(_.filter(dataLabels, function(d) {
|
9436 | return d.isVisible;
|
9437 | }), labelKeyFunction);
|
9438 | labels.enter().append("text").classed(labelsClass["class"], !0).style("opacity", 0);
|
9439 | var labelAttr = {
|
9440 | x: function(d) {
|
9441 | return d.boundingBox.left + d.boundingBox.width / 2;
|
9442 | },
|
9443 | y: function(d) {
|
9444 | return d.boundingBox.top + d.boundingBox.height;
|
9445 | },
|
9446 | dy: "-0.15em"
|
9447 | };
|
9448 | return numeric && (labelAttr.dy = void 0), labels.text(function(d) {
|
9449 | return d.text;
|
9450 | }).style({
|
9451 | fill: function(d) {
|
9452 | return d.fill;
|
9453 | },
|
9454 | "font-size": function(d) {
|
9455 | return PixelConverter.fromPoint(d.fontSize || NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
9456 | }
|
9457 | }).transition().ease(easeType).duration(duration).attr(labelAttr).style("opacity", 1),
|
9458 | labels.exit().transition().duration(duration).style("opacity", 0).remove(), labels;
|
9459 | }
|
9460 | function drawLabelBackground(context, dataLabels, fill, fillOpacity) {
|
9461 | var labelRects = context.selectAll("rect").data(_.filter(dataLabels, function(d) {
|
9462 | return d.isVisible;
|
9463 | }), labelKeyFunction);
|
9464 | return labelRects.enter().append("rect"), labelRects.attr({
|
9465 | x: function(d) {
|
9466 | return d.boundingBox.left - NewDataLabelUtils.horizontalLabelBackgroundPadding;
|
9467 | },
|
9468 | y: function(d) {
|
9469 | return d.boundingBox.top - NewDataLabelUtils.verticalLabelBackgroundPadding;
|
9470 | },
|
9471 | rx: labelBackgroundRounding,
|
9472 | ry: labelBackgroundRounding,
|
9473 | width: function(d) {
|
9474 | return d.boundingBox.width + 2 * NewDataLabelUtils.horizontalLabelBackgroundPadding;
|
9475 | },
|
9476 | height: function(d) {
|
9477 | return void 0 === d.text && void 0 === d.secondRowText ? 0 : d.boundingBox.height + 2 * NewDataLabelUtils.verticalLabelBackgroundPadding;
|
9478 | }
|
9479 | }).style("fill", fill ? fill : "#000000").style("fill-opacity", null != fillOpacity ? fillOpacity : 1),
|
9480 | labelRects.exit().remove(), labelRects;
|
9481 | }
|
9482 | function drawLabelLeaderLines(context, filteredDataLabels, key, leaderLineColor) {
|
9483 | context.select(linesGraphicsContextClass.selector).empty() && context.append("g").classed(linesGraphicsContextClass["class"], !0);
|
9484 | var lines = context.select(linesGraphicsContextClass.selector).selectAll("polyline").data(filteredDataLabels, key);
|
9485 | lines.enter().append("polyline").classed(lineClass["class"], !0), lines.attr("points", function(d) {
|
9486 | return d.leaderLinePoints;
|
9487 | }).style({
|
9488 | stroke: function(d) {
|
9489 | return leaderLineColor ? leaderLineColor : d.fill;
|
9490 | },
|
9491 | "stroke-width": visuals.DonutLabelUtils.LineStrokeWidth
|
9492 | }), lines.exit().remove();
|
9493 | }
|
9494 | function getLabelFormattedText(label, format, formatter) {
|
9495 | return formatter ? formatter.format(label) : powerbi.formattingService.formatValue(label, format);
|
9496 | }
|
9497 | function getDisplayUnitValueFromAxisFormatter(axisFormatter, labelSettings) {
|
9498 | return axisFormatter && axisFormatter.displayUnit && 0 === labelSettings.displayUnits ? axisFormatter.displayUnit.value : null;
|
9499 | }
|
9500 | function getLabelPrecision(precision, format) {
|
9501 | if (precision !== defaultLabelPrecision) return precision;
|
9502 | if (format) {
|
9503 | var positiveFormat = format.split(";")[0], formatMetadata = powerbi.NumberFormat.getCustomFormatMetadata(positiveFormat, !0);
|
9504 | if (formatMetadata.hasDots) return formatMetadata.precision;
|
9505 | }
|
9506 | return defaultCountLabelPrecision;
|
9507 | }
|
9508 | function createColumnFormatterCacheManager() {
|
9509 | return {
|
9510 | cache: {
|
9511 | defaultFormatter: null
|
9512 | },
|
9513 | getOrCreate: function(formatString, labelSetting, value2) {
|
9514 | if (formatString) {
|
9515 | var cacheKeyObject = {
|
9516 | formatString: formatString,
|
9517 | displayUnits: labelSetting.displayUnits,
|
9518 | precision: getLabelPrecision(labelSetting.precision, formatString),
|
9519 | value2: value2
|
9520 | }, cacheKey = JSON.stringify(cacheKeyObject);
|
9521 | return this.cache[cacheKey] || (this.cache[cacheKey] = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, cacheKeyObject.precision))),
|
9522 | this.cache[cacheKey];
|
9523 | }
|
9524 | return this.cache.defaultFormatter || (this.cache.defaultFormatter = visuals.valueFormatter.create(getOptionsForLabelFormatter(labelSetting, formatString, value2, labelSetting.precision))),
|
9525 | this.cache.defaultFormatter;
|
9526 | }
|
9527 | };
|
9528 | }
|
9529 | function getOptionsForLabelFormatter(labelSetting, formatString, value2, precision) {
|
9530 | return {
|
9531 | displayUnitSystemType: powerbi.DisplayUnitSystemType.DataLabels,
|
9532 | format: formatString,
|
9533 | precision: precision,
|
9534 | value: labelSetting.displayUnits,
|
9535 | value2: value2,
|
9536 | allowFormatBeautification: !0
|
9537 | };
|
9538 | }
|
9539 | function removeDuplicates(labelDataPoints) {
|
9540 | for (var uniqueLabelDataPoints = [], labelDataPointMap = {}, sameParentIsInArray = function(newValue, array, parentIsRect) {
|
9541 | return array.some(function(arrayValue) {
|
9542 | return parentIsRect ? visuals.shapes.Rect.equals(newValue.parentShape.rect, arrayValue.rect) : visuals.shapes.Point.equals(newValue.parentShape.point, arrayValue.point);
|
9543 | });
|
9544 | }, _i = 0, labelDataPoints_1 = labelDataPoints; _i < labelDataPoints_1.length; _i++) {
|
9545 | var dataPoint = labelDataPoints_1[_i], parentIsRect = 1 === dataPoint.parentType, resultsFromMap = labelDataPointMap[dataPoint.text];
|
9546 | resultsFromMap ? sameParentIsInArray(dataPoint, resultsFromMap, parentIsRect) || (uniqueLabelDataPoints.push(dataPoint),
|
9547 | resultsFromMap.push(dataPoint.parentShape)) : (uniqueLabelDataPoints.push(dataPoint),
|
9548 | labelDataPointMap[dataPoint.text] = [ dataPoint.parentShape ]);
|
9549 | }
|
9550 | return uniqueLabelDataPoints;
|
9551 | }
|
9552 | function getDataLabelLayoutOptions(type) {
|
9553 | switch (type) {
|
9554 | case 9:
|
9555 | return {
|
9556 | maximumOffset: visuals.ScatterChart.dataLabelLayoutMaximumOffset,
|
9557 | startingOffset: visuals.ScatterChart.dataLabelLayoutStartingOffset,
|
9558 | offsetIterationDelta: visuals.ScatterChart.dataLabelLayoutOffsetIterationDelta,
|
9559 | allowLeaderLines: !0,
|
9560 | attemptToMoveLabelsIntoViewport: !0
|
9561 | };
|
9562 |
|
9563 | default:
|
9564 | return {
|
9565 | maximumOffset: NewDataLabelUtils.maxLabelOffset,
|
9566 | startingOffset: NewDataLabelUtils.startingLabelOffset,
|
9567 | attemptToMoveLabelsIntoViewport: !0
|
9568 | };
|
9569 | }
|
9570 | }
|
9571 | function getTextSize(text, fontSize) {
|
9572 | var labelTextProperties = NewDataLabelUtils.LabelTextProperties, properties = {
|
9573 | text: text,
|
9574 | fontFamily: labelTextProperties.fontFamily,
|
9575 | fontSize: jsCommon.PixelConverter.fromPoint(fontSize),
|
9576 | fontWeight: labelTextProperties.fontWeight
|
9577 | };
|
9578 | return {
|
9579 | width: powerbi.TextMeasurementService.measureSvgTextWidth(properties),
|
9580 | height: powerbi.TextMeasurementService.estimateSvgTextHeight(properties)
|
9581 | };
|
9582 | }
|
9583 | function labelKeyFunction(label, index) {
|
9584 | return label.key ? label.key : label.identity ? label.identity.getKeyWithoutHighlight() : index;
|
9585 | }
|
9586 | NewDataLabelUtils.DefaultLabelFontSizeInPt = 9, NewDataLabelUtils.MapPolylineOpacity = .5,
|
9587 | NewDataLabelUtils.LabelDensityBufferFactor = 3, NewDataLabelUtils.LabelDensityPadding = 6,
|
9588 | NewDataLabelUtils.LabelDensityMin = 0, NewDataLabelUtils.LabelDensityMax = 6, NewDataLabelUtils.startingLabelOffset = 8,
|
9589 | NewDataLabelUtils.maxLabelOffset = 8, NewDataLabelUtils.maxLabelWidth = 50, NewDataLabelUtils.hundredPercentFormat = "0.00 %;-0.00 %;0.00 %",
|
9590 | NewDataLabelUtils.LabelTextProperties = {
|
9591 | fontFamily: "wf_standard-font",
|
9592 | fontSize: PixelConverter.fromPoint(NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
9593 | fontWeight: "normal"
|
9594 | }, NewDataLabelUtils.defaultLabelColor = "#777777", NewDataLabelUtils.defaultInsideLabelColor = "#ffffff",
|
9595 | NewDataLabelUtils.horizontalLabelBackgroundPadding = 4, NewDataLabelUtils.verticalLabelBackgroundPadding = 2;
|
9596 | var labelBackgroundRounding = 4, defaultLabelPrecision = void 0, defaultCountLabelPrecision = 0;
|
9597 | NewDataLabelUtils.labelGraphicsContextClass = createClassAndSelector("labelGraphicsContext"),
|
9598 | NewDataLabelUtils.labelBackgroundGraphicsContextClass = createClassAndSelector("labelBackgroundGraphicsContext");
|
9599 | var labelsClass = createClassAndSelector("label"), secondLineLabelClass = createClassAndSelector("label-second-line"), linesGraphicsContextClass = createClassAndSelector("leader-lines"), lineClass = createClassAndSelector("line-label");
|
9600 | NewDataLabelUtils.drawDefaultLabels = drawDefaultLabels, NewDataLabelUtils.animateDefaultLabels = animateDefaultLabels,
|
9601 | NewDataLabelUtils.drawLabelBackground = drawLabelBackground, NewDataLabelUtils.drawLabelLeaderLines = drawLabelLeaderLines,
|
9602 | NewDataLabelUtils.getLabelFormattedText = getLabelFormattedText, NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter = getDisplayUnitValueFromAxisFormatter,
|
9603 | NewDataLabelUtils.createColumnFormatterCacheManager = createColumnFormatterCacheManager,
|
9604 | NewDataLabelUtils.removeDuplicates = removeDuplicates, NewDataLabelUtils.getDataLabelLayoutOptions = getDataLabelLayoutOptions,
|
9605 | NewDataLabelUtils.getTextSize = getTextSize;
|
9606 | }(NewDataLabelUtils = visuals.NewDataLabelUtils || (visuals.NewDataLabelUtils = {}));
|
9607 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9608 | }(powerbi || (powerbi = {}));
|
9609 |
|
9610 | var powerbi;
|
9611 |
|
9612 | !function(powerbi) {
|
9613 | var visuals;
|
9614 | !function(visuals) {
|
9615 | var KpiUtil;
|
9616 | !function(KpiUtil) {
|
9617 | function getKpiIcon(kpi, value) {
|
9618 | var numValue = parseFloat(value);
|
9619 | if (kpi) {
|
9620 | var statusGraphicFormat = statusGraphicFormatStrings[kpi.graphic.toUpperCase()];
|
9621 | if (statusGraphicFormat && !isNaN(numValue)) {
|
9622 | var statusValues = statusGraphicFormat.statusValues;
|
9623 | kpi.normalizedFiveStateKpiRange && 5 === statusValues.length && (numValue = 2 * numValue);
|
9624 | var num = numValue + Math.floor(statusValues.length / 2);
|
9625 | return [ statusGraphicFormat.kpiIconClass, statusValues[num] ].join(" ").trim();
|
9626 | }
|
9627 | }
|
9628 | }
|
9629 | function getKpiIconClassName(kpiIcon, kpiImageSize) {
|
9630 | return kpiIcon ? 1 === kpiImageSize ? [ KPIImageClassName, BigImageClassName, kpiIcon ].join(" ") : [ KPIImageClassName, kpiIcon ].join(" ") : void 0;
|
9631 | }
|
9632 | function getClassForKpi(kpi, value, kpiImageSize) {
|
9633 | var kpiIcon = getKpiIcon(kpi, value);
|
9634 | return getKpiIconClassName(kpiIcon, kpiImageSize);
|
9635 | }
|
9636 | function getKpiImageMetadata(metaDataColumn, value, kpiImageSize) {
|
9637 | var kpi = metaDataColumn && metaDataColumn.kpi;
|
9638 | if (kpi) {
|
9639 | var kpiIcon = getKpiIcon(kpi, value);
|
9640 | if (kpiIcon) return {
|
9641 | caption: kpiIcon,
|
9642 | statusGraphic: kpi.graphic,
|
9643 | "class": getKpiIconClassName(kpiIcon, kpiImageSize)
|
9644 | };
|
9645 | }
|
9646 | }
|
9647 | var KPIImageClassName = "powervisuals-glyph", BigImageClassName = "big-kpi", RYGStatusIconClassNames = [ "kpi-red", "kpi-yellow", "kpi-green" ], threeLights = {
|
9648 | kpiIconClass: "circle",
|
9649 | statusValues: RYGStatusIconClassNames
|
9650 | }, roadSigns = {
|
9651 | kpiIconClass: "",
|
9652 | statusValues: [ "circle-x kpi-red", "circle-exclamation kpi-yellow", "circle-checkmark kpi-green" ]
|
9653 | }, trafficLight = {
|
9654 | kpiIconClass: "traffic-light",
|
9655 | statusValues: RYGStatusIconClassNames
|
9656 | }, shapes = {
|
9657 | kpiIconClass: "",
|
9658 | statusValues: [ "rhombus kpi-red", "triangle kpi-yellow", "circle kpi-green" ]
|
9659 | }, gauge = {
|
9660 | kpiIconClass: "",
|
9661 | statusValues: [ "circle-empty", "circle-one-quarter", "circle-half", "circle-three-quarters", "circle-full" ]
|
9662 | }, statusGraphicFormatStrings = {
|
9663 | "THREE CIRCLES COLORED": threeLights,
|
9664 | "TRAFFIC LIGHT - SINGLE": threeLights,
|
9665 | "THREE FLAGS COLORED": {
|
9666 | kpiIconClass: "flag",
|
9667 | statusValues: RYGStatusIconClassNames
|
9668 | },
|
9669 | "ROAD SIGNS": roadSigns,
|
9670 | "THREE SYMBOLS CIRCLED COLORED": roadSigns,
|
9671 | "TRAFFIC LIGHT": trafficLight,
|
9672 | "THREE TRAFFIC LIGHTS RIMMED COLORED": trafficLight,
|
9673 | "THREE SYMBOLS UNCIRCLED COLORED": {
|
9674 | kpiIconClass: "",
|
9675 | statusValues: [ "x kpi-red", "exclamation kpi-yellow", "checkmark kpi-green" ]
|
9676 | },
|
9677 | SHAPES: shapes,
|
9678 | "SMILEY FACE": shapes,
|
9679 | THERMOMETER: shapes,
|
9680 | CYLINDER: shapes,
|
9681 | "THREE SIGNS COLORED": shapes,
|
9682 | "THREE STARS COLORED": {
|
9683 | kpiIconClass: "star-stacked",
|
9684 | statusValues: [ "star-empty", "star-half-full", "star-full" ]
|
9685 | },
|
9686 | "FIVE BARS COLORED": {
|
9687 | kpiIconClass: "bars-stacked",
|
9688 | statusValues: [ "bars-zero", "bars-one", "bars-two", "bars-three", "bars-four" ]
|
9689 | },
|
9690 | "FIVE BOXES COLORED": {
|
9691 | kpiIconClass: "boxes-stacked",
|
9692 | statusValues: [ "boxes-zero", "boxes-one", "boxes-two", "boxes-three", "boxes-four" ]
|
9693 | },
|
9694 | "FIVE QUARTERS COLORED": gauge,
|
9695 | "GAUGE - ASCENDING": gauge,
|
9696 | "GAUGE - DESCENDING": {
|
9697 | kpiIconClass: "",
|
9698 | statusValues: [ "circle-full", "circle-three-quarters", "circle-half", "circle-one-quarter", "circle-empty" ]
|
9699 | },
|
9700 | "STANDARD ARROW": {
|
9701 | kpiIconClass: "",
|
9702 | statusValues: [ "arrow-down", "arrow-right-down", "arrow-right", "arrow-right-up", "arrow-up" ]
|
9703 | },
|
9704 | "VARIANCE ARROW": {
|
9705 | kpiIconClass: "",
|
9706 | statusValues: [ "arrow-down kpi-red", "arrow-right kpi-yellow", "arrow-up kpi-green" ]
|
9707 | },
|
9708 | "STATUS ARROW - ASCENDING": {
|
9709 | kpiIconClass: "",
|
9710 | statusValues: [ "arrow-down kpi-red", "arrow-right-down kpi-yellow", "arrow-right kpi-yellow", "arrow-right-up kpi-yellow", "arrow-up kpi-green" ]
|
9711 | },
|
9712 | "STATUS ARROW - DESCENDING": {
|
9713 | kpiIconClass: "",
|
9714 | statusValues: [ "arrow-up kpi-green", "arrow-right-up kpi-yellow", "arrow-right kpi-yellow", "arrow-right-down kpi-yellow", "arrow-down kpi-red" ]
|
9715 | }
|
9716 | };
|
9717 | KpiUtil.getClassForKpi = getClassForKpi, KpiUtil.getKpiImageMetadata = getKpiImageMetadata;
|
9718 | }(KpiUtil = visuals.KpiUtil || (visuals.KpiUtil = {}));
|
9719 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9720 | }(powerbi || (powerbi = {}));
|
9721 |
|
9722 | var powerbi;
|
9723 |
|
9724 | !function(powerbi) {
|
9725 | var visuals;
|
9726 | !function(visuals) {
|
9727 | var ReferenceLineHelper;
|
9728 | !function(ReferenceLineHelper) {
|
9729 | function enumerateObjectInstances(enumeration, referenceLines, defaultColor, objectName) {
|
9730 | if (_.isEmpty(referenceLines)) {
|
9731 | var instance = {
|
9732 | selector: {
|
9733 | id: "0"
|
9734 | },
|
9735 | properties: {
|
9736 | show: !1,
|
9737 | value: "",
|
9738 | lineColor: {
|
9739 | solid: {
|
9740 | color: defaultColor
|
9741 | }
|
9742 | },
|
9743 | transparency: 50,
|
9744 | style: visuals.lineStyle.dashed,
|
9745 | position: visuals.referenceLinePosition.back,
|
9746 | dataLabelShow: !1
|
9747 | },
|
9748 | objectName: objectName
|
9749 | };
|
9750 | return void enumeration.pushInstance(instance);
|
9751 | }
|
9752 | for (var _i = 0, referenceLines_1 = referenceLines; _i < referenceLines_1.length; _i++) {
|
9753 | 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, {
|
9754 | solid: {
|
9755 | color: defaultColor
|
9756 | }
|
9757 | }), 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 = {
|
9758 | selector: {
|
9759 | id: referenceLine.id
|
9760 | },
|
9761 | properties: {
|
9762 | show: show,
|
9763 | value: value,
|
9764 | lineColor: lineColor,
|
9765 | transparency: transparency,
|
9766 | style: style,
|
9767 | position: position,
|
9768 | dataLabelShow: dataLabelShow
|
9769 | },
|
9770 | objectName: objectName
|
9771 | };
|
9772 | if (dataLabelShow) {
|
9773 | var dataLabelColor = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.dataLabelColor, {
|
9774 | solid: {
|
9775 | color: defaultColor
|
9776 | }
|
9777 | }), 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);
|
9778 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelColor] = dataLabelColor,
|
9779 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelHorizontalPosition] = dataLabelHorizontalPosition,
|
9780 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelVerticalPosition] = dataLabelVerticalPosition,
|
9781 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelDecimalPoints] = dataLabelDecimalPoints,
|
9782 | instance.properties[ReferenceLineHelper.referenceLineProps.dataLabelDisplayUnits] = dataLabelDisplayUnits;
|
9783 | }
|
9784 | enumeration.pushInstance(instance);
|
9785 | }
|
9786 | }
|
9787 | function render(options) {
|
9788 | 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, {
|
9789 | solid: {
|
9790 | color: options.defaultColor
|
9791 | }
|
9792 | }), 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;
|
9793 | isRefLineExists && isPositionChanged && refLine.remove(), isRefLineExists && !isPositionChanged || (refLine = position === visuals.referenceLinePosition.back ? graphicContext.insert("line", ":first-child") : graphicContext.append("line"));
|
9794 | var refLineX1 = isHorizontal ? 0 : xScale(refValue), refLineY1 = isHorizontal ? yScale(refValue) : 0, refLineX2 = isHorizontal ? viewport.width : xScale(refValue), refLineY2 = isHorizontal ? yScale(refValue) : viewport.height;
|
9795 | refLine.attr({
|
9796 | "class": classAndSelector["class"],
|
9797 | x1: refLineX1,
|
9798 | y1: refLineY1,
|
9799 | x2: refLineX2,
|
9800 | y2: refLineY2
|
9801 | }).style({
|
9802 | stroke: lineColor.solid.color
|
9803 | }), null != transparency && refLine.style("stroke-opacity", (100 - transparency) / 100),
|
9804 | style === visuals.lineStyle.dashed ? refLine.style("stroke-dasharray", "5, 5") : style === visuals.lineStyle.dotted ? refLine.style({
|
9805 | "stroke-dasharray": "1, 5",
|
9806 | "stroke-linecap": "round"
|
9807 | }) : style === visuals.lineStyle.solid && refLine.style({
|
9808 | "stroke-dasharray": null,
|
9809 | "stroke-linecap": null
|
9810 | });
|
9811 | }
|
9812 | function createLabelDataPoint(options) {
|
9813 | 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, {
|
9814 | solid: {
|
9815 | color: options.defaultColor
|
9816 | }
|
9817 | }), 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;
|
9818 | if (null != axisFormatter.options) {
|
9819 | var formatterOptions = powerbi.Prototype.inherit(axisFormatter.options);
|
9820 | formatterOptions.precision = decimalPoints, formatterOptions.value = displayUnits,
|
9821 | formatterOptions.detectAxisPrecision = !1, formatterForReferenceLineDataLabel = visuals.valueFormatter.create(formatterOptions);
|
9822 | }
|
9823 | var dataLabelX, dataLabelY, text = visuals.NewDataLabelUtils.getLabelFormattedText(formatterForReferenceLineDataLabel.format(refValue)), properties = {
|
9824 | text: text,
|
9825 | fontFamily: visuals.dataLabelUtils.LabelTextProperties.fontFamily,
|
9826 | fontSize: visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
9827 | fontWeight: visuals.dataLabelUtils.LabelTextProperties.fontWeight
|
9828 | }, 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 ];
|
9829 | isHorizontal ? (dataLabelX = horizontalPosition === visuals.referenceLineDataLabelHorizontalPosition.left ? x1 + offsetRefLine : x2 - rectWidth / 2 - offsetRefLine,
|
9830 | dataLabelY = y1, validPositions = verticalPosition === visuals.referenceLineDataLabelVerticalPosition.above ? [ 1 ] : [ 2 ]) : (dataLabelX = x1,
|
9831 | dataLabelY = verticalPosition === visuals.referenceLineDataLabelVerticalPosition.above ? y1 + rectHeight / 2 + offsetRefLine : y2 - rectHeight / 2 - offsetRefLine,
|
9832 | validPositions = horizontalPosition === visuals.referenceLineDataLabelHorizontalPosition.left ? [ 4 ] : [ 8 ]);
|
9833 | var parentShape, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
9834 | return parentShape = {
|
9835 | point: {
|
9836 | x: dataLabelX,
|
9837 | y: dataLabelY
|
9838 | },
|
9839 | radius: 0,
|
9840 | validPositions: validPositions
|
9841 | }, {
|
9842 | isPreferred: !0,
|
9843 | text: text,
|
9844 | textSize: {
|
9845 | width: textWidth,
|
9846 | height: textHeight
|
9847 | },
|
9848 | outsideFill: color.solid.color,
|
9849 | insideFill: null,
|
9850 | parentShape: parentShape,
|
9851 | parentType: 0,
|
9852 | fontSize: 9,
|
9853 | identity: null,
|
9854 | secondRowText: null,
|
9855 | key: options.key
|
9856 | };
|
9857 | }
|
9858 | function extractReferenceLineValue(referenceLineProperties) {
|
9859 | var referenceLineValue = null;
|
9860 | return referenceLineProperties && powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.show, !1) && (referenceLineValue = powerbi.DataViewObject.getValue(referenceLineProperties, ReferenceLineHelper.referenceLineProps.value, null)),
|
9861 | referenceLineValue;
|
9862 | }
|
9863 | ReferenceLineHelper.referenceLineProps = {
|
9864 | show: "show",
|
9865 | lineColor: "lineColor",
|
9866 | transparency: "transparency",
|
9867 | value: "value",
|
9868 | style: "style",
|
9869 | position: "position",
|
9870 | dataLabelShow: "dataLabelShow",
|
9871 | dataLabelColor: "dataLabelColor",
|
9872 | dataLabelDecimalPoints: "dataLabelDecimalPoints",
|
9873 | dataLabelHorizontalPosition: "dataLabelHorizontalPosition",
|
9874 | dataLabelVerticalPosition: "dataLabelVerticalPosition",
|
9875 | dataLabelDisplayUnits: "dataLabelDisplayUnits"
|
9876 | }, ReferenceLineHelper.enumerateObjectInstances = enumerateObjectInstances, ReferenceLineHelper.render = render,
|
9877 | ReferenceLineHelper.createLabelDataPoint = createLabelDataPoint, ReferenceLineHelper.extractReferenceLineValue = extractReferenceLineValue;
|
9878 | }(ReferenceLineHelper = visuals.ReferenceLineHelper || (visuals.ReferenceLineHelper = {}));
|
9879 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9880 | }(powerbi || (powerbi = {}));
|
9881 |
|
9882 | var powerbi;
|
9883 |
|
9884 | !function(powerbi) {
|
9885 | var visuals;
|
9886 | !function(visuals) {
|
9887 | var InteractivityUtils;
|
9888 | !function(InteractivityUtils) {
|
9889 | function getPositionOfLastInputEvent() {
|
9890 | return {
|
9891 | x: d3.event.clientX,
|
9892 | y: d3.event.clientY
|
9893 | };
|
9894 | }
|
9895 | function registerStandardInteractivityHandlers(selection, selectionHandler) {
|
9896 | registerStandardSelectionHandler(selection, selectionHandler), registerStandardContextMenuHandler(selection, selectionHandler);
|
9897 | }
|
9898 | function registerStandardSelectionHandler(selection, selectionHandler) {
|
9899 | selection.on("click", function(d) {
|
9900 | return handleSelection(d, selectionHandler);
|
9901 | });
|
9902 | }
|
9903 | function registerStandardContextMenuHandler(selection, selectionHandler) {
|
9904 | selection.on("contextmenu", function(d) {
|
9905 | return handleContextMenu(d, selectionHandler);
|
9906 | });
|
9907 | }
|
9908 | function registerGroupInteractivityHandlers(group, selectionHandler) {
|
9909 | registerGroupSelectionHandler(group, selectionHandler), registerGroupContextMenuHandler(group, selectionHandler);
|
9910 | }
|
9911 | function registerGroupSelectionHandler(group, selectionHandler) {
|
9912 | group.on("click", function() {
|
9913 | var target = d3.event.target, d = d3.select(target).datum();
|
9914 | handleSelection(d, selectionHandler);
|
9915 | });
|
9916 | }
|
9917 | function registerGroupContextMenuHandler(group, selectionHandler) {
|
9918 | group.on("contextmenu", function() {
|
9919 | var target = d3.event.target, d = d3.select(target).datum();
|
9920 | handleContextMenu(d, selectionHandler);
|
9921 | });
|
9922 | }
|
9923 | function handleContextMenu(d, selectionHandler) {
|
9924 | if (!d3.event.ctrlKey) {
|
9925 | d3.event.preventDefault();
|
9926 | var position = InteractivityUtils.getPositionOfLastInputEvent();
|
9927 | selectionHandler.handleContextMenu(d, position);
|
9928 | }
|
9929 | }
|
9930 | function handleSelection(d, selectionHandler) {
|
9931 | selectionHandler.handleSelection(d, d3.event.ctrlKey);
|
9932 | }
|
9933 | InteractivityUtils.getPositionOfLastInputEvent = getPositionOfLastInputEvent, InteractivityUtils.registerStandardInteractivityHandlers = registerStandardInteractivityHandlers,
|
9934 | InteractivityUtils.registerStandardSelectionHandler = registerStandardSelectionHandler,
|
9935 | InteractivityUtils.registerStandardContextMenuHandler = registerStandardContextMenuHandler,
|
9936 | InteractivityUtils.registerGroupInteractivityHandlers = registerGroupInteractivityHandlers,
|
9937 | InteractivityUtils.registerGroupSelectionHandler = registerGroupSelectionHandler,
|
9938 | InteractivityUtils.registerGroupContextMenuHandler = registerGroupContextMenuHandler;
|
9939 | }(InteractivityUtils = visuals.InteractivityUtils || (visuals.InteractivityUtils = {}));
|
9940 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9941 | }(powerbi || (powerbi = {}));
|
9942 |
|
9943 | var powerbi;
|
9944 |
|
9945 | !function(powerbi) {
|
9946 | var visuals;
|
9947 | !function(visuals) {
|
9948 | function getInvalidValueWarnings(dataViews, supportsNaN, supportsNegativeInfinity, supportsPositiveInfinity) {
|
9949 | var checker = new InvalidDataValuesChecker(supportsNaN, supportsNegativeInfinity, supportsPositiveInfinity);
|
9950 | return checker.getWarningMessages(dataViews);
|
9951 | }
|
9952 | visuals.getInvalidValueWarnings = getInvalidValueWarnings;
|
9953 | var InvalidDataValuesChecker = function() {
|
9954 | function InvalidDataValuesChecker(supportsNaN, supportsNegativeInfinity, supportsPositiveInfinity) {
|
9955 | this.supportsNaN = supportsNaN, this.supportsNegativeInfinity = supportsNegativeInfinity,
|
9956 | this.supportsPositiveInfinity = supportsPositiveInfinity;
|
9957 | }
|
9958 | return InvalidDataValuesChecker.prototype.getWarningMessages = function(dataViews) {
|
9959 | this.loadWarningStatus(dataViews);
|
9960 | var warnings = [];
|
9961 | return this.hasNaN && !this.supportsNaN && warnings.push(new visuals.NaNNotSupportedWarning()),
|
9962 | (this.hasNegativeInfinity && !this.supportsNegativeInfinity || this.hasPositiveInfinity && !this.supportsPositiveInfinity) && warnings.push(new visuals.InfinityValuesNotSupportedWarning()),
|
9963 | this.hasOutOfRange && warnings.push(new visuals.ValuesOutOfRangeWarning()), warnings;
|
9964 | }, InvalidDataValuesChecker.prototype.loadWarningStatus = function(dataViews) {
|
9965 | this.hasNaN = !1, this.hasNegativeInfinity = !1, this.hasOutOfRange = !1, this.hasPositiveInfinity = !1;
|
9966 | for (var k = 0; k < dataViews.length; k++) {
|
9967 | var dataView = dataViews[k], values = dataView && dataView.categorical && dataView.categorical.values ? dataView.categorical.values : null;
|
9968 | if (!values) return;
|
9969 | for (var valueLength = values.length, i = 0; valueLength > i; i++) {
|
9970 | var value = values[i];
|
9971 | if (value.values) for (var valueValueLength = value.values.length, j = 0; valueValueLength > j; j++) {
|
9972 | var v = value.values[j];
|
9973 | 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);
|
9974 | }
|
9975 | }
|
9976 | }
|
9977 | }, InvalidDataValuesChecker;
|
9978 | }();
|
9979 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
9980 | }(powerbi || (powerbi = {}));
|
9981 |
|
9982 | var powerbi;
|
9983 |
|
9984 | !function(powerbi) {
|
9985 | var visuals;
|
9986 | !function(visuals) {
|
9987 | var ListViewFactory;
|
9988 | !function(ListViewFactory) {
|
9989 | function createListView(options) {
|
9990 | return new ListView(options);
|
9991 | }
|
9992 | ListViewFactory.createListView = createListView;
|
9993 | }(ListViewFactory = visuals.ListViewFactory || (visuals.ListViewFactory = {}));
|
9994 | var ListView = function() {
|
9995 | function ListView(options) {
|
9996 | var _this = this;
|
9997 | this.options = $.extend(!0, {}, options), this.scrollbarInner = options.baseContainer.append("div").classed("scrollbar-inner", !0).on("scroll", function() {
|
9998 | return _this.renderImpl(_this.options.rowHeight);
|
9999 | }), this.scrollContainer = this.scrollbarInner.append("div").classed("scrollRegion", !0).on("touchstart", function() {
|
10000 | return _this.stopTouchPropagation();
|
10001 | }).on("touchmove", function() {
|
10002 | return _this.stopTouchPropagation();
|
10003 | }), this.visibleGroupContainer = this.scrollContainer.append("div").classed("visibleGroup", !0),
|
10004 | $(options.baseContainer.node()).find(".scroll-element").attr("drag-resize-disabled", "true"),
|
10005 | ListView.SetDefaultOptions(options);
|
10006 | }
|
10007 | return ListView.SetDefaultOptions = function(options) {
|
10008 | options.rowHeight = options.rowHeight || ListView.defaultRowHeight;
|
10009 | }, ListView.prototype.rowHeight = function(rowHeight) {
|
10010 | return this.options.rowHeight = Math.ceil(rowHeight), this;
|
10011 | }, ListView.prototype.data = function(data, getDatumIndex, dataReset) {
|
10012 | return void 0 === dataReset && (dataReset = !1), this._data = data, this.getDatumIndex = getDatumIndex,
|
10013 | this.setTotalRows(), dataReset && $(this.scrollbarInner.node()).scrollTop(0), this.render(),
|
10014 | this;
|
10015 | }, ListView.prototype.viewport = function(viewport) {
|
10016 | return this.options.viewport = viewport, this.render(), this;
|
10017 | }, ListView.prototype.empty = function() {
|
10018 | this._data = [], this.render();
|
10019 | }, ListView.prototype.render = function() {
|
10020 | var _this = this;
|
10021 | this.renderTimeoutId && window.clearTimeout(this.renderTimeoutId), this.renderTimeoutId = window.setTimeout(function() {
|
10022 | _this.getRowHeight().then(function(rowHeight) {
|
10023 | _this.renderImpl(rowHeight);
|
10024 | }), _this.renderTimeoutId = void 0;
|
10025 | }, 0);
|
10026 | }, ListView.prototype.renderImpl = function(rowHeight) {
|
10027 | var totalHeight = this.options.scrollEnabled ? Math.max(0, this._totalRows * rowHeight) : this.options.viewport.height;
|
10028 | this.scrollContainer.style("height", totalHeight + "px").attr("height", totalHeight),
|
10029 | this.scrollToFrame(!0);
|
10030 | }, ListView.prototype.stopTouchPropagation = function() {
|
10031 | if (this.options.isReadMode()) {
|
10032 | if ("touchstart" === d3.event.type) {
|
10033 | var event_1 = d3.event;
|
10034 | event_1.touches && 1 === event_1.touches.length && d3.event.stopPropagation();
|
10035 | }
|
10036 | "touchmove" === d3.event.type && d3.event.stopPropagation();
|
10037 | }
|
10038 | }, ListView.prototype.scrollToFrame = function(loadMoreData) {
|
10039 | var options = this.options, visibleGroupContainer = this.visibleGroupContainer, totalRows = this._totalRows, rowHeight = options.rowHeight || ListView.defaultRowHeight, visibleRows = this.getVisibleRows() || 1, scrollTop = this.scrollbarInner.node().scrollTop, scrollPosition = 0 === scrollTop ? 0 : Math.floor(scrollTop / rowHeight), transformAttr = visuals.SVGUtil.translateWithPixels(0, scrollPosition * rowHeight);
|
10040 | visibleGroupContainer.style({
|
10041 | transform: function(d) {
|
10042 | return transformAttr;
|
10043 | },
|
10044 | "-webkit-transform": transformAttr
|
10045 | });
|
10046 | var position0 = Math.max(0, Math.min(scrollPosition, totalRows - visibleRows + 1)), position1 = position0 + visibleRows;
|
10047 | if (this.options.scrollEnabled) {
|
10048 | var topRowHiddenHeight = scrollTop - scrollPosition * rowHeight, halfRowHeight = .5 * rowHeight;
|
10049 | topRowHiddenHeight > halfRowHeight && position1++;
|
10050 | }
|
10051 | var rowSelection = visibleGroupContainer.selectAll(".row").data(this._data.slice(position0, Math.min(position1, totalRows)), this.getDatumIndex);
|
10052 | rowSelection.enter().append("div").classed("row", !0).call(function(d) {
|
10053 | return options.enter(d);
|
10054 | }), rowSelection.order();
|
10055 | var rowUpdateSelection = visibleGroupContainer.selectAll(".row:not(.transitioning)");
|
10056 | rowUpdateSelection.call(function(d) {
|
10057 | return options.update(d);
|
10058 | }), rowSelection.exit().call(function(d) {
|
10059 | return options.exit(d);
|
10060 | }).remove(), loadMoreData && visibleRows !== totalRows && position1 >= totalRows * ListView.loadMoreDataThreshold && options.loadMoreData();
|
10061 | }, ListView.prototype.setTotalRows = function() {
|
10062 | var data = this._data;
|
10063 | this._totalRows = data ? data.length : 0;
|
10064 | }, ListView.prototype.getVisibleRows = function() {
|
10065 | var minimumVisibleRows = 1, rowHeight = this.options.rowHeight, viewportHeight = this.options.viewport.height;
|
10066 | return !rowHeight || 1 > rowHeight ? minimumVisibleRows : this.options.scrollEnabled ? Math.min(Math.ceil(viewportHeight / rowHeight), this._totalRows) || minimumVisibleRows : Math.min(Math.floor(viewportHeight / rowHeight), this._totalRows) || minimumVisibleRows;
|
10067 | }, ListView.prototype.getRowHeight = function() {
|
10068 | var deferred = $.Deferred(), listView = this, options = listView.options;
|
10069 | if (this.cancelMeasurePass && this.cancelMeasurePass(), !(this._data && this._data.length && options)) return listView.rowHeight(ListView.defaultRowHeight),
|
10070 | deferred.resolve(options.rowHeight).promise();
|
10071 | this.scrollToFrame(!1);
|
10072 | var requestAnimationFrameId = window.requestAnimationFrame(function() {
|
10073 | var rows = listView.visibleGroupContainer.select(".row");
|
10074 | if (!rows.empty()) {
|
10075 | var firstRow = rows.node(), rowHeight = Math.max($(firstRow).outerHeight(!0), $(firstRow).children().first().outerHeight(!0));
|
10076 | listView.rowHeight(rowHeight), deferred.resolve(rowHeight);
|
10077 | }
|
10078 | listView.cancelMeasurePass = void 0, window.cancelAnimationFrame(requestAnimationFrameId);
|
10079 | });
|
10080 | return this.cancelMeasurePass = function() {
|
10081 | window.cancelAnimationFrame(requestAnimationFrameId), deferred.reject();
|
10082 | }, deferred.promise();
|
10083 | }, ListView.loadMoreDataThreshold = .8, ListView.defaultRowHeight = 1, ListView;
|
10084 | }();
|
10085 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10086 | }(powerbi || (powerbi = {}));
|
10087 |
|
10088 | var powerbi;
|
10089 |
|
10090 | !function(powerbi) {
|
10091 | var visuals;
|
10092 | !function(visuals) {
|
10093 | var MapUtil, defaultLevelOfDetail = 11;
|
10094 | !function(MapUtil) {
|
10095 | function clip(n, minValue, maxValue) {
|
10096 | return Math.min(Math.max(n, minValue), maxValue);
|
10097 | }
|
10098 | function getMapSize(levelOfDetail) {
|
10099 | return 23 === levelOfDetail ? 2147483648 : Math.floor(levelOfDetail) === levelOfDetail ? 256 << levelOfDetail : 256 * Math.pow(2, levelOfDetail);
|
10100 | }
|
10101 | function latLongToPixelXYArray(latLongArray, levelOfDetail, buildString) {
|
10102 | void 0 === buildString && (buildString = !1);
|
10103 | for (var helperArray = [], result = {
|
10104 | array: new Float64Array(latLongArray.length),
|
10105 | arrayString: ""
|
10106 | }, i = 0; i < latLongArray.length; i += 2) {
|
10107 | 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);
|
10108 | result.array[i] = clip(x * mapSize + .5, 0, mapSize - 1), result.array[i + 1] = clip(y * mapSize + .5, 0, mapSize - 1),
|
10109 | buildString && (helperArray.push(result.array[i], result.array[i + 1]), helperArray.length >= pointArrayChunkLength && (result.arrayString += helperArray.join(" ") + " ",
|
10110 | helperArray = []));
|
10111 | }
|
10112 | return buildString && (result.arrayString += helperArray.join(" ") + " "), result;
|
10113 | }
|
10114 | function getLocationBoundaries(latLongArray) {
|
10115 | for (var northWest = {
|
10116 | latitude: -90,
|
10117 | longitude: 180
|
10118 | }, southEast = {
|
10119 | latitude: 90,
|
10120 | longitude: -180
|
10121 | }, i = 0; i < latLongArray.length; i += 2) northWest.latitude = Math.max(latLongArray[i], northWest.latitude),
|
10122 | northWest.longitude = Math.min(latLongArray[i + 1], northWest.longitude), southEast.latitude = Math.min(latLongArray[i], southEast.latitude),
|
10123 | southEast.longitude = Math.max(latLongArray[i + 1], southEast.longitude);
|
10124 | return northWest.longitude = clip(northWest.longitude, -180, 180), southEast.longitude = clip(southEast.longitude, -180, 180),
|
10125 | Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(northWest.latitude, northWest.longitude), new Microsoft.Maps.Location(southEast.latitude, southEast.longitude));
|
10126 | }
|
10127 | function parseEncodedSpatialValueArray(value) {
|
10128 | for (var list = [], index = 0, xsum = 0, ysum = 0, max = 4294967296; index < value.length; ) {
|
10129 | for (var n = 0, k = 0; ;) {
|
10130 | if (index >= value.length) return null;
|
10131 | var b = safeCharacters.indexOf(value.charAt(index++));
|
10132 | if (-1 === b) return null;
|
10133 | var tmp = (31 & b) * Math.pow(2, k), ht = tmp / max, lt = tmp % max, hn = n / max, ln = n % max, nl = (lt | ln) >>> 0;
|
10134 | if (n = (ht | hn) * max + nl, k += 5, 32 > b) break;
|
10135 | }
|
10136 | var diagonal = Math.floor((Math.sqrt(8 * n + 5) - 1) / 2);
|
10137 | n -= diagonal * (diagonal + 1) / 2;
|
10138 | var ny = Math.floor(n), nx = diagonal - ny;
|
10139 | nx = nx >> 1 ^ -(1 & nx), ny = ny >> 1 ^ -(1 & ny), xsum += nx, ysum += ny;
|
10140 | var lat = 1e-5 * ysum, lon = 1e-5 * xsum;
|
10141 | list.push(lat), list.push(lon);
|
10142 | }
|
10143 | return new Float64Array(list);
|
10144 | }
|
10145 | function calcGeoData(data) {
|
10146 | for (var locations = data.locations, i = 0; i < locations.length; i++) {
|
10147 | var location_1 = locations[i];
|
10148 | location_1.geographic || (location_1.geographic = MapUtil.parseEncodedSpatialValueArray(location_1.nativeBing));
|
10149 | var polygon = location_1.geographic;
|
10150 | if (polygon && !location_1.absolute) {
|
10151 | var result = MapUtil.latLongToPixelXYArray(polygon, MapUtil.DefaultLevelOfDetail, !0);
|
10152 | location_1.absolute = result.array, location_1.absoluteString = result.arrayString;
|
10153 | var geographicBounds = MapUtil.getLocationBoundaries(polygon);
|
10154 | location_1.absoluteBounds = MapUtil.locationRectToRectXY(geographicBounds, MapUtil.DefaultLevelOfDetail);
|
10155 | }
|
10156 | }
|
10157 | }
|
10158 | function locationToPixelXY(location, levelOfDetail) {
|
10159 | return latLongToPixelXY(location.latitude, location.longitude, levelOfDetail);
|
10160 | }
|
10161 | function locationRectToRectXY(locationRect, levelOfDetail) {
|
10162 | var topleft = locationToPixelXY(locationRect.getNorthwest(), levelOfDetail), bottomRight = locationToPixelXY(locationRect.getSoutheast(), levelOfDetail);
|
10163 | return new powerbi.visuals.Rect(topleft.x, topleft.y, bottomRight.x - topleft.x, bottomRight.y - topleft.y);
|
10164 | }
|
10165 | function latLongToPixelXY(latitude, longitude, levelOfDetail) {
|
10166 | var array = latLongToPixelXYArray(new Float64Array([ latitude, longitude ]), levelOfDetail).array;
|
10167 | return new powerbi.visuals.Point(array[0], array[1]);
|
10168 | }
|
10169 | function pixelXYToLocation(pixelX, pixelY, levelOfDetail) {
|
10170 | 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;
|
10171 | return new Microsoft.Maps.Location(latitude, longitude);
|
10172 | }
|
10173 | MapUtil.Settings = {
|
10174 | MaxBingRequest: 6,
|
10175 | MaxCacheSize: 3e3,
|
10176 | MaxCacheSizeOverflow: 100,
|
10177 | BingKey: "insert your key",
|
10178 | BingUrl: "https://dev.virtualearth.net/REST/v1/Locations",
|
10179 | BingUrlGeodata: "https://platform.bing.com/geo/spatial/v1/public/Geodata?",
|
10180 | UseDoubleArrayGeodataResult: !0,
|
10181 | UseDoubleArrayDequeueTimeout: 0
|
10182 | }, MapUtil.MinAllowedLatitude = -85.05112878, MapUtil.MaxAllowedLatitude = 85.05112878,
|
10183 | MapUtil.MinAllowedLongitude = -180, MapUtil.MaxAllowedLongitude = 180, MapUtil.TileSize = 256,
|
10184 | MapUtil.MaxLevelOfDetail = 23, MapUtil.MinLevelOfDetail = 1, MapUtil.MaxAutoZoomLevel = 5,
|
10185 | MapUtil.DefaultLevelOfDetail = 11, MapUtil.WorkerErrorName = "___error___", MapUtil.CategoryTypes = {
|
10186 | Address: "Address",
|
10187 | City: "City",
|
10188 | Continent: "Continent",
|
10189 | CountryRegion: "Country",
|
10190 | County: "County",
|
10191 | Longitude: "Longitude",
|
10192 | Latitude: "Latitude",
|
10193 | Place: "Place",
|
10194 | PostalCode: "PostalCode",
|
10195 | StateOrProvince: "StateOrProvince"
|
10196 | };
|
10197 | var safeCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
10198 | MapUtil.clip = clip, MapUtil.getMapSize = getMapSize;
|
10199 | var pointArrayChunkLength = 15e3;
|
10200 | MapUtil.latLongToPixelXYArray = latLongToPixelXYArray, MapUtil.getLocationBoundaries = getLocationBoundaries,
|
10201 | MapUtil.parseEncodedSpatialValueArray = parseEncodedSpatialValueArray, MapUtil.calcGeoData = calcGeoData,
|
10202 | MapUtil.locationToPixelXY = locationToPixelXY, MapUtil.locationRectToRectXY = locationRectToRectXY,
|
10203 | MapUtil.latLongToPixelXY = latLongToPixelXY, MapUtil.pixelXYToLocation = pixelXYToLocation;
|
10204 | var CurrentLocation;
|
10205 | !function(CurrentLocation) {
|
10206 | function createPushpin(location) {
|
10207 | 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 = {
|
10208 | draggable: !1,
|
10209 | htmlContent: template,
|
10210 | height: 24,
|
10211 | width: 24
|
10212 | };
|
10213 | return new Microsoft.Maps.Pushpin(location, options);
|
10214 | }
|
10215 | CurrentLocation.createPushpin = createPushpin;
|
10216 | }(CurrentLocation = MapUtil.CurrentLocation || (MapUtil.CurrentLocation = {}));
|
10217 | }(MapUtil = visuals.MapUtil || (visuals.MapUtil = {}));
|
10218 | var MapPolygonInfo = function() {
|
10219 | function MapPolygonInfo() {
|
10220 | this._locationRect = new Microsoft.Maps.LocationRect(new Microsoft.Maps.Location(30, -30), 60, 60);
|
10221 | }
|
10222 | return MapPolygonInfo.prototype.reCalc = function(mapControl, width, height) {
|
10223 | var baseLocations = [ this._locationRect.getNorthwest(), this._locationRect.getSoutheast() ];
|
10224 | if (width /= 2, height /= 2, !this._baseRect) {
|
10225 | var l0 = MapUtil.locationToPixelXY(this._locationRect.getNorthwest(), defaultLevelOfDetail), l1 = MapUtil.locationToPixelXY(this._locationRect.getSoutheast(), defaultLevelOfDetail);
|
10226 | this._baseRect = new visuals.Rect(l0.x, l0.y, l1.x - l0.x, l1.y - l0.y);
|
10227 | }
|
10228 | var l = mapControl.tryLocationToPixel(baseLocations);
|
10229 | 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);
|
10230 | }, Object.defineProperty(MapPolygonInfo.prototype, "scale", {
|
10231 | get: function() {
|
10232 | return this._baseRect ? this._currentRect.width / this._baseRect.width : 1;
|
10233 | },
|
10234 | enumerable: !0,
|
10235 | configurable: !0
|
10236 | }), Object.defineProperty(MapPolygonInfo.prototype, "transform", {
|
10237 | get: function() {
|
10238 | var base = this._baseRect, current = this._currentRect, transform = new visuals.Transform();
|
10239 | return transform.translate(current.left, current.top), transform.scale(current.width / base.width, current.height / base.height),
|
10240 | transform.translate(-base.left, -base.top), transform;
|
10241 | },
|
10242 | enumerable: !0,
|
10243 | configurable: !0
|
10244 | }), Object.defineProperty(MapPolygonInfo.prototype, "outherTransform", {
|
10245 | get: function() {
|
10246 | var base = this._baseRect, current = this._currentRect, transform = new visuals.Transform();
|
10247 | transform.translate(current.left, current.top);
|
10248 | var scale = Math.sqrt(current.width / base.width);
|
10249 | return transform.scale(scale, scale), transform;
|
10250 | },
|
10251 | enumerable: !0,
|
10252 | configurable: !0
|
10253 | }), MapPolygonInfo.prototype.setViewBox = function(svg) {
|
10254 | var rect = svg.getBoundingClientRect(), current = this._currentRect;
|
10255 | svg.setAttribute("viewBox", [ -current.left, -current.top, rect.width, rect.height ].join(" "));
|
10256 | }, Object.defineProperty(MapPolygonInfo.prototype, "innerTransform", {
|
10257 | get: function() {
|
10258 | var base = this._baseRect, current = this._currentRect, transform = new visuals.Transform(), scale = current.width / base.width;
|
10259 | return transform.scale(scale, scale), transform.translate(-base.left, -base.top),
|
10260 | transform;
|
10261 | },
|
10262 | enumerable: !0,
|
10263 | configurable: !0
|
10264 | }), MapPolygonInfo.prototype.transformToString = function(transform) {
|
10265 | var m = transform.matrix;
|
10266 | return "matrix(" + m.m00 + " " + m.m10 + " " + m.m01 + " " + m.m11 + " " + m.m02 + " " + m.m12 + ")";
|
10267 | }, MapPolygonInfo;
|
10268 | }();
|
10269 | visuals.MapPolygonInfo = MapPolygonInfo;
|
10270 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10271 | }(powerbi || (powerbi = {}));
|
10272 |
|
10273 | var powerbi;
|
10274 |
|
10275 | !function(powerbi) {
|
10276 | var visuals;
|
10277 | !function(visuals) {
|
10278 | var utility;
|
10279 | !function(utility) {
|
10280 | var SelectionManager = function() {
|
10281 | function SelectionManager(options) {
|
10282 | this.hostServices = options.hostServices, this.selectedIds = [];
|
10283 | }
|
10284 | return SelectionManager.prototype.select = function(selectionId, multiSelect) {
|
10285 | void 0 === multiSelect && (multiSelect = !1);
|
10286 | var deferred = $.Deferred();
|
10287 | return this.hostServices.shouldRetainSelection() ? this.sendSelectionToHost([ selectionId ]) : (this.selectInternal(selectionId, multiSelect),
|
10288 | this.sendSelectionToHost(this.selectedIds)), deferred.resolve(this.selectedIds),
|
10289 | deferred;
|
10290 | }, SelectionManager.prototype.showContextMenu = function(selectionId, position) {
|
10291 | var deferred = $.Deferred();
|
10292 | return position = position || visuals.InteractivityUtils.getPositionOfLastInputEvent(),
|
10293 | this.sendContextMenuToHost(selectionId, position), deferred.resolve(), deferred;
|
10294 | }, SelectionManager.prototype.hasSelection = function() {
|
10295 | return this.selectedIds.length > 0;
|
10296 | }, SelectionManager.prototype.clear = function() {
|
10297 | var deferred = $.Deferred();
|
10298 | return this.selectedIds = [], this.sendSelectionToHost([]), deferred.resolve(),
|
10299 | deferred;
|
10300 | }, SelectionManager.prototype.getSelectionIds = function() {
|
10301 | return this.selectedIds;
|
10302 | }, SelectionManager.prototype.sendSelectionToHost = function(ids) {
|
10303 | var selectArgs = {
|
10304 | data: ids.filter(function(value) {
|
10305 | return value.hasIdentity();
|
10306 | }).map(function(value) {
|
10307 | return value.getSelector();
|
10308 | })
|
10309 | }, data2 = this.getSelectorsByColumn(ids);
|
10310 | _.isEmpty(data2) || (selectArgs.data2 = data2), this.hostServices.onSelect(selectArgs);
|
10311 | }, SelectionManager.prototype.sendContextMenuToHost = function(selectionId, position) {
|
10312 | var selectors = this.getSelectorsByColumn([ selectionId ]);
|
10313 | if (!_.isEmpty(selectors)) {
|
10314 | var args = {
|
10315 | data: selectors,
|
10316 | position: position
|
10317 | };
|
10318 | this.hostServices.onContextMenu(args);
|
10319 | }
|
10320 | }, SelectionManager.prototype.getSelectorsByColumn = function(selectionIds) {
|
10321 | return _(selectionIds).filter(function(value) {
|
10322 | return value.hasIdentity;
|
10323 | }).map(function(value) {
|
10324 | return value.getSelectorsByColumn();
|
10325 | }).compact().value();
|
10326 | }, SelectionManager.prototype.selectInternal = function(selectionId, multiSelect) {
|
10327 | SelectionManager.containsSelection(this.selectedIds, selectionId) ? this.selectedIds = multiSelect ? this.selectedIds.filter(function(d) {
|
10328 | return !powerbi.data.Selector.equals(d, selectionId);
|
10329 | }) : this.selectedIds.length > 1 ? [ selectionId ] : [] : multiSelect ? this.selectedIds.push(selectionId) : this.selectedIds = [ selectionId ];
|
10330 | }, SelectionManager.containsSelection = function(list, id) {
|
10331 | return list.some(function(d) {
|
10332 | return powerbi.data.Selector.equals(d.getSelector(), id.getSelector());
|
10333 | });
|
10334 | }, SelectionManager;
|
10335 | }();
|
10336 | utility.SelectionManager = SelectionManager;
|
10337 | }(utility = visuals.utility || (visuals.utility = {}));
|
10338 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10339 | }(powerbi || (powerbi = {}));
|
10340 |
|
10341 | var powerbi;
|
10342 |
|
10343 | !function(powerbi) {
|
10344 | var visuals;
|
10345 | !function(visuals) {
|
10346 | "use strict";
|
10347 | var shapes;
|
10348 | !function(shapes) {
|
10349 | var Utility = jsCommon.Utility, Polygon = function() {
|
10350 | function Polygon(absolutePoints) {
|
10351 | this.polygonPoints = this.convertArrayPathToPoints(absolutePoints);
|
10352 | }
|
10353 | return Polygon.prototype.absoluteCentroid = function() {
|
10354 | return null == this._absoluteCentroid && (this._absoluteCentroid = this.calculatePolygonCentroid()),
|
10355 | this._absoluteCentroid;
|
10356 | }, Polygon.prototype.absoluteBoundingRect = function() {
|
10357 | return null == this._absoluteBoundingRect && (this._absoluteBoundingRect = this.calculateBoundingRect()),
|
10358 | this._absoluteBoundingRect;
|
10359 | }, Polygon.prototype.contains = function(rect) {
|
10360 | var topLeft = {
|
10361 | x: rect.left,
|
10362 | y: rect.top
|
10363 | }, topRight = {
|
10364 | x: rect.left + rect.width,
|
10365 | y: rect.top
|
10366 | }, bottomLeft = {
|
10367 | x: rect.left,
|
10368 | y: rect.top + rect.height
|
10369 | }, bottomRight = {
|
10370 | x: rect.left + rect.width,
|
10371 | y: rect.top + rect.height
|
10372 | };
|
10373 | return this.inside(topLeft) && this.inside(topRight) && this.inside(bottomLeft) && this.inside(bottomRight);
|
10374 | }, Polygon.prototype.conflicts = function(rect) {
|
10375 | if (!this.isConflictWithBoundingBox(rect)) return !1;
|
10376 | var topLeft = {
|
10377 | x: rect.left,
|
10378 | y: rect.top
|
10379 | }, topCenter = {
|
10380 | x: rect.left + rect.width / 2,
|
10381 | y: rect.top
|
10382 | }, topRight = {
|
10383 | x: rect.left + rect.width,
|
10384 | y: rect.top
|
10385 | }, bottomLeft = {
|
10386 | x: rect.left,
|
10387 | y: rect.top + rect.height
|
10388 | }, bottomCenter = {
|
10389 | x: rect.left + rect.width / 2,
|
10390 | y: rect.top + rect.height
|
10391 | }, bottomRight = {
|
10392 | x: rect.left + rect.width,
|
10393 | y: rect.top + rect.height
|
10394 | }, middleLeft = {
|
10395 | x: rect.left,
|
10396 | y: rect.top + rect.height / 2
|
10397 | }, middleRight = {
|
10398 | x: rect.left + rect.width,
|
10399 | y: rect.top + rect.height / 2
|
10400 | };
|
10401 | 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);
|
10402 | }, Polygon.prototype.lineIntersectionPoint = function(p0, p1) {
|
10403 | for (var i = 0; i < this.polygonPoints.length; i++) {
|
10404 | 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);
|
10405 | if (null !== intersection) return intersection;
|
10406 | }
|
10407 | return null;
|
10408 | }, Polygon.calculateAbsolutePolygonArea = function(polygonPoints) {
|
10409 | var i, j = 1, area = 0;
|
10410 | for (i = 0; i < polygonPoints.length; i++) area += polygonPoints[i].x * polygonPoints[j].y - polygonPoints[j].x * polygonPoints[i].y,
|
10411 | j = (j + 1) % polygonPoints.length;
|
10412 | return area *= .5;
|
10413 | }, Polygon.prototype.isConflictWithBoundingBox = function(rect) {
|
10414 | return Rect.isIntersecting(this.absoluteBoundingRect(), rect);
|
10415 | }, Polygon.prototype.calculatePolygonCentroid = function() {
|
10416 | var area, tempPoint, cx, cy, i, j;
|
10417 | for (area = Polygon.calculateAbsolutePolygonArea(this.polygonPoints), cx = cy = 0,
|
10418 | 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,
|
10419 | cx += (this.polygonPoints[i].x + this.polygonPoints[j].x) * tempPoint, cy += (this.polygonPoints[i].y + this.polygonPoints[j].y) * tempPoint,
|
10420 | j = (j + 1) % this.polygonPoints.length;
|
10421 | return cx /= 6 * area, cy /= 6 * area, {
|
10422 | x: cx,
|
10423 | y: cy
|
10424 | };
|
10425 | }, Polygon.prototype.calculateBoundingRect = function() {
|
10426 | 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),
|
10427 | this.polygonPoints[i].y < minY ? minY = this.polygonPoints[i].y : this.polygonPoints[i].y > maxY && (maxY = this.polygonPoints[i].y);
|
10428 | return {
|
10429 | left: minX,
|
10430 | top: minY,
|
10431 | width: maxX - minX,
|
10432 | height: maxY - minY
|
10433 | };
|
10434 | }, Polygon.prototype.inside = function(point) {
|
10435 | for (var x = point.x, y = point.y, insideVar = !1, i = 0, j = this.polygonPoints.length - 1; i < this.polygonPoints.length; j = i++) {
|
10436 | 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;
|
10437 | intersect && (insideVar = !insideVar);
|
10438 | }
|
10439 | return insideVar;
|
10440 | }, Polygon.prototype.getLineIntersection = function(line0p1, line0p2, line1p1, line1p2) {
|
10441 | 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);
|
10442 | return s >= 0 && 1 >= s && t >= 0 && 1 >= t ? {
|
10443 | x: p0_x + t * s1_x,
|
10444 | y: p0_y + t * s1_y
|
10445 | } : null;
|
10446 | }, Polygon.prototype.convertArrayPathToPoints = function(path) {
|
10447 | for (var pointsRes = [], i = 0; i < path.length; i += 2) {
|
10448 | var x = path[i], y = path[i + 1], newPoint = {
|
10449 | x: x,
|
10450 | y: y
|
10451 | };
|
10452 | pointsRes.push(newPoint);
|
10453 | }
|
10454 | return pointsRes;
|
10455 | }, Polygon;
|
10456 | }();
|
10457 | shapes.Polygon = Polygon;
|
10458 | var Point;
|
10459 | !function(Point) {
|
10460 | function offset(point, offsetX, offsetY) {
|
10461 | var newPointX = point.x + offsetX >= 0 ? point.x + offsetX : 0, newPointY = point.y + offsetY >= 0 ? point.y + offsetY : 0;
|
10462 | return {
|
10463 | x: newPointX,
|
10464 | y: newPointY
|
10465 | };
|
10466 | }
|
10467 | function equals(point, other) {
|
10468 | return void 0 !== point && null !== point && void 0 !== other && null !== other && point.x === other.x && point.y === other.y;
|
10469 | }
|
10470 | function clone(point) {
|
10471 | return null !== point ? {
|
10472 | x: point.x,
|
10473 | y: point.y
|
10474 | } : null;
|
10475 | }
|
10476 | function toString(point) {
|
10477 | return "{x:" + point.x + ", y:" + point.y + "}";
|
10478 | }
|
10479 | function serialize(point) {
|
10480 | return point.x + "," + point.y;
|
10481 | }
|
10482 | function getDistance(point, other) {
|
10483 | if (null === point || null === other) return null;
|
10484 | var diffX = other.x - point.x, diffY = other.y - point.y;
|
10485 | return Math.sqrt(diffX * diffX + diffY * diffY);
|
10486 | }
|
10487 | function equalWithPrecision(point1, point2) {
|
10488 | return point1 === point2 || void 0 !== point1 && void 0 !== point2 && powerbi.Double.equalWithPrecision(point1.x, point2.x) && powerbi.Double.equalWithPrecision(point1.y, point2.y);
|
10489 | }
|
10490 | function parsePoint(value, defaultValue) {
|
10491 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
10492 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
10493 | if (2 === value.length) return {
|
10494 | x: Utility.parseNumber(value[0]),
|
10495 | y: Utility.parseNumber(value[1])
|
10496 | };
|
10497 | if ("string" == typeof value) {
|
10498 | var parts = value.split(",");
|
10499 | return 2 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
10500 | x: Utility.parseNumber(parts[0]),
|
10501 | y: Utility.parseNumber(parts[1])
|
10502 | };
|
10503 | }
|
10504 | return 2 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
10505 | x: Utility.parseNumber(value.x),
|
10506 | y: Utility.parseNumber(value.y)
|
10507 | };
|
10508 | }
|
10509 | Point.offset = offset, Point.equals = equals, Point.clone = clone, Point.toString = toString,
|
10510 | Point.serialize = serialize, Point.getDistance = getDistance, Point.equalWithPrecision = equalWithPrecision,
|
10511 | Point.parsePoint = parsePoint;
|
10512 | }(Point = shapes.Point || (shapes.Point = {}));
|
10513 | var Size;
|
10514 | !function(Size) {
|
10515 | function isEmpty(size) {
|
10516 | return 0 === size.width && 0 === size.height;
|
10517 | }
|
10518 | function equals(size, other) {
|
10519 | return void 0 !== size && null !== size && void 0 !== other && null !== other && size.width === other.width && size.height === other.height;
|
10520 | }
|
10521 | function clone(size) {
|
10522 | return null !== size ? {
|
10523 | width: size.width,
|
10524 | height: size.height
|
10525 | } : null;
|
10526 | }
|
10527 | function inflate(size, padding) {
|
10528 | var result = clone(size);
|
10529 | return padding && (result.width += padding.left + padding.right, result.height += padding.top + padding.bottom),
|
10530 | result;
|
10531 | }
|
10532 | function deflate(size, padding) {
|
10533 | var result = clone(size);
|
10534 | return padding && (result.width = result.width - padding.left - padding.right, result.width < 0 && (result.width = 0),
|
10535 | result.height = result.height - padding.top - padding.bottom, result.height < 0 && (result.height = 0)),
|
10536 | result;
|
10537 | }
|
10538 | function combine(size, other) {
|
10539 | return other && (size.width = Math.max(size.width, other.width), size.height = Math.max(size.height, other.height)),
|
10540 | size;
|
10541 | }
|
10542 | function toRect(size) {
|
10543 | return {
|
10544 | left: 0,
|
10545 | top: 0,
|
10546 | width: size.width,
|
10547 | height: size.height
|
10548 | };
|
10549 | }
|
10550 | function toString(size) {
|
10551 | return "{width:" + size.width + ", height:" + size.height + "}";
|
10552 | }
|
10553 | function equal(size1, size2) {
|
10554 | return size1 === size2 || void 0 !== size1 && void 0 !== size2 && size1.width === size2.width && size1.height === size2.height;
|
10555 | }
|
10556 | function equalWithPrecision(size1, size2) {
|
10557 | return size1 === size2 || void 0 !== size1 && void 0 !== size2 && powerbi.Double.equalWithPrecision(size1.width, size2.width) && powerbi.Double.equalWithPrecision(size1.height, size2.height);
|
10558 | }
|
10559 | function parseSize(value, defaultValue) {
|
10560 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
10561 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
10562 | if (2 === value.length) return {
|
10563 | width: Utility.parseNumber(value[0]),
|
10564 | height: Utility.parseNumber(value[1])
|
10565 | };
|
10566 | if ("string" == typeof value) {
|
10567 | var parts = value.split(",");
|
10568 | return 2 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
10569 | width: Utility.parseNumber(parts[0]),
|
10570 | height: Utility.parseNumber(parts[1])
|
10571 | };
|
10572 | }
|
10573 | return 2 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
10574 | width: Utility.parseNumber(value.width),
|
10575 | height: Utility.parseNumber(value.height)
|
10576 | };
|
10577 | }
|
10578 | Size.isEmpty = isEmpty, Size.equals = equals, Size.clone = clone, Size.inflate = inflate,
|
10579 | Size.deflate = deflate, Size.combine = combine, Size.toRect = toRect, Size.toString = toString,
|
10580 | Size.equal = equal, Size.equalWithPrecision = equalWithPrecision, Size.parseSize = parseSize;
|
10581 | }(Size = shapes.Size || (shapes.Size = {}));
|
10582 | var Rect;
|
10583 | !function(Rect) {
|
10584 | function getOffset(rect) {
|
10585 | return {
|
10586 | x: rect.left,
|
10587 | y: rect.top
|
10588 | };
|
10589 | }
|
10590 | function getSize(rect) {
|
10591 | return {
|
10592 | width: rect.width,
|
10593 | height: rect.height
|
10594 | };
|
10595 | }
|
10596 | function setSize(rect, value) {
|
10597 | rect.width = value.width, rect.height = value.height;
|
10598 | }
|
10599 | function right(rect) {
|
10600 | return rect.left + rect.width;
|
10601 | }
|
10602 | function bottom(rect) {
|
10603 | return rect.top + rect.height;
|
10604 | }
|
10605 | function topLeft(rect) {
|
10606 | return {
|
10607 | x: rect.left,
|
10608 | y: rect.top
|
10609 | };
|
10610 | }
|
10611 | function topRight(rect) {
|
10612 | return {
|
10613 | x: rect.left + rect.width,
|
10614 | y: rect.top
|
10615 | };
|
10616 | }
|
10617 | function bottomLeft(rect) {
|
10618 | return {
|
10619 | x: rect.left,
|
10620 | y: rect.top + rect.height
|
10621 | };
|
10622 | }
|
10623 | function bottomRight(rect) {
|
10624 | return {
|
10625 | x: rect.left + rect.width,
|
10626 | y: rect.top + rect.height
|
10627 | };
|
10628 | }
|
10629 | function equals(rect, other) {
|
10630 | return void 0 !== other && null !== other && rect.left === other.left && rect.top === other.top && rect.width === other.width && rect.height === other.height;
|
10631 | }
|
10632 | function clone(rect) {
|
10633 | return null !== rect ? {
|
10634 | left: rect.left,
|
10635 | top: rect.top,
|
10636 | width: rect.width,
|
10637 | height: rect.height
|
10638 | } : null;
|
10639 | }
|
10640 | function toString(rect) {
|
10641 | return "{left:" + rect.left + ", top:" + rect.top + ", width:" + rect.width + ", height:" + rect.height + "}";
|
10642 | }
|
10643 | function offset(rect, offsetX, offsetY) {
|
10644 | var newLeft = rect.left + offsetX >= 0 ? rect.left + offsetX : 0, newTop = rect.top + offsetY >= 0 ? rect.top + offsetY : 0;
|
10645 | return {
|
10646 | left: newLeft,
|
10647 | top: newTop,
|
10648 | width: rect.width,
|
10649 | height: rect.height
|
10650 | };
|
10651 | }
|
10652 | function inflate(rect, padding) {
|
10653 | var result = clone(rect);
|
10654 | return padding && (result.left -= padding.left, result.top -= padding.top, result.width += padding.left + padding.right,
|
10655 | result.height += padding.top + padding.bottom), result;
|
10656 | }
|
10657 | function deflate(rect, padding) {
|
10658 | var result = clone(rect);
|
10659 | return padding && (result.left += padding.left, result.top += padding.top, result.width -= padding.left + padding.right,
|
10660 | result.height -= padding.top + padding.bottom), result;
|
10661 | }
|
10662 | function inflateBy(rect, padding) {
|
10663 | return {
|
10664 | left: rect.left - padding,
|
10665 | top: rect.top - padding,
|
10666 | width: rect.width + padding + padding,
|
10667 | height: rect.height + padding + padding
|
10668 | };
|
10669 | }
|
10670 | function deflateBy(rect, padding) {
|
10671 | return {
|
10672 | left: rect.left + padding,
|
10673 | top: rect.top + padding,
|
10674 | width: rect.width - padding - padding,
|
10675 | height: rect.height - padding - padding
|
10676 | };
|
10677 | }
|
10678 | function getClosestPoint(rect, x, y) {
|
10679 | return {
|
10680 | x: Math.min(Math.max(rect.left, x), rect.left + rect.width),
|
10681 | y: Math.min(Math.max(rect.top, y), rect.top + rect.height)
|
10682 | };
|
10683 | }
|
10684 | function equal(rect1, rect2) {
|
10685 | 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;
|
10686 | }
|
10687 | function equalWithPrecision(rect1, rect2) {
|
10688 | 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);
|
10689 | }
|
10690 | function isEmpty(rect) {
|
10691 | return void 0 === rect || null === rect || 0 === rect.width && 0 === rect.height;
|
10692 | }
|
10693 | function containsPoint(rect, point) {
|
10694 | 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);
|
10695 | }
|
10696 | function isIntersecting(rect1, rect2) {
|
10697 | if (!rect1 || !rect2) return !1;
|
10698 | var left = Math.max(rect1.left, rect2.left), right = Math.min(rect1.left + rect1.width, rect2.left + rect2.width);
|
10699 | if (left > right) return !1;
|
10700 | var top = Math.max(rect1.top, rect2.top), bottom = Math.min(rect1.top + rect1.height, rect2.top + rect2.height);
|
10701 | return bottom >= top;
|
10702 | }
|
10703 | function intersect(rect1, rect2) {
|
10704 | if (!rect1) return rect2;
|
10705 | if (!rect2) return rect1;
|
10706 | 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);
|
10707 | return right >= left && bottom >= top ? {
|
10708 | left: left,
|
10709 | top: top,
|
10710 | width: right - left,
|
10711 | height: bottom - top
|
10712 | } : {
|
10713 | left: 0,
|
10714 | top: 0,
|
10715 | width: 0,
|
10716 | height: 0
|
10717 | };
|
10718 | }
|
10719 | function combine(rect1, rect2) {
|
10720 | if (!rect1) return rect2;
|
10721 | if (!rect2) return rect1;
|
10722 | 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);
|
10723 | return {
|
10724 | left: left,
|
10725 | top: top,
|
10726 | width: right - left,
|
10727 | height: bottom - top
|
10728 | };
|
10729 | }
|
10730 | function parseRect(value, defaultValue) {
|
10731 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
10732 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
10733 | if (4 === value.length) return {
|
10734 | left: Utility.parseNumber(value[0]),
|
10735 | top: Utility.parseNumber(value[1]),
|
10736 | width: Utility.parseNumber(value[2]),
|
10737 | height: Utility.parseNumber(value[3])
|
10738 | };
|
10739 | if ("string" == typeof value) {
|
10740 | var parts = value.split(",");
|
10741 | return 4 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
10742 | left: Utility.parseNumber(parts[0]),
|
10743 | top: Utility.parseNumber(parts[1]),
|
10744 | width: Utility.parseNumber(parts[2]),
|
10745 | height: Utility.parseNumber(parts[3])
|
10746 | };
|
10747 | }
|
10748 | return 4 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
10749 | left: Utility.parseNumber(value.left),
|
10750 | top: Utility.parseNumber(value.top),
|
10751 | width: Utility.parseNumber(value.width),
|
10752 | height: Utility.parseNumber(value.height)
|
10753 | };
|
10754 | }
|
10755 | Rect.getOffset = getOffset, Rect.getSize = getSize, Rect.setSize = setSize, Rect.right = right,
|
10756 | Rect.bottom = bottom, Rect.topLeft = topLeft, Rect.topRight = topRight, Rect.bottomLeft = bottomLeft,
|
10757 | Rect.bottomRight = bottomRight, Rect.equals = equals, Rect.clone = clone, Rect.toString = toString,
|
10758 | Rect.offset = offset, Rect.inflate = inflate, Rect.deflate = deflate, Rect.inflateBy = inflateBy,
|
10759 | Rect.deflateBy = deflateBy, Rect.getClosestPoint = getClosestPoint, Rect.equal = equal,
|
10760 | Rect.equalWithPrecision = equalWithPrecision, Rect.isEmpty = isEmpty, Rect.containsPoint = containsPoint,
|
10761 | Rect.isIntersecting = isIntersecting, Rect.intersect = intersect, Rect.combine = combine,
|
10762 | Rect.parseRect = parseRect;
|
10763 | }(Rect = shapes.Rect || (shapes.Rect = {}));
|
10764 | var Thickness;
|
10765 | !function(Thickness) {
|
10766 | function inflate(thickness, other) {
|
10767 | var result = clone(thickness);
|
10768 | return other && (result.left = thickness.left + other.left, result.right = thickness.right + other.right,
|
10769 | result.bottom = thickness.bottom + other.bottom, result.top = thickness.top + other.top),
|
10770 | result;
|
10771 | }
|
10772 | function getWidth(thickness) {
|
10773 | return thickness.left + thickness.right;
|
10774 | }
|
10775 | function getHeight(thickness) {
|
10776 | return thickness.top + thickness.bottom;
|
10777 | }
|
10778 | function clone(thickness) {
|
10779 | return null !== thickness ? {
|
10780 | left: thickness.left,
|
10781 | top: thickness.top,
|
10782 | right: thickness.right,
|
10783 | bottom: thickness.bottom
|
10784 | } : null;
|
10785 | }
|
10786 | function equals(thickness, other) {
|
10787 | 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;
|
10788 | }
|
10789 | function flipHorizontal(thickness) {
|
10790 | var temp = thickness.right;
|
10791 | thickness.right = thickness.left, thickness.left = temp;
|
10792 | }
|
10793 | function flipVertical(thickness) {
|
10794 | var top = thickness.top;
|
10795 | thickness.top = thickness.bottom, thickness.bottom = top;
|
10796 | }
|
10797 | function toString(thickness) {
|
10798 | return "{top:" + thickness.top + ", left:" + thickness.left + ", right:" + thickness.right + ", bottom:" + thickness.bottom + "}";
|
10799 | }
|
10800 | function toCssString(thickness) {
|
10801 | return thickness.top + "px " + thickness.right + "px " + thickness.bottom + "px " + thickness.left + "px";
|
10802 | }
|
10803 | function isEmpty(thickness) {
|
10804 | return 0 === thickness.left && 0 === thickness.top && 0 === thickness.right && 0 === thickness.bottom;
|
10805 | }
|
10806 | function equal(thickness1, thickness2) {
|
10807 | 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;
|
10808 | }
|
10809 | function equalWithPrecision(thickness1, thickness2) {
|
10810 | 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);
|
10811 | }
|
10812 | function parseThickness(value, defaultValue, resetValue) {
|
10813 | if (null === value) return void 0 === defaultValue ? null : defaultValue;
|
10814 | if (void 0 === value) return void 0 === defaultValue ? null : defaultValue;
|
10815 | if (4 === value.length) return {
|
10816 | left: Utility.parseNumber(value[0]),
|
10817 | top: Utility.parseNumber(value[1]),
|
10818 | right: Utility.parseNumber(value[2]),
|
10819 | bottom: Utility.parseNumber(value[3])
|
10820 | };
|
10821 | if ("string" == typeof value) {
|
10822 | var parts = value.split(",");
|
10823 | return 4 !== parts.length ? void 0 === defaultValue ? null : defaultValue : {
|
10824 | left: Utility.parseNumber(parts[0]),
|
10825 | top: Utility.parseNumber(parts[1]),
|
10826 | right: Utility.parseNumber(parts[2]),
|
10827 | bottom: Utility.parseNumber(parts[3])
|
10828 | };
|
10829 | }
|
10830 | return 4 !== value.length && "string" != typeof value ? void 0 === defaultValue ? null : defaultValue : {
|
10831 | left: Utility.parseNumber(value.left),
|
10832 | top: Utility.parseNumber(value.top),
|
10833 | right: Utility.parseNumber(value.right),
|
10834 | bottom: Utility.parseNumber(value.bottom)
|
10835 | };
|
10836 | }
|
10837 | Thickness.inflate = inflate, Thickness.getWidth = getWidth, Thickness.getHeight = getHeight,
|
10838 | Thickness.clone = clone, Thickness.equals = equals, Thickness.flipHorizontal = flipHorizontal,
|
10839 | Thickness.flipVertical = flipVertical, Thickness.toString = toString, Thickness.toCssString = toCssString,
|
10840 | Thickness.isEmpty = isEmpty, Thickness.equal = equal, Thickness.equalWithPrecision = equalWithPrecision,
|
10841 | Thickness.parseThickness = parseThickness;
|
10842 | }(Thickness = shapes.Thickness || (shapes.Thickness = {}));
|
10843 | var Vector;
|
10844 | !function(Vector) {
|
10845 | function isEmpty(vector) {
|
10846 | return 0 === vector.x && 0 === vector.y;
|
10847 | }
|
10848 | function equals(vector, other) {
|
10849 | return void 0 !== vector && null !== vector && void 0 !== other && null !== other && vector.x === other.x && vector.y === other.y;
|
10850 | }
|
10851 | function clone(vector) {
|
10852 | return null !== vector ? {
|
10853 | x: vector.x,
|
10854 | y: vector.y
|
10855 | } : null;
|
10856 | }
|
10857 | function toString(vector) {
|
10858 | return "{x:" + vector.x + ", y:" + vector.y + "}";
|
10859 | }
|
10860 | function getLength(vector) {
|
10861 | return Math.sqrt(vector.x * vector.x + vector.y * vector.y);
|
10862 | }
|
10863 | function getLengthSqr(vector) {
|
10864 | return vector.x * vector.x + vector.y * vector.y;
|
10865 | }
|
10866 | function scale(vector, scalar) {
|
10867 | return {
|
10868 | x: vector.x * scalar,
|
10869 | y: vector.y * scalar
|
10870 | };
|
10871 | }
|
10872 | function normalize(vector) {
|
10873 | return isEmpty(vector) ? vector : scale(vector, 1 / getLength(vector));
|
10874 | }
|
10875 | function rotate90DegCW(vector) {
|
10876 | return {
|
10877 | x: vector.y,
|
10878 | y: -vector.x
|
10879 | };
|
10880 | }
|
10881 | function rotate90DegCCW(vector) {
|
10882 | return {
|
10883 | x: -vector.y,
|
10884 | y: vector.x
|
10885 | };
|
10886 | }
|
10887 | function rotate(vector, angle) {
|
10888 | var newX = vector.x * Math.cos(angle) - vector.y * Math.sin(angle), newY = vector.x * Math.sin(angle) + vector.y * Math.cos(angle);
|
10889 | return {
|
10890 | x: newX,
|
10891 | y: newY
|
10892 | };
|
10893 | }
|
10894 | function equal(vector1, vector2) {
|
10895 | return vector1 === vector2 || void 0 !== vector1 && void 0 !== vector2 && vector1.x === vector2.x && vector1.y === vector2.y;
|
10896 | }
|
10897 | function equalWithPrecision(vector1, vector2) {
|
10898 | return vector1 === vector2 || void 0 !== vector1 && void 0 !== vector2 && powerbi.Double.equalWithPrecision(vector1.x, vector2.x) && powerbi.Double.equalWithPrecision(vector1.y, vector2.y);
|
10899 | }
|
10900 | function add(vect1, vect2) {
|
10901 | return vect1 && vect2 ? {
|
10902 | x: vect1.x + vect2.x,
|
10903 | y: vect1.y + vect2.y
|
10904 | } : void 0;
|
10905 | }
|
10906 | function subtract(vect1, vect2) {
|
10907 | return vect1 && vect2 ? {
|
10908 | x: vect1.x - vect2.x,
|
10909 | y: vect1.y - vect2.y
|
10910 | } : void 0;
|
10911 | }
|
10912 | function dotProduct(vect1, vect2) {
|
10913 | return vect1 && vect2 ? vect1.x * vect2.x + vect1.y * vect2.y : void 0;
|
10914 | }
|
10915 | function getDeltaVector(p0, p1) {
|
10916 | return p0 && p1 ? {
|
10917 | x: p1.x - p0.x,
|
10918 | y: p1.y - p0.y
|
10919 | } : void 0;
|
10920 | }
|
10921 | Vector.isEmpty = isEmpty, Vector.equals = equals, Vector.clone = clone, Vector.toString = toString,
|
10922 | Vector.getLength = getLength, Vector.getLengthSqr = getLengthSqr, Vector.scale = scale,
|
10923 | Vector.normalize = normalize, Vector.rotate90DegCW = rotate90DegCW, Vector.rotate90DegCCW = rotate90DegCCW,
|
10924 | Vector.rotate = rotate, Vector.equal = equal, Vector.equalWithPrecision = equalWithPrecision,
|
10925 | Vector.add = add, Vector.subtract = subtract, Vector.dotProduct = dotProduct, Vector.getDeltaVector = getDeltaVector;
|
10926 | }(Vector = shapes.Vector || (shapes.Vector = {}));
|
10927 | }(shapes = visuals.shapes || (visuals.shapes = {}));
|
10928 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
10929 | }(powerbi || (powerbi = {}));
|
10930 |
|
10931 | var powerbi;
|
10932 |
|
10933 | !function(powerbi) {
|
10934 | var visuals;
|
10935 | !function(visuals) {
|
10936 | var SlicerUtil, PixelConverter = jsCommon.PixelConverter;
|
10937 | !function(SlicerUtil) {
|
10938 | function tryRemoveValueFromRetainedList(value, selectedScopeIds, caseInsensitive) {
|
10939 | if (!value || _.isEmpty(selectedScopeIds)) return !1;
|
10940 | for (var i = 0, len = selectedScopeIds.length; len > i; i++) {
|
10941 | var retainedValueScopeId = selectedScopeIds[i];
|
10942 | if (powerbi.DataViewScopeIdentity.equals(value, retainedValueScopeId, caseInsensitive)) return selectedScopeIds.splice(i, 1),
|
10943 | !0;
|
10944 | }
|
10945 | return !1;
|
10946 | }
|
10947 | var Selectors;
|
10948 | !function(Selectors) {
|
10949 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector;
|
10950 | Selectors.HeaderContainer = createClassAndSelector("headerContainer"), Selectors.Header = createClassAndSelector("slicerHeader"),
|
10951 | Selectors.HeaderText = createClassAndSelector("headerText"), Selectors.Body = createClassAndSelector("slicerBody"),
|
10952 | Selectors.Label = createClassAndSelector("slicerLabel"), Selectors.LabelText = createClassAndSelector("slicerText"),
|
10953 | Selectors.LabelImage = createClassAndSelector("slicerImage"), Selectors.CountText = createClassAndSelector("slicerCountText"),
|
10954 | Selectors.Clear = createClassAndSelector("clear"), Selectors.MultiSelectEnabled = createClassAndSelector("isMultiSelectEnabled");
|
10955 | }(Selectors = SlicerUtil.Selectors || (SlicerUtil.Selectors = {}));
|
10956 | var DisplayNameKeys;
|
10957 | !function(DisplayNameKeys) {
|
10958 | DisplayNameKeys.Clear = "Slicer_Clear", DisplayNameKeys.SelectAll = "Slicer_SelectAll";
|
10959 | }(DisplayNameKeys = SlicerUtil.DisplayNameKeys || (SlicerUtil.DisplayNameKeys = {}));
|
10960 | var SettingsHelper;
|
10961 | !function(SettingsHelper) {
|
10962 | function areSettingsDefined(data) {
|
10963 | return null != data && null != data.slicerSettings;
|
10964 | }
|
10965 | SettingsHelper.areSettingsDefined = areSettingsDefined;
|
10966 | }(SettingsHelper = SlicerUtil.SettingsHelper || (SlicerUtil.SettingsHelper = {}));
|
10967 | var DefaultValueHandler;
|
10968 | !function(DefaultValueHandler) {
|
10969 | function getIdentityFields(dataView) {
|
10970 | if (dataView) {
|
10971 | var dataViewCategorical = dataView.categorical;
|
10972 | if (dataViewCategorical && !_.isEmpty(dataViewCategorical.categories)) return dataViewCategorical.categories[0].identityFields;
|
10973 | }
|
10974 | }
|
10975 | DefaultValueHandler.getIdentityFields = getIdentityFields;
|
10976 | }(DefaultValueHandler = SlicerUtil.DefaultValueHandler || (SlicerUtil.DefaultValueHandler = {})),
|
10977 | SlicerUtil.tryRemoveValueFromRetainedList = tryRemoveValueFromRetainedList;
|
10978 | var DOMHelper = function() {
|
10979 | function DOMHelper() {}
|
10980 | return DOMHelper.prototype.createSlicerHeader = function(hostServices) {
|
10981 | var slicerHeaderDiv = document.createElement("div");
|
10982 | slicerHeaderDiv.className = Selectors.Header["class"];
|
10983 | var slicerHeader = d3.select(slicerHeaderDiv);
|
10984 | return slicerHeader.append("span").classed(Selectors.Clear["class"], !0).attr("title", hostServices.getLocalizedString(DisplayNameKeys.Clear)),
|
10985 | slicerHeader.append("div").classed(Selectors.HeaderText["class"], !0), slicerHeaderDiv;
|
10986 | }, DOMHelper.prototype.getHeaderTextProperties = function(settings) {
|
10987 | var headerTextProperties = {
|
10988 | fontFamily: "wf_segoe-ui_normal",
|
10989 | fontSize: "10px"
|
10990 | };
|
10991 | return settings.header.show && (headerTextProperties.fontSize = PixelConverter.fromPoint(settings.header.textSize)),
|
10992 | headerTextProperties;
|
10993 | }, DOMHelper.prototype.getSlicerBodyViewport = function(currentViewport, settings, headerTextProperties) {
|
10994 | var headerHeight = settings.header.show ? this.getHeaderHeight(settings, headerTextProperties) : 0, slicerBodyHeight = currentViewport.height - (headerHeight + settings.header.borderBottomWidth);
|
10995 | return {
|
10996 | height: slicerBodyHeight,
|
10997 | width: currentViewport.width
|
10998 | };
|
10999 | }, DOMHelper.prototype.updateSlicerBodyDimensions = function(currentViewport, slicerBody, settings) {
|
11000 | var slicerViewport = this.getSlicerBodyViewport(currentViewport, settings, this.getHeaderTextProperties(settings));
|
11001 | slicerBody.style({
|
11002 | height: PixelConverter.toString(slicerViewport.height),
|
11003 | width: PixelConverter.toString(slicerViewport.width)
|
11004 | });
|
11005 | }, DOMHelper.prototype.getHeaderHeight = function(settings, textProperties) {
|
11006 | return powerbi.TextMeasurementService.estimateSvgTextHeight(this.getTextProperties(settings.header.textSize, textProperties)) + settings.general.outlineWeight;
|
11007 | }, DOMHelper.prototype.getRowHeight = function(settings, textProperties) {
|
11008 | return powerbi.TextMeasurementService.estimateSvgTextHeight(this.getTextProperties(settings.slicerText.textSize, textProperties)) + this.getRowsOutlineWidth(settings.slicerText.outline, settings.general.outlineWeight);
|
11009 | }, DOMHelper.prototype.styleSlicerHeader = function(slicerHeader, settings, headerText) {
|
11010 | if (settings.header.show) {
|
11011 | slicerHeader.style("display", "block");
|
11012 | var headerTextElement = slicerHeader.select(Selectors.HeaderText.selector).text(headerText);
|
11013 | this.setSlicerHeaderTextStyle(headerTextElement, settings);
|
11014 | } else slicerHeader.style("display", "none");
|
11015 | }, DOMHelper.prototype.setSlicerTextStyle = function(slicerText, settings) {
|
11016 | slicerText.style({
|
11017 | color: settings.slicerText.color,
|
11018 | "background-color": settings.slicerText.background,
|
11019 | "border-style": "solid",
|
11020 | "border-color": settings.general.outlineColor,
|
11021 | "border-width": visuals.VisualBorderUtil.getBorderWidth(settings.slicerText.outline, settings.general.outlineWeight),
|
11022 | "font-size": PixelConverter.fromPoint(settings.slicerText.textSize)
|
11023 | });
|
11024 | }, DOMHelper.prototype.getRowsOutlineWidth = function(outlineElement, outlineWeight) {
|
11025 | switch (outlineElement) {
|
11026 | case visuals.outline.none:
|
11027 | case visuals.outline.leftRight:
|
11028 | return 0;
|
11029 |
|
11030 | case visuals.outline.bottomOnly:
|
11031 | case visuals.outline.topOnly:
|
11032 | return outlineWeight;
|
11033 |
|
11034 | case visuals.outline.topBottom:
|
11035 | case visuals.outline.frame:
|
11036 | return 2 * outlineWeight;
|
11037 |
|
11038 | default:
|
11039 | return 0;
|
11040 | }
|
11041 | }, DOMHelper.prototype.setSlicerHeaderTextStyle = function(slicerHeader, settings) {
|
11042 | slicerHeader.style({
|
11043 | "border-style": "solid",
|
11044 | "border-color": settings.general.outlineColor,
|
11045 | "border-width": visuals.VisualBorderUtil.getBorderWidth(settings.header.outline, settings.general.outlineWeight),
|
11046 | color: settings.header.fontColor,
|
11047 | "background-color": settings.header.background,
|
11048 | "font-size": PixelConverter.fromPoint(settings.header.textSize)
|
11049 | });
|
11050 | }, DOMHelper.prototype.getTextProperties = function(textSize, textProperties) {
|
11051 | return textProperties.fontSize = PixelConverter.fromPoint(textSize), textProperties;
|
11052 | }, DOMHelper;
|
11053 | }();
|
11054 | SlicerUtil.DOMHelper = DOMHelper;
|
11055 | }(SlicerUtil = visuals.SlicerUtil || (visuals.SlicerUtil = {}));
|
11056 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11057 | }(powerbi || (powerbi = {}));
|
11058 |
|
11059 | var powerbi;
|
11060 |
|
11061 | !function(powerbi) {
|
11062 | var visuals;
|
11063 | !function(visuals) {
|
11064 | var tooltipUtils;
|
11065 | !function(tooltipUtils) {
|
11066 | function tooltipUpdate(selection, tooltips) {
|
11067 | if (0 !== tooltips.length) {
|
11068 | var titles = selection.selectAll("title"), titlesUpdate = titles.data(function(d, i) {
|
11069 | return [ tooltips[i] ];
|
11070 | });
|
11071 | titlesUpdate.enter().append("title"), titlesUpdate.exit().remove(), titlesUpdate.text(function(d) {
|
11072 | return d;
|
11073 | });
|
11074 | }
|
11075 | }
|
11076 | tooltipUtils.tooltipUpdate = tooltipUpdate;
|
11077 | }(tooltipUtils = visuals.tooltipUtils || (visuals.tooltipUtils = {}));
|
11078 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11079 | }(powerbi || (powerbi = {}));
|
11080 |
|
11081 | var powerbi;
|
11082 |
|
11083 | !function(powerbi) {
|
11084 | var visuals;
|
11085 | !function(visuals) {
|
11086 | var SVGUtil;
|
11087 | !function(SVGUtil) {
|
11088 | function translate(x, y) {
|
11089 | return "translate(" + x + "," + y + ")";
|
11090 | }
|
11091 | function translateXWithPixels(x) {
|
11092 | return "translateX(" + x + "px)";
|
11093 | }
|
11094 | function translateWithPixels(x, y) {
|
11095 | return "translate(" + x + "px," + y + "px)";
|
11096 | }
|
11097 | function translateAndRotate(x, y, px, py, angle) {
|
11098 | return "translate(" + x + "," + y + ") rotate(" + angle + "," + px + "," + py + ")";
|
11099 | }
|
11100 | function scale(scale) {
|
11101 | return "scale(" + scale + ")";
|
11102 | }
|
11103 | function translateAndScale(x, y, ratio) {
|
11104 | return "translate(" + x + "," + y + ") scale(" + ratio + ")";
|
11105 | }
|
11106 | function transformOrigin(xOffset, yOffset) {
|
11107 | return xOffset + " " + yOffset;
|
11108 | }
|
11109 | function flushAllD3Transitions() {
|
11110 | var now = Date.now;
|
11111 | Date.now = function() {
|
11112 | return 1 / 0;
|
11113 | }, d3.timer.flush(), Date.now = now;
|
11114 | }
|
11115 | function flushAllD3TransitionsIfNeeded(options) {
|
11116 | if (options) {
|
11117 | var animationOptions = options, asVisualInitOptions = options;
|
11118 | asVisualInitOptions.animation && (animationOptions = asVisualInitOptions.animation),
|
11119 | animationOptions && animationOptions.transitionImmediate && flushAllD3Transitions();
|
11120 | }
|
11121 | }
|
11122 | function ensureDAttribute(pathElement) {
|
11123 | pathElement.getAttribute("d") || pathElement.setAttribute("d", "");
|
11124 | }
|
11125 | function ensureValidSVGPoint(point) {
|
11126 | isNaN(point.x) && (point.x = 0), isNaN(point.y) && (point.y = 0);
|
11127 | }
|
11128 | function parseTranslateTransform(input) {
|
11129 | if (!input || 0 === input.length) return {
|
11130 | x: "0",
|
11131 | y: "0"
|
11132 | };
|
11133 | var xValue, translateCoordinates = input.split(/[\s,]+/), yValue = "0", xCoord = translateCoordinates[0];
|
11134 | if (1 === translateCoordinates.length) xValue = xCoord.substring(10, xCoord.length - 1); else {
|
11135 | var yCoord = translateCoordinates[1];
|
11136 | yValue = yCoord.substring(0, yCoord.length - 1), xValue = xCoord.substring(10, xCoord.length);
|
11137 | }
|
11138 | return {
|
11139 | x: xValue,
|
11140 | y: yValue
|
11141 | };
|
11142 | }
|
11143 | function createArrow(width, height, rotate) {
|
11144 | var transform = "rotate(" + rotate + " " + width / 2 + " " + height / 2 + ")", path = "M0 0";
|
11145 | return path += "L0 " + height, path += "L" + width + " " + height / 2 + " Z", {
|
11146 | path: path,
|
11147 | transform: transform
|
11148 | };
|
11149 | }
|
11150 | function getTransformScaleRatios(svgElement) {
|
11151 | if (null != svgElement) {
|
11152 | var scaledRect = svgElement.getBoundingClientRect(), domRect = svgElement.getBBox();
|
11153 | if (domRect.height > 0 && domRect.width > 0) return {
|
11154 | x: scaledRect.width / domRect.width,
|
11155 | y: scaledRect.height / domRect.height
|
11156 | };
|
11157 | }
|
11158 | return {
|
11159 | x: 1,
|
11160 | y: 1
|
11161 | };
|
11162 | }
|
11163 | SVGUtil.AlmostZero = 1e-6, SVGUtil.translate = translate, SVGUtil.translateXWithPixels = translateXWithPixels,
|
11164 | SVGUtil.translateWithPixels = translateWithPixels, SVGUtil.translateAndRotate = translateAndRotate,
|
11165 | SVGUtil.scale = scale, SVGUtil.translateAndScale = translateAndScale, SVGUtil.transformOrigin = transformOrigin,
|
11166 | SVGUtil.flushAllD3Transitions = flushAllD3Transitions, SVGUtil.flushAllD3TransitionsIfNeeded = flushAllD3TransitionsIfNeeded,
|
11167 | SVGUtil.ensureDAttribute = ensureDAttribute, SVGUtil.ensureValidSVGPoint = ensureValidSVGPoint,
|
11168 | SVGUtil.parseTranslateTransform = parseTranslateTransform, SVGUtil.createArrow = createArrow,
|
11169 | SVGUtil.getTransformScaleRatios = getTransformScaleRatios;
|
11170 | }(SVGUtil = visuals.SVGUtil || (visuals.SVGUtil = {}));
|
11171 | var SVGScaleDetector = function() {
|
11172 | function SVGScaleDetector(svgElement) {
|
11173 | this.scaleDetectorElement = svgElement.append("rect").classed("scale-detector", !0).attr({
|
11174 | width: 1,
|
11175 | height: 1,
|
11176 | "stroke-width": "0px",
|
11177 | fill: "none"
|
11178 | }).node();
|
11179 | }
|
11180 | return SVGScaleDetector.prototype.getScale = function() {
|
11181 | var scaledRect = this.scaleDetectorElement.getBoundingClientRect(), domRect = this.scaleDetectorElement.getBBox();
|
11182 | return domRect.height > 0 && domRect.width > 0 ? {
|
11183 | x: scaledRect.width / domRect.width,
|
11184 | y: scaledRect.height / domRect.height
|
11185 | } : {
|
11186 | x: 1,
|
11187 | y: 1
|
11188 | };
|
11189 | }, SVGScaleDetector;
|
11190 | }();
|
11191 | visuals.SVGScaleDetector = SVGScaleDetector;
|
11192 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11193 | }(powerbi || (powerbi = {}));
|
11194 |
|
11195 | var powerbi;
|
11196 |
|
11197 | !function(powerbi) {
|
11198 | var visuals;
|
11199 | !function(visuals) {
|
11200 | var TextUtil;
|
11201 | !function(TextUtil) {
|
11202 | function removeBreakingSpaces(str) {
|
11203 | return str.toString().replace(new RegExp(" ", "g"), " ");
|
11204 | }
|
11205 | function removeEllipses(str) {
|
11206 | return str.replace(/…/g, "");
|
11207 | }
|
11208 | function replaceSpaceWithNBSP(txt) {
|
11209 | return null != txt ? txt.replace(/ /g, " ") : void 0;
|
11210 | }
|
11211 | TextUtil.removeBreakingSpaces = removeBreakingSpaces, TextUtil.removeEllipses = removeEllipses,
|
11212 | TextUtil.replaceSpaceWithNBSP = replaceSpaceWithNBSP;
|
11213 | }(TextUtil = visuals.TextUtil || (visuals.TextUtil = {}));
|
11214 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11215 | }(powerbi || (powerbi = {}));
|
11216 |
|
11217 | var powerbi;
|
11218 |
|
11219 | !function(powerbi) {
|
11220 | var visuals;
|
11221 | !function(visuals) {
|
11222 | var GradientUtils, DataRoleHelper = powerbi.data.DataRoleHelper;
|
11223 | !function(GradientUtils) {
|
11224 | function getFillRuleRole(objectDescs) {
|
11225 | if (objectDescs) for (var objectName in objectDescs) {
|
11226 | var objectDesc = objectDescs[objectName];
|
11227 | for (var propertyName in objectDesc.properties) {
|
11228 | var propertyDesc = objectDesc.properties[propertyName];
|
11229 | if (propertyDesc.type && propertyDesc.type[FillRulePropertyIdentifier]) return propertyDesc.rule.inputRole;
|
11230 | }
|
11231 | }
|
11232 | }
|
11233 | function shouldShowGradient(visualConfig) {
|
11234 | var isShowGradienCard = !!(visualConfig && visualConfig.query && visualConfig.query.projections && visualConfig.query.projections.Gradient);
|
11235 | return isShowGradienCard;
|
11236 | }
|
11237 | function getUpdatedGradientSettings(gradientObject) {
|
11238 | var gradientSettings;
|
11239 | if (gradientObject && !$.isEmptyObject(gradientObject)) {
|
11240 | gradientSettings = getDefaultGradientSettings();
|
11241 | for (var propertyName in gradientSettings) {
|
11242 | var hasProperty = gradientObject.hasOwnProperty(propertyName);
|
11243 | if (hasProperty) {
|
11244 | var value = gradientObject[propertyName];
|
11245 | value && value.solid && value.solid.color && (value = value.solid.color), gradientSettings[propertyName] = value;
|
11246 | }
|
11247 | }
|
11248 | }
|
11249 | return gradientSettings;
|
11250 | }
|
11251 | function getGradientMeasureIndex(dataViewCategorical) {
|
11252 | if (dataViewCategorical && dataViewCategorical.values && dataViewCategorical.values.grouped) {
|
11253 | var grouped = dataViewCategorical.values.grouped();
|
11254 | return DataRoleHelper.getMeasureIndexOfRole(grouped, "Gradient");
|
11255 | }
|
11256 | return -1;
|
11257 | }
|
11258 | function getGradientValueColumn(dataViewCategorical) {
|
11259 | if (null == dataViewCategorical) return null;
|
11260 | var gradientMeasureIndex = GradientUtils.getGradientMeasureIndex(dataViewCategorical), gradientValueColumn = -1 === gradientMeasureIndex ? null : dataViewCategorical.values[gradientMeasureIndex];
|
11261 | return gradientValueColumn;
|
11262 | }
|
11263 | function hasGradientRole(dataViewCategorical) {
|
11264 | var gradientMeasureIndex = getGradientMeasureIndex(dataViewCategorical);
|
11265 | return gradientMeasureIndex >= 0;
|
11266 | }
|
11267 | function getDefaultGradientSettings() {
|
11268 | var colors = getDefaultColors(), gradientSettings = {
|
11269 | diverging: !1,
|
11270 | minColor: colors.minColor,
|
11271 | midColor: DefaultMidColor,
|
11272 | maxColor: colors.maxColor,
|
11273 | minValue: void 0,
|
11274 | midValue: void 0,
|
11275 | maxValue: void 0
|
11276 | };
|
11277 | return gradientSettings;
|
11278 | }
|
11279 | function getDefaultFillRuleDefinition() {
|
11280 | return getLinearGradien2FillRuleDefinition();
|
11281 | }
|
11282 | function updateFillRule(propertyName, propertyValue, definitions) {
|
11283 | var numericValueExpr, colorValueExpr, dataPointObjectDefinition = powerbi.data.DataViewObjectDefinitions.ensure(definitions, DataPointPropertyIdentifier, null), fillRule = getFillRule(definitions);
|
11284 | fillRule && ($.isNumeric(propertyValue) && (numericValueExpr = void 0 !== propertyValue ? SQExprBuilder["double"](+propertyValue) : void 0),
|
11285 | "minColor" !== propertyName && "midColor" !== propertyName && "maxColor" !== propertyName || (colorValueExpr = getColorExpressionValue(fillRule, propertyName, propertyValue)),
|
11286 | "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),
|
11287 | dataPointObjectDefinition.properties[FillRulePropertyIdentifier] = fillRule) : "revertToDefault" === propertyName && (fillRule = this.getDefaultFillRuleDefinition(),
|
11288 | dataPointObjectDefinition.properties[FillRulePropertyIdentifier] = fillRule));
|
11289 | }
|
11290 | function getGradientSettings(baseFillRule) {
|
11291 | return baseFillRule ? getGradientSettingsFromRule(baseFillRule) : getDefaultGradientSettings();
|
11292 | }
|
11293 | function getFillRule(objectDefinitions) {
|
11294 | var fillRuleDefinition = powerbi.data.DataViewObjectDefinitions.getValue(objectDefinitions, {
|
11295 | objectName: DataPointPropertyIdentifier,
|
11296 | propertyName: FillRulePropertyIdentifier
|
11297 | }, null);
|
11298 | return fillRuleDefinition;
|
11299 | }
|
11300 | function getDefaultColors() {
|
11301 | 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;
|
11302 | return {
|
11303 | minColor: minColor,
|
11304 | midColor: midColor,
|
11305 | maxColor: maxColor
|
11306 | };
|
11307 | }
|
11308 | function getGradientSettingsFromRule(fillRule) {
|
11309 | var maxColor, minColor, maxValue, midValue, minValue, midColor = DefaultMidColor, diverging = void 0 !== fillRule.linearGradient3;
|
11310 | if (fillRule.linearGradient2) {
|
11311 | var maxColorExpr = fillRule.linearGradient2.max.color, minColorExpr = fillRule.linearGradient2.min.color, maxValueExpr = fillRule.linearGradient2.max.value, minValueExpr = fillRule.linearGradient2.min.value;
|
11312 | maxColor = maxColorExpr.value, minColor = minColorExpr.value, maxValueExpr && (maxValue = maxValueExpr.value),
|
11313 | minValueExpr && (minValue = minValueExpr.value);
|
11314 | } else if (fillRule.linearGradient3) {
|
11315 | 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;
|
11316 | maxColor = maxColorExpr.value, midColor = midColorExpr.value, minColor = minColorExpr.value,
|
11317 | maxValueExpr && (maxValue = maxValueExpr.value), midValueExpr && (midValue = midValueExpr.value),
|
11318 | minValueExpr && (minValue = minValueExpr.value);
|
11319 | }
|
11320 | return {
|
11321 | diverging: diverging,
|
11322 | minColor: minColor,
|
11323 | midColor: midColor,
|
11324 | maxColor: maxColor,
|
11325 | minValue: minValue,
|
11326 | midValue: midValue,
|
11327 | maxValue: maxValue
|
11328 | };
|
11329 | }
|
11330 | function getGradientBarColors(gradientSettings) {
|
11331 | var colors = [];
|
11332 | return colors.push(gradientSettings.minColor), gradientSettings.diverging && colors.push(gradientSettings.midColor),
|
11333 | colors.push(gradientSettings.maxColor), colors.join(",");
|
11334 | }
|
11335 | function getLinearGradien2FillRuleDefinition(baseFillRule) {
|
11336 | var gradientSettings = getGradientSettings(baseFillRule), fillRuleDefinition = {
|
11337 | linearGradient2: {
|
11338 | max: {
|
11339 | color: SQExprBuilder.text(gradientSettings.maxColor)
|
11340 | },
|
11341 | min: {
|
11342 | color: SQExprBuilder.text(gradientSettings.minColor)
|
11343 | }
|
11344 | }
|
11345 | };
|
11346 | return fillRuleDefinition;
|
11347 | }
|
11348 | function getLinearGradien3FillRuleDefinition(baseFillRule) {
|
11349 | var gradientSettings = getGradientSettings(baseFillRule), fillRuleDefinition = {
|
11350 | linearGradient3: {
|
11351 | max: {
|
11352 | color: SQExprBuilder.text(gradientSettings.maxColor)
|
11353 | },
|
11354 | mid: {
|
11355 | color: SQExprBuilder.text(gradientSettings.midColor)
|
11356 | },
|
11357 | min: {
|
11358 | color: SQExprBuilder.text(gradientSettings.minColor)
|
11359 | }
|
11360 | }
|
11361 | };
|
11362 | return fillRuleDefinition;
|
11363 | }
|
11364 | function getDefaultColorExpression(fillRule, propertyName) {
|
11365 | var defaultColor, defaultFillRule;
|
11366 | return fillRule.linearGradient3 ? (defaultFillRule = getLinearGradien3FillRuleDefinition(),
|
11367 | "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(),
|
11368 | "minColor" === propertyName ? defaultColor = defaultFillRule.linearGradient2.min.color : "maxColor" === propertyName && (defaultColor = defaultFillRule.linearGradient2.max.color)),
|
11369 | defaultColor;
|
11370 | }
|
11371 | function getColorExpressionValue(fillRule, propertyName, propertyValue) {
|
11372 | var colorExpressionValue;
|
11373 | return colorExpressionValue = propertyValue ? SQExprBuilder.text(propertyValue) : getDefaultColorExpression(fillRule, propertyName);
|
11374 | }
|
11375 | function updateMinColor(fillRule, colorExpressionValue) {
|
11376 | fillRule.linearGradient2 ? fillRule.linearGradient2.min.color = colorExpressionValue : fillRule.linearGradient3 && (fillRule.linearGradient3.min.color = colorExpressionValue);
|
11377 | }
|
11378 | function updateMidColor(fillRule, colorExpressionValue) {
|
11379 | fillRule.linearGradient3 && (fillRule.linearGradient3.mid.color = colorExpressionValue);
|
11380 | }
|
11381 | function updateMaxColor(fillRule, colorExpressionValue) {
|
11382 | fillRule.linearGradient2 ? fillRule.linearGradient2.max.color = colorExpressionValue : fillRule.linearGradient3 && (fillRule.linearGradient3.max.color = colorExpressionValue);
|
11383 | }
|
11384 | function updateMinValue(fillRule, value) {
|
11385 | fillRule.linearGradient2 ? fillRule.linearGradient2.min.value = value : fillRule.linearGradient3 && (fillRule.linearGradient3.min.value = value);
|
11386 | }
|
11387 | function updateMidValue(fillRule, value) {
|
11388 | fillRule.linearGradient3 && (fillRule.linearGradient3.mid.value = value);
|
11389 | }
|
11390 | function updateMaxValue(fillRule, value) {
|
11391 | fillRule.linearGradient2 ? fillRule.linearGradient2.max.value = value : fillRule.linearGradient3 && (fillRule.linearGradient3.max.value = value);
|
11392 | }
|
11393 | var SQExprBuilder = powerbi.data.SQExprBuilder, DefaultMidColor = "#ffffff", DataPointPropertyIdentifier = "dataPoint", FillRulePropertyIdentifier = "fillRule";
|
11394 | GradientUtils.getFillRuleRole = getFillRuleRole, GradientUtils.shouldShowGradient = shouldShowGradient,
|
11395 | GradientUtils.getUpdatedGradientSettings = getUpdatedGradientSettings, GradientUtils.getGradientMeasureIndex = getGradientMeasureIndex,
|
11396 | GradientUtils.getGradientValueColumn = getGradientValueColumn, GradientUtils.hasGradientRole = hasGradientRole,
|
11397 | GradientUtils.getDefaultGradientSettings = getDefaultGradientSettings, GradientUtils.getDefaultFillRuleDefinition = getDefaultFillRuleDefinition,
|
11398 | GradientUtils.updateFillRule = updateFillRule, GradientUtils.getGradientSettings = getGradientSettings,
|
11399 | GradientUtils.getFillRule = getFillRule, GradientUtils.getGradientSettingsFromRule = getGradientSettingsFromRule,
|
11400 | GradientUtils.getGradientBarColors = getGradientBarColors;
|
11401 | }(GradientUtils = visuals.GradientUtils || (visuals.GradientUtils = {}));
|
11402 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11403 | }(powerbi || (powerbi = {}));
|
11404 |
|
11405 | var powerbi;
|
11406 |
|
11407 | !function(powerbi) {
|
11408 | var visuals;
|
11409 | !function(visuals) {
|
11410 | var visualBackgroundHelper;
|
11411 | !function(visualBackgroundHelper) {
|
11412 | function getDefaultColor() {
|
11413 | return "#FFF";
|
11414 | }
|
11415 | function getDefaultTransparency() {
|
11416 | return 50;
|
11417 | }
|
11418 | function getDefaultShow() {
|
11419 | return !1;
|
11420 | }
|
11421 | function getDefaultValues() {
|
11422 | return {
|
11423 | color: getDefaultColor(),
|
11424 | transparency: getDefaultTransparency(),
|
11425 | show: getDefaultShow()
|
11426 | };
|
11427 | }
|
11428 | function enumeratePlot(enumeration, background) {
|
11429 | var transparency = background && background.transparency;
|
11430 | null == transparency && (transparency = getDefaultTransparency());
|
11431 | var backgroundObject = {
|
11432 | selector: null,
|
11433 | properties: {
|
11434 | transparency: transparency,
|
11435 | image: background && background.image
|
11436 | },
|
11437 | objectName: "plotArea"
|
11438 | };
|
11439 | enumeration.pushInstance(backgroundObject);
|
11440 | }
|
11441 | function renderBackgroundImage(background, visualElement, layout) {
|
11442 | var image = background && background.image, imageUrl = image && image.url, imageFit = image && image.scaling, imageTransparency = background && background.transparency, backgroundImage = visualElement.children(".background-image");
|
11443 | if (!imageUrl) return void (0 !== backgroundImage.length && backgroundImage.remove());
|
11444 | switch (0 === backgroundImage.length && (visualElement.prepend('<div class="background-image"></div>'),
|
11445 | backgroundImage = visualElement.children(".background-image"), backgroundImage.css("position", "absolute")),
|
11446 | backgroundImage.css({
|
11447 | width: layout.width,
|
11448 | height: layout.height,
|
11449 | "margin-left": layout.left,
|
11450 | "margin-top": layout.top
|
11451 | }), backgroundImage.css({
|
11452 | "background-image": "url(" + imageUrl + ")",
|
11453 | "background-repeat": "no-repeat",
|
11454 | opacity: (100 - imageTransparency) / 100
|
11455 | }), imageFit) {
|
11456 | case visuals.imageScalingType.normal:
|
11457 | backgroundImage.css({
|
11458 | "background-size": "",
|
11459 | "background-position": "50% 50%"
|
11460 | });
|
11461 | break;
|
11462 |
|
11463 | case visuals.imageScalingType.fit:
|
11464 | backgroundImage.css({
|
11465 | "background-size": "100% 100%",
|
11466 | "background-position": ""
|
11467 | });
|
11468 | break;
|
11469 |
|
11470 | case visuals.imageScalingType.fill:
|
11471 | backgroundImage.css({
|
11472 | "background-size": "100%",
|
11473 | "background-position": "50% 50%"
|
11474 | });
|
11475 | break;
|
11476 |
|
11477 | default:
|
11478 | backgroundImage.css({
|
11479 | "background-size": "",
|
11480 | "background-position": "50% 50%"
|
11481 | });
|
11482 | }
|
11483 | }
|
11484 | visualBackgroundHelper.getDefaultColor = getDefaultColor, visualBackgroundHelper.getDefaultTransparency = getDefaultTransparency,
|
11485 | visualBackgroundHelper.getDefaultShow = getDefaultShow, visualBackgroundHelper.getDefaultValues = getDefaultValues,
|
11486 | visualBackgroundHelper.enumeratePlot = enumeratePlot, visualBackgroundHelper.renderBackgroundImage = renderBackgroundImage;
|
11487 | }(visualBackgroundHelper = visuals.visualBackgroundHelper || (visuals.visualBackgroundHelper = {}));
|
11488 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11489 | }(powerbi || (powerbi = {}));
|
11490 |
|
11491 | var powerbi;
|
11492 |
|
11493 | !function(powerbi) {
|
11494 | var visuals;
|
11495 | !function(visuals) {
|
11496 | var Selector = powerbi.data.Selector, ObjectEnumerationBuilder = function() {
|
11497 | function ObjectEnumerationBuilder() {}
|
11498 | return ObjectEnumerationBuilder.prototype.pushInstance = function(instance) {
|
11499 | var instances = this.instances;
|
11500 | instances || (instances = this.instances = []);
|
11501 | var containerIdx = this.containerIdx;
|
11502 | null != containerIdx && (instance.containerIdx = containerIdx);
|
11503 | for (var _i = 0, instances_1 = instances; _i < instances_1.length; _i++) {
|
11504 | var existingInstance = instances_1[_i];
|
11505 | if (this.canMerge(existingInstance, instance)) return this.extend(existingInstance, instance, "properties"),
|
11506 | this.extend(existingInstance, instance, "validValues"), this;
|
11507 | }
|
11508 | return instances.push(instance), this;
|
11509 | }, ObjectEnumerationBuilder.prototype.pushContainer = function(container) {
|
11510 | var containers = this.containers;
|
11511 | containers || (containers = this.containers = []);
|
11512 | var updatedLen = containers.push(container);
|
11513 | return this.containerIdx = updatedLen - 1, this;
|
11514 | }, ObjectEnumerationBuilder.prototype.popContainer = function() {
|
11515 | return this.containerIdx = void 0, this;
|
11516 | }, ObjectEnumerationBuilder.prototype.complete = function() {
|
11517 | if (this.instances) {
|
11518 | var result = {
|
11519 | instances: this.instances
|
11520 | }, containers = this.containers;
|
11521 | return containers && (result.containers = containers), result;
|
11522 | }
|
11523 | }, ObjectEnumerationBuilder.prototype.canMerge = function(x, y) {
|
11524 | return x.objectName === y.objectName && x.containerIdx === y.containerIdx && Selector.equals(x.selector, y.selector);
|
11525 | }, ObjectEnumerationBuilder.prototype.extend = function(target, source, propertyName) {
|
11526 | var sourceValues = source[propertyName];
|
11527 | if (sourceValues) {
|
11528 | var targetValues = target[propertyName];
|
11529 | targetValues || (targetValues = target[propertyName] = {});
|
11530 | for (var valuePropertyName in sourceValues) targetValues[valuePropertyName] || (targetValues[valuePropertyName] = sourceValues[valuePropertyName]);
|
11531 | }
|
11532 | }, ObjectEnumerationBuilder.merge = function(x, y) {
|
11533 | var xNormalized = ObjectEnumerationBuilder.normalize(x), yNormalized = ObjectEnumerationBuilder.normalize(y);
|
11534 | if (!xNormalized || !yNormalized) return xNormalized || yNormalized;
|
11535 | for (var xCategoryCount = xNormalized.containers ? xNormalized.containers.length : 0, _i = 0, _a = yNormalized.instances; _i < _a.length; _i++) {
|
11536 | var yInstance = _a[_i];
|
11537 | xNormalized.instances.push(yInstance), null != yInstance.containerIdx && (yInstance.containerIdx += xCategoryCount);
|
11538 | }
|
11539 | var yContainers = yNormalized.containers;
|
11540 | return _.isEmpty(yContainers) || (xNormalized.containers ? Array.prototype.push.apply(xNormalized.containers, yContainers) : xNormalized.containers = yContainers),
|
11541 | xNormalized;
|
11542 | }, ObjectEnumerationBuilder.normalize = function(x) {
|
11543 | return _.isArray(x) ? {
|
11544 | instances: x
|
11545 | } : x;
|
11546 | }, ObjectEnumerationBuilder.getContainerForInstance = function(enumeration, instance) {
|
11547 | return enumeration.containers[instance.containerIdx];
|
11548 | }, ObjectEnumerationBuilder;
|
11549 | }();
|
11550 | visuals.ObjectEnumerationBuilder = ObjectEnumerationBuilder;
|
11551 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11552 | }(powerbi || (powerbi = {}));
|
11553 |
|
11554 | var powerbi;
|
11555 |
|
11556 | !function(powerbi) {
|
11557 | var visuals;
|
11558 | !function(visuals) {
|
11559 | var VisualBorderUtil;
|
11560 | !function(VisualBorderUtil) {
|
11561 | function getBorderWidth(outlineType, outlineWeight) {
|
11562 | switch (outlineType) {
|
11563 | case visuals.outline.none:
|
11564 | return "0px";
|
11565 |
|
11566 | case visuals.outline.bottomOnly:
|
11567 | return "0px 0px " + outlineWeight + "px 0px";
|
11568 |
|
11569 | case visuals.outline.topOnly:
|
11570 | return outlineWeight + "px 0px 0px 0px";
|
11571 |
|
11572 | case visuals.outline.leftOnly:
|
11573 | return "0px 0px 0px " + outlineWeight + "px";
|
11574 |
|
11575 | case visuals.outline.rightOnly:
|
11576 | return "0px " + outlineWeight + "px 0px 0px";
|
11577 |
|
11578 | case visuals.outline.topBottom:
|
11579 | return outlineWeight + "px 0px";
|
11580 |
|
11581 | case visuals.outline.leftRight:
|
11582 | return "0px " + outlineWeight + "px";
|
11583 |
|
11584 | case visuals.outline.frame:
|
11585 | return outlineWeight + "px";
|
11586 |
|
11587 | default:
|
11588 | return "0px";
|
11589 | }
|
11590 | }
|
11591 | VisualBorderUtil.getBorderWidth = getBorderWidth;
|
11592 | }(VisualBorderUtil = visuals.VisualBorderUtil || (visuals.VisualBorderUtil = {}));
|
11593 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11594 | }(powerbi || (powerbi = {}));
|
11595 |
|
11596 | var powerbi;
|
11597 |
|
11598 | !function(powerbi) {
|
11599 | var visuals;
|
11600 | !function(visuals) {
|
11601 | function createTranslateMatrix(xOffset, yOffset) {
|
11602 | return {
|
11603 | m00: 1,
|
11604 | m01: 0,
|
11605 | m02: xOffset,
|
11606 | m10: 0,
|
11607 | m11: 1,
|
11608 | m12: yOffset
|
11609 | };
|
11610 | }
|
11611 | function createScaleMatrix(xScale, yScale) {
|
11612 | return {
|
11613 | m00: xScale,
|
11614 | m01: 0,
|
11615 | m02: 0,
|
11616 | m10: 0,
|
11617 | m11: yScale,
|
11618 | m12: 0
|
11619 | };
|
11620 | }
|
11621 | function createRotationMatrix(angleInRads) {
|
11622 | var a = angleInRads, sinA = Math.sin(a), cosA = Math.cos(a);
|
11623 | return {
|
11624 | m00: cosA,
|
11625 | m01: -sinA,
|
11626 | m02: 0,
|
11627 | m10: sinA,
|
11628 | m11: cosA,
|
11629 | m12: 0
|
11630 | };
|
11631 | }
|
11632 | function createInverseMatrix(m) {
|
11633 | var determinant = m.m00 * m.m11 - m.m01 * m.m10, invdet = 1 / determinant;
|
11634 | return {
|
11635 | m00: m.m11 * invdet,
|
11636 | m01: -m.m01 * invdet,
|
11637 | m02: (m.m01 * m.m12 - m.m02 * m.m11) * invdet,
|
11638 | m10: -m.m10 * invdet,
|
11639 | m11: m.m00 * invdet,
|
11640 | m12: -(m.m00 * m.m12 - m.m10 * m.m02) * invdet
|
11641 | };
|
11642 | }
|
11643 | function multiplyMatrices(a, b) {
|
11644 | return {
|
11645 | m00: a.m00 * b.m00 + a.m01 * b.m10,
|
11646 | m01: a.m00 * b.m01 + a.m01 * b.m11,
|
11647 | m02: a.m00 * b.m02 + a.m01 * b.m12 + a.m02,
|
11648 | m10: a.m10 * b.m00 + a.m11 * b.m10,
|
11649 | m11: a.m10 * b.m01 + a.m11 * b.m11,
|
11650 | m12: a.m10 * b.m02 + a.m11 * b.m12 + a.m12
|
11651 | };
|
11652 | }
|
11653 | var Transform = function() {
|
11654 | function Transform(m) {
|
11655 | this.matrix = m || {
|
11656 | m00: 1,
|
11657 | m01: 0,
|
11658 | m02: 0,
|
11659 | m10: 0,
|
11660 | m11: 1,
|
11661 | m12: 0
|
11662 | };
|
11663 | }
|
11664 | return Transform.prototype.applyToPoint = function(point) {
|
11665 | if (!point) return point;
|
11666 | var m = this.matrix;
|
11667 | return {
|
11668 | x: m.m00 * point.x + m.m01 * point.y + m.m02,
|
11669 | y: m.m10 * point.x + m.m11 * point.y + m.m12
|
11670 | };
|
11671 | }, Transform.prototype.applyToRect = function(rect) {
|
11672 | if (!rect) return rect;
|
11673 | var x0 = rect.left, y0 = rect.top, m = this.matrix, isScaled = 1 !== m.m00 || 1 !== m.m11, isRotated = 0 !== m.m01 || 0 !== m.m10;
|
11674 | if (!isRotated && !isScaled) return {
|
11675 | left: x0 + m.m02,
|
11676 | top: y0 + m.m12,
|
11677 | width: rect.width,
|
11678 | height: rect.height
|
11679 | };
|
11680 | var minX, maxX, minY, maxY, x1 = rect.left + rect.width, y1 = rect.top + rect.height;
|
11681 | if (isRotated) {
|
11682 | 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;
|
11683 | minX = Math.min(p0x, p1x, p2x, p3x), maxX = Math.max(p0x, p1x, p2x, p3x), minY = Math.min(p0y, p1y, p2y, p3y),
|
11684 | maxY = Math.max(p0y, p1y, p2y, p3y);
|
11685 | } else {
|
11686 | 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;
|
11687 | minX = Math.min(p0x, p3x), maxX = Math.max(p0x, p3x), minY = Math.min(p0y, p3y),
|
11688 | maxY = Math.max(p0y, p3y);
|
11689 | }
|
11690 | return {
|
11691 | left: minX,
|
11692 | top: minY,
|
11693 | width: maxX - minX,
|
11694 | height: maxY - minY
|
11695 | };
|
11696 | }, Transform.prototype.translate = function(xOffset, yOffset) {
|
11697 | if (0 !== xOffset || 0 !== yOffset) {
|
11698 | var m = createTranslateMatrix(xOffset, yOffset);
|
11699 | this.matrix = multiplyMatrices(this.matrix, m), this._inverse = null;
|
11700 | }
|
11701 | }, Transform.prototype.scale = function(xScale, yScale) {
|
11702 | if (1 !== xScale || 1 !== yScale) {
|
11703 | var m = createScaleMatrix(xScale, yScale);
|
11704 | this.matrix = multiplyMatrices(this.matrix, m), this._inverse = null;
|
11705 | }
|
11706 | }, Transform.prototype.rotate = function(angleInRadians) {
|
11707 | if (0 !== angleInRadians) {
|
11708 | var m = createRotationMatrix(angleInRadians);
|
11709 | this.matrix = multiplyMatrices(this.matrix, m), this._inverse = null;
|
11710 | }
|
11711 | }, Transform.prototype.add = function(other) {
|
11712 | other && (this.matrix = multiplyMatrices(this.matrix, other.matrix), this._inverse = null);
|
11713 | }, Transform.prototype.getInverse = function() {
|
11714 | return this._inverse || (this._inverse = new Transform(createInverseMatrix(this.matrix))),
|
11715 | this._inverse;
|
11716 | }, Transform;
|
11717 | }();
|
11718 | visuals.Transform = Transform, visuals.createTranslateMatrix = createTranslateMatrix,
|
11719 | visuals.createScaleMatrix = createScaleMatrix, visuals.createRotationMatrix = createRotationMatrix,
|
11720 | visuals.createInverseMatrix = createInverseMatrix;
|
11721 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11722 | }(powerbi || (powerbi = {}));
|
11723 |
|
11724 | var powerbi;
|
11725 |
|
11726 | !function(powerbi) {
|
11727 | var visuals;
|
11728 | !function(visuals) {
|
11729 | var TrendLineHelper, Color = jsCommon.Color, DataRoleHelper = powerbi.data.DataRoleHelper;
|
11730 | !function(TrendLineHelper) {
|
11731 | function enumerateObjectInstances(enumeration, trendLines) {
|
11732 | if (_.isEmpty(trendLines)) return void enumeration.pushInstance({
|
11733 | selector: null,
|
11734 | properties: {
|
11735 | show: !1,
|
11736 | lineColor: TrendLineHelper.defaults.lineColor,
|
11737 | transparency: TrendLineHelper.defaults.transparency,
|
11738 | style: TrendLineHelper.defaults.lineStyle,
|
11739 | combineSeries: TrendLineHelper.defaults.combineSeries
|
11740 | },
|
11741 | objectName: trendObjectName
|
11742 | });
|
11743 | var trendLine = trendLines[0], properties = {};
|
11744 | properties.show = trendLine.show, trendLine.combineSeries && (properties.lineColor = trendLine.lineColor),
|
11745 | properties.transparency = trendLine.transparency, properties.style = trendLine.style,
|
11746 | properties.combineSeries = trendLine.combineSeries, properties.useHighlightValues = trendLine.useHighlightValues,
|
11747 | enumeration.pushInstance({
|
11748 | selector: null,
|
11749 | properties: properties,
|
11750 | objectName: trendObjectName
|
11751 | });
|
11752 | }
|
11753 | function isDataViewForRegression(dataView) {
|
11754 | return DataRoleHelper.hasRoleInDataView(dataView, "regression.X");
|
11755 | }
|
11756 | function readDataView(dataView, sourceDataView, y2, colors) {
|
11757 | if (dataView && dataView.categorical) {
|
11758 | var categorical = dataView.categorical;
|
11759 | if (!_.isEmpty(categorical.categories) && !_.isEmpty(categorical.values)) {
|
11760 | var categories = categorical.categories[0].values, groups = categorical.values.grouped();
|
11761 | if (categories && groups) {
|
11762 | 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);
|
11763 | legacyColor && (lineColor = legacyColor);
|
11764 | for (var objects = sourceDataView.metadata.objects, defaultColor = powerbi.DataViewObjects.getFillColor(objects, {
|
11765 | objectName: "dataPoint",
|
11766 | propertyName: "defaultColor"
|
11767 | }), colorHelper = new visuals.ColorHelper(colors, {
|
11768 | objectName: "dataPoint",
|
11769 | propertyName: "fill"
|
11770 | }, defaultColor), trendLines = [], groupIndex = 0; groupIndex < groups.length; groupIndex++) {
|
11771 | for (var group = groups[groupIndex], points = [], i = 0; i < categories.length; i++) {
|
11772 | var x = visuals.AxisHelper.normalizeNonFiniteNumber(categories[i]), valueColumn = group.values[0], values = void 0;
|
11773 | values = useHighlightValues && valueColumn.highlights ? valueColumn.highlights : valueColumn.values;
|
11774 | var y = visuals.AxisHelper.normalizeNonFiniteNumber(values[i]);
|
11775 | null != x && null != y && points.push({
|
11776 | x: x,
|
11777 | y: y
|
11778 | });
|
11779 | }
|
11780 | var seriesLineColor = void 0;
|
11781 | if (combineSeries) seriesLineColor = lineColor || TrendLineHelper.defaults.lineColor; else if (sourceDataView.categorical.values.source) {
|
11782 | var sourceGroups = sourceDataView.categorical.values.grouped(), color = colorHelper.getColorForSeriesValue(sourceGroups[groupIndex].objects, sourceDataView.categorical.values.identityFields, group.name);
|
11783 | color = darkenTrendLineColor(color), seriesLineColor = {
|
11784 | solid: {
|
11785 | color: color
|
11786 | }
|
11787 | };
|
11788 | } else {
|
11789 | var matchingMeasure = sourceDataView.categorical.values[groupIndex], color = colorHelper.getColorForMeasure(matchingMeasure.source.objects, group.name);
|
11790 | color = darkenTrendLineColor(color), seriesLineColor = {
|
11791 | solid: {
|
11792 | color: color
|
11793 | }
|
11794 | };
|
11795 | }
|
11796 | trendLines.push({
|
11797 | points: points,
|
11798 | show: show,
|
11799 | lineColor: seriesLineColor,
|
11800 | transparency: transparency,
|
11801 | style: style,
|
11802 | combineSeries: combineSeries,
|
11803 | useHighlightValues: useHighlightValues,
|
11804 | y2Axis: y2
|
11805 | });
|
11806 | }
|
11807 | return trendLines;
|
11808 | }
|
11809 | }
|
11810 | }
|
11811 | }
|
11812 | function darkenTrendLineColor(color) {
|
11813 | var rgb = Color.parseColorString(color);
|
11814 | return rgb = Color.darken(rgb, 20), Color.rgbString(rgb);
|
11815 | }
|
11816 | function render(trendLines, graphicsContext, axes, viewport) {
|
11817 | var layer = graphicsContext.select(TrendLineLayerClassSelector.selector);
|
11818 | layer.empty() && (layer = graphicsContext.append("svg").classed(TrendLineLayerClassSelector["class"], !0)),
|
11819 | layer.attr({
|
11820 | height: viewport.height,
|
11821 | width: viewport.width
|
11822 | });
|
11823 | var lines = layer.selectAll(TrendLineClassSelector.selector).data(trendLines || []);
|
11824 | lines.enter().append("path").classed(TrendLineClassSelector["class"], !0), lines.attr("d", function(d) {
|
11825 | var xScale = axes.x.scale, yScale = d.y2Axis && axes.y2 ? axes.y2.scale : axes.y1.scale, pathGen = d3.svg.line().x(function(point) {
|
11826 | return xScale(point.x);
|
11827 | }).y(function(point) {
|
11828 | return yScale(point.y);
|
11829 | });
|
11830 | return pathGen(_.filter(d.points, function(point) {
|
11831 | return null != point.x && null != point.y;
|
11832 | }));
|
11833 | }), lines.each(function(d) {
|
11834 | var line = d3.select(this), style = {};
|
11835 | style.stroke = d.lineColor.solid.color, null != d.transparency && (style["stroke-opacity"] = (100 - d.transparency) / 100),
|
11836 | d.style === visuals.lineStyle.dashed ? style["stroke-dasharray"] = "5, 5" : d.style === visuals.lineStyle.dotted ? (style["stroke-dasharray"] = "1, 5",
|
11837 | style["stroke-linecap"] = "round") : d.style === visuals.lineStyle.solid && (style["stroke-dasharray"] = null,
|
11838 | style["stroke-linecap"] = null), line.style(style);
|
11839 | }), lines.exit().remove();
|
11840 | }
|
11841 | var trendLinePropertyNames = {
|
11842 | show: "show",
|
11843 | lineColor: "lineColor",
|
11844 | transparency: "transparency",
|
11845 | style: "style",
|
11846 | combineSeries: "combineSeries",
|
11847 | useHighlightValues: "useHighlightValues"
|
11848 | }, trendObjectName = "trend";
|
11849 | TrendLineHelper.defaults = {
|
11850 | lineColor: {
|
11851 | solid: {
|
11852 | color: "#000"
|
11853 | }
|
11854 | },
|
11855 | lineStyle: visuals.lineStyle.dashed,
|
11856 | transparency: 0,
|
11857 | combineSeries: !0,
|
11858 | useHighlightValues: !0
|
11859 | };
|
11860 | var TrendLineClassSelector = jsCommon.CssConstants.createClassAndSelector("trend-line"), TrendLineLayerClassSelector = jsCommon.CssConstants.createClassAndSelector("trend-line-layer");
|
11861 | TrendLineHelper.enumerateObjectInstances = enumerateObjectInstances, TrendLineHelper.isDataViewForRegression = isDataViewForRegression,
|
11862 | TrendLineHelper.readDataView = readDataView, TrendLineHelper.darkenTrendLineColor = darkenTrendLineColor,
|
11863 | TrendLineHelper.render = render;
|
11864 | }(TrendLineHelper = visuals.TrendLineHelper || (visuals.TrendLineHelper = {}));
|
11865 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11866 | }(powerbi || (powerbi = {}));
|
11867 |
|
11868 | var powerbi;
|
11869 |
|
11870 | !function(powerbi) {
|
11871 | var visuals;
|
11872 | !function(visuals) {
|
11873 | var visibilityHelper;
|
11874 | !function(visibilityHelper) {
|
11875 | function partiallyVisible(element) {
|
11876 | return element.is(":visible");
|
11877 | }
|
11878 | visibilityHelper.partiallyVisible = partiallyVisible;
|
11879 | }(visibilityHelper = visuals.visibilityHelper || (visuals.visibilityHelper = {}));
|
11880 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
11881 | }(powerbi || (powerbi = {}));
|
11882 |
|
11883 | var powerbi;
|
11884 |
|
11885 | !function(powerbi) {
|
11886 | var VisualObjectRepetition, Selector = powerbi.data.Selector;
|
11887 | !function(VisualObjectRepetition) {
|
11888 | function equals(x, y) {
|
11889 | 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;
|
11890 | }
|
11891 | VisualObjectRepetition.equals = equals;
|
11892 | }(VisualObjectRepetition = powerbi.VisualObjectRepetition || (powerbi.VisualObjectRepetition = {}));
|
11893 | }(powerbi || (powerbi = {}));
|
11894 |
|
11895 | var powerbi;
|
11896 |
|
11897 | !function(powerbi) {
|
11898 | var visuals;
|
11899 | !function(visuals) {
|
11900 | var DataConversion, SemanticFilter = powerbi.data.SemanticFilter, UrlUtils = jsCommon.UrlUtils;
|
11901 | !function(DataConversion) {
|
11902 | function convert(dataView, localizedSelectAllText, interactivityService, hostServices) {
|
11903 | if (dataView && dataView.categorical && !_.isEmpty(dataView.categorical.categories)) {
|
11904 | var identityFields = dataView.categorical.categories[0].identityFields;
|
11905 | if (identityFields) {
|
11906 | var filter = dataView.metadata && dataView.metadata.objects && powerbi.DataViewObjects.getValue(dataView.metadata.objects, visuals.slicerProps.filterPropertyIdentifier), analyzer = hostServices.analyzeFilter({
|
11907 | dataView: dataView,
|
11908 | defaultValuePropertyId: visuals.slicerProps.defaultValue,
|
11909 | filter: filter,
|
11910 | fieldSQExprs: identityFields
|
11911 | });
|
11912 | if (analyzer) {
|
11913 | var analyzedSemanticFilter = analyzer.filter;
|
11914 | if (analyzedSemanticFilter && !SemanticFilter.isSameFilter(analyzedSemanticFilter, filter)) {
|
11915 | interactivityService.handleClearSelection();
|
11916 | var filterPropertyIdentifier = visuals.slicerProps.filterPropertyIdentifier, properties = {};
|
11917 | properties[filterPropertyIdentifier.propertyName] = analyzer.filter;
|
11918 | var instance = {
|
11919 | objectName: filterPropertyIdentifier.objectName,
|
11920 | selector: void 0,
|
11921 | properties: properties
|
11922 | }, changes = {
|
11923 | merge: [ instance ]
|
11924 | };
|
11925 | hostServices.persistProperties(changes);
|
11926 | }
|
11927 | var slicerData = getSlicerData(analyzer, dataView.metadata, dataView.categorical, localizedSelectAllText, interactivityService, hostServices);
|
11928 | return slicerData;
|
11929 | }
|
11930 | }
|
11931 | }
|
11932 | }
|
11933 | function getSlicerData(analyzer, dataViewMetadata, categorical, localizedSelectAllText, interactivityService, hostServices) {
|
11934 | var isInvertedSelectionMode = interactivityService && interactivityService.isSelectionModeInverted(), selectedScopeIds = analyzer.selectedIdentities, hasSelectionOverride = !_.isEmpty(selectedScopeIds) || isInvertedSelectionMode === !0;
|
11935 | !isInvertedSelectionMode && analyzer.filter && (isInvertedSelectionMode = analyzer.isNotFilter),
|
11936 | interactivityService && (interactivityService.setSelectionModeInverted(isInvertedSelectionMode),
|
11937 | interactivityService.setDefaultValueMode(SemanticFilter.isDefaultFilter(analyzer.filter)));
|
11938 | 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;
|
11939 | valueCounts && _.isEmpty(valueCounts) && (valueCounts = void 0);
|
11940 | for (var isImageData = dataViewMetadata && !_.isEmpty(dataViewMetadata.columns) && visuals.converterHelper.isImageUrlColumn(dataViewMetadata.columns[0]), displayNameIdentityPairs = [], i = 0; categoryValuesLen > i; i++) {
|
11941 | 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 = {
|
11942 | value: label,
|
11943 | tooltip: label,
|
11944 | identity: visuals.SelectionId.createWithId(scopeId),
|
11945 | selected: isRetained,
|
11946 | count: count,
|
11947 | isImage: isImage
|
11948 | };
|
11949 | if (isRetained) {
|
11950 | var displayNameIdentityPair = {
|
11951 | displayName: label,
|
11952 | identity: scopeId
|
11953 | };
|
11954 | displayNameIdentityPairs.push(displayNameIdentityPair);
|
11955 | }
|
11956 | slicerDataPoints.push(slicerData_1), slicerData_1.selected && numOfSelected++;
|
11957 | }
|
11958 | if (_.isEmpty(displayNameIdentityPairs) || hostServices.setIdentityDisplayNames(displayNameIdentityPairs),
|
11959 | hasSelectionOverride && !_.isEmpty(selectedScopeIds)) {
|
11960 | var displayNamesIdentityPairs = hostServices.getIdentityDisplayNames(selectedScopeIds);
|
11961 | if (!_.isEmpty(displayNamesIdentityPairs)) for (var _i = 0, displayNamesIdentityPairs_1 = displayNamesIdentityPairs; _i < displayNamesIdentityPairs_1.length; _i++) {
|
11962 | var pair = displayNamesIdentityPairs_1[_i], slicerData_2 = {
|
11963 | value: pair.displayName,
|
11964 | tooltip: pair.displayName,
|
11965 | identity: visuals.SelectionId.createWithId(pair.identity),
|
11966 | selected: !0,
|
11967 | count: null != valueCounts ? 0 : void 0
|
11968 | };
|
11969 | slicerDataPoints.push(slicerData_2), numOfSelected++;
|
11970 | }
|
11971 | }
|
11972 | var defaultSettings = createDefaultSettings(dataViewMetadata);
|
11973 | if (defaultSettings.selection.selectAllCheckboxEnabled) {
|
11974 | if (numOfSelected > 0 && !dataViewMetadata.segment && numOfSelected === slicerDataPoints.length) {
|
11975 | isInvertedSelectionMode = !isInvertedSelectionMode, interactivityService.setSelectionModeInverted(isInvertedSelectionMode);
|
11976 | for (var _a = 0, slicerDataPoints_1 = slicerDataPoints; _a < slicerDataPoints_1.length; _a++) {
|
11977 | var item = slicerDataPoints_1[_a];
|
11978 | item.selected = !1;
|
11979 | }
|
11980 | hasSelectionOverride = !1, numOfSelected = 0;
|
11981 | }
|
11982 | slicerDataPoints.unshift({
|
11983 | value: localizedSelectAllText,
|
11984 | tooltip: localizedSelectAllText,
|
11985 | identity: visuals.SelectionId.createWithMeasure(localizedSelectAllText),
|
11986 | selected: !!isInvertedSelectionMode && 0 === numOfSelected,
|
11987 | isSelectAllDataPoint: !0,
|
11988 | count: void 0
|
11989 | });
|
11990 | }
|
11991 | var slicerData = {
|
11992 | categorySourceName: category.source.displayName,
|
11993 | slicerSettings: defaultSettings,
|
11994 | slicerDataPoints: slicerDataPoints,
|
11995 | hasSelectionOverride: hasSelectionOverride,
|
11996 | defaultValue: analyzer.defaultValue
|
11997 | };
|
11998 | return slicerData;
|
11999 | }
|
12000 | function createDefaultSettings(dataViewMetadata) {
|
12001 | var defaultSettings = visuals.Slicer.DefaultStyleProperties(), objects = dataViewMetadata.objects, forceSingleSelect = dataViewMetadata.columns && _.some(dataViewMetadata.columns, function(column) {
|
12002 | return column.discourageAggregationAcrossGroups;
|
12003 | });
|
12004 | if (objects) {
|
12005 | defaultSettings.general.outlineColor = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.general.outlineColor, defaultSettings.general.outlineColor),
|
12006 | defaultSettings.general.outlineWeight = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.general.outlineWeight, defaultSettings.general.outlineWeight),
|
12007 | defaultSettings.general.orientation = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.general.orientation, defaultSettings.general.orientation),
|
12008 | defaultSettings.header.show = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.header.show, defaultSettings.header.show),
|
12009 | defaultSettings.header.fontColor = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.header.fontColor, defaultSettings.header.fontColor);
|
12010 | var headerBackground = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.header.background);
|
12011 | headerBackground && (defaultSettings.header.background = headerBackground), defaultSettings.header.outline = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.header.outline, defaultSettings.header.outline),
|
12012 | defaultSettings.header.textSize = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.header.textSize, defaultSettings.header.textSize),
|
12013 | defaultSettings.slicerText.color = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.items.fontColor, defaultSettings.slicerText.color);
|
12014 | var textBackground = powerbi.DataViewObjects.getFillColor(objects, visuals.slicerProps.items.background);
|
12015 | textBackground && (defaultSettings.slicerText.background = textBackground), defaultSettings.slicerText.outline = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.items.outline, defaultSettings.slicerText.outline),
|
12016 | defaultSettings.slicerText.textSize = powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.items.textSize, defaultSettings.slicerText.textSize),
|
12017 | defaultSettings.selection.selectAllCheckboxEnabled = !forceSingleSelect && powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.selection.selectAllCheckboxEnabled, defaultSettings.selection.selectAllCheckboxEnabled),
|
12018 | defaultSettings.selection.singleSelect = forceSingleSelect || powerbi.DataViewObjects.getValue(objects, visuals.slicerProps.selection.singleSelect, defaultSettings.selection.singleSelect);
|
12019 | }
|
12020 | return defaultSettings;
|
12021 | }
|
12022 | DataConversion.convert = convert;
|
12023 | }(DataConversion = visuals.DataConversion || (visuals.DataConversion = {}));
|
12024 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
12025 | }(powerbi || (powerbi = {}));
|
12026 |
|
12027 | var powerbi;
|
12028 |
|
12029 | !function(powerbi) {
|
12030 | var shapes = powerbi.visuals.shapes;
|
12031 | !function(RectOrientation) {
|
12032 | RectOrientation[RectOrientation.None = 0] = "None", RectOrientation[RectOrientation.VerticalBottomTop = 1] = "VerticalBottomTop",
|
12033 | RectOrientation[RectOrientation.VerticalTopBottom = 2] = "VerticalTopBottom", RectOrientation[RectOrientation.HorizontalLeftRight = 3] = "HorizontalLeftRight",
|
12034 | RectOrientation[RectOrientation.HorizontalRightLeft = 4] = "HorizontalRightLeft";
|
12035 | }(powerbi.RectOrientation || (powerbi.RectOrientation = {}));
|
12036 | var RectOrientation = powerbi.RectOrientation;
|
12037 | !function(OutsidePlacement) {
|
12038 | OutsidePlacement[OutsidePlacement.Allowed = 0] = "Allowed", OutsidePlacement[OutsidePlacement.Disallowed = 1] = "Disallowed",
|
12039 | OutsidePlacement[OutsidePlacement.Partial = 2] = "Partial";
|
12040 | }(powerbi.OutsidePlacement || (powerbi.OutsidePlacement = {}));
|
12041 | var OutsidePlacement = powerbi.OutsidePlacement, DataLabelManager = function() {
|
12042 | function DataLabelManager() {
|
12043 | this.movingStep = 3, this.hideOverlapped = !0, this.defaultDataLabelSettings = {
|
12044 | anchorMargin: DataLabelManager.DefaultAnchorMargin,
|
12045 | anchorRectOrientation: RectOrientation.None,
|
12046 | contentPosition: 128,
|
12047 | outsidePlacement: OutsidePlacement.Disallowed,
|
12048 | maximumMovingDistance: DataLabelManager.DefaultMaximumMovingDistance,
|
12049 | minimumMovingDistance: DataLabelManager.DefaultMinimumMovingDistance,
|
12050 | validContentPositions: 128,
|
12051 | opacity: 1
|
12052 | };
|
12053 | }
|
12054 | return Object.defineProperty(DataLabelManager.prototype, "defaultSettings", {
|
12055 | get: function() {
|
12056 | return this.defaultDataLabelSettings;
|
12057 | },
|
12058 | enumerable: !0,
|
12059 | configurable: !0
|
12060 | }), DataLabelManager.prototype.hideCollidedLabels = function(viewport, data, layout, addTransform) {
|
12061 | void 0 === addTransform && (addTransform = !1);
|
12062 | var arrangeGrid = new DataLabelArrangeGrid(viewport, data, layout), filteredData = [], transform = {
|
12063 | x: 0,
|
12064 | y: 0
|
12065 | };
|
12066 | addTransform && (transform.x = viewport.width / 2, transform.y = viewport.height / 2);
|
12067 | for (var i = 0, len = data.length; len > i; i++) if (layout.filter(data[i])) {
|
12068 | var info = this.getLabelInfo(data[i]);
|
12069 | info.anchorPoint = {
|
12070 | x: layout.labelLayout.x(data[i]) + transform.x,
|
12071 | y: layout.labelLayout.y(data[i]) + transform.y
|
12072 | };
|
12073 | var position = this.calculateContentPosition(info, info.contentPosition, data[i].size, info.anchorMargin);
|
12074 | DataLabelManager.isValid(position) && !this.hasCollisions(arrangeGrid, info, position, viewport) && (data[i].labelX = position.left - transform.x,
|
12075 | data[i].labelY = position.top - transform.y, arrangeGrid.add(info, position), filteredData.push(data[i]));
|
12076 | }
|
12077 | return filteredData;
|
12078 | }, DataLabelManager.prototype.getLabelInfo = function(source) {
|
12079 | var settings = this.defaultDataLabelSettings;
|
12080 | return source.anchorMargin = void 0 !== source.anchorMargin ? source.anchorMargin : settings.anchorMargin,
|
12081 | source.anchorRectOrientation = void 0 !== source.anchorRectOrientation ? source.anchorRectOrientation : settings.anchorRectOrientation,
|
12082 | source.contentPosition = void 0 !== source.contentPosition ? source.contentPosition : settings.contentPosition,
|
12083 | source.maximumMovingDistance = void 0 !== source.maximumMovingDistance ? source.maximumMovingDistance : settings.maximumMovingDistance,
|
12084 | source.minimumMovingDistance = void 0 !== source.minimumMovingDistance ? source.minimumMovingDistance : settings.minimumMovingDistance,
|
12085 | source.outsidePlacement = void 0 !== source.outsidePlacement ? source.outsidePlacement : settings.outsidePlacement,
|
12086 | source.validContentPositions = void 0 !== source.validContentPositions ? source.validContentPositions : settings.validContentPositions,
|
12087 | source.opacity = void 0 !== source.opacity ? source.opacity : settings.opacity,
|
12088 | source.maximumMovingDistance += source.anchorMargin, source;
|
12089 | }, DataLabelManager.prototype.calculateContentPositionFromPoint = function(anchorPoint, contentPosition, contentSize, offset) {
|
12090 | var position = {
|
12091 | x: 0,
|
12092 | y: 0
|
12093 | };
|
12094 | if (anchorPoint) {
|
12095 | if (void 0 !== anchorPoint.x && isFinite(anchorPoint.x)) switch (position.x = anchorPoint.x,
|
12096 | contentPosition) {
|
12097 | case 1:
|
12098 | case 8:
|
12099 | case 64:
|
12100 | position.x -= contentSize.width / 2;
|
12101 | break;
|
12102 |
|
12103 | case 4:
|
12104 | case 32:
|
12105 | case 256:
|
12106 | position.x += contentSize.width / 2;
|
12107 | }
|
12108 | if (void 0 !== anchorPoint.y && isFinite(anchorPoint.y)) switch (position.y = anchorPoint.y,
|
12109 | contentPosition) {
|
12110 | case 8:
|
12111 | case 16:
|
12112 | case 32:
|
12113 | position.y -= contentSize.height / 2;
|
12114 | break;
|
12115 |
|
12116 | case 4:
|
12117 | case 1:
|
12118 | case 2:
|
12119 | position.y -= contentSize.height;
|
12120 | }
|
12121 | if (void 0 !== offset && isFinite(offset)) switch (contentPosition) {
|
12122 | case 1:
|
12123 | position.x -= offset, position.y -= offset;
|
12124 | break;
|
12125 |
|
12126 | case 8:
|
12127 | position.x -= offset;
|
12128 | break;
|
12129 |
|
12130 | case 64:
|
12131 | position.x -= offset, position.y += offset;
|
12132 | break;
|
12133 |
|
12134 | case 2:
|
12135 | position.y -= offset;
|
12136 | break;
|
12137 |
|
12138 | case 16:
|
12139 | break;
|
12140 |
|
12141 | case 128:
|
12142 | position.y += offset;
|
12143 | break;
|
12144 |
|
12145 | case 4:
|
12146 | position.x += offset, position.y -= offset;
|
12147 | break;
|
12148 |
|
12149 | case 32:
|
12150 | position.x += offset;
|
12151 | break;
|
12152 |
|
12153 | case 256:
|
12154 | position.x += offset, position.y += offset;
|
12155 | }
|
12156 | }
|
12157 | return {
|
12158 | left: position.x,
|
12159 | top: position.y,
|
12160 | width: contentSize.width,
|
12161 | height: contentSize.height
|
12162 | };
|
12163 | }, DataLabelManager.prototype.calculateContentPositionFromRect = function(anchorRect, anchorRectOrientation, contentPosition, contentSize, offset) {
|
12164 | switch (contentPosition) {
|
12165 | case 512:
|
12166 | return this.handleInsideCenterPosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12167 |
|
12168 | case 2048:
|
12169 | return this.handleInsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12170 |
|
12171 | case 1024:
|
12172 | return this.handleInsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12173 |
|
12174 | case 8192:
|
12175 | return this.handleOutsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12176 |
|
12177 | case 4096:
|
12178 | return this.handleOutsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
|
12179 | }
|
12180 | return {
|
12181 | left: 0,
|
12182 | top: 0,
|
12183 | width: -1,
|
12184 | height: -1
|
12185 | };
|
12186 | }, DataLabelManager.prototype.handleInsideCenterPosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12187 | switch (anchorRectOrientation) {
|
12188 | case RectOrientation.VerticalBottomTop:
|
12189 | case RectOrientation.VerticalTopBottom:
|
12190 | return LocationConverter.middleVertical(contentSize, anchorRect, offset);
|
12191 |
|
12192 | case RectOrientation.HorizontalLeftRight:
|
12193 | case RectOrientation.HorizontalRightLeft:
|
12194 | default:
|
12195 | return LocationConverter.middleHorizontal(contentSize, anchorRect, offset);
|
12196 | }
|
12197 | }, DataLabelManager.prototype.handleInsideEndPosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12198 | switch (anchorRectOrientation) {
|
12199 | case RectOrientation.VerticalBottomTop:
|
12200 | return LocationConverter.topInside(contentSize, anchorRect, offset);
|
12201 |
|
12202 | case RectOrientation.VerticalTopBottom:
|
12203 | return LocationConverter.bottomInside(contentSize, anchorRect, offset);
|
12204 |
|
12205 | case RectOrientation.HorizontalRightLeft:
|
12206 | return LocationConverter.leftInside(contentSize, anchorRect, offset);
|
12207 |
|
12208 | case RectOrientation.HorizontalLeftRight:
|
12209 | default:
|
12210 | return LocationConverter.rightInside(contentSize, anchorRect, offset);
|
12211 | }
|
12212 | }, DataLabelManager.prototype.handleInsideBasePosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12213 | switch (anchorRectOrientation) {
|
12214 | case RectOrientation.VerticalBottomTop:
|
12215 | return LocationConverter.bottomInside(contentSize, anchorRect, offset);
|
12216 |
|
12217 | case RectOrientation.VerticalTopBottom:
|
12218 | return LocationConverter.topInside(contentSize, anchorRect, offset);
|
12219 |
|
12220 | case RectOrientation.HorizontalRightLeft:
|
12221 | return LocationConverter.rightInside(contentSize, anchorRect, offset);
|
12222 |
|
12223 | case RectOrientation.HorizontalLeftRight:
|
12224 | default:
|
12225 | return LocationConverter.leftInside(contentSize, anchorRect, offset);
|
12226 | }
|
12227 | }, DataLabelManager.prototype.handleOutsideEndPosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12228 | switch (anchorRectOrientation) {
|
12229 | case RectOrientation.VerticalBottomTop:
|
12230 | return LocationConverter.topOutside(contentSize, anchorRect, offset);
|
12231 |
|
12232 | case RectOrientation.VerticalTopBottom:
|
12233 | return LocationConverter.bottomOutside(contentSize, anchorRect, offset);
|
12234 |
|
12235 | case RectOrientation.HorizontalRightLeft:
|
12236 | return LocationConverter.leftOutside(contentSize, anchorRect, offset);
|
12237 |
|
12238 | case RectOrientation.HorizontalLeftRight:
|
12239 | default:
|
12240 | return LocationConverter.rightOutside(contentSize, anchorRect, offset);
|
12241 | }
|
12242 | }, DataLabelManager.prototype.handleOutsideBasePosition = function(anchorRectOrientation, contentSize, anchorRect, offset) {
|
12243 | switch (anchorRectOrientation) {
|
12244 | case RectOrientation.VerticalBottomTop:
|
12245 | return LocationConverter.bottomOutside(contentSize, anchorRect, offset);
|
12246 |
|
12247 | case RectOrientation.VerticalTopBottom:
|
12248 | return LocationConverter.topOutside(contentSize, anchorRect, offset);
|
12249 |
|
12250 | case RectOrientation.HorizontalRightLeft:
|
12251 | return LocationConverter.rightOutside(contentSize, anchorRect, offset);
|
12252 |
|
12253 | case RectOrientation.HorizontalLeftRight:
|
12254 | default:
|
12255 | return LocationConverter.leftOutside(contentSize, anchorRect, offset);
|
12256 | }
|
12257 | }, DataLabelManager.prototype.calculateContentPosition = function(anchoredElementInfo, contentPosition, contentSize, offset) {
|
12258 | 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);
|
12259 | }, DataLabelManager.prototype.hasCollisions = function(arrangeGrid, info, position, size) {
|
12260 | var rect = shapes.Rect;
|
12261 | if (arrangeGrid.hasConflict(position)) return !0;
|
12262 | var intersection = {
|
12263 | left: 0,
|
12264 | top: position.height / 2,
|
12265 | width: size.width,
|
12266 | height: size.height
|
12267 | };
|
12268 | if (intersection = rect.inflate(intersection, {
|
12269 | left: DataLabelManager.InflateAmount,
|
12270 | top: 0,
|
12271 | right: DataLabelManager.InflateAmount,
|
12272 | bottom: 0
|
12273 | }), intersection = rect.intersect(intersection, position), rect.isEmpty(intersection)) return !0;
|
12274 | var lessWithPrecision = powerbi.Double.lessWithPrecision;
|
12275 | switch (info.outsidePlacement) {
|
12276 | case OutsidePlacement.Disallowed:
|
12277 | return lessWithPrecision(intersection.width, position.width) || lessWithPrecision(intersection.height, position.height / 2);
|
12278 |
|
12279 | case OutsidePlacement.Partial:
|
12280 | return lessWithPrecision(intersection.width, position.width / 2) || lessWithPrecision(intersection.height, position.height / 4);
|
12281 | }
|
12282 | return !1;
|
12283 | }, DataLabelManager.isValid = function(rect) {
|
12284 | return !shapes.Rect.isEmpty(rect) && rect.width > 0 && rect.height > 0;
|
12285 | }, DataLabelManager.DefaultAnchorMargin = 0, DataLabelManager.DefaultMaximumMovingDistance = 12,
|
12286 | DataLabelManager.DefaultMinimumMovingDistance = 3, DataLabelManager.InflateAmount = 5,
|
12287 | DataLabelManager;
|
12288 | }();
|
12289 | powerbi.DataLabelManager = DataLabelManager;
|
12290 | var DataLabelArrangeGrid = function() {
|
12291 | function DataLabelArrangeGrid(size, elements, layout) {
|
12292 | this.grid = [], 0 !== size.width && 0 !== size.height || (this.cellSize = size,
|
12293 | this.rowCount = this.colCount = 0);
|
12294 | var baseProperties = {
|
12295 | fontFamily: powerbi.visuals.dataLabelUtils.LabelTextProperties.fontFamily,
|
12296 | fontSize: powerbi.visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
12297 | fontWeight: powerbi.visuals.dataLabelUtils.LabelTextProperties.fontWeight
|
12298 | };
|
12299 | this.cellSize = {
|
12300 | width: 0,
|
12301 | height: 0
|
12302 | };
|
12303 | for (var i = 0, len = elements.length; len > i; i++) {
|
12304 | var child = elements[i];
|
12305 | child.labeltext = layout.labelText(child);
|
12306 | var properties = powerbi.Prototype.inherit(baseProperties);
|
12307 | properties.text = child.labeltext, properties.fontSize = child.data ? child.data.labelFontSize : child.labelFontSize ? child.labelFontSize : powerbi.visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
12308 | child.size = {
|
12309 | width: powerbi.TextMeasurementService.measureSvgTextWidth(properties),
|
12310 | height: powerbi.TextMeasurementService.estimateSvgTextHeight(properties)
|
12311 | };
|
12312 | var w = 2 * child.size.width, h = 2 * child.size.height;
|
12313 | w > this.cellSize.width && (this.cellSize.width = w), h > this.cellSize.height && (this.cellSize.height = h);
|
12314 | }
|
12315 | 0 === this.cellSize.width && (this.cellSize.width = size.width), 0 === this.cellSize.height && (this.cellSize.height = size.height),
|
12316 | this.colCount = this.getGridRowColCount(this.cellSize.width, size.width, DataLabelArrangeGrid.ARRANGEGRID_MIN_COUNT, DataLabelArrangeGrid.ARRANGEGRID_MAX_COUNT),
|
12317 | this.rowCount = this.getGridRowColCount(this.cellSize.height, size.height, DataLabelArrangeGrid.ARRANGEGRID_MIN_COUNT, DataLabelArrangeGrid.ARRANGEGRID_MAX_COUNT),
|
12318 | this.cellSize.width = size.width / this.colCount, this.cellSize.height = size.height / this.rowCount;
|
12319 | for (var grid = this.grid, x = 0; x < this.colCount; x++) {
|
12320 | grid[x] = [];
|
12321 | for (var y = 0; y < this.rowCount; y++) grid[x][y] = [];
|
12322 | }
|
12323 | }
|
12324 | return DataLabelArrangeGrid.prototype.add = function(element, rect) {
|
12325 | 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({
|
12326 | element: element,
|
12327 | rect: rect
|
12328 | });
|
12329 | }, DataLabelArrangeGrid.prototype.hasConflict = function(rect) {
|
12330 | 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++) {
|
12331 | var item = grid[x][y][z];
|
12332 | if (isIntersecting(item.rect, rect)) return !0;
|
12333 | }
|
12334 | return !1;
|
12335 | }, DataLabelArrangeGrid.prototype.getGridRowColCount = function(step, length, minCount, maxCount) {
|
12336 | return Math.min(Math.max(Math.ceil(length / step), minCount), maxCount);
|
12337 | }, DataLabelArrangeGrid.prototype.getGridIndexRect = function(rect) {
|
12338 | var restrict = function(n, min, max) {
|
12339 | return Math.min(Math.max(n, min), max);
|
12340 | };
|
12341 | return {
|
12342 | left: restrict(Math.floor(rect.left / this.cellSize.width), 0, this.colCount),
|
12343 | top: restrict(Math.floor(rect.top / this.cellSize.height), 0, this.rowCount),
|
12344 | right: restrict(Math.ceil((rect.left + rect.width) / this.cellSize.width), 0, this.colCount),
|
12345 | bottom: restrict(Math.ceil((rect.top + rect.height) / this.cellSize.height), 0, this.rowCount)
|
12346 | };
|
12347 | }, DataLabelArrangeGrid.ARRANGEGRID_MIN_COUNT = 1, DataLabelArrangeGrid.ARRANGEGRID_MAX_COUNT = 100,
|
12348 | DataLabelArrangeGrid;
|
12349 | }();
|
12350 | powerbi.DataLabelArrangeGrid = DataLabelArrangeGrid;
|
12351 | var LocationConverter;
|
12352 | !function(LocationConverter) {
|
12353 | function topInside(size, rect, offset) {
|
12354 | return {
|
12355 | left: rect.left + rect.width / 2 - size.width / 2,
|
12356 | top: rect.top + offset,
|
12357 | width: size.width,
|
12358 | height: size.height
|
12359 | };
|
12360 | }
|
12361 | function bottomInside(size, rect, offset) {
|
12362 | return {
|
12363 | left: rect.left + rect.width / 2 - size.width / 2,
|
12364 | top: rect.top + rect.height - size.height - offset,
|
12365 | width: size.width,
|
12366 | height: size.height
|
12367 | };
|
12368 | }
|
12369 | function rightInside(size, rect, offset) {
|
12370 | return {
|
12371 | left: rect.left + rect.width - size.width - offset,
|
12372 | top: rect.top + rect.height / 2 - size.height / 2,
|
12373 | width: size.width,
|
12374 | height: size.height
|
12375 | };
|
12376 | }
|
12377 | function leftInside(size, rect, offset) {
|
12378 | return {
|
12379 | left: rect.left + offset,
|
12380 | top: rect.top + rect.height / 2 - size.height / 2,
|
12381 | width: size.width,
|
12382 | height: size.height
|
12383 | };
|
12384 | }
|
12385 | function topOutside(size, rect, offset) {
|
12386 | return {
|
12387 | left: rect.left + rect.width / 2 - size.width / 2,
|
12388 | top: rect.top - size.height - offset,
|
12389 | width: size.width,
|
12390 | height: size.height
|
12391 | };
|
12392 | }
|
12393 | function bottomOutside(size, rect, offset) {
|
12394 | return {
|
12395 | left: rect.left + rect.width / 2 - size.width / 2,
|
12396 | top: rect.top + rect.height + offset,
|
12397 | width: size.width,
|
12398 | height: size.height
|
12399 | };
|
12400 | }
|
12401 | function rightOutside(size, rect, offset) {
|
12402 | return {
|
12403 | left: rect.left + rect.width + offset,
|
12404 | top: rect.top + rect.height / 2 - size.height / 2,
|
12405 | width: size.width,
|
12406 | height: size.height
|
12407 | };
|
12408 | }
|
12409 | function leftOutside(size, rect, offset) {
|
12410 | return {
|
12411 | left: rect.left - size.width - offset,
|
12412 | top: rect.top + rect.height / 2 - size.height / 2,
|
12413 | width: size.width,
|
12414 | height: size.height
|
12415 | };
|
12416 | }
|
12417 | function middleHorizontal(size, rect, offset) {
|
12418 | return {
|
12419 | left: rect.left + rect.width / 2 - size.width / 2 + offset,
|
12420 | top: rect.top + rect.height / 2 - size.height / 2,
|
12421 | width: size.width,
|
12422 | height: size.height
|
12423 | };
|
12424 | }
|
12425 | function middleVertical(size, rect, offset) {
|
12426 | return {
|
12427 | left: rect.left + rect.width / 2 - size.width / 2,
|
12428 | top: rect.top + rect.height / 2 - size.height / 2 + offset,
|
12429 | width: size.width,
|
12430 | height: size.height
|
12431 | };
|
12432 | }
|
12433 | LocationConverter.topInside = topInside, LocationConverter.bottomInside = bottomInside,
|
12434 | LocationConverter.rightInside = rightInside, LocationConverter.leftInside = leftInside,
|
12435 | LocationConverter.topOutside = topOutside, LocationConverter.bottomOutside = bottomOutside,
|
12436 | LocationConverter.rightOutside = rightOutside, LocationConverter.leftOutside = leftOutside,
|
12437 | LocationConverter.middleHorizontal = middleHorizontal, LocationConverter.middleVertical = middleVertical;
|
12438 | }(LocationConverter || (LocationConverter = {}));
|
12439 | }(powerbi || (powerbi = {}));
|
12440 |
|
12441 | var powerbi;
|
12442 |
|
12443 | !function(powerbi) {
|
12444 | var shapes = powerbi.visuals.shapes, Rect = powerbi.visuals.shapes.Rect, NewDataLabelUtils = powerbi.visuals.NewDataLabelUtils, LabelArrangeGrid = function() {
|
12445 | function LabelArrangeGrid(labelDataPointsGroups, viewport) {
|
12446 | this.viewport = viewport;
|
12447 | 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++) {
|
12448 | var labelDataPoint = _b[_a];
|
12449 | if (labelDataPoint.isPreferred) {
|
12450 | var dataLabelSize = labelDataPoint.labelSize;
|
12451 | dataLabelSize.width > maxLabelWidth && (maxLabelWidth = dataLabelSize.width), dataLabelSize.height > maxLabelHeight && (maxLabelHeight = dataLabelSize.height);
|
12452 | }
|
12453 | }
|
12454 | 0 === maxLabelWidth && (maxLabelWidth = viewport.width), 0 === maxLabelHeight && (maxLabelHeight = viewport.height);
|
12455 | var cellSize = this.cellSize = {
|
12456 | width: maxLabelWidth * LabelArrangeGrid.cellSizeMultiplier,
|
12457 | height: maxLabelHeight * LabelArrangeGrid.cellSizeMultiplier
|
12458 | };
|
12459 | this.columnCount = LabelArrangeGrid.getCellCount(cellSize.width, viewport.width, 1, 100),
|
12460 | this.rowCount = LabelArrangeGrid.getCellCount(cellSize.height, viewport.height, 1, 100);
|
12461 | for (var grid = [], i = 0, ilen = this.columnCount; ilen > i; i++) {
|
12462 | grid[i] = [];
|
12463 | for (var j = 0, jlen = this.rowCount; jlen > j; j++) grid[i][j] = [];
|
12464 | }
|
12465 | this.grid = grid;
|
12466 | }
|
12467 | return LabelArrangeGrid.prototype.add = function(rect) {
|
12468 | 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);
|
12469 | }, LabelArrangeGrid.prototype.hasConflict = function(rect) {
|
12470 | return this.isWithinGridViewport(rect) ? this.hasCollision(rect) : !0;
|
12471 | }, LabelArrangeGrid.prototype.tryPositionInViewport = function(rect) {
|
12472 | return this.isCloseToGridViewport(rect) ? (this.isWithinGridViewport(rect) || (rect = this.tryMoveInsideViewport(rect)),
|
12473 | rect && !this.hasCollision(rect) ? rect : void 0) : void 0;
|
12474 | }, LabelArrangeGrid.prototype.hasCollision = function(rect) {
|
12475 | 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++) {
|
12476 | var currentGridRect = _a[_i];
|
12477 | if (isIntersecting(currentGridRect, rect)) return !0;
|
12478 | }
|
12479 | return !1;
|
12480 | }, LabelArrangeGrid.prototype.isWithinGridViewport = function(rect) {
|
12481 | return rect.left >= 0 && rect.top >= 0 && rect.left + rect.width <= this.viewport.width && rect.top + rect.height <= this.viewport.height;
|
12482 | }, LabelArrangeGrid.prototype.isCloseToGridViewport = function(rect) {
|
12483 | 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;
|
12484 | }, LabelArrangeGrid.prototype.tryMoveInsideViewport = function(rect) {
|
12485 | var result = Rect.clone(rect), viewport = this.viewport;
|
12486 | 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),
|
12487 | rect.top < 0 ? result.top = 0 : rect.top + rect.height > viewport.height && (result.top -= rect.top + rect.height - viewport.height),
|
12488 | result);
|
12489 | }, LabelArrangeGrid.prototype.getContainingGridSubsection = function(rect) {
|
12490 | return {
|
12491 | xMin: LabelArrangeGrid.bound(Math.floor(rect.left / this.cellSize.width), 0, this.columnCount),
|
12492 | xMax: LabelArrangeGrid.bound(Math.ceil((rect.left + rect.width) / this.cellSize.width), 0, this.columnCount),
|
12493 | yMin: LabelArrangeGrid.bound(Math.floor(rect.top / this.cellSize.height), 0, this.rowCount),
|
12494 | yMax: LabelArrangeGrid.bound(Math.ceil((rect.top + rect.height) / this.cellSize.height), 0, this.rowCount)
|
12495 | };
|
12496 | }, LabelArrangeGrid.getCellCount = function(step, length, minCount, maxCount) {
|
12497 | return LabelArrangeGrid.bound(Math.ceil(length / step), minCount, maxCount);
|
12498 | }, LabelArrangeGrid.bound = function(value, min, max) {
|
12499 | return Math.max(Math.min(value, max), min);
|
12500 | }, LabelArrangeGrid.cellSizeMultiplier = 2, LabelArrangeGrid;
|
12501 | }();
|
12502 | powerbi.LabelArrangeGrid = LabelArrangeGrid;
|
12503 | var LabelLayout = function() {
|
12504 | function LabelLayout(options) {
|
12505 | this.startingOffset = options.startingOffset, this.maximumOffset = options.maximumOffset,
|
12506 | null != options.offsetIterationDelta ? this.offsetIterationDelta = options.offsetIterationDelta : this.offsetIterationDelta = LabelLayout.defaultOffsetIterationDelta,
|
12507 | null != options.horizontalPadding ? this.horizontalPadding = options.horizontalPadding : this.horizontalPadding = LabelLayout.defaultHorizontalPadding,
|
12508 | null != options.verticalPadding ? this.verticalPadding = options.verticalPadding : this.verticalPadding = LabelLayout.defaultVerticalPadding,
|
12509 | this.allowLeaderLines = !!options.allowLeaderLines, this.attemptToMoveLabelsIntoViewport = !!options.attemptToMoveLabelsIntoViewport;
|
12510 | }
|
12511 | return LabelLayout.prototype.layout = function(labelDataPointsGroups, viewport) {
|
12512 | 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++) {
|
12513 | var labelPoint = _b[_a];
|
12514 | labelPoint.hasBeenRendered = !1, labelPoint.hasBackground ? labelPoint.labelSize = {
|
12515 | width: labelPoint.textSize.width + 2 * NewDataLabelUtils.horizontalLabelBackgroundPadding,
|
12516 | height: labelPoint.textSize.height + 2 * NewDataLabelUtils.verticalLabelBackgroundPadding
|
12517 | } : labelPoint.labelSize = labelPoint.textSize;
|
12518 | }
|
12519 | for (var resultingDataLabels = [], grid = new LabelArrangeGrid(labelDataPointsGroups, viewport), _c = 0, labelDataPointsGroups_3 = labelDataPointsGroups; _c < labelDataPointsGroups_3.length; _c++) {
|
12520 | 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--) {
|
12521 | var labelPoint = labelDataPoints[j];
|
12522 | labelPoint.isPreferred && (preferredLabels.unshift(labelDataPoints.splice(j, 1)[0]),
|
12523 | localMax--);
|
12524 | }
|
12525 | if (preferredLabels.length > 0) {
|
12526 | var positionedLabels = this.positionDataLabels(preferredLabels, viewport, grid, maxLabelsToRender);
|
12527 | maxLabelsToRender -= positionedLabels.length, resultingDataLabels = resultingDataLabels.concat(positionedLabels);
|
12528 | }
|
12529 | if (labelDataPoints.length > 0) {
|
12530 | var labels = this.positionDataLabels(labelDataPoints, viewport, grid, maxLabelsToRender);
|
12531 | resultingDataLabels = resultingDataLabels.concat(labels);
|
12532 | }
|
12533 | }
|
12534 | return resultingDataLabels;
|
12535 | }, LabelLayout.prototype.positionDataLabels = function(labelDataPoints, viewport, grid, maxLabelsToRender) {
|
12536 | for (var drawLeaderLinesOnIteration, resultingDataLabels = [], offsetDelta = this.offsetIterationDelta, currentOffset = this.startingOffset, currentCenteredOffset = 0; currentOffset <= this.maximumOffset && maxLabelsToRender > 0; ) {
|
12537 | drawLeaderLinesOnIteration = this.allowLeaderLines && currentOffset > this.startingOffset;
|
12538 | for (var _i = 0, labelDataPoints_2 = labelDataPoints; _i < labelDataPoints_2.length; _i++) {
|
12539 | var labelPoint = labelDataPoints_2[_i];
|
12540 | if (0 === maxLabelsToRender) break;
|
12541 | if (!labelPoint.hasBeenRendered) {
|
12542 | var dataLabel = void 0;
|
12543 | dataLabel = 1 === labelPoint.parentType ? this.tryPositionForRectPositions(labelPoint, grid, currentOffset, currentCenteredOffset) : this.tryPositionForPointPositions(labelPoint, grid, currentOffset, drawLeaderLinesOnIteration),
|
12544 | dataLabel && (resultingDataLabels.push(dataLabel), maxLabelsToRender--);
|
12545 | }
|
12546 | }
|
12547 | currentOffset += offsetDelta, currentCenteredOffset += offsetDelta;
|
12548 | }
|
12549 | return resultingDataLabels;
|
12550 | }, LabelLayout.prototype.tryPositionForRectPositions = function(labelPoint, grid, currentLabelOffset, currentCenteredLabelOffset) {
|
12551 | for (var _this = this, tryPosition = function(position, adjustForViewport) {
|
12552 | var isPositionInside = 7 & position;
|
12553 | if (!isPositionInside || DataLabelRectPositioner.canFitWithinParent(labelPoint, _this.horizontalPadding, _this.verticalPadding)) {
|
12554 | var resultingBoundingBox = LabelLayout.tryPositionRect(grid, position, labelPoint, currentLabelOffset, currentCenteredLabelOffset, adjustForViewport);
|
12555 | if (resultingBoundingBox) {
|
12556 | if (isPositionInside && !DataLabelRectPositioner.isLabelWithinParent(resultingBoundingBox, labelPoint, _this.horizontalPadding, _this.verticalPadding)) return;
|
12557 | return grid.add(resultingBoundingBox), labelPoint.hasBeenRendered = !0, {
|
12558 | boundingBox: resultingBoundingBox,
|
12559 | text: labelPoint.text,
|
12560 | tooltip: labelPoint.tooltip,
|
12561 | isVisible: !0,
|
12562 | fill: isPositionInside ? labelPoint.insideFill : labelPoint.outsideFill,
|
12563 | identity: labelPoint.identity,
|
12564 | key: labelPoint.key,
|
12565 | fontSize: labelPoint.fontSize,
|
12566 | selected: !1,
|
12567 | hasBackground: !!labelPoint.hasBackground
|
12568 | };
|
12569 | }
|
12570 | }
|
12571 | }, _i = 0, _a = labelPoint.parentShape.validPositions; _i < _a.length; _i++) {
|
12572 | var position = _a[_i], label = tryPosition(position, !1);
|
12573 | if (label) return label;
|
12574 | }
|
12575 | if (this.attemptToMoveLabelsIntoViewport) for (var _b = 0, _c = labelPoint.parentShape.validPositions; _b < _c.length; _b++) {
|
12576 | var position = _c[_b], label = tryPosition(position, !0);
|
12577 | if (label) return label;
|
12578 | }
|
12579 | return null;
|
12580 | }, LabelLayout.tryPositionRect = function(grid, position, labelDataPoint, offset, centerOffset, adjustForViewport) {
|
12581 | var offsetForPosition = offset;
|
12582 | 1 & position && (offsetForPosition = centerOffset);
|
12583 | var labelRect = DataLabelRectPositioner.getLabelRect(labelDataPoint, position, offsetForPosition);
|
12584 | if (1 !== position || 0 === labelDataPoint.parentShape.orientation) {
|
12585 | if (!grid.hasConflict(labelRect)) return labelRect;
|
12586 | if (adjustForViewport) return grid.tryPositionInViewport(labelRect);
|
12587 | } else {
|
12588 | if (!grid.hasConflict(labelRect)) return labelRect;
|
12589 | if (labelRect = DataLabelRectPositioner.getLabelRect(labelDataPoint, position, -offsetForPosition),
|
12590 | !grid.hasConflict(labelRect)) return labelRect;
|
12591 | }
|
12592 | return null;
|
12593 | }, LabelLayout.prototype.tryPositionForPointPositions = function(labelPoint, grid, currentLabelOffset, drawLeaderLines) {
|
12594 | for (var tryPosition = function(position, parentShape, adjustForViewport) {
|
12595 | var resultingBoundingBox = LabelLayout.tryPositionPoint(grid, position, labelPoint, currentLabelOffset, adjustForViewport);
|
12596 | return resultingBoundingBox ? (grid.add(resultingBoundingBox), labelPoint.hasBeenRendered = !0,
|
12597 | {
|
12598 | boundingBox: resultingBoundingBox,
|
12599 | text: labelPoint.text,
|
12600 | tooltip: labelPoint.tooltip,
|
12601 | isVisible: !0,
|
12602 | fill: 256 === position ? labelPoint.insideFill : labelPoint.outsideFill,
|
12603 | isInsideParent: 256 === position,
|
12604 | identity: labelPoint.identity,
|
12605 | key: labelPoint.key,
|
12606 | fontSize: labelPoint.fontSize,
|
12607 | selected: !1,
|
12608 | leaderLinePoints: drawLeaderLines ? DataLabelPointPositioner.getLabelLeaderLineEndingPoint(resultingBoundingBox, position, parentShape) : null,
|
12609 | hasBackground: !!labelPoint.hasBackground
|
12610 | }) : void 0;
|
12611 | }, parentShape = labelPoint.parentShape, validPositions = parentShape.validPositions, _i = 0, validPositions_1 = validPositions; _i < validPositions_1.length; _i++) {
|
12612 | var position = validPositions_1[_i], label = tryPosition(position, parentShape, !1);
|
12613 | if (label) return label;
|
12614 | }
|
12615 | if (this.attemptToMoveLabelsIntoViewport && !_.isEmpty(validPositions)) {
|
12616 | var label = tryPosition(validPositions[0], parentShape, !0);
|
12617 | if (label) return label;
|
12618 | }
|
12619 | return null;
|
12620 | }, LabelLayout.tryPositionPoint = function(grid, position, labelDataPoint, offset, adjustForViewport) {
|
12621 | var labelRect = DataLabelPointPositioner.getLabelRect(labelDataPoint.labelSize, labelDataPoint.parentShape, position, offset);
|
12622 | return grid.hasConflict(labelRect) ? adjustForViewport ? grid.tryPositionInViewport(labelRect) : null : labelRect;
|
12623 | }, LabelLayout.defaultOffsetIterationDelta = 2, LabelLayout.defaultHorizontalPadding = 2,
|
12624 | LabelLayout.defaultVerticalPadding = 2, LabelLayout;
|
12625 | }();
|
12626 | powerbi.LabelLayout = LabelLayout;
|
12627 | var DataLabelRectPositioner;
|
12628 | !function(DataLabelRectPositioner) {
|
12629 | function getLabelRect(labelDataPoint, position, offset) {
|
12630 | var parentRect = labelDataPoint.parentShape;
|
12631 | if (null != parentRect) switch (position) {
|
12632 | case 1:
|
12633 | switch (parentRect.orientation) {
|
12634 | case 1:
|
12635 | case 2:
|
12636 | return DataLabelRectPositioner.middleVertical(labelDataPoint.labelSize, parentRect.rect, offset);
|
12637 |
|
12638 | case 3:
|
12639 | case 4:
|
12640 | return DataLabelRectPositioner.middleHorizontal(labelDataPoint.labelSize, parentRect.rect, offset);
|
12641 |
|
12642 | case 0: }
|
12643 |
|
12644 | case 2:
|
12645 | switch (parentRect.orientation) {
|
12646 | case 1:
|
12647 | return DataLabelRectPositioner.bottomInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12648 |
|
12649 | case 2:
|
12650 | return DataLabelRectPositioner.topInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12651 |
|
12652 | case 3:
|
12653 | return DataLabelRectPositioner.leftInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12654 |
|
12655 | case 4:
|
12656 | return DataLabelRectPositioner.rightInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12657 |
|
12658 | case 0: }
|
12659 |
|
12660 | case 4:
|
12661 | switch (parentRect.orientation) {
|
12662 | case 1:
|
12663 | return DataLabelRectPositioner.topInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12664 |
|
12665 | case 2:
|
12666 | return DataLabelRectPositioner.bottomInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12667 |
|
12668 | case 3:
|
12669 | return DataLabelRectPositioner.rightInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12670 |
|
12671 | case 4:
|
12672 | return DataLabelRectPositioner.leftInside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12673 |
|
12674 | case 0: }
|
12675 |
|
12676 | case 8:
|
12677 | switch (parentRect.orientation) {
|
12678 | case 1:
|
12679 | return DataLabelRectPositioner.bottomOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12680 |
|
12681 | case 2:
|
12682 | return DataLabelRectPositioner.topOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12683 |
|
12684 | case 3:
|
12685 | return DataLabelRectPositioner.leftOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12686 |
|
12687 | case 4:
|
12688 | return DataLabelRectPositioner.rightOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12689 |
|
12690 | case 0: }
|
12691 |
|
12692 | case 16:
|
12693 | switch (parentRect.orientation) {
|
12694 | case 1:
|
12695 | return DataLabelRectPositioner.topOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12696 |
|
12697 | case 2:
|
12698 | return DataLabelRectPositioner.bottomOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12699 |
|
12700 | case 3:
|
12701 | return DataLabelRectPositioner.rightOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12702 |
|
12703 | case 4:
|
12704 | return DataLabelRectPositioner.leftOutside(labelDataPoint.labelSize, parentRect.rect, offset);
|
12705 |
|
12706 | case 0: }
|
12707 | }
|
12708 | return null;
|
12709 | }
|
12710 | function canFitWithinParent(labelDataPoint, horizontalPadding, verticalPadding) {
|
12711 | return labelDataPoint.labelSize.width + 2 * horizontalPadding < labelDataPoint.parentShape.rect.width || labelDataPoint.labelSize.height + 2 * verticalPadding < labelDataPoint.parentShape.rect.height;
|
12712 | }
|
12713 | function isLabelWithinParent(labelRect, labelPoint, horizontalPadding, verticalPadding) {
|
12714 | var parentRect = labelPoint.parentShape.rect, labelRectWithPadding = shapes.Rect.inflate(labelRect, {
|
12715 | left: horizontalPadding,
|
12716 | right: horizontalPadding,
|
12717 | top: verticalPadding,
|
12718 | bottom: verticalPadding
|
12719 | });
|
12720 | return shapes.Rect.containsPoint(parentRect, {
|
12721 | x: labelRectWithPadding.left,
|
12722 | y: labelRectWithPadding.top
|
12723 | }) && shapes.Rect.containsPoint(parentRect, {
|
12724 | x: labelRectWithPadding.left + labelRectWithPadding.width,
|
12725 | y: labelRectWithPadding.top + labelRectWithPadding.height
|
12726 | });
|
12727 | }
|
12728 | function topInside(labelSize, parentRect, offset) {
|
12729 | return {
|
12730 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
12731 | top: parentRect.top + offset,
|
12732 | width: labelSize.width,
|
12733 | height: labelSize.height
|
12734 | };
|
12735 | }
|
12736 | function bottomInside(labelSize, parentRect, offset) {
|
12737 | return {
|
12738 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
12739 | top: parentRect.top + parentRect.height - offset - labelSize.height,
|
12740 | width: labelSize.width,
|
12741 | height: labelSize.height
|
12742 | };
|
12743 | }
|
12744 | function rightInside(labelSize, parentRect, offset) {
|
12745 | return {
|
12746 | left: parentRect.left + parentRect.width - labelSize.width - offset,
|
12747 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
12748 | width: labelSize.width,
|
12749 | height: labelSize.height
|
12750 | };
|
12751 | }
|
12752 | function leftInside(labelSize, parentRect, offset) {
|
12753 | return {
|
12754 | left: parentRect.left + offset,
|
12755 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
12756 | width: labelSize.width,
|
12757 | height: labelSize.height
|
12758 | };
|
12759 | }
|
12760 | function topOutside(labelSize, parentRect, offset) {
|
12761 | return {
|
12762 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
12763 | top: parentRect.top - labelSize.height - offset,
|
12764 | width: labelSize.width,
|
12765 | height: labelSize.height
|
12766 | };
|
12767 | }
|
12768 | function bottomOutside(labelSize, parentRect, offset) {
|
12769 | return {
|
12770 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
12771 | top: parentRect.top + parentRect.height + offset,
|
12772 | width: labelSize.width,
|
12773 | height: labelSize.height
|
12774 | };
|
12775 | }
|
12776 | function rightOutside(labelSize, parentRect, offset) {
|
12777 | return {
|
12778 | left: parentRect.left + parentRect.width + offset,
|
12779 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
12780 | width: labelSize.width,
|
12781 | height: labelSize.height
|
12782 | };
|
12783 | }
|
12784 | function leftOutside(labelSize, parentRect, offset) {
|
12785 | return {
|
12786 | left: parentRect.left - labelSize.width - offset,
|
12787 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
12788 | width: labelSize.width,
|
12789 | height: labelSize.height
|
12790 | };
|
12791 | }
|
12792 | function middleHorizontal(labelSize, parentRect, offset) {
|
12793 | return {
|
12794 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2 + offset,
|
12795 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2,
|
12796 | width: labelSize.width,
|
12797 | height: labelSize.height
|
12798 | };
|
12799 | }
|
12800 | function middleVertical(labelSize, parentRect, offset) {
|
12801 | return {
|
12802 | left: parentRect.left + parentRect.width / 2 - labelSize.width / 2,
|
12803 | top: parentRect.top + parentRect.height / 2 - labelSize.height / 2 + offset,
|
12804 | width: labelSize.width,
|
12805 | height: labelSize.height
|
12806 | };
|
12807 | }
|
12808 | DataLabelRectPositioner.getLabelRect = getLabelRect, DataLabelRectPositioner.canFitWithinParent = canFitWithinParent,
|
12809 | DataLabelRectPositioner.isLabelWithinParent = isLabelWithinParent, DataLabelRectPositioner.topInside = topInside,
|
12810 | DataLabelRectPositioner.bottomInside = bottomInside, DataLabelRectPositioner.rightInside = rightInside,
|
12811 | DataLabelRectPositioner.leftInside = leftInside, DataLabelRectPositioner.topOutside = topOutside,
|
12812 | DataLabelRectPositioner.bottomOutside = bottomOutside, DataLabelRectPositioner.rightOutside = rightOutside,
|
12813 | DataLabelRectPositioner.leftOutside = leftOutside, DataLabelRectPositioner.middleHorizontal = middleHorizontal,
|
12814 | DataLabelRectPositioner.middleVertical = middleVertical;
|
12815 | }(DataLabelRectPositioner = powerbi.DataLabelRectPositioner || (powerbi.DataLabelRectPositioner = {}));
|
12816 | var DataLabelPointPositioner;
|
12817 | !function(DataLabelPointPositioner) {
|
12818 | function getLabelRect(labelSize, parentPoint, position, offset) {
|
12819 | switch (position) {
|
12820 | case 1:
|
12821 | return DataLabelPointPositioner.above(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12822 |
|
12823 | case 2:
|
12824 | return DataLabelPointPositioner.below(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12825 |
|
12826 | case 4:
|
12827 | return DataLabelPointPositioner.left(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12828 |
|
12829 | case 8:
|
12830 | return DataLabelPointPositioner.right(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12831 |
|
12832 | case 32:
|
12833 | return DataLabelPointPositioner.belowLeft(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12834 |
|
12835 | case 16:
|
12836 | return DataLabelPointPositioner.belowRight(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12837 |
|
12838 | case 128:
|
12839 | return DataLabelPointPositioner.aboveLeft(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12840 |
|
12841 | case 64:
|
12842 | return DataLabelPointPositioner.aboveRight(labelSize, parentPoint.point, parentPoint.radius + offset);
|
12843 |
|
12844 | case 256:
|
12845 | return DataLabelPointPositioner.center(labelSize, parentPoint.point);
|
12846 | }
|
12847 | return null;
|
12848 | }
|
12849 | function above(labelSize, parentPoint, offset) {
|
12850 | return {
|
12851 | left: parentPoint.x - labelSize.width / 2,
|
12852 | top: parentPoint.y - offset - labelSize.height,
|
12853 | width: labelSize.width,
|
12854 | height: labelSize.height
|
12855 | };
|
12856 | }
|
12857 | function below(labelSize, parentPoint, offset) {
|
12858 | return {
|
12859 | left: parentPoint.x - labelSize.width / 2,
|
12860 | top: parentPoint.y + offset,
|
12861 | width: labelSize.width,
|
12862 | height: labelSize.height
|
12863 | };
|
12864 | }
|
12865 | function left(labelSize, parentPoint, offset) {
|
12866 | return {
|
12867 | left: parentPoint.x - offset - labelSize.width,
|
12868 | top: parentPoint.y - labelSize.height / 2,
|
12869 | width: labelSize.width,
|
12870 | height: labelSize.height
|
12871 | };
|
12872 | }
|
12873 | function right(labelSize, parentPoint, offset) {
|
12874 | return {
|
12875 | left: parentPoint.x + offset,
|
12876 | top: parentPoint.y - labelSize.height / 2,
|
12877 | width: labelSize.width,
|
12878 | height: labelSize.height
|
12879 | };
|
12880 | }
|
12881 | function belowLeft(labelSize, parentPoint, offset) {
|
12882 | return {
|
12883 | left: parentPoint.x - DataLabelPointPositioner.sin45 * offset - labelSize.width,
|
12884 | top: parentPoint.y + DataLabelPointPositioner.cos45 * offset,
|
12885 | width: labelSize.width,
|
12886 | height: labelSize.height
|
12887 | };
|
12888 | }
|
12889 | function belowRight(labelSize, parentPoint, offset) {
|
12890 | return {
|
12891 | left: parentPoint.x + DataLabelPointPositioner.sin45 * offset,
|
12892 | top: parentPoint.y + DataLabelPointPositioner.cos45 * offset,
|
12893 | width: labelSize.width,
|
12894 | height: labelSize.height
|
12895 | };
|
12896 | }
|
12897 | function aboveLeft(labelSize, parentPoint, offset) {
|
12898 | return {
|
12899 | left: parentPoint.x - DataLabelPointPositioner.sin45 * offset - labelSize.width,
|
12900 | top: parentPoint.y - DataLabelPointPositioner.cos45 * offset - labelSize.height,
|
12901 | width: labelSize.width,
|
12902 | height: labelSize.height
|
12903 | };
|
12904 | }
|
12905 | function aboveRight(labelSize, parentPoint, offset) {
|
12906 | return {
|
12907 | left: parentPoint.x + DataLabelPointPositioner.sin45 * offset,
|
12908 | top: parentPoint.y - DataLabelPointPositioner.cos45 * offset - labelSize.height,
|
12909 | width: labelSize.width,
|
12910 | height: labelSize.height
|
12911 | };
|
12912 | }
|
12913 | function center(labelSize, parentPoint) {
|
12914 | return {
|
12915 | left: parentPoint.x - labelSize.width / 2,
|
12916 | top: parentPoint.y - labelSize.height / 2,
|
12917 | width: labelSize.width,
|
12918 | height: labelSize.height
|
12919 | };
|
12920 | }
|
12921 | function getLabelLeaderLineEndingPoint(boundingBox, position, parentShape) {
|
12922 | var x = boundingBox.left, y = boundingBox.top;
|
12923 | switch (position) {
|
12924 | case 1:
|
12925 | x += boundingBox.width / 2, y += boundingBox.height;
|
12926 | break;
|
12927 |
|
12928 | case 2:
|
12929 | x += boundingBox.width / 2;
|
12930 | break;
|
12931 |
|
12932 | case 4:
|
12933 | x += boundingBox.width, y += 2 * boundingBox.height / 3;
|
12934 | break;
|
12935 |
|
12936 | case 8:
|
12937 | y += 2 * boundingBox.height / 3;
|
12938 | break;
|
12939 |
|
12940 | case 32:
|
12941 | x += boundingBox.width, y += boundingBox.height / 2;
|
12942 | break;
|
12943 |
|
12944 | case 16:
|
12945 | y += boundingBox.height / 2;
|
12946 | break;
|
12947 |
|
12948 | case 128:
|
12949 | x += boundingBox.width, y += boundingBox.height;
|
12950 | break;
|
12951 |
|
12952 | case 64:
|
12953 | y += boundingBox.height;
|
12954 | }
|
12955 | return [ [ parentShape.point.x, parentShape.point.y ], [ x, y ] ];
|
12956 | }
|
12957 | DataLabelPointPositioner.cos45 = Math.cos(45), DataLabelPointPositioner.sin45 = Math.sin(45),
|
12958 | DataLabelPointPositioner.getLabelRect = getLabelRect, DataLabelPointPositioner.above = above,
|
12959 | DataLabelPointPositioner.below = below, DataLabelPointPositioner.left = left, DataLabelPointPositioner.right = right,
|
12960 | DataLabelPointPositioner.belowLeft = belowLeft, DataLabelPointPositioner.belowRight = belowRight,
|
12961 | DataLabelPointPositioner.aboveLeft = aboveLeft, DataLabelPointPositioner.aboveRight = aboveRight,
|
12962 | DataLabelPointPositioner.center = center, DataLabelPointPositioner.getLabelLeaderLineEndingPoint = getLabelLeaderLineEndingPoint;
|
12963 | }(DataLabelPointPositioner = powerbi.DataLabelPointPositioner || (powerbi.DataLabelPointPositioner = {}));
|
12964 | }(powerbi || (powerbi = {}));
|
12965 |
|
12966 | var powerbi;
|
12967 |
|
12968 | !function(powerbi) {
|
12969 | var NewDataLabelUtils = powerbi.visuals.NewDataLabelUtils, labelStyle = powerbi.visuals.labelStyle, DonutLabelUtils = powerbi.visuals.DonutLabelUtils, DonutLabelLayout = function() {
|
12970 | function DonutLabelLayout(options, donutChartProperties) {
|
12971 | this.startingOffset = options.startingOffset, this.maximumOffset = options.maximumOffset,
|
12972 | null != options.offsetIterationDelta && (this.offsetIterationDelta = options.offsetIterationDelta),
|
12973 | this.donutChartProperties = donutChartProperties, this.center = {
|
12974 | x: donutChartProperties.viewport.width / 2,
|
12975 | y: donutChartProperties.viewport.height / 2
|
12976 | }, this.outerRadius = this.donutChartProperties.radius * this.donutChartProperties.outerArcRadiusRatio,
|
12977 | this.innerRadius = this.donutChartProperties.radius / 2 * this.donutChartProperties.innerArcRadiusRatio,
|
12978 | this.additionalCharsWidth = powerbi.TextMeasurementService.measureSvgTextWidth({
|
12979 | text: " ()",
|
12980 | fontFamily: NewDataLabelUtils.LabelTextProperties.fontFamily,
|
12981 | fontSize: jsCommon.PixelConverter.fromPoint(donutChartProperties.dataLabelsSettings.fontSize),
|
12982 | fontWeight: NewDataLabelUtils.LabelTextProperties.fontWeight
|
12983 | });
|
12984 | }
|
12985 | return DonutLabelLayout.prototype.layout = function(labelDataPoints) {
|
12986 | for (var _i = 0, labelDataPoints_3 = labelDataPoints; _i < labelDataPoints_3.length; _i++) {
|
12987 | var donutLabel = labelDataPoints_3[_i];
|
12988 | donutLabel.hasBeenRendered = !1, donutLabel.labelSize = donutLabel.textSize;
|
12989 | }
|
12990 | for (var resultingLabels = [], preferredLabels = [], viewport = this.donutChartProperties.viewport, labelDataPointsGroup = {
|
12991 | labelDataPoints: labelDataPoints,
|
12992 | maxNumberOfLabels: labelDataPoints.length
|
12993 | }, grid = new powerbi.LabelArrangeGrid([ labelDataPointsGroup ], viewport), i = labelDataPoints.length - 1; i >= 0; i--) {
|
12994 | var labelPoint = labelDataPoints[i];
|
12995 | if (labelPoint.isPreferred) {
|
12996 | var label = labelDataPoints.splice(i, 1);
|
12997 | preferredLabels = label.concat(preferredLabels);
|
12998 | }
|
12999 | }
|
13000 | if (preferredLabels.length > 0 && (resultingLabels = this.positionLabels(preferredLabels, grid)),
|
13001 | labelDataPoints.length > 0) {
|
13002 | var labels = this.positionLabels(labelDataPoints, grid);
|
13003 | resultingLabels = resultingLabels.concat(labels);
|
13004 | }
|
13005 | return resultingLabels;
|
13006 | }, DonutLabelLayout.prototype.positionLabels = function(labelDataPoints, grid) {
|
13007 | for (var resultingLabels = [], offsetDelta = this.offsetIterationDelta, currentOffset = this.startingOffset, currentCenteredOffset = 0; currentOffset <= this.maximumOffset; ) {
|
13008 | for (var _i = 0, labelDataPoints_4 = labelDataPoints; _i < labelDataPoints_4.length; _i++) {
|
13009 | var labelPoint = labelDataPoints_4[_i];
|
13010 | if (!labelPoint.hasBeenRendered) {
|
13011 | var label = this.tryPositionForDonut(labelPoint, grid, currentOffset);
|
13012 | label && resultingLabels.push(label);
|
13013 | }
|
13014 | }
|
13015 | currentOffset += offsetDelta, currentCenteredOffset += offsetDelta;
|
13016 | }
|
13017 | return resultingLabels;
|
13018 | }, DonutLabelLayout.prototype.tryPositionForDonut = function(labelPoint, grid, currentLabelOffset) {
|
13019 | var parentShape = labelPoint.parentShape;
|
13020 | if (!_.isEmpty(parentShape.validPositions) && 0 !== parentShape.validPositions[0]) {
|
13021 | var defaultPosition = parentShape.validPositions[0], bestCandidate = this.tryAllPositions(labelPoint, grid, defaultPosition, currentLabelOffset);
|
13022 | if (bestCandidate && 0 === bestCandidate.score) return this.buildLabel(bestCandidate, grid);
|
13023 | if (this.donutChartProperties.dataLabelsSettings.labelStyle === labelStyle.both) {
|
13024 | var splitLabelDataPoint = this.splitDonutDataPoint(labelPoint), bestSplitCandidate = this.tryAllPositions(splitLabelDataPoint, grid, defaultPosition, currentLabelOffset);
|
13025 | if (bestSplitCandidate && (!bestCandidate || bestSplitCandidate.score < bestCandidate.score)) return this.buildLabel(bestSplitCandidate, grid);
|
13026 | }
|
13027 | return bestCandidate ? this.buildLabel(bestCandidate, grid) : void 0;
|
13028 | }
|
13029 | }, DonutLabelLayout.prototype.generateCandidate = function(labelDataPoint, candidatePosition, grid, currentLabelOffset) {
|
13030 | 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);
|
13031 | newLabelDataPoint.angle = angle, newLabelDataPoint.parentShape = parentShape, newLabelDataPoint.leaderLinePoints = leaderLinePoints,
|
13032 | newLabelDataPoint.linesSize = leaderLinesSize;
|
13033 | var boundingBoxs = DonutLabelLayout.tryPositionPoint(grid, parentShape.validPositions[0], newLabelDataPoint, currentLabelOffset, this.center, this.donutChartProperties.viewport);
|
13034 | return {
|
13035 | angle: angle,
|
13036 | point: parentShape,
|
13037 | score: score,
|
13038 | labelRects: boundingBoxs,
|
13039 | labelDataPoint: newLabelDataPoint
|
13040 | };
|
13041 | }, DonutLabelLayout.prototype.tryAllPositions = function(labelDataPoint, grid, defaultPosition, currentLabelOffset) {
|
13042 | var boundingBoxs = DonutLabelLayout.tryPositionPoint(grid, defaultPosition, labelDataPoint, currentLabelOffset, this.center, this.donutChartProperties.viewport), originalPoint = labelDataPoint.parentShape, originalCandidate = {
|
13043 | point: originalPoint,
|
13044 | angle: labelDataPoint.angle,
|
13045 | score: this.score(labelDataPoint, originalPoint.point),
|
13046 | labelRects: boundingBoxs,
|
13047 | labelDataPoint: labelDataPoint
|
13048 | };
|
13049 | if (boundingBoxs && boundingBoxs.textRect && 0 === originalCandidate.score) return originalCandidate;
|
13050 | var bestCandidate, positions = [];
|
13051 | boundingBoxs && boundingBoxs.textRect ? (positions = this.getLabelPointPositions(labelDataPoint, !0),
|
13052 | bestCandidate = originalCandidate) : positions = this.getLabelPointPositions(labelDataPoint, !1);
|
13053 | for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
13054 | var position = positions_1[_i], candidate = this.generateCandidate(labelDataPoint, position, grid, currentLabelOffset);
|
13055 | if (candidate.labelRects && candidate.labelRects.textRect && (null == bestCandidate || candidate.score < bestCandidate.score) && (bestCandidate = candidate,
|
13056 | 0 === bestCandidate.score)) return bestCandidate;
|
13057 | }
|
13058 | return bestCandidate;
|
13059 | }, DonutLabelLayout.prototype.buildLabel = function(labelLayout, grid) {
|
13060 | var resultingBoundingBox = labelLayout.labelRects.textRect, labelPoint = labelLayout.labelDataPoint;
|
13061 | grid.add(resultingBoundingBox), grid.add(labelLayout.labelRects.horizontalLineRect),
|
13062 | grid.add(labelLayout.labelRects.diagonalLineRect), labelPoint.hasBeenRendered = !0;
|
13063 | var left = resultingBoundingBox.left - this.center.x;
|
13064 | 0 > left ? left += resultingBoundingBox.width / 2 : left -= resultingBoundingBox.width / 2;
|
13065 | var formattedDataLabel, formattedCategoryLabel, text, textAnchor = 8 === labelPoint.parentShape.validPositions[0] ? "start" : "end", boundingBox = {
|
13066 | left: left,
|
13067 | top: resultingBoundingBox.top - this.center.y,
|
13068 | height: resultingBoundingBox.height,
|
13069 | width: resultingBoundingBox.width
|
13070 | }, 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;
|
13071 | switch (hasOneLabelRow && (labelPoint.dataLabel = " (" + labelPoint.dataLabel + ")",
|
13072 | spaceAvailableForLabels /= 2), labelSettingsStyle !== labelStyle.both && labelSettingsStyle !== labelStyle.data || (formattedDataLabel = getLabelFormattedText({
|
13073 | label: labelPoint.dataLabel,
|
13074 | maxWidth: spaceAvailableForLabels,
|
13075 | fontSize: fontSize
|
13076 | })), labelSettingsStyle !== labelStyle.both && labelSettingsStyle !== labelStyle.category || (formattedCategoryLabel = getLabelFormattedText({
|
13077 | label: labelPoint.categoryLabel,
|
13078 | maxWidth: spaceAvailableForLabels,
|
13079 | fontSize: fontSize
|
13080 | })), labelSettingsStyle) {
|
13081 | case labelStyle.both:
|
13082 | null == labelPoint.secondRowText ? text = formattedCategoryLabel + formattedDataLabel : (text = formattedDataLabel,
|
13083 | labelPoint.secondRowText = formattedCategoryLabel);
|
13084 | break;
|
13085 |
|
13086 | case labelStyle.data:
|
13087 | text = formattedDataLabel;
|
13088 | break;
|
13089 |
|
13090 | case labelStyle.category:
|
13091 | text = formattedCategoryLabel;
|
13092 | }
|
13093 | return labelPoint.textSize.width = Math.min(labelPoint.textSize.width, hasOneLabelRow ? 2 * spaceAvailableForLabels : spaceAvailableForLabels),
|
13094 | {
|
13095 | boundingBox: boundingBox,
|
13096 | text: text,
|
13097 | tooltip: labelPoint.tooltip,
|
13098 | isVisible: !0,
|
13099 | fill: labelPoint.outsideFill,
|
13100 | identity: labelPoint.identity,
|
13101 | fontSize: fontSize,
|
13102 | selected: !1,
|
13103 | textAnchor: textAnchor,
|
13104 | leaderLinePoints: labelPoint.leaderLinePoints,
|
13105 | hasBackground: !1,
|
13106 | secondRowText: labelPoint.secondRowText
|
13107 | };
|
13108 | }, DonutLabelLayout.tryPositionPoint = function(grid, position, labelDataPoint, offset, center, viewport) {
|
13109 | var parentPoint = labelDataPoint.parentShape, textSize = _.clone(labelDataPoint.textSize);
|
13110 | textSize.width = Math.min(textSize.width, DonutLabelUtils.getSpaceAvailableForDonutLabels(parentPoint.point.x, viewport));
|
13111 | var labelRect = powerbi.DataLabelPointPositioner.getLabelRect(textSize, parentPoint, position, offset), diagonalLineParentPoint = {
|
13112 | point: {
|
13113 | x: labelDataPoint.leaderLinePoints[0][0],
|
13114 | y: labelDataPoint.leaderLinePoints[0][1] < 0 ? labelDataPoint.leaderLinePoints[1][1] : labelDataPoint.leaderLinePoints[0][1]
|
13115 | },
|
13116 | radius: 0,
|
13117 | validPositions: null
|
13118 | }, diagonalLineRect = powerbi.DataLabelPointPositioner.getLabelRect(labelDataPoint.linesSize[DonutLabelUtils.DiagonalLineIndex], diagonalLineParentPoint, position, offset), horizontalLineParentPoint = {
|
13119 | point: {
|
13120 | x: labelDataPoint.leaderLinePoints[1][0],
|
13121 | y: labelDataPoint.leaderLinePoints[1][1]
|
13122 | },
|
13123 | radius: 0,
|
13124 | validPositions: null
|
13125 | }, horizontalLineRect = powerbi.DataLabelPointPositioner.getLabelRect(labelDataPoint.linesSize[DonutLabelUtils.HorizontalLineIndex], horizontalLineParentPoint, position, offset);
|
13126 | if (labelRect && diagonalLineRect && horizontalLineRect) {
|
13127 | labelRect.left += center.x, labelRect.top += center.y;
|
13128 | var centerForLinesWidth = center.x - labelRect.width / 2;
|
13129 | return diagonalLineRect.left += centerForLinesWidth, diagonalLineRect.top += center.y,
|
13130 | horizontalLineRect.left += centerForLinesWidth, horizontalLineRect.top += center.y,
|
13131 | grid.hasConflict(labelRect) || grid.hasConflict(diagonalLineRect) || grid.hasConflict(horizontalLineRect) ? void 0 : {
|
13132 | textRect: labelRect,
|
13133 | diagonalLineRect: diagonalLineRect,
|
13134 | horizontalLineRect: horizontalLineRect
|
13135 | };
|
13136 | }
|
13137 | }, DonutLabelLayout.prototype.getLabelPointPositions = function(labelPoint, isTruncated) {
|
13138 | var parentShape = labelPoint.parentShape, position = parentShape.validPositions[0];
|
13139 | return isTruncated ? parentShape.point.y < 0 ? 8 === position ? [ 64 ] : [ 128 ] : 8 === position ? [ 16 ] : [ 32 ] : 4 === position ? [ 128, 32 ] : [ 16, 64 ];
|
13140 | }, DonutLabelLayout.prototype.splitDonutDataPoint = function(labelPoint) {
|
13141 | var textSize = {
|
13142 | width: Math.max(labelPoint.categoryLabelSize.width, labelPoint.dataLabelSize.width),
|
13143 | height: 2 * labelPoint.dataLabelSize.height
|
13144 | }, newLabelPoint = _.clone(labelPoint);
|
13145 | return newLabelPoint.textSize = textSize, newLabelPoint.secondRowText = labelPoint.categoryLabel,
|
13146 | newLabelPoint;
|
13147 | }, DonutLabelLayout.prototype.generateCandidateAngleForPosition = function(d, position) {
|
13148 | var midAngle = d.startAngle + (d.endAngle - d.startAngle) / 2;
|
13149 | switch (position) {
|
13150 | case 64:
|
13151 | case 32:
|
13152 | return (d.startAngle + midAngle - Math.PI) / 2;
|
13153 |
|
13154 | case 128:
|
13155 | case 16:
|
13156 | return (midAngle + d.endAngle - Math.PI) / 2;
|
13157 | }
|
13158 | }, DonutLabelLayout.prototype.getPointPositionForAngle = function(angle) {
|
13159 | var labelX = DonutLabelUtils.getXPositionForDonutLabel(Math.cos(angle) * this.outerRadius), labelY = Math.sin(angle) * this.outerRadius, newPosition = 0 > labelX ? 4 : 8, pointPosition = {
|
13160 | point: {
|
13161 | x: labelX,
|
13162 | y: labelY
|
13163 | },
|
13164 | validPositions: [ newPosition ],
|
13165 | radius: 0
|
13166 | };
|
13167 | return pointPosition;
|
13168 | }, DonutLabelLayout.prototype.score = function(labelPoint, point) {
|
13169 | var textWidth, spaceAvailableForLabels = DonutLabelUtils.getSpaceAvailableForDonutLabels(point.x, this.donutChartProperties.viewport);
|
13170 | return this.donutChartProperties.dataLabelsSettings.labelStyle === labelStyle.both && null == labelPoint.secondRowText ? (textWidth = Math.max(labelPoint.categoryLabelSize.width, labelPoint.dataLabelSize.width + this.additionalCharsWidth),
|
13171 | spaceAvailableForLabels /= 2) : textWidth = labelPoint.textSize.width, Math.max(textWidth - spaceAvailableForLabels, 0);
|
13172 | }, DonutLabelLayout;
|
13173 | }();
|
13174 | powerbi.DonutLabelLayout = DonutLabelLayout;
|
13175 | }(powerbi || (powerbi = {}));
|
13176 |
|
13177 | var powerbi;
|
13178 |
|
13179 | !function(powerbi) {
|
13180 | var NewDataLabelUtils = powerbi.visuals.NewDataLabelUtils, DefaultCentroidOffset = 5, OffsetDelta = 10, MaximumOffset = 60, stemExtension = 5, FilledMapLabelLayout = function() {
|
13181 | function FilledMapLabelLayout() {}
|
13182 | return FilledMapLabelLayout.prototype.layout = function(labelDataPoints, viewport, polygonInfoTransform, redrawDataLabels) {
|
13183 | if (redrawDataLabels || void 0 === this.labels) {
|
13184 | for (var labelDataPointsGroup = {
|
13185 | labelDataPoints: labelDataPoints,
|
13186 | maxNumberOfLabels: labelDataPoints.length
|
13187 | }, _i = 0, labelDataPoints_5 = labelDataPoints; _i < labelDataPoints_5.length; _i++) {
|
13188 | var labelPoint = labelDataPoints_5[_i];
|
13189 | labelPoint.labelSize = {
|
13190 | width: labelPoint.textSize.width + 2 * NewDataLabelUtils.horizontalLabelBackgroundPadding,
|
13191 | height: labelPoint.textSize.height + 2 * NewDataLabelUtils.verticalLabelBackgroundPadding
|
13192 | };
|
13193 | }
|
13194 | for (var grid = new powerbi.LabelArrangeGrid([ labelDataPointsGroup ], viewport), resultingDataLabels = [], allPolygons = [], _a = 0, labelDataPoints_6 = labelDataPoints; _a < labelDataPoints_6.length; _a++) {
|
13195 | var labelPoint = labelDataPoints_6[_a], polygon = labelPoint.parentShape.polygon;
|
13196 | allPolygons.push(polygon), polygon.pixelBoundingRect = polygonInfoTransform.applyToRect(polygon.absoluteBoundingRect());
|
13197 | }
|
13198 | for (var shapesgrid = new LabelPolygonArrangeGrid(allPolygons, viewport), _b = 0, labelDataPoints_7 = labelDataPoints; _b < labelDataPoints_7.length; _b++) {
|
13199 | var labelPoint = labelDataPoints_7[_b], dataLabel = this.getLabelByPolygonPositions(labelPoint, polygonInfoTransform, grid, shapesgrid);
|
13200 | null != dataLabel && resultingDataLabels.push(dataLabel);
|
13201 | }
|
13202 | this.labels = resultingDataLabels;
|
13203 | } else this.updateLabelOffsets(polygonInfoTransform);
|
13204 | return this.labels;
|
13205 | }, FilledMapLabelLayout.prototype.getLabelPolygon = function(mapDataPoint, position, pointPosition, offset) {
|
13206 | var dataPointSize = {
|
13207 | width: mapDataPoint.textSize.width,
|
13208 | height: mapDataPoint.textSize.height
|
13209 | };
|
13210 | return this.getLabelBoundingBox(dataPointSize, position, pointPosition, offset);
|
13211 | }, FilledMapLabelLayout.prototype.getLabelBoundingBox = function(dataPointSize, position, pointPosition, offset) {
|
13212 | switch (position) {
|
13213 | case 1:
|
13214 | return powerbi.DataLabelPointPositioner.above(dataPointSize, pointPosition, offset);
|
13215 |
|
13216 | case 2:
|
13217 | return powerbi.DataLabelPointPositioner.below(dataPointSize, pointPosition, offset);
|
13218 |
|
13219 | case 4:
|
13220 | return powerbi.DataLabelPointPositioner.left(dataPointSize, pointPosition, offset);
|
13221 |
|
13222 | case 8:
|
13223 | return powerbi.DataLabelPointPositioner.right(dataPointSize, pointPosition, offset);
|
13224 |
|
13225 | case 128:
|
13226 | return powerbi.DataLabelPointPositioner.aboveLeft(dataPointSize, pointPosition, offset);
|
13227 |
|
13228 | case 64:
|
13229 | return powerbi.DataLabelPointPositioner.aboveRight(dataPointSize, pointPosition, offset);
|
13230 |
|
13231 | case 32:
|
13232 | return powerbi.DataLabelPointPositioner.belowLeft(dataPointSize, pointPosition, offset);
|
13233 |
|
13234 | case 16:
|
13235 | return powerbi.DataLabelPointPositioner.belowRight(dataPointSize, pointPosition, offset);
|
13236 |
|
13237 | case 256:
|
13238 | return powerbi.DataLabelPointPositioner.center(dataPointSize, pointPosition);
|
13239 | }
|
13240 | return null;
|
13241 | }, FilledMapLabelLayout.prototype.getLabelByPolygonPositions = function(labelPoint, polygonInfoTransform, grid, shapesGrid) {
|
13242 | for (var offset = 0, inverseTransorm = polygonInfoTransform.getInverse(), i = 0; 2 > i; i++) {
|
13243 | 1 === i && (offset = DefaultCentroidOffset);
|
13244 | for (var _i = 0, _a = labelPoint.parentShape.validPositions; _i < _a.length; _i++) {
|
13245 | var position = _a[_i], resultingAbsoluteBoundingBox = this.tryPositionForPolygonPosition(position, labelPoint, polygonInfoTransform, offset, inverseTransorm);
|
13246 | if ((256 !== position || 0 === i) && resultingAbsoluteBoundingBox) {
|
13247 | var resultingBoundingBox = polygonInfoTransform.applyToRect(resultingAbsoluteBoundingBox), dataLabel = {
|
13248 | text: labelPoint.text,
|
13249 | secondRowText: labelPoint.secondRowText,
|
13250 | boundingBox: resultingBoundingBox,
|
13251 | isVisible: !0,
|
13252 | fill: labelPoint.insideFill,
|
13253 | identity: null,
|
13254 | selected: !1,
|
13255 | hasBackground: !0,
|
13256 | textAnchor: "middle",
|
13257 | originalPixelOffset: offset,
|
13258 | isPlacedInsidePolygon: !0,
|
13259 | absoluteBoundingBoxCenter: {
|
13260 | x: resultingAbsoluteBoundingBox.left + resultingAbsoluteBoundingBox.width / 2,
|
13261 | y: resultingAbsoluteBoundingBox.top + resultingAbsoluteBoundingBox.height / 2
|
13262 | }
|
13263 | };
|
13264 | return dataLabel;
|
13265 | }
|
13266 | }
|
13267 | }
|
13268 | for (var currentOffset = 6; MaximumOffset >= currentOffset; ) {
|
13269 | for (var _b = 0, _c = labelPoint.parentShape.validPositions; _b < _c.length; _b++) {
|
13270 | var position = _c[_b];
|
13271 | if (256 !== position) {
|
13272 | var polygon = labelPoint.parentShape.polygon, pixelCentroid = polygonInfoTransform.applyToPoint(polygon.absoluteCentroid()), resultingAbsolutBoundingBox = this.tryPlaceLabelOutsidePolygon(grid, position, labelPoint, currentOffset, pixelCentroid, shapesGrid, inverseTransorm);
|
13273 | if (resultingAbsolutBoundingBox) {
|
13274 | var resultingBoundingBox = polygonInfoTransform.applyToRect(resultingAbsolutBoundingBox), dataLabel = {
|
13275 | text: labelPoint.text,
|
13276 | secondRowText: labelPoint.secondRowText,
|
13277 | boundingBox: resultingBoundingBox,
|
13278 | isVisible: !0,
|
13279 | fill: labelPoint.insideFill,
|
13280 | identity: null,
|
13281 | selected: !1,
|
13282 | hasBackground: !0,
|
13283 | isPlacedInsidePolygon: !1,
|
13284 | textAnchor: "middle",
|
13285 | originalPixelOffset: currentOffset,
|
13286 | originalPosition: position,
|
13287 | originalAbsoluteCentroid: polygon.absoluteCentroid(),
|
13288 | absoluteBoundingBoxCenter: {
|
13289 | x: resultingAbsolutBoundingBox.left + resultingAbsolutBoundingBox.width / 2,
|
13290 | y: resultingAbsolutBoundingBox.top + resultingAbsolutBoundingBox.height / 2
|
13291 | }
|
13292 | }, pixelStemSource = this.calculateStemSource(polygonInfoTransform, inverseTransorm, polygon, resultingBoundingBox, position, pixelCentroid);
|
13293 | return dataLabel.leaderLinePoints = this.setLeaderLinePoints(pixelStemSource, this.calculateStemDestination(resultingBoundingBox, position)),
|
13294 | dataLabel.absoluteStemSource = inverseTransorm.applyToPoint(pixelStemSource), grid.add(resultingBoundingBox),
|
13295 | dataLabel;
|
13296 | }
|
13297 | }
|
13298 | }
|
13299 | currentOffset += OffsetDelta;
|
13300 | }
|
13301 | return null;
|
13302 | }, FilledMapLabelLayout.prototype.setLeaderLinePoints = function(stemSource, stemDestination) {
|
13303 | return [ [ stemSource.x, stemSource.y ], [ stemDestination.x, stemDestination.y ] ];
|
13304 | }, FilledMapLabelLayout.prototype.calculateStemSource = function(polygonInfoTransform, inverseTransorm, polygon, labelBoundingBox, position, pixelCentroid) {
|
13305 | var absoluteStemSource = polygon.lineIntersectionPoint(polygon.absoluteCentroid(), inverseTransorm.applyToPoint({
|
13306 | x: labelBoundingBox.left + labelBoundingBox.width / 2,
|
13307 | y: labelBoundingBox.top + labelBoundingBox.height / 2
|
13308 | }));
|
13309 | if (null == absoluteStemSource) return pixelCentroid;
|
13310 | var stemSource = polygonInfoTransform.applyToPoint(absoluteStemSource);
|
13311 | switch (position) {
|
13312 | case 1:
|
13313 | stemSource.y += stemExtension;
|
13314 | break;
|
13315 |
|
13316 | case 2:
|
13317 | stemSource.y -= stemExtension;
|
13318 | break;
|
13319 |
|
13320 | case 4:
|
13321 | stemSource.x += stemExtension;
|
13322 | break;
|
13323 |
|
13324 | case 8:
|
13325 | stemSource.x -= stemExtension;
|
13326 | break;
|
13327 |
|
13328 | case 128:
|
13329 | stemSource.x += stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y += stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13330 | break;
|
13331 |
|
13332 | case 64:
|
13333 | stemSource.x -= stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y += stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13334 | break;
|
13335 |
|
13336 | case 32:
|
13337 | stemSource.x += stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y -= stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13338 | break;
|
13339 |
|
13340 | case 16:
|
13341 | stemSource.x -= stemExtension / powerbi.DataLabelPointPositioner.cos45, stemSource.y -= stemExtension / powerbi.DataLabelPointPositioner.sin45;
|
13342 | break;
|
13343 |
|
13344 | case 256: }
|
13345 | return stemSource;
|
13346 | }, FilledMapLabelLayout.prototype.calculateStemDestination = function(labelBoundingBox, position) {
|
13347 | var x, y;
|
13348 | switch (position) {
|
13349 | case 1:
|
13350 | x = labelBoundingBox.left + labelBoundingBox.width / 2, y = labelBoundingBox.top + labelBoundingBox.height;
|
13351 | break;
|
13352 |
|
13353 | case 2:
|
13354 | x = labelBoundingBox.left + labelBoundingBox.width / 2, y = labelBoundingBox.top;
|
13355 | break;
|
13356 |
|
13357 | case 4:
|
13358 | x = labelBoundingBox.left + labelBoundingBox.width, y = labelBoundingBox.top + labelBoundingBox.height / 2;
|
13359 | break;
|
13360 |
|
13361 | case 8:
|
13362 | x = labelBoundingBox.left, y = labelBoundingBox.top + labelBoundingBox.height / 2;
|
13363 | break;
|
13364 |
|
13365 | case 128:
|
13366 | x = labelBoundingBox.left + labelBoundingBox.width, y = labelBoundingBox.top + labelBoundingBox.height;
|
13367 | break;
|
13368 |
|
13369 | case 64:
|
13370 | x = labelBoundingBox.left, y = labelBoundingBox.top + labelBoundingBox.height;
|
13371 | break;
|
13372 |
|
13373 | case 32:
|
13374 | x = labelBoundingBox.left + labelBoundingBox.width, y = labelBoundingBox.top;
|
13375 | break;
|
13376 |
|
13377 | case 16:
|
13378 | x = labelBoundingBox.left, y = labelBoundingBox.top;
|
13379 | break;
|
13380 |
|
13381 | case 256: }
|
13382 | return {
|
13383 | x: x,
|
13384 | y: y
|
13385 | };
|
13386 | }, FilledMapLabelLayout.prototype.tryPositionForPolygonPosition = function(position, labelDataPoint, polygonInfoTransform, offset, inverseTransorm) {
|
13387 | var polygon = labelDataPoint.parentShape.polygon, pixelCentroid = polygonInfoTransform.applyToPoint(polygon.absoluteCentroid()), labelRect = this.getLabelPolygon(labelDataPoint, position, pixelCentroid, offset), absoluteLabelRect = this.getAbsoluteRectangle(inverseTransorm, labelRect);
|
13388 | return polygon.contains(absoluteLabelRect) ? absoluteLabelRect : null;
|
13389 | }, FilledMapLabelLayout.prototype.tryPlaceLabelOutsidePolygon = function(grid, position, labelDataPoint, offset, pixelCentroid, shapesGrid, inverseTransform) {
|
13390 | var offsetForPosition = offset, labelRect = this.getLabelPolygon(labelDataPoint, position, pixelCentroid, offsetForPosition), otherLabelsConflict = grid.hasConflict(labelRect);
|
13391 | if (!otherLabelsConflict) {
|
13392 | var absoluteLabelRect = this.getAbsoluteRectangle(inverseTransform, labelRect);
|
13393 | if (!shapesGrid.hasConflict(absoluteLabelRect, labelRect)) return absoluteLabelRect;
|
13394 | }
|
13395 | return null;
|
13396 | }, FilledMapLabelLayout.prototype.updateLabelOffsets = function(polygonInfoTransform) {
|
13397 | for (var _i = 0, _a = this.labels; _i < _a.length; _i++) {
|
13398 | var label = _a[_i];
|
13399 | if (label.isVisible) if (label.isPlacedInsidePolygon) {
|
13400 | 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;
|
13401 | label.boundingBox.top -= yDelta, label.boundingBox.left -= xDelta;
|
13402 | } else {
|
13403 | var stemSourcePoint = polygonInfoTransform.applyToPoint(label.absoluteStemSource), pixelCentroid = polygonInfoTransform.applyToPoint(label.originalAbsoluteCentroid);
|
13404 | label.boundingBox = this.getLabelBoundingBox({
|
13405 | width: label.boundingBox.width,
|
13406 | height: label.boundingBox.height
|
13407 | }, label.originalPosition, pixelCentroid, label.originalPixelOffset), void 0 !== label.leaderLinePoints && (label.leaderLinePoints = this.setLeaderLinePoints(stemSourcePoint, this.calculateStemDestination(label.boundingBox, label.originalPosition)));
|
13408 | }
|
13409 | }
|
13410 | }, FilledMapLabelLayout.prototype.getAbsoluteRectangle = function(inverseTransorm, rect) {
|
13411 | return inverseTransorm.applyToRect(rect);
|
13412 | }, FilledMapLabelLayout;
|
13413 | }();
|
13414 | powerbi.FilledMapLabelLayout = FilledMapLabelLayout;
|
13415 | var LabelPolygonArrangeGrid = function() {
|
13416 | function LabelPolygonArrangeGrid(polygons, viewport) {
|
13417 | this.viewport = viewport;
|
13418 | for (var maxPolygonWidth = 0, maxPolygonHeight = 0, _i = 0, polygons_1 = polygons; _i < polygons_1.length; _i++) {
|
13419 | var polygon = polygons_1[_i], polygonSize = polygon.pixelBoundingRect;
|
13420 | polygonSize.width > maxPolygonWidth && (maxPolygonWidth = polygonSize.width), polygonSize.height > maxPolygonHeight && (maxPolygonHeight = polygonSize.height);
|
13421 | }
|
13422 | 0 === maxPolygonWidth && (maxPolygonWidth = viewport.width), 0 === maxPolygonHeight && (maxPolygonHeight = viewport.height);
|
13423 | var cellSize = this.cellSize = {
|
13424 | width: maxPolygonWidth * LabelPolygonArrangeGrid.cellSizeMultiplier,
|
13425 | height: maxPolygonHeight * LabelPolygonArrangeGrid.cellSizeMultiplier
|
13426 | };
|
13427 | this.columnCount = LabelPolygonArrangeGrid.getCellCount(cellSize.width, viewport.width, 1, 100),
|
13428 | this.rowCount = LabelPolygonArrangeGrid.getCellCount(cellSize.height, viewport.height, 1, 100);
|
13429 | for (var grid = [], i = 0, ilen = this.columnCount; ilen > i; i++) {
|
13430 | grid[i] = [];
|
13431 | for (var j = 0, jlen = this.rowCount; jlen > j; j++) grid[i][j] = [];
|
13432 | }
|
13433 | this.grid = grid;
|
13434 | for (var _a = 0, polygons_2 = polygons; _a < polygons_2.length; _a++) {
|
13435 | var polygon = polygons_2[_a];
|
13436 | this.add(polygon);
|
13437 | }
|
13438 | }
|
13439 | return LabelPolygonArrangeGrid.prototype.hasConflict = function(absolutLabelRect, pixelLabelRect) {
|
13440 | 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++) {
|
13441 | var currentPolygon = _a[_i];
|
13442 | if (currentPolygon.conflicts(absolutLabelRect)) return !0;
|
13443 | }
|
13444 | return !1;
|
13445 | }, LabelPolygonArrangeGrid.prototype.add = function(polygon) {
|
13446 | 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);
|
13447 | }, LabelPolygonArrangeGrid.prototype.getContainingGridSubsection = function(rect) {
|
13448 | return {
|
13449 | xMin: LabelPolygonArrangeGrid.bound(Math.floor(rect.left / this.cellSize.width), 0, this.columnCount),
|
13450 | xMax: LabelPolygonArrangeGrid.bound(Math.ceil((rect.left + rect.width) / this.cellSize.width), 0, this.columnCount),
|
13451 | yMin: LabelPolygonArrangeGrid.bound(Math.floor(rect.top / this.cellSize.height), 0, this.rowCount),
|
13452 | yMax: LabelPolygonArrangeGrid.bound(Math.ceil((rect.top + rect.height) / this.cellSize.height), 0, this.rowCount)
|
13453 | };
|
13454 | }, LabelPolygonArrangeGrid.getCellCount = function(step, length, minCount, maxCount) {
|
13455 | return LabelPolygonArrangeGrid.bound(Math.ceil(length / step), minCount, maxCount);
|
13456 | }, LabelPolygonArrangeGrid.bound = function(value, min, max) {
|
13457 | return Math.max(Math.min(value, max), min);
|
13458 | }, LabelPolygonArrangeGrid.cellSizeMultiplier = 2, LabelPolygonArrangeGrid;
|
13459 | }();
|
13460 | powerbi.LabelPolygonArrangeGrid = LabelPolygonArrangeGrid;
|
13461 | }(powerbi || (powerbi = {}));
|
13462 |
|
13463 | var powerbi;
|
13464 |
|
13465 | !function(powerbi) {
|
13466 | var visuals;
|
13467 | !function(visuals) {
|
13468 | function createColorAllocatorFactory() {
|
13469 | return new ColorAllocatorFactory();
|
13470 | }
|
13471 | visuals.createColorAllocatorFactory = createColorAllocatorFactory;
|
13472 | var ColorAllocatorFactory = function() {
|
13473 | function ColorAllocatorFactory() {}
|
13474 | return ColorAllocatorFactory.prototype.linearGradient2 = function(options) {
|
13475 | return new LinearGradient2Allocator(options);
|
13476 | }, ColorAllocatorFactory.prototype.linearGradient3 = function(options, splitScales) {
|
13477 | return splitScales ? new LinearGradient3AllocatorWithSplittedScales(options) : new LinearGradient3Allocator(options);
|
13478 | }, ColorAllocatorFactory;
|
13479 | }(), LinearGradient2Allocator = function() {
|
13480 | function LinearGradient2Allocator(options) {
|
13481 | this.options = options;
|
13482 | var min = options.min, max = options.max;
|
13483 | this.scale = d3.scale.linear().domain([ min.value, max.value ]).range([ min.color, max.color ]).clamp(!0);
|
13484 | }
|
13485 | return LinearGradient2Allocator.prototype.color = function(value) {
|
13486 | var min = this.options.min, max = this.options.max;
|
13487 | return min.value === max.value ? value >= max.value ? max.color : min.color : this.scale(value);
|
13488 | }, LinearGradient2Allocator;
|
13489 | }(), LinearGradient3Allocator = function() {
|
13490 | function LinearGradient3Allocator(options) {
|
13491 | this.options = options;
|
13492 | var min = options.min, mid = options.mid, max = options.max;
|
13493 | this.scale = d3.scale.linear().domain([ min.value, mid.value, max.value ]).range([ min.color, mid.color, max.color ]).clamp(!0);
|
13494 | }
|
13495 | return LinearGradient3Allocator.prototype.color = function(value) {
|
13496 | var min = this.options.min, mid = this.options.mid, max = this.options.max;
|
13497 | 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);
|
13498 | }, LinearGradient3Allocator;
|
13499 | }(), LinearGradient3AllocatorWithSplittedScales = function() {
|
13500 | function LinearGradient3AllocatorWithSplittedScales(options) {
|
13501 | this.options = options;
|
13502 | var min = options.min, mid = options.mid, max = options.max;
|
13503 | this.scale1 = d3.scale.linear().domain([ min.value, mid.value ]).range([ min.color, mid.color ]).clamp(!0),
|
13504 | this.scale2 = d3.scale.linear().domain([ mid.value, max.value ]).range([ mid.color, max.color ]).clamp(!0);
|
13505 | }
|
13506 | return LinearGradient3AllocatorWithSplittedScales.prototype.color = function(value) {
|
13507 | var min = this.options.min, mid = this.options.mid, max = this.options.max;
|
13508 | 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);
|
13509 | }, LinearGradient3AllocatorWithSplittedScales;
|
13510 | }();
|
13511 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
13512 | }(powerbi || (powerbi = {}));
|
13513 |
|
13514 | var powerbi;
|
13515 |
|
13516 | !function(powerbi) {
|
13517 | var visuals;
|
13518 | !function(visuals) {
|
13519 | var BeautifiedFormat = {
|
13520 | "0.00 %;-0.00 %;0.00 %": "Percentage",
|
13521 | "0.0 %;-0.0 %;0.0 %": "Percentage1"
|
13522 | }, defaultLocalizedStrings = {
|
13523 | NullValue: "(Blank)",
|
13524 | BooleanTrue: "True",
|
13525 | BooleanFalse: "False",
|
13526 | NaNValue: "NaN",
|
13527 | InfinityValue: "+Infinity",
|
13528 | NegativeInfinityValue: "-Infinity",
|
13529 | Restatement_Comma: "{0}, {1}",
|
13530 | Restatement_CompoundAnd: "{0} and {1}",
|
13531 | DisplayUnitSystem_EAuto_Title: "Auto",
|
13532 | DisplayUnitSystem_E0_Title: "None",
|
13533 | DisplayUnitSystem_E3_LabelFormat: "{0}K",
|
13534 | DisplayUnitSystem_E3_Title: "Thousands",
|
13535 | DisplayUnitSystem_E6_LabelFormat: "{0}M",
|
13536 | DisplayUnitSystem_E6_Title: "Millions",
|
13537 | DisplayUnitSystem_E9_LabelFormat: "{0}bn",
|
13538 | DisplayUnitSystem_E9_Title: "Billions",
|
13539 | DisplayUnitSystem_E12_LabelFormat: "{0}T",
|
13540 | DisplayUnitSystem_E12_Title: "Trillions",
|
13541 | Percentage: "#,0.##%",
|
13542 | Percentage1: "#,0.#%",
|
13543 | RichTextbox_Link_DefaultText: "Link",
|
13544 | TableTotalLabel: "Total",
|
13545 | Tooltip_HighlightedValueDisplayName: "Highlighted",
|
13546 | Funnel_PercentOfFirst: "Percent of first",
|
13547 | Funnel_PercentOfPrevious: "Percent of previous",
|
13548 | Funnel_PercentOfFirst_Highlight: "Percent of first (highlighted)",
|
13549 | Funnel_PercentOfPrevious_Highlight: "Percent of previous (highlighted)",
|
13550 | GeotaggingString_Continent: "continent",
|
13551 | GeotaggingString_Continents: "continents",
|
13552 | GeotaggingString_Country: "country",
|
13553 | GeotaggingString_Countries: "countries",
|
13554 | GeotaggingString_State: "state",
|
13555 | GeotaggingString_States: "states",
|
13556 | GeotaggingString_City: "city",
|
13557 | GeotaggingString_Cities: "cities",
|
13558 | GeotaggingString_Town: "town",
|
13559 | GeotaggingString_Towns: "towns",
|
13560 | GeotaggingString_Province: "province",
|
13561 | GeotaggingString_Provinces: "provinces",
|
13562 | GeotaggingString_County: "county",
|
13563 | GeotaggingString_Counties: "counties",
|
13564 | GeotaggingString_Village: "village",
|
13565 | GeotaggingString_Villages: "villages",
|
13566 | GeotaggingString_Post: "post",
|
13567 | GeotaggingString_Zip: "zip",
|
13568 | GeotaggingString_Code: "code",
|
13569 | GeotaggingString_Place: "place",
|
13570 | GeotaggingString_Places: "places",
|
13571 | GeotaggingString_Address: "address",
|
13572 | GeotaggingString_Addresses: "addresses",
|
13573 | GeotaggingString_Street: "street",
|
13574 | GeotaggingString_Streets: "streets",
|
13575 | GeotaggingString_Longitude: "longitude",
|
13576 | GeotaggingString_Longitude_Short: "lon",
|
13577 | GeotaggingString_Latitude: "latitude",
|
13578 | GeotaggingString_Latitude_Short: "lat",
|
13579 | GeotaggingString_PostalCode: "postal code",
|
13580 | GeotaggingString_PostalCodes: "postal codes",
|
13581 | GeotaggingString_ZipCode: "zip code",
|
13582 | GeotaggingString_ZipCodes: "zip codes",
|
13583 | GeotaggingString_Territory: "territory",
|
13584 | GeotaggingString_Territories: "territories",
|
13585 | Waterfall_IncreaseLabel: "Increase",
|
13586 | Waterfall_DecreaseLabel: "Decrease",
|
13587 | Waterfall_TotalLabel: "Total",
|
13588 | Slicer_SelectAll: "Select All"
|
13589 | }, DefaultVisualHostServices = function() {
|
13590 | function DefaultVisualHostServices() {}
|
13591 | return DefaultVisualHostServices.initialize = function() {
|
13592 | visuals.valueFormatter.setLocaleOptions(DefaultVisualHostServices.createLocaleOptions()),
|
13593 | visuals.TooltipManager.setLocalizedStrings(DefaultVisualHostServices.createTooltipLocaleOptions());
|
13594 | }, DefaultVisualHostServices.createLocaleOptions = function() {
|
13595 | return {
|
13596 | "null": defaultLocalizedStrings.NullValue,
|
13597 | "true": defaultLocalizedStrings.BooleanTrue,
|
13598 | "false": defaultLocalizedStrings.BooleanFalse,
|
13599 | NaN: defaultLocalizedStrings.NaNValue,
|
13600 | infinity: defaultLocalizedStrings.InfinityValue,
|
13601 | negativeInfinity: defaultLocalizedStrings.NegativeInfinityValue,
|
13602 | beautify: function(format) {
|
13603 | return DefaultVisualHostServices.beautify(format);
|
13604 | },
|
13605 | describe: function(exponent) {
|
13606 | return DefaultVisualHostServices.describeUnit(exponent);
|
13607 | },
|
13608 | restatementComma: defaultLocalizedStrings.Restatement_Comma,
|
13609 | restatementCompoundAnd: defaultLocalizedStrings.Restatement_CompoundAnd,
|
13610 | restatementCompoundOr: defaultLocalizedStrings.Restatement_CompoundOr
|
13611 | };
|
13612 | }, DefaultVisualHostServices.createTooltipLocaleOptions = function() {
|
13613 | return {
|
13614 | highlightedValueDisplayName: defaultLocalizedStrings.Tooltip_HighlightedValueDisplayName
|
13615 | };
|
13616 | }, DefaultVisualHostServices.prototype.getLocalizedString = function(stringId) {
|
13617 | return defaultLocalizedStrings[stringId];
|
13618 | }, DefaultVisualHostServices.prototype.onDragStart = function() {}, DefaultVisualHostServices.prototype.canSelect = function() {
|
13619 | return !1;
|
13620 | }, DefaultVisualHostServices.prototype.onSelect = function() {}, DefaultVisualHostServices.prototype.onContextMenu = function() {},
|
13621 | DefaultVisualHostServices.prototype.loadMoreData = function() {}, DefaultVisualHostServices.prototype.persistProperties = function(changes) {},
|
13622 | DefaultVisualHostServices.prototype.onCustomSort = function(args) {}, DefaultVisualHostServices.prototype.getViewMode = function() {
|
13623 | return 0;
|
13624 | }, DefaultVisualHostServices.prototype.setWarnings = function(warnings) {}, DefaultVisualHostServices.prototype.setToolbar = function($toolbar) {},
|
13625 | DefaultVisualHostServices.prototype.shouldRetainSelection = function() {
|
13626 | return !1;
|
13627 | }, DefaultVisualHostServices.prototype.geocoder = function() {
|
13628 | return visuals.services.createGeocoder();
|
13629 | }, DefaultVisualHostServices.prototype.geolocation = function() {
|
13630 | return visuals.services.createGeolocation();
|
13631 | }, DefaultVisualHostServices.prototype.promiseFactory = function() {
|
13632 | return powerbi.createJQueryPromiseFactory();
|
13633 | }, DefaultVisualHostServices.prototype.analyzeFilter = function(options) {
|
13634 | return {
|
13635 | isNotFilter: !1,
|
13636 | selectedIdentities: [],
|
13637 | filter: void 0,
|
13638 | defaultValue: void 0
|
13639 | };
|
13640 | }, DefaultVisualHostServices.prototype.getIdentityDisplayNames = function(dentities) {},
|
13641 | DefaultVisualHostServices.prototype.setIdentityDisplayNames = function(displayNamesIdentityPairs) {},
|
13642 | DefaultVisualHostServices.beautify = function(format) {
|
13643 | var key = BeautifiedFormat[format];
|
13644 | return key ? defaultLocalizedStrings[key] || format : format;
|
13645 | }, DefaultVisualHostServices.describeUnit = function(exponent) {
|
13646 | var exponentLookup = -1 === exponent ? "Auto" : exponent.toString(), title = defaultLocalizedStrings["DisplayUnitSystem_E" + exponentLookup + "_Title"], format = 0 >= exponent ? "{0}" : defaultLocalizedStrings["DisplayUnitSystem_E" + exponentLookup + "_LabelFormat"];
|
13647 | return title || format ? {
|
13648 | title: title,
|
13649 | format: format
|
13650 | } : void 0;
|
13651 | }, DefaultVisualHostServices;
|
13652 | }();
|
13653 | visuals.DefaultVisualHostServices = DefaultVisualHostServices, visuals.defaultVisualHostServices = new DefaultVisualHostServices();
|
13654 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
13655 | }(powerbi || (powerbi = {}));
|
13656 |
|
13657 | var powerbi;
|
13658 |
|
13659 | !function(powerbi) {
|
13660 | var visuals;
|
13661 | !function(visuals) {
|
13662 | function createInteractivityService(hostServices) {
|
13663 | return new InteractivityService(hostServices);
|
13664 | }
|
13665 | function appendClearCatcher(selection) {
|
13666 | return selection.append("rect").classed("clearCatcher", !0).attr({
|
13667 | width: "100%",
|
13668 | height: "100%"
|
13669 | });
|
13670 | }
|
13671 | function isCategoryColumnSelected(propertyId, categories, idx) {
|
13672 | return null != categories.objects && categories.objects[idx] && powerbi.DataViewObjects.getValue(categories.objects[idx], propertyId);
|
13673 | }
|
13674 | function dataHasSelection(data) {
|
13675 | for (var i = 0, ilen = data.length; ilen > i; i++) if (data[i].selected) return !0;
|
13676 | return !1;
|
13677 | }
|
13678 | var ArrayExtensions = jsCommon.ArrayExtensions;
|
13679 | visuals.createInteractivityService = createInteractivityService, visuals.appendClearCatcher = appendClearCatcher,
|
13680 | visuals.isCategoryColumnSelected = isCategoryColumnSelected, visuals.dataHasSelection = dataHasSelection;
|
13681 | var InteractivityService = function() {
|
13682 | function InteractivityService(hostServices) {
|
13683 | this.renderSelectionInVisual = _.noop, this.renderSelectionInLegend = _.noop, this.renderSelectionInLabels = _.noop,
|
13684 | this.selectedIds = [], this.isInvertedSelectionMode = !1, this.hostService = hostServices;
|
13685 | }
|
13686 | return InteractivityService.prototype.bind = function(dataPoints, behavior, behaviorOptions, options) {
|
13687 | var _this = this;
|
13688 | options && options.overrideSelectionFromData && this.takeSelectionStateFromDataPoints(dataPoints),
|
13689 | options ? (options.isLegend ? (this.selectableLegendDataPoints = dataPoints, this.renderSelectionInLegend = function() {
|
13690 | return behavior.renderSelection(_this.legendHasSelection());
|
13691 | }) : options.isLabels ? (this.selectableLabelsDataPoints = dataPoints, this.renderSelectionInLabels = function() {
|
13692 | return behavior.renderSelection(_this.labelsHasSelection());
|
13693 | }) : (this.selectableDataPoints = dataPoints, this.renderSelectionInVisual = function() {
|
13694 | return behavior.renderSelection(_this.hasSelection());
|
13695 | }), null != options.hasSelectionOverride && (this.hasSelectionOverride = options.hasSelectionOverride),
|
13696 | options.slicerDefaultValueHandler && (this.slicerDefaultValueHandler = options.slicerDefaultValueHandler)) : (this.selectableDataPoints = dataPoints,
|
13697 | this.renderSelectionInVisual = function() {
|
13698 | return behavior.renderSelection(_this.hasSelection());
|
13699 | }), this.behavior = behavior, behavior.bindEvents(behaviorOptions, this), this.syncSelectionState();
|
13700 | }, InteractivityService.prototype.clearSelection = function() {
|
13701 | return this.slicerDefaultValueHandler && this.slicerDefaultValueHandler.getDefaultValue() && this.useDefaultValue ? void (this.isInvertedSelectionMode = !1) : (this.hasSelectionOverride = void 0,
|
13702 | ArrayExtensions.clear(this.selectedIds), this.isInvertedSelectionMode = !1, this.applyToAllSelectableDataPoints(function(dataPoint) {
|
13703 | return dataPoint.selected = !1;
|
13704 | }), void this.renderAll());
|
13705 | }, InteractivityService.prototype.applySelectionStateToData = function(dataPoints) {
|
13706 | for (var _i = 0, dataPoints_2 = dataPoints; _i < dataPoints_2.length; _i++) {
|
13707 | var dataPoint = dataPoints_2[_i];
|
13708 | dataPoint.selected = InteractivityService.checkDatapointAgainstSelectedIds(dataPoint, this.selectedIds);
|
13709 | }
|
13710 | return this.hasSelection();
|
13711 | }, InteractivityService.prototype.hasSelection = function() {
|
13712 | return this.selectedIds.length > 0;
|
13713 | }, InteractivityService.prototype.legendHasSelection = function() {
|
13714 | return this.selectableLegendDataPoints ? dataHasSelection(this.selectableLegendDataPoints) : !1;
|
13715 | }, InteractivityService.prototype.labelsHasSelection = function() {
|
13716 | return this.selectableLabelsDataPoints ? dataHasSelection(this.selectableLabelsDataPoints) : !1;
|
13717 | }, InteractivityService.prototype.isSelectionModeInverted = function() {
|
13718 | return this.isInvertedSelectionMode;
|
13719 | }, InteractivityService.prototype.setSelectionModeInverted = function(inverted) {
|
13720 | this.isInvertedSelectionMode = inverted;
|
13721 | }, InteractivityService.prototype.handleSelection = function(dataPoint, multiSelect) {
|
13722 | dataPoint && (this.useDefaultValue = !1, this.select(dataPoint, multiSelect), this.sendSelectionToHost(),
|
13723 | this.renderAll());
|
13724 | }, InteractivityService.prototype.handleContextMenu = function(dataPoint, point) {
|
13725 | this.sendContextMenuToHost(dataPoint, point);
|
13726 | }, InteractivityService.prototype.handleClearSelection = function() {
|
13727 | this.useDefaultValue = !0, this.clearSelection(), this.sendSelectionToHost();
|
13728 | }, InteractivityService.prototype.toggleSelectionModeInversion = function() {
|
13729 | return this.useDefaultValue = !1, this.isInvertedSelectionMode = !this.isInvertedSelectionMode,
|
13730 | ArrayExtensions.clear(this.selectedIds), this.applyToAllSelectableDataPoints(function(dataPoint) {
|
13731 | return dataPoint.selected = !1;
|
13732 | }), this.sendSelectionToHost(), this.isInvertedSelectionMode ? this.syncSelectionStateInverted() : this.syncSelectionState(),
|
13733 | this.renderAll(), this.isInvertedSelectionMode;
|
13734 | }, InteractivityService.prototype.persistSelectionFilter = function(filterPropertyIdentifier) {
|
13735 | this.hostService.persistProperties(this.createChangeForFilterProperty(filterPropertyIdentifier));
|
13736 | }, InteractivityService.prototype.setDefaultValueMode = function(useDefaultValue) {
|
13737 | this.useDefaultValue = useDefaultValue;
|
13738 | }, InteractivityService.prototype.isDefaultValueEnabled = function() {
|
13739 | return this.useDefaultValue;
|
13740 | }, InteractivityService.prototype.renderAll = function() {
|
13741 | this.renderSelectionInVisual(), this.renderSelectionInLegend(), this.renderSelectionInLabels();
|
13742 | }, InteractivityService.prototype.select = function(d, multiSelect) {
|
13743 | if (this.isInvertedSelectionMode) return this.selectInverted(d, multiSelect);
|
13744 | d.identity.highlight && (d = _.find(this.selectableDataPoints, function(dp) {
|
13745 | return !dp.identity.highlight && d.identity.includes(dp.identity, !0);
|
13746 | }));
|
13747 | var id = d.identity;
|
13748 | if (id) {
|
13749 | var selected = !d.selected || !multiSelect && this.selectedIds.length > 1;
|
13750 | multiSelect && (selected ? (d.selected = !0, this.selectedIds.push(id), id.hasIdentity() ? this.removeSelectionIdsWithOnlyMeasures() : this.removeSelectionIdsExceptOnlyMeasures()) : (d.selected = !1,
|
13751 | this.removeId(id))), multiSelect && this.hostService.canSelect({
|
13752 | data: this.selectedIds.map(function(value) {
|
13753 | return value.getSelector();
|
13754 | })
|
13755 | }) || (this.clearSelection(), selected && (d.selected = !0, this.selectedIds.push(id))),
|
13756 | this.syncSelectionState();
|
13757 | }
|
13758 | }, InteractivityService.prototype.selectInverted = function(d, multiSelect) {
|
13759 | var wasSelected = d.selected, id = d.identity;
|
13760 | d.selected = !wasSelected, wasSelected ? this.removeId(id) : (this.selectedIds.push(id),
|
13761 | id.hasIdentity() ? this.removeSelectionIdsWithOnlyMeasures() : this.removeSelectionIdsExceptOnlyMeasures()),
|
13762 | this.syncSelectionStateInverted();
|
13763 | }, InteractivityService.prototype.removeId = function(toRemove) {
|
13764 | for (var selectedIds = this.selectedIds, i = selectedIds.length - 1; i > -1; i--) {
|
13765 | var currentId = selectedIds[i];
|
13766 | toRemove.includes(currentId) && selectedIds.splice(i, 1);
|
13767 | }
|
13768 | }, InteractivityService.prototype.createChangeForFilterProperty = function(filterPropertyIdentifier) {
|
13769 | var properties = {}, selectors = [];
|
13770 | this.selectedIds.length > 0 && (selectors = _.chain(this.selectedIds).filter(function(value) {
|
13771 | return value.hasIdentity();
|
13772 | }).map(function(value) {
|
13773 | return value.getSelector();
|
13774 | }).value());
|
13775 | var instance = {
|
13776 | objectName: filterPropertyIdentifier.objectName,
|
13777 | selector: void 0,
|
13778 | properties: properties
|
13779 | }, filter = powerbi.data.Selector.filterFromSelector(selectors, this.isInvertedSelectionMode);
|
13780 | return this.slicerDefaultValueHandler && this.slicerDefaultValueHandler.getDefaultValue() && (this.useDefaultValue === !0 ? filter = powerbi.data.SemanticFilter.getDefaultValueFilter(this.slicerDefaultValueHandler.getIdentityFields()) : _.isEmpty(selectors) && (filter = powerbi.data.SemanticFilter.getAnyValueFilter(this.slicerDefaultValueHandler.getIdentityFields()))),
|
13781 | null == filter ? (properties[filterPropertyIdentifier.propertyName] = {}, {
|
13782 | remove: [ instance ]
|
13783 | }) : (properties[filterPropertyIdentifier.propertyName] = filter, {
|
13784 | merge: [ instance ]
|
13785 | });
|
13786 | }, InteractivityService.prototype.sendContextMenuToHost = function(dataPoint, position) {
|
13787 | var host = this.hostService;
|
13788 | if (host.onContextMenu) {
|
13789 | var selectors = this.getSelectorsByColumn([ dataPoint.identity ]);
|
13790 | if (!_.isEmpty(selectors)) {
|
13791 | var args = {
|
13792 | data: selectors,
|
13793 | position: position
|
13794 | };
|
13795 | host.onContextMenu(args);
|
13796 | }
|
13797 | }
|
13798 | }, InteractivityService.prototype.sendSelectionToHost = function() {
|
13799 | var host = this.hostService;
|
13800 | if (host.onSelect) {
|
13801 | var selectArgs = {
|
13802 | data: this.selectedIds.filter(function(value) {
|
13803 | return value.hasIdentity();
|
13804 | }).map(function(value) {
|
13805 | return value.getSelector();
|
13806 | })
|
13807 | }, data2 = this.getSelectorsByColumn(this.selectedIds);
|
13808 | _.isEmpty(data2) || (selectArgs.data2 = data2), host.onSelect(selectArgs);
|
13809 | }
|
13810 | }, InteractivityService.prototype.getSelectorsByColumn = function(selectionIds) {
|
13811 | return _(selectionIds).filter(function(value) {
|
13812 | return value.hasIdentity;
|
13813 | }).map(function(value) {
|
13814 | return value.getSelectorsByColumn();
|
13815 | }).compact().value();
|
13816 | }, InteractivityService.prototype.takeSelectionStateFromDataPoints = function(dataPoints) {
|
13817 | var selectedIds = this.selectedIds;
|
13818 | ArrayExtensions.clear(selectedIds);
|
13819 | for (var _i = 0, dataPoints_3 = dataPoints; _i < dataPoints_3.length; _i++) {
|
13820 | var dataPoint = dataPoints_3[_i];
|
13821 | dataPoint.selected && selectedIds.push(dataPoint.identity);
|
13822 | }
|
13823 | }, InteractivityService.prototype.syncSelectionState = function() {
|
13824 | if (this.isInvertedSelectionMode) return this.syncSelectionStateInverted();
|
13825 | var selectedIds = this.selectedIds, selectableDataPoints = this.selectableDataPoints, selectableLegendDataPoints = this.selectableLegendDataPoints, selectableLabelsDataPoints = this.selectableLabelsDataPoints, foundMatchingId = !1;
|
13826 | if (selectableDataPoints || selectableLegendDataPoints) {
|
13827 | if (selectableDataPoints && InteractivityService.updateSelectableDataPointsBySelectedIds(selectableDataPoints, selectedIds) && (foundMatchingId = !0),
|
13828 | selectableLegendDataPoints && InteractivityService.updateSelectableDataPointsBySelectedIds(selectableLegendDataPoints, selectedIds) && (foundMatchingId = !0),
|
13829 | selectableLabelsDataPoints) for (var labelsDataPoint_1, i = 0, ilen = selectableLabelsDataPoints.length; ilen > i; i++) labelsDataPoint_1 = selectableLabelsDataPoints[i],
|
13830 | selectedIds.some(function(value) {
|
13831 | return value.includes(labelsDataPoint_1.identity);
|
13832 | }) ? labelsDataPoint_1.selected = !0 : labelsDataPoint_1.selected = !1;
|
13833 | !foundMatchingId && selectedIds.length > 0 && (this.clearSelection(), this.sendSelectionToHost());
|
13834 | }
|
13835 | }, InteractivityService.prototype.syncSelectionStateInverted = function() {
|
13836 | var selectedIds = this.selectedIds, selectableDataPoints = this.selectableDataPoints;
|
13837 | if (selectableDataPoints) if (0 === selectedIds.length) for (var _i = 0, selectableDataPoints_1 = selectableDataPoints; _i < selectableDataPoints_1.length; _i++) {
|
13838 | var dataPoint_1 = selectableDataPoints_1[_i];
|
13839 | dataPoint_1.selected = !1;
|
13840 | } else for (var _a = 0, selectableDataPoints_2 = selectableDataPoints; _a < selectableDataPoints_2.length; _a++) {
|
13841 | var dataPoint = selectableDataPoints_2[_a];
|
13842 | selectedIds.some(function(value) {
|
13843 | return value.includes(dataPoint.identity);
|
13844 | }) ? dataPoint.selected = !0 : dataPoint.selected && (dataPoint.selected = !1);
|
13845 | }
|
13846 | }, InteractivityService.prototype.applyToAllSelectableDataPoints = function(action) {
|
13847 | var selectableDataPoints = this.selectableDataPoints, selectableLegendDataPoints = this.selectableLegendDataPoints, selectableLabelsDataPoints = this.selectableLabelsDataPoints;
|
13848 | if (selectableDataPoints) for (var _i = 0, selectableDataPoints_3 = selectableDataPoints; _i < selectableDataPoints_3.length; _i++) {
|
13849 | var dataPoint = selectableDataPoints_3[_i];
|
13850 | action(dataPoint);
|
13851 | }
|
13852 | if (selectableLegendDataPoints) for (var _a = 0, selectableLegendDataPoints_1 = selectableLegendDataPoints; _a < selectableLegendDataPoints_1.length; _a++) {
|
13853 | var dataPoint = selectableLegendDataPoints_1[_a];
|
13854 | action(dataPoint);
|
13855 | }
|
13856 | if (selectableLabelsDataPoints) for (var _b = 0, selectableLabelsDataPoints_1 = selectableLabelsDataPoints; _b < selectableLabelsDataPoints_1.length; _b++) {
|
13857 | var dataPoint = selectableLabelsDataPoints_1[_b];
|
13858 | action(dataPoint);
|
13859 | }
|
13860 | }, InteractivityService.updateSelectableDataPointsBySelectedIds = function(selectableDataPoints, selectedIds) {
|
13861 | for (var foundMatchingId = !1, _i = 0, selectableDataPoints_4 = selectableDataPoints; _i < selectableDataPoints_4.length; _i++) {
|
13862 | var datapoint = selectableDataPoints_4[_i];
|
13863 | datapoint.selected = InteractivityService.checkDatapointAgainstSelectedIds(datapoint, selectedIds),
|
13864 | datapoint.selected && (foundMatchingId = !0);
|
13865 | }
|
13866 | return foundMatchingId;
|
13867 | }, InteractivityService.checkDatapointAgainstSelectedIds = function(datapoint, selectedIds) {
|
13868 | return selectedIds.some(function(value) {
|
13869 | return value.includes(datapoint.identity);
|
13870 | });
|
13871 | }, InteractivityService.prototype.removeSelectionIdsWithOnlyMeasures = function() {
|
13872 | this.selectedIds = _.filter(this.selectedIds, function(identity) {
|
13873 | return identity.hasIdentity();
|
13874 | });
|
13875 | }, InteractivityService.prototype.removeSelectionIdsExceptOnlyMeasures = function() {
|
13876 | this.selectedIds = _.filter(this.selectedIds, function(identity) {
|
13877 | return !identity.hasIdentity();
|
13878 | });
|
13879 | }, InteractivityService;
|
13880 | }();
|
13881 | visuals.InteractivityService = InteractivityService;
|
13882 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
13883 | }(powerbi || (powerbi = {}));
|
13884 |
|
13885 | var powerbi;
|
13886 |
|
13887 | !function(powerbi) {
|
13888 | var visuals;
|
13889 | !function(visuals) {
|
13890 | var services;
|
13891 | !function(services) {
|
13892 | function createGeocoder() {
|
13893 | return {
|
13894 | geocode: geocode,
|
13895 | geocodeBoundary: geocodeBoundary,
|
13896 | geocodePoint: geocodePoint,
|
13897 | tryGeocodeImmediate: tryGeocodeImmediate,
|
13898 | tryGeocodeBoundaryImmediate: tryGeocodeBoundaryImmediate
|
13899 | };
|
13900 | }
|
13901 | function isCategoryType(value) {
|
13902 | return services.CategoryTypeArray.indexOf(value) > -1;
|
13903 | }
|
13904 | function mapLocalesForBing(locale) {
|
13905 | switch (locale.toLowerCase()) {
|
13906 | case "fr":
|
13907 | return "fr-FR";
|
13908 |
|
13909 | default:
|
13910 | return locale;
|
13911 | }
|
13912 | }
|
13913 | function tryGeocodeImmediate(query, category) {
|
13914 | var result = geocodingCache ? geocodingCache.getCoordinates(new GeocodeQuery(query, category).key) : void 0;
|
13915 | return result;
|
13916 | }
|
13917 | function tryGeocodeBoundaryImmediate(latitude, longitude, category, levelOfDetail, maxGeoData) {
|
13918 | void 0 === maxGeoData && (maxGeoData = 3);
|
13919 | var result = geocodingCache ? geocodingCache.getCoordinates(new GeocodeBoundaryQuery(latitude, longitude, category, levelOfDetail, maxGeoData).key) : void 0;
|
13920 | return result;
|
13921 | }
|
13922 | function geocodeCore(geocodeQuery) {
|
13923 | var result = geocodingCache ? geocodingCache.getCoordinates(geocodeQuery.key) : void 0, deferred = $.Deferred();
|
13924 | return result ? deferred.resolve(result) : (geocodeQueue.push({
|
13925 | query: geocodeQuery,
|
13926 | deferred: deferred
|
13927 | }), dequeue()), deferred;
|
13928 | }
|
13929 | function geocode(query, category) {
|
13930 | return void 0 === category && (category = ""), geocodeCore(new GeocodeQuery(query, category));
|
13931 | }
|
13932 | function geocodeBoundary(latitude, longitude, category, levelOfDetail, maxGeoData) {
|
13933 | return void 0 === category && (category = ""), void 0 === levelOfDetail && (levelOfDetail = 2),
|
13934 | void 0 === maxGeoData && (maxGeoData = 3), geocodeCore(new GeocodeBoundaryQuery(latitude, longitude, category, levelOfDetail, maxGeoData));
|
13935 | }
|
13936 | function geocodePoint(latitude, longitude) {
|
13937 | return geocodeCore(new GeocodePointQuery(latitude, longitude));
|
13938 | }
|
13939 | function dequeue(decrement) {
|
13940 | for (void 0 === decrement && (decrement = 0), activeRequests -= decrement; activeRequests < Settings.MaxBingRequest && 0 !== geocodeQueue.length; ) activeRequests++,
|
13941 | makeRequest(geocodeQueue.shift());
|
13942 | }
|
13943 | function makeRequest(item) {
|
13944 | var result = geocodingCache ? geocodingCache.getCoordinates(item.query.key) : void 0;
|
13945 | if (result) return setTimeout(function() {
|
13946 | return dequeue(1);
|
13947 | }), void item.deferred.resolve(result);
|
13948 | var config = {
|
13949 | type: "GET",
|
13950 | dataType: "jsonp",
|
13951 | jsonp: "jsonp"
|
13952 | }, url = item.query.getUrl();
|
13953 | url || completeRequest(item, new Error("Unsupported query. " + item.query.query)),
|
13954 | services.BingAjaxCall(url, config).then(function(data) {
|
13955 | try {
|
13956 | if (item.query instanceof GeocodeBoundaryQuery) {
|
13957 | var result_1 = data;
|
13958 | if (result_1 && result_1.d && Array.isArray(result_1.d.results) && result_1.d.results.length > 0) {
|
13959 | var entity = result_1.d.results[0], primitives = entity.Primitives;
|
13960 | if (primitives && primitives.length > 0) {
|
13961 | var coordinates = {
|
13962 | latitude: item.query.latitude,
|
13963 | longitude: item.query.longitude,
|
13964 | locations: []
|
13965 | };
|
13966 | primitives.sort(function(a, b) {
|
13967 | return a.Shape.length < b.Shape.length ? 1 : a.Shape.length > b.Shape.length ? -1 : 0;
|
13968 | });
|
13969 | 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({
|
13970 | nativeBing: ringArray[j]
|
13971 | });
|
13972 | completeRequest(item, null, coordinates);
|
13973 | } else completeRequest(item, new Error("Geocode result is empty."));
|
13974 | } else completeRequest(item, new Error("Geocode result is empty."));
|
13975 | } else if (item.query instanceof GeocodePointQuery) {
|
13976 | var resources = data.resourceSets[0].resources;
|
13977 | if (Array.isArray(resources) && resources.length > 0) {
|
13978 | var index = getBestResultIndex(resources, item.query), pointData = resources[index].point.coordinates, addressData = resources[index].address, coordinates = {
|
13979 | latitude: parseFloat(pointData[0]),
|
13980 | longitude: parseFloat(pointData[1]),
|
13981 | addressLine: addressData.addressLine,
|
13982 | locality: addressData.locality,
|
13983 | neighborhood: addressData.neighborhood,
|
13984 | adminDistrict: addressData.adminDistrict,
|
13985 | adminDistrict2: addressData.adminDistrict2,
|
13986 | formattedAddress: addressData.formattedAddress,
|
13987 | postalCode: addressData.postalCode,
|
13988 | countryRegionIso2: addressData.countryRegionIso2,
|
13989 | countryRegion: addressData.countryRegion,
|
13990 | landmark: addressData.landmark
|
13991 | };
|
13992 | completeRequest(item, null, coordinates);
|
13993 | } else completeRequest(item, new Error("Geocode result is empty."));
|
13994 | } else {
|
13995 | var resources = data.resourceSets[0].resources;
|
13996 | if (Array.isArray(resources) && resources.length > 0) {
|
13997 | var index = getBestResultIndex(resources, item.query), pointData = resources[index].point.coordinates, coordinates = {
|
13998 | latitude: parseFloat(pointData[0]),
|
13999 | longitude: parseFloat(pointData[1])
|
14000 | };
|
14001 | completeRequest(item, null, coordinates);
|
14002 | } else completeRequest(item, new Error("Geocode result is empty."));
|
14003 | }
|
14004 | } catch (error) {
|
14005 | completeRequest(item, error);
|
14006 | }
|
14007 | }, function(error) {
|
14008 | completeRequest(item, error);
|
14009 | });
|
14010 | }
|
14011 | function completeRequest(item, error, coordinate) {
|
14012 | void 0 === coordinate && (coordinate = null), dequeueTimeoutId = setTimeout(function() {
|
14013 | return dequeue(1);
|
14014 | }, Settings.UseDoubleArrayGeodataResult ? Settings.UseDoubleArrayDequeueTimeout : 0),
|
14015 | error ? item.deferred.reject(error) : (!geocodingCache || item.query instanceof GeocodePointQuery || geocodingCache.registerCoordinates(item.query.key, coordinate),
|
14016 | item.deferred.resolve(coordinate));
|
14017 | }
|
14018 | function getBestResultIndex(resources, query) {
|
14019 | var queryString = query.query.toLowerCase();
|
14020 | if (2 === queryString.length && query.category === CategoryTypes.CountryRegion) for (var index = 0; index < resources.length; index++) {
|
14021 | var iso2 = resources[index].address && resources[index].address.countryRegionIso2;
|
14022 | if (iso2 && queryString === iso2.toLowerCase()) return index;
|
14023 | }
|
14024 | for (var targetEntity = query.getBingEntity().toLowerCase(), index = 0; index < resources.length; index++) {
|
14025 | var resultEntity = (resources[index].entityType || "").toLowerCase();
|
14026 | if (resultEntity === targetEntity) return index;
|
14027 | }
|
14028 | return 0;
|
14029 | }
|
14030 | function reset() {
|
14031 | geocodeQueue = [], activeRequests = 0, categoryToBingEntity = null, clearTimeout(dequeueTimeoutId);
|
14032 | }
|
14033 | var CategoryTypes = visuals.MapUtil.CategoryTypes, Settings = visuals.MapUtil.Settings;
|
14034 | services.createGeocoder = createGeocoder, services.safeCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-",
|
14035 | services.BingAjaxCall = $.ajax, services.CategoryTypeArray = [ "Address", "City", "Continent", "Country", "County", "Longitude", "Latitude", "Place", "PostalCode", "StateOrProvince" ],
|
14036 | services.isCategoryType = isCategoryType, services.BingEntities = {
|
14037 | Continent: "Continent",
|
14038 | Sovereign: "Sovereign",
|
14039 | CountryRegion: "CountryRegion",
|
14040 | AdminDivision1: "AdminDivision1",
|
14041 | AdminDivision2: "AdminDivision2",
|
14042 | PopulatedPlace: "PopulatedPlace",
|
14043 | Postcode: "Postcode",
|
14044 | Postcode1: "Postcode1",
|
14045 | Neighborhood: "Neighborhood",
|
14046 | Address: "Address"
|
14047 | };
|
14048 | var geocodeQueue, activeRequests, categoryToBingEntity, categoryToBingEntityGeodata, geocodingCache, GeocodeQuery = function() {
|
14049 | function GeocodeQuery(query, category) {
|
14050 | this.query = null != query ? query : "", this.category = null != category ? category : "",
|
14051 | this.key = (this.query + "/" + this.category).toLowerCase(), geocodingCache || (geocodingCache = services.createGeocodingCache(Settings.MaxCacheSize, Settings.MaxCacheSizeOverflow));
|
14052 | }
|
14053 | return GeocodeQuery.prototype.getBingEntity = function() {
|
14054 | var category = this.category.toLowerCase();
|
14055 | return categoryToBingEntity || (categoryToBingEntity = {}, categoryToBingEntity[CategoryTypes.Continent.toLowerCase()] = services.BingEntities.Continent,
|
14056 | categoryToBingEntity[CategoryTypes.CountryRegion.toLowerCase()] = services.BingEntities.Sovereign,
|
14057 | categoryToBingEntity[CategoryTypes.StateOrProvince.toLowerCase()] = services.BingEntities.AdminDivision1,
|
14058 | categoryToBingEntity[CategoryTypes.County.toLowerCase()] = services.BingEntities.AdminDivision2,
|
14059 | categoryToBingEntity[CategoryTypes.City.toLowerCase()] = services.BingEntities.PopulatedPlace,
|
14060 | categoryToBingEntity[CategoryTypes.PostalCode.toLowerCase()] = services.BingEntities.Postcode,
|
14061 | categoryToBingEntity[CategoryTypes.Address.toLowerCase()] = services.BingEntities.Address),
|
14062 | categoryToBingEntity[category] || "";
|
14063 | }, GeocodeQuery.prototype.getUrl = function() {
|
14064 | var url = Settings.BingUrl + "?key=" + Settings.BingKey, entityType = this.getBingEntity(), queryAdded = !1;
|
14065 | 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 {
|
14066 | queryAdded = !0;
|
14067 | try {
|
14068 | url += "&adminDistrict=" + decodeURIComponent(this.query);
|
14069 | } catch (e) {
|
14070 | return null;
|
14071 | }
|
14072 | }
|
14073 | if (!queryAdded) try {
|
14074 | url += "&q=" + decodeURIComponent(this.query);
|
14075 | } catch (e) {
|
14076 | return null;
|
14077 | }
|
14078 | var cultureName = navigator.userLanguage || navigator.language;
|
14079 | return cultureName = mapLocalesForBing(cultureName), cultureName && (url += "&c=" + cultureName),
|
14080 | url += "&maxRes=20", 2 === this.query.length && this.category === CategoryTypes.CountryRegion && (url += "&include=ciso2"),
|
14081 | url;
|
14082 | }, GeocodeQuery;
|
14083 | }();
|
14084 | services.GeocodeQuery = GeocodeQuery;
|
14085 | var GeocodePointQuery = function(_super) {
|
14086 | function GeocodePointQuery(latitude, longitude) {
|
14087 | _super.call(this, [ latitude, longitude ].join(), "Point"), this.latitude = latitude,
|
14088 | this.longitude = longitude;
|
14089 | }
|
14090 | return __extends(GeocodePointQuery, _super), GeocodePointQuery.prototype.getUrl = function() {
|
14091 | var url = Settings.BingUrl + "/" + [ this.latitude, this.longitude ].join() + "?key=" + Settings.BingKey + "&includeEntityTypes=" + [ services.BingEntities.Address, services.BingEntities.Neighborhood, services.BingEntities.PopulatedPlace, services.BingEntities.Postcode1, services.BingEntities.AdminDivision1, services.BingEntities.AdminDivision2, services.BingEntities.CountryRegion ].join() + "&include=ciso2";
|
14092 | return url;
|
14093 | }, GeocodePointQuery;
|
14094 | }(GeocodeQuery);
|
14095 | services.GeocodePointQuery = GeocodePointQuery;
|
14096 | var GeocodeBoundaryQuery = function(_super) {
|
14097 | function GeocodeBoundaryQuery(latitude, longitude, category, levelOfDetail, maxGeoData) {
|
14098 | void 0 === maxGeoData && (maxGeoData = 3), _super.call(this, [ latitude, longitude, levelOfDetail, maxGeoData ].join(","), category),
|
14099 | this.latitude = latitude, this.longitude = longitude, this.levelOfDetail = levelOfDetail,
|
14100 | this.maxGeoData = maxGeoData;
|
14101 | }
|
14102 | return __extends(GeocodeBoundaryQuery, _super), GeocodeBoundaryQuery.prototype.getBingEntity = function() {
|
14103 | var category = this.category.toLowerCase();
|
14104 | return categoryToBingEntityGeodata || (categoryToBingEntityGeodata = {}, categoryToBingEntityGeodata[CategoryTypes.CountryRegion.toLowerCase()] = services.BingEntities.CountryRegion,
|
14105 | categoryToBingEntityGeodata[CategoryTypes.StateOrProvince.toLowerCase()] = services.BingEntities.AdminDivision1,
|
14106 | categoryToBingEntityGeodata[CategoryTypes.County.toLowerCase()] = services.BingEntities.AdminDivision2,
|
14107 | categoryToBingEntityGeodata[CategoryTypes.City.toLowerCase()] = services.BingEntities.PopulatedPlace,
|
14108 | categoryToBingEntityGeodata[CategoryTypes.PostalCode.toLowerCase()] = services.BingEntities.Postcode1),
|
14109 | categoryToBingEntityGeodata[category] || "";
|
14110 | }, GeocodeBoundaryQuery.prototype.getUrl = function() {
|
14111 | var url = Settings.BingUrlGeodata + "key=" + Settings.BingKey + "&$format=json", entityType = this.getBingEntity();
|
14112 | if (!entityType) return null;
|
14113 | var cultureName = navigator.userLanguage || navigator.language;
|
14114 | cultureName = mapLocalesForBing(cultureName);
|
14115 | var cultures = cultureName.split("-"), data = [ this.latitude, this.longitude, this.levelOfDetail, "'" + entityType + "'", 1, 0, "'" + cultureName + "'" ];
|
14116 | return cultures.length > 1 && data.push("'" + cultures[1] + "'"), url + "&SpatialFilter=GetBoundary(" + data.join(", ") + ")";
|
14117 | }, GeocodeBoundaryQuery;
|
14118 | }(GeocodeQuery);
|
14119 | services.GeocodeBoundaryQuery = GeocodeBoundaryQuery, services.geocodeCore = geocodeCore,
|
14120 | services.geocode = geocode, services.geocodeBoundary = geocodeBoundary, services.geocodePoint = geocodePoint;
|
14121 | var dequeueTimeoutId;
|
14122 | services.reset = reset, reset();
|
14123 | }(services = visuals.services || (visuals.services = {}));
|
14124 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14125 | }(powerbi || (powerbi = {}));
|
14126 |
|
14127 | var powerbi;
|
14128 |
|
14129 | !function(powerbi) {
|
14130 | var visuals;
|
14131 | !function(visuals) {
|
14132 | var services;
|
14133 | !function(services) {
|
14134 | function createGeocodingCache(maxCacheSize, maxCacheSizeOverflow, localStorageService) {
|
14135 | return localStorageService || (localStorageService = powerbi.localStorageService),
|
14136 | new GeocodingCache(maxCacheSize, maxCacheSizeOverflow, localStorageService);
|
14137 | }
|
14138 | services.createGeocodingCache = createGeocodingCache;
|
14139 | var GeocodingCache = function() {
|
14140 | function GeocodingCache(maxCacheSize, maxCacheSizeOverflow, localStorageService) {
|
14141 | this.geocodeCache = {}, this.geocodeCacheCount = 0, this.maxCacheSize = maxCacheSize,
|
14142 | this.maxCacheSizeOverflow = maxCacheSizeOverflow, this.localStorageService = localStorageService;
|
14143 | }
|
14144 | return GeocodingCache.prototype.getCoordinates = function(key) {
|
14145 | var pair = this.geocodeCache[key];
|
14146 | return pair ? (++pair.hitCount, pair.coordinate) : (pair = this.localStorageService.getData(key),
|
14147 | pair ? (this.registerInMemory(key, pair.coordinate), pair.coordinate) : void 0);
|
14148 | }, GeocodingCache.prototype.registerCoordinates = function(key, coordinate) {
|
14149 | this.registerInMemory(key, coordinate), this.registerInStorage(key, coordinate);
|
14150 | }, GeocodingCache.prototype.registerInMemory = function(key, coordinate) {
|
14151 | var geocodeCache = this.geocodeCache, maxCacheSize = this.maxCacheSize, maxCacheCount = maxCacheSize + this.maxCacheSizeOverflow;
|
14152 | if (this.geocodeCacheCount >= maxCacheCount) {
|
14153 | var keys = Object.keys(geocodeCache), cacheSize = keys.length;
|
14154 | if (keys.sort(function(a, b) {
|
14155 | var cachedA = geocodeCache[a], cachedB = geocodeCache[b], ca = cachedA ? cachedA.hitCount : 0, cb = cachedB ? cachedB.hitCount : 0;
|
14156 | return cb > ca ? 1 : ca > cb ? -1 : 0;
|
14157 | }), 2 * maxCacheCount > cacheSize) for (var i = maxCacheSize; cacheSize > i; i++) geocodeCache[keys[i]] = void 0; else {
|
14158 | for (var newGeocodeCache = {}, i = 0; maxCacheSize > i; ++i) newGeocodeCache[keys[i]] = geocodeCache[keys[i]];
|
14159 | geocodeCache = this.geocodeCache = newGeocodeCache;
|
14160 | }
|
14161 | this.geocodeCacheCount = maxCacheSize;
|
14162 | }
|
14163 | geocodeCache[key] = {
|
14164 | key: key,
|
14165 | coordinate: coordinate,
|
14166 | hitCount: 1
|
14167 | }, ++this.geocodeCacheCount;
|
14168 | }, GeocodingCache.prototype.registerInStorage = function(key, coordinate) {
|
14169 | this.localStorageService.setData(key, {
|
14170 | coordinate: coordinate
|
14171 | });
|
14172 | }, GeocodingCache;
|
14173 | }();
|
14174 | }(services = visuals.services || (visuals.services = {}));
|
14175 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14176 | }(powerbi || (powerbi = {}));
|
14177 |
|
14178 | var powerbi;
|
14179 |
|
14180 | !function(powerbi) {
|
14181 | var visuals;
|
14182 | !function(visuals) {
|
14183 | var services;
|
14184 | !function(services) {
|
14185 | function createGeolocation() {
|
14186 | return new GeolocationService();
|
14187 | }
|
14188 | services.createGeolocation = createGeolocation;
|
14189 | var GeolocationService = function() {
|
14190 | function GeolocationService() {
|
14191 | this.webGeolocation = navigator.geolocation;
|
14192 | }
|
14193 | return GeolocationService.prototype.watchPosition = function(successCallback, errorCallback) {
|
14194 | return this.webGeolocation.watchPosition(function(position) {
|
14195 | successCallback(position);
|
14196 | }, function(error) {
|
14197 | null != errorCallback && errorCallback(error);
|
14198 | });
|
14199 | }, GeolocationService.prototype.clearWatch = function(watchId) {
|
14200 | this.webGeolocation.clearWatch(watchId);
|
14201 | }, GeolocationService.prototype.getCurrentPosition = function(successCallback, errorCallback) {
|
14202 | this.webGeolocation.getCurrentPosition(function(position) {
|
14203 | successCallback(position);
|
14204 | }, function(error) {
|
14205 | null != errorCallback && errorCallback(error);
|
14206 | });
|
14207 | }, GeolocationService;
|
14208 | }();
|
14209 | }(services = visuals.services || (visuals.services = {}));
|
14210 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14211 | }(powerbi || (powerbi = {}));
|
14212 |
|
14213 | var powerbi;
|
14214 |
|
14215 | !function(powerbi) {
|
14216 | var visuals;
|
14217 | !function(visuals) {
|
14218 | var visualPluginFactory, unsupportedVisuals = [ "play", "subview", "smallMultiple" ];
|
14219 | !function(visualPluginFactory) {
|
14220 | function createPlugin(visualPlugins, base, create, modifyPluginFn) {
|
14221 | var visualPlugin = powerbi.Prototype.inherit(base);
|
14222 | visualPlugin.create = create, modifyPluginFn && modifyPluginFn(visualPlugin), visualPlugins[base.name] = visualPlugin;
|
14223 | }
|
14224 | function createDashboardPlugins(plugins, options, featureSwitches) {
|
14225 | var tooltipsOnDashboard = options.tooltipsEnabled, lineChartLabelDensityEnabled = featureSwitches && featureSwitches.lineChartLabelDensityEnabled;
|
14226 | createPlugin(plugins, powerbi.visuals.plugins.barChart, function() {
|
14227 | return new visuals.CartesianChart({
|
14228 | chartType: 6,
|
14229 | tooltipsEnabled: tooltipsOnDashboard
|
14230 | });
|
14231 | }), createPlugin(plugins, powerbi.visuals.plugins.clusteredBarChart, function() {
|
14232 | return new visuals.CartesianChart({
|
14233 | chartType: 5,
|
14234 | tooltipsEnabled: tooltipsOnDashboard
|
14235 | });
|
14236 | }), createPlugin(plugins, powerbi.visuals.plugins.clusteredColumnChart, function() {
|
14237 | return new visuals.CartesianChart({
|
14238 | chartType: 3,
|
14239 | tooltipsEnabled: tooltipsOnDashboard
|
14240 | });
|
14241 | }), createPlugin(plugins, powerbi.visuals.plugins.columnChart, function() {
|
14242 | return new visuals.CartesianChart({
|
14243 | chartType: 4,
|
14244 | tooltipsEnabled: tooltipsOnDashboard
|
14245 | });
|
14246 | }), createPlugin(plugins, powerbi.visuals.plugins.dataDotClusteredColumnComboChart, function() {
|
14247 | return new visuals.CartesianChart({
|
14248 | chartType: 15,
|
14249 | tooltipsEnabled: tooltipsOnDashboard
|
14250 | });
|
14251 | }), createPlugin(plugins, powerbi.visuals.plugins.dataDotStackedColumnComboChart, function() {
|
14252 | return new visuals.CartesianChart({
|
14253 | chartType: 16,
|
14254 | tooltipsEnabled: tooltipsOnDashboard
|
14255 | });
|
14256 | }), createPlugin(plugins, powerbi.visuals.plugins.donutChart, function() {
|
14257 | return new visuals.DonutChart({
|
14258 | tooltipsEnabled: tooltipsOnDashboard
|
14259 | });
|
14260 | }), createPlugin(plugins, powerbi.visuals.plugins.funnel, function() {
|
14261 | return new visuals.FunnelChart({
|
14262 | tooltipsEnabled: tooltipsOnDashboard
|
14263 | });
|
14264 | }), createPlugin(plugins, powerbi.visuals.plugins.gauge, function() {
|
14265 | return new visuals.Gauge({
|
14266 | tooltipsEnabled: tooltipsOnDashboard
|
14267 | });
|
14268 | }), createPlugin(plugins, powerbi.visuals.plugins.hundredPercentStackedBarChart, function() {
|
14269 | return new visuals.CartesianChart({
|
14270 | chartType: 7,
|
14271 | tooltipsEnabled: tooltipsOnDashboard
|
14272 | });
|
14273 | }), createPlugin(plugins, powerbi.visuals.plugins.hundredPercentStackedColumnChart, function() {
|
14274 | return new visuals.CartesianChart({
|
14275 | chartType: 8,
|
14276 | tooltipsEnabled: tooltipsOnDashboard
|
14277 | });
|
14278 | }), createPlugin(plugins, powerbi.visuals.plugins.lineChart, function() {
|
14279 | return new visuals.CartesianChart({
|
14280 | chartType: 0,
|
14281 | tooltipsEnabled: tooltipsOnDashboard,
|
14282 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
14283 | });
|
14284 | }), createPlugin(plugins, powerbi.visuals.plugins.areaChart, function() {
|
14285 | return new visuals.CartesianChart({
|
14286 | chartType: 1,
|
14287 | tooltipsEnabled: tooltipsOnDashboard,
|
14288 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
14289 | });
|
14290 | }), createPlugin(plugins, powerbi.visuals.plugins.stackedAreaChart, function() {
|
14291 | return new visuals.CartesianChart({
|
14292 | chartType: 2,
|
14293 | tooltipsEnabled: tooltipsOnDashboard,
|
14294 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
14295 | });
|
14296 | }), createPlugin(plugins, powerbi.visuals.plugins.lineClusteredColumnComboChart, function() {
|
14297 | return new visuals.CartesianChart({
|
14298 | chartType: 13,
|
14299 | tooltipsEnabled: tooltipsOnDashboard
|
14300 | });
|
14301 | }), createPlugin(plugins, powerbi.visuals.plugins.lineStackedColumnComboChart, function() {
|
14302 | return new visuals.CartesianChart({
|
14303 | chartType: 14,
|
14304 | tooltipsEnabled: tooltipsOnDashboard
|
14305 | });
|
14306 | }), createPlugin(plugins, powerbi.visuals.plugins.pieChart, function() {
|
14307 | return new visuals.DonutChart({
|
14308 | sliceWidthRatio: 0,
|
14309 | tooltipsEnabled: tooltipsOnDashboard
|
14310 | });
|
14311 | }), createPlugin(plugins, powerbi.visuals.plugins.scatterChart, function() {
|
14312 | return new visuals.CartesianChart({
|
14313 | chartType: 9,
|
14314 | tooltipsEnabled: tooltipsOnDashboard
|
14315 | });
|
14316 | }), createPlugin(plugins, powerbi.visuals.plugins.treemap, function() {
|
14317 | return new visuals.Treemap({
|
14318 | isScrollable: !1,
|
14319 | tooltipsEnabled: tooltipsOnDashboard
|
14320 | });
|
14321 | }), createPlugin(plugins, powerbi.visuals.plugins.waterfallChart, function() {
|
14322 | return new visuals.CartesianChart({
|
14323 | chartType: 12,
|
14324 | tooltipsEnabled: tooltipsOnDashboard
|
14325 | });
|
14326 | }), createPlugin(plugins, powerbi.visuals.plugins.map, function() {
|
14327 | return new visuals.Map({
|
14328 | tooltipsEnabled: tooltipsOnDashboard,
|
14329 | disableZooming: !0,
|
14330 | disablePanning: !0
|
14331 | });
|
14332 | }), createPlugin(plugins, powerbi.visuals.plugins.filledMap, function() {
|
14333 | return new visuals.Map({
|
14334 | filledMap: !0,
|
14335 | tooltipsEnabled: tooltipsOnDashboard,
|
14336 | disableZooming: !0,
|
14337 | disablePanning: !0
|
14338 | });
|
14339 | }), createPlugin(plugins, powerbi.visuals.plugins.matrix, function() {
|
14340 | return new visuals.Matrix({});
|
14341 | }), createPlugin(plugins, powerbi.visuals.plugins.table, function() {
|
14342 | return new visuals.Table({
|
14343 | isConditionalFormattingEnabled: !1
|
14344 | });
|
14345 | });
|
14346 | }
|
14347 | function createMinervaPlugins(plugins, featureSwitches) {
|
14348 | var scriptVisualEnabled = featureSwitches ? featureSwitches.scriptVisualEnabled : !1, scriptVisualAuthoringEnabled = featureSwitches ? featureSwitches.scriptVisualAuthoringEnabled : !1, isLabelInteractivityEnabled = featureSwitches ? featureSwitches.isLabelInteractivityEnabled : !1, conditionalFormattingEnabled = featureSwitches ? featureSwitches.conditionalFormattingEnabled : !1, fillMapDataLabelsEnabled = featureSwitches ? featureSwitches.filledMapDataLabelsEnabled : !1, lineChartLabelDensityEnabled = featureSwitches ? featureSwitches.lineChartLabelDensityEnabled : !1;
|
14349 | createPlugin(plugins, powerbi.visuals.plugins.barChart, function() {
|
14350 | return new visuals.CartesianChart({
|
14351 | chartType: 6,
|
14352 | isScrollable: !0,
|
14353 | animator: new visuals.WebColumnChartAnimator(),
|
14354 | tooltipsEnabled: !0,
|
14355 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior() ]),
|
14356 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14357 | });
|
14358 | }), createPlugin(plugins, powerbi.visuals.plugins.card, function() {
|
14359 | return new visuals.Card({
|
14360 | isScrollable: !0,
|
14361 | animator: new visuals.BaseAnimator()
|
14362 | });
|
14363 | }), createPlugin(plugins, powerbi.visuals.plugins.clusteredBarChart, function() {
|
14364 | return new visuals.CartesianChart({
|
14365 | chartType: 5,
|
14366 | isScrollable: !0,
|
14367 | tooltipsEnabled: !0,
|
14368 | animator: new visuals.WebColumnChartAnimator(),
|
14369 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior() ]),
|
14370 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14371 | });
|
14372 | }), createPlugin(plugins, powerbi.visuals.plugins.clusteredColumnChart, function() {
|
14373 | return new visuals.CartesianChart({
|
14374 | chartType: 3,
|
14375 | isScrollable: !0,
|
14376 | tooltipsEnabled: !0,
|
14377 | animator: new visuals.WebColumnChartAnimator(),
|
14378 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior() ]),
|
14379 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14380 | });
|
14381 | }), createPlugin(plugins, powerbi.visuals.plugins.columnChart, function() {
|
14382 | return new visuals.CartesianChart({
|
14383 | chartType: 4,
|
14384 | isScrollable: !0,
|
14385 | tooltipsEnabled: !0,
|
14386 | animator: new visuals.WebColumnChartAnimator(),
|
14387 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior() ]),
|
14388 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14389 | });
|
14390 | }), createPlugin(plugins, powerbi.visuals.plugins.dataDotClusteredColumnComboChart, function() {
|
14391 | return new visuals.CartesianChart({
|
14392 | chartType: 15,
|
14393 | isScrollable: !0,
|
14394 | tooltipsEnabled: !0,
|
14395 | animator: new visuals.WebColumnChartAnimator(),
|
14396 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior(), new visuals.DataDotChartWebBehavior() ]),
|
14397 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14398 | });
|
14399 | }), createPlugin(plugins, powerbi.visuals.plugins.dataDotStackedColumnComboChart, function() {
|
14400 | return new visuals.CartesianChart({
|
14401 | chartType: 16,
|
14402 | isScrollable: !0,
|
14403 | tooltipsEnabled: !0,
|
14404 | animator: new visuals.WebColumnChartAnimator(),
|
14405 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior(), new visuals.DataDotChartWebBehavior() ]),
|
14406 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14407 | });
|
14408 | }), createPlugin(plugins, powerbi.visuals.plugins.donutChart, function() {
|
14409 | return new visuals.DonutChart({
|
14410 | animator: new visuals.WebDonutChartAnimator(),
|
14411 | isScrollable: !0,
|
14412 | tooltipsEnabled: !0,
|
14413 | behavior: new visuals.DonutChartWebBehavior()
|
14414 | });
|
14415 | }), createPlugin(plugins, powerbi.visuals.plugins.funnel, function() {
|
14416 | return new visuals.FunnelChart({
|
14417 | animator: new visuals.WebFunnelAnimator(),
|
14418 | behavior: new visuals.FunnelWebBehavior(),
|
14419 | tooltipsEnabled: !0
|
14420 | });
|
14421 | }), createPlugin(plugins, powerbi.visuals.plugins.gauge, function() {
|
14422 | return new visuals.Gauge({
|
14423 | animator: new visuals.BaseAnimator(),
|
14424 | tooltipsEnabled: !0
|
14425 | });
|
14426 | }), createPlugin(plugins, powerbi.visuals.plugins.hundredPercentStackedBarChart, function() {
|
14427 | return new visuals.CartesianChart({
|
14428 | chartType: 7,
|
14429 | isScrollable: !0,
|
14430 | tooltipsEnabled: !0,
|
14431 | animator: new visuals.WebColumnChartAnimator(),
|
14432 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior() ]),
|
14433 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14434 | });
|
14435 | }), createPlugin(plugins, powerbi.visuals.plugins.hundredPercentStackedColumnChart, function() {
|
14436 | return new visuals.CartesianChart({
|
14437 | chartType: 8,
|
14438 | isScrollable: !0,
|
14439 | tooltipsEnabled: !0,
|
14440 | animator: new visuals.WebColumnChartAnimator(),
|
14441 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior() ]),
|
14442 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14443 | });
|
14444 | }), createPlugin(plugins, powerbi.visuals.plugins.lineChart, function() {
|
14445 | return new visuals.CartesianChart({
|
14446 | chartType: 0,
|
14447 | isScrollable: !0,
|
14448 | tooltipsEnabled: !0,
|
14449 | animator: new visuals.BaseAnimator(),
|
14450 | behavior: new visuals.CartesianChartBehavior([ new visuals.LineChartWebBehavior() ]),
|
14451 | isLabelInteractivityEnabled: isLabelInteractivityEnabled,
|
14452 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
14453 | });
|
14454 | }), createPlugin(plugins, powerbi.visuals.plugins.areaChart, function() {
|
14455 | return new visuals.CartesianChart({
|
14456 | chartType: 1,
|
14457 | isScrollable: !0,
|
14458 | tooltipsEnabled: !0,
|
14459 | animator: new visuals.BaseAnimator(),
|
14460 | behavior: new visuals.CartesianChartBehavior([ new visuals.LineChartWebBehavior() ]),
|
14461 | isLabelInteractivityEnabled: isLabelInteractivityEnabled,
|
14462 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
14463 | });
|
14464 | }), createPlugin(plugins, powerbi.visuals.plugins.stackedAreaChart, function() {
|
14465 | return new visuals.CartesianChart({
|
14466 | chartType: 2,
|
14467 | isScrollable: !0,
|
14468 | tooltipsEnabled: !0,
|
14469 | animator: new visuals.BaseAnimator(),
|
14470 | behavior: new visuals.CartesianChartBehavior([ new visuals.LineChartWebBehavior() ]),
|
14471 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
14472 | });
|
14473 | }), createPlugin(plugins, powerbi.visuals.plugins.lineClusteredColumnComboChart, function() {
|
14474 | return new visuals.CartesianChart({
|
14475 | chartType: 13,
|
14476 | isScrollable: !0,
|
14477 | tooltipsEnabled: !0,
|
14478 | animator: new visuals.WebColumnChartAnimator(),
|
14479 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior(), new visuals.LineChartWebBehavior() ]),
|
14480 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14481 | });
|
14482 | }), createPlugin(plugins, powerbi.visuals.plugins.lineStackedColumnComboChart, function() {
|
14483 | return new visuals.CartesianChart({
|
14484 | chartType: 14,
|
14485 | isScrollable: !0,
|
14486 | tooltipsEnabled: !0,
|
14487 | animator: new visuals.WebColumnChartAnimator(),
|
14488 | behavior: new visuals.CartesianChartBehavior([ new visuals.ColumnChartWebBehavior(), new visuals.LineChartWebBehavior() ]),
|
14489 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14490 | });
|
14491 | }), createPlugin(plugins, powerbi.visuals.plugins.pieChart, function() {
|
14492 | return new visuals.DonutChart({
|
14493 | sliceWidthRatio: 0,
|
14494 | animator: new visuals.WebDonutChartAnimator(),
|
14495 | isScrollable: !0,
|
14496 | tooltipsEnabled: !0,
|
14497 | behavior: new visuals.DonutChartWebBehavior()
|
14498 | });
|
14499 | }), createPlugin(plugins, powerbi.visuals.plugins.scatterChart, function() {
|
14500 | return new visuals.CartesianChart({
|
14501 | chartType: 9,
|
14502 | isScrollable: !0,
|
14503 | tooltipsEnabled: !0,
|
14504 | animator: new visuals.BaseAnimator(),
|
14505 | behavior: new visuals.CartesianChartBehavior([ new visuals.ScatterChartWebBehavior() ]),
|
14506 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14507 | });
|
14508 | }), createPlugin(plugins, powerbi.visuals.plugins.treemap, function() {
|
14509 | return new visuals.Treemap({
|
14510 | animator: new visuals.WebTreemapAnimator(),
|
14511 | isScrollable: !0,
|
14512 | behavior: new visuals.TreemapWebBehavior(),
|
14513 | tooltipsEnabled: !0
|
14514 | });
|
14515 | }), createPlugin(plugins, powerbi.visuals.plugins.waterfallChart, function() {
|
14516 | return new visuals.CartesianChart({
|
14517 | chartType: 12,
|
14518 | isScrollable: !0,
|
14519 | tooltipsEnabled: !0,
|
14520 | behavior: new visuals.CartesianChartBehavior([ new visuals.WaterfallChartWebBehavior() ]),
|
14521 | isLabelInteractivityEnabled: isLabelInteractivityEnabled
|
14522 | });
|
14523 | }), createPlugin(plugins, powerbi.visuals.plugins.map, function() {
|
14524 | return new visuals.Map({
|
14525 | behavior: new visuals.MapBehavior(),
|
14526 | tooltipsEnabled: !0,
|
14527 | isLegendScrollable: !0
|
14528 | });
|
14529 | }), createPlugin(plugins, powerbi.visuals.plugins.filledMap, function() {
|
14530 | return new visuals.Map({
|
14531 | filledMap: !0,
|
14532 | behavior: new visuals.MapBehavior(),
|
14533 | tooltipsEnabled: !0,
|
14534 | filledMapDataLabelsEnabled: fillMapDataLabelsEnabled,
|
14535 | isLegendScrollable: !0
|
14536 | });
|
14537 | }), createPlugin(plugins, powerbi.visuals.plugins.slicer, function() {
|
14538 | return new visuals.Slicer({
|
14539 | behavior: new visuals.SlicerWebBehavior()
|
14540 | });
|
14541 | }), createPlugin(plugins, powerbi.visuals.plugins.matrix, function() {
|
14542 | return new visuals.Matrix({});
|
14543 | }), createPlugin(plugins, powerbi.visuals.plugins.table, function() {
|
14544 | return new visuals.Table({
|
14545 | isConditionalFormattingEnabled: conditionalFormattingEnabled
|
14546 | });
|
14547 | }), scriptVisualEnabled && scriptVisualAuthoringEnabled && createPlugin(plugins, powerbi.visuals.plugins.scriptVisual, function() {
|
14548 | return new visuals.ScriptVisual({
|
14549 | canRefresh: !0
|
14550 | });
|
14551 | });
|
14552 | }
|
14553 | function create() {
|
14554 | return new VisualPluginService(void 0);
|
14555 | }
|
14556 | function createVisualPluginService(featureSwitch) {
|
14557 | return new VisualPluginService(featureSwitch);
|
14558 | }
|
14559 | function createDashboard(featureSwitches, options) {
|
14560 | return new DashboardPluginService(featureSwitches, options);
|
14561 | }
|
14562 | function createInsights(featureSwitches) {
|
14563 | return new InsightsPluginService(featureSwitches);
|
14564 | }
|
14565 | function createMobile(smallViewPortProperties, featureSwitches) {
|
14566 | return new MobileVisualPluginService(smallViewPortProperties, featureSwitches);
|
14567 | }
|
14568 | var VisualPluginService = function() {
|
14569 | function VisualPluginService(featureSwitches) {
|
14570 | this.plugins = powerbi.visuals.plugins, this.featureSwitches = featureSwitches;
|
14571 | }
|
14572 | return VisualPluginService.prototype.getVisuals = function() {
|
14573 | var registry = this.plugins, names = Object.keys(registry);
|
14574 | return names.map(function(name) {
|
14575 | return registry[name];
|
14576 | });
|
14577 | }, VisualPluginService.prototype.getPlugin = function(type) {
|
14578 | if (type) {
|
14579 | var plugin = this.plugins[type];
|
14580 | if (plugin) return plugin;
|
14581 | }
|
14582 | }, VisualPluginService.prototype.capabilities = function(type) {
|
14583 | var plugin = this.getPlugin(type);
|
14584 | return plugin ? plugin.capabilities : void 0;
|
14585 | }, VisualPluginService.prototype.requireSandbox = function(plugin) {
|
14586 | return plugin && plugin.custom;
|
14587 | }, VisualPluginService.prototype.removeAnyCustomVisuals = function() {
|
14588 | var plugins = powerbi.visuals.plugins;
|
14589 | for (var key in plugins) {
|
14590 | var p = plugins[key];
|
14591 | p.custom && delete plugins[key];
|
14592 | }
|
14593 | }, VisualPluginService.prototype.isCustomVisual = function(visual) {
|
14594 | return visual ? this.plugins[visual] ? this.plugins[visual].custom === !0 : !_.include(unsupportedVisuals, visual) : !1;
|
14595 | }, VisualPluginService.prototype.isScriptVisual = function(type) {
|
14596 | var visualCapabilities = this.capabilities(type);
|
14597 | return !!(visualCapabilities && visualCapabilities.dataViewMappings && powerbi.ScriptResultUtil.findScriptResult(visualCapabilities.dataViewMappings));
|
14598 | }, VisualPluginService.prototype.shouldDisableVisual = function(type, mapDisabled) {
|
14599 | return (type === visuals.plugins.map.name || type === visuals.plugins.filledMap.name) && mapDisabled;
|
14600 | }, VisualPluginService.prototype.isScriptVisualQueryable = function() {
|
14601 | return void 0 !== this.featureSwitches && this.featureSwitches.scriptVisualEnabled;
|
14602 | }, VisualPluginService.prototype.getInteractivityOptions = function(visualType) {
|
14603 | var interactivityOptions = {
|
14604 | overflow: "hidden"
|
14605 | };
|
14606 | return interactivityOptions;
|
14607 | }, VisualPluginService;
|
14608 | }();
|
14609 | visualPluginFactory.VisualPluginService = VisualPluginService, visualPluginFactory.createPlugin = createPlugin;
|
14610 | var PlaygroundVisualPluginService = function(_super) {
|
14611 | function PlaygroundVisualPluginService() {
|
14612 | _super.call(this, void 0), this.visualPlugins = powerbi.visuals.plugins, createMinervaPlugins(this.visualPlugins, null);
|
14613 | }
|
14614 | return __extends(PlaygroundVisualPluginService, _super), PlaygroundVisualPluginService.prototype.getVisuals = function() {
|
14615 | var registry = this.visualPlugins, names = Object.keys(registry);
|
14616 | return names.map(function(name) {
|
14617 | return registry[name];
|
14618 | });
|
14619 | }, PlaygroundVisualPluginService.prototype.getPlugin = function(type) {
|
14620 | if (type) {
|
14621 | var plugin = this.visualPlugins[type];
|
14622 | if (plugin) return plugin;
|
14623 | }
|
14624 | }, PlaygroundVisualPluginService.prototype.capabilities = function(type) {
|
14625 | var plugin = this.getPlugin(type);
|
14626 | return plugin ? plugin.capabilities : void 0;
|
14627 | }, PlaygroundVisualPluginService;
|
14628 | }(VisualPluginService);
|
14629 | visualPluginFactory.PlaygroundVisualPluginService = PlaygroundVisualPluginService;
|
14630 | var DashboardPluginService = function(_super) {
|
14631 | function DashboardPluginService(featureSwitches, options) {
|
14632 | _super.call(this, featureSwitches), this.visualPlugins = {}, createDashboardPlugins(this.visualPlugins, options, this.featureSwitches);
|
14633 | }
|
14634 | return __extends(DashboardPluginService, _super), DashboardPluginService.prototype.getPlugin = function(type) {
|
14635 | return this.visualPlugins[type] ? this.visualPlugins[type] : _super.prototype.getPlugin.call(this, type);
|
14636 | }, DashboardPluginService.prototype.requireSandbox = function(plugin) {
|
14637 | return this.featureSwitches.sandboxVisualsEnabled && (!plugin || plugin && plugin.custom);
|
14638 | }, DashboardPluginService;
|
14639 | }(VisualPluginService);
|
14640 | visualPluginFactory.DashboardPluginService = DashboardPluginService;
|
14641 | var InsightsPluginService = function(_super) {
|
14642 | function InsightsPluginService(featureSwitches) {
|
14643 | _super.call(this, featureSwitches), this.visualPlugins = {}, createPlugin(this.visualPlugins, powerbi.visuals.plugins.clusteredBarChart, function() {
|
14644 | return new visuals.CartesianChart({
|
14645 | chartType: 5,
|
14646 | animator: new visuals.WebColumnChartAnimator(),
|
14647 | tooltipsEnabled: !0
|
14648 | });
|
14649 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.columnChart, function() {
|
14650 | return new visuals.CartesianChart({
|
14651 | chartType: 4,
|
14652 | animator: new visuals.WebColumnChartAnimator(),
|
14653 | tooltipsEnabled: !0
|
14654 | });
|
14655 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.donutChart, function() {
|
14656 | return new visuals.DonutChart({
|
14657 | animator: new visuals.WebDonutChartAnimator(),
|
14658 | tooltipsEnabled: !0
|
14659 | });
|
14660 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.hundredPercentStackedBarChart, function() {
|
14661 | return new visuals.CartesianChart({
|
14662 | chartType: 7,
|
14663 | animator: new visuals.WebColumnChartAnimator(),
|
14664 | tooltipsEnabled: !0
|
14665 | });
|
14666 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.hundredPercentStackedColumnChart, function() {
|
14667 | return new visuals.CartesianChart({
|
14668 | chartType: 8,
|
14669 | animator: new visuals.WebColumnChartAnimator(),
|
14670 | tooltipsEnabled: !0
|
14671 | });
|
14672 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.lineChart, function() {
|
14673 | return new visuals.CartesianChart({
|
14674 | chartType: 0,
|
14675 | animator: new visuals.BaseAnimator(),
|
14676 | tooltipsEnabled: !0
|
14677 | });
|
14678 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.areaChart, function() {
|
14679 | return new visuals.CartesianChart({
|
14680 | chartType: 1,
|
14681 | animator: new visuals.BaseAnimator(),
|
14682 | tooltipsEnabled: !0
|
14683 | });
|
14684 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.pieChart, function() {
|
14685 | return new visuals.DonutChart({
|
14686 | sliceWidthRatio: 0,
|
14687 | animator: new visuals.WebDonutChartAnimator(),
|
14688 | tooltipsEnabled: !0
|
14689 | });
|
14690 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.scatterChart, function() {
|
14691 | return new visuals.CartesianChart({
|
14692 | chartType: 9,
|
14693 | animator: new visuals.BaseAnimator(),
|
14694 | tooltipsEnabled: !0
|
14695 | });
|
14696 | }, void 0);
|
14697 | }
|
14698 | return __extends(InsightsPluginService, _super), InsightsPluginService.prototype.getPlugin = function(type) {
|
14699 | return this.visualPlugins[type] ? this.visualPlugins[type] : _super.prototype.getPlugin.call(this, type);
|
14700 | }, InsightsPluginService.prototype.requireSandbox = function(plugin) {
|
14701 | return this.featureSwitches.sandboxVisualsEnabled && (!plugin || plugin && plugin.custom);
|
14702 | }, InsightsPluginService;
|
14703 | }(VisualPluginService);
|
14704 | visualPluginFactory.InsightsPluginService = InsightsPluginService;
|
14705 | var MobileVisualPluginService = function(_super) {
|
14706 | function MobileVisualPluginService(smallViewPortProperties, featureSwitches) {
|
14707 | var _this = this;
|
14708 | _super.call(this, featureSwitches), this.smallViewPortProperties = smallViewPortProperties || {
|
14709 | CartesianSmallViewPortProperties: {
|
14710 | hideAxesOnSmallViewPort: !0,
|
14711 | hideLegendOnSmallViewPort: !0,
|
14712 | MinHeightLegendVisible: MobileVisualPluginService.MinHeightLegendVisible,
|
14713 | MinHeightAxesVisible: MobileVisualPluginService.MinHeightAxesVisible
|
14714 | },
|
14715 | GaugeSmallViewPortProperties: {
|
14716 | hideGaugeSideNumbersOnSmallViewPort: !0,
|
14717 | smallGaugeMarginsOnSmallViewPort: !0,
|
14718 | MinHeightGaugeSideNumbersVisible: MobileVisualPluginService.MinHeightGaugeSideNumbersVisible,
|
14719 | GaugeMarginsOnSmallViewPort: MobileVisualPluginService.GaugeMarginsOnSmallViewPort
|
14720 | },
|
14721 | FunnelSmallViewPortProperties: {
|
14722 | hideFunnelCategoryLabelsOnSmallViewPort: !0,
|
14723 | minHeightFunnelCategoryLabelsVisible: MobileVisualPluginService.MinHeightFunnelCategoryLabelsVisible
|
14724 | },
|
14725 | DonutSmallViewPortProperties: {
|
14726 | maxHeightToScaleDonutLegend: MobileVisualPluginService.MaxHeightToScaleDonutLegend
|
14727 | }
|
14728 | }, visuals.TooltipManager.ShowTooltips = !1;
|
14729 | var trimOrdinalDataOnOverflow = !1, mapThrottleInterval = this.getMapThrottleInterval();
|
14730 | this.visualPlugins = {}, createPlugin(this.visualPlugins, powerbi.visuals.plugins.areaChart, function() {
|
14731 | return new visuals.CartesianChart({
|
14732 | chartType: 1,
|
14733 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14734 | });
|
14735 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.barChart, function() {
|
14736 | return new visuals.CartesianChart({
|
14737 | chartType: 6,
|
14738 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14739 | });
|
14740 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.clusteredBarChart, function() {
|
14741 | return new visuals.CartesianChart({
|
14742 | chartType: 5,
|
14743 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14744 | });
|
14745 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.clusteredColumnChart, function() {
|
14746 | return new visuals.CartesianChart({
|
14747 | chartType: 3,
|
14748 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14749 | });
|
14750 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.columnChart, function() {
|
14751 | return new visuals.CartesianChart({
|
14752 | chartType: 4,
|
14753 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14754 | });
|
14755 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.comboChart, function() {
|
14756 | return new visuals.CartesianChart({
|
14757 | chartType: 10,
|
14758 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14759 | });
|
14760 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.dataDotChart, function() {
|
14761 | return new visuals.CartesianChart({
|
14762 | chartType: 11,
|
14763 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14764 | });
|
14765 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.dataDotClusteredColumnComboChart, function() {
|
14766 | return new visuals.CartesianChart({
|
14767 | chartType: 15,
|
14768 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14769 | });
|
14770 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.dataDotStackedColumnComboChart, function() {
|
14771 | return new visuals.CartesianChart({
|
14772 | chartType: 16,
|
14773 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14774 | });
|
14775 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.hundredPercentStackedBarChart, function() {
|
14776 | return new visuals.CartesianChart({
|
14777 | chartType: 7,
|
14778 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14779 | });
|
14780 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.hundredPercentStackedColumnChart, function() {
|
14781 | return new visuals.CartesianChart({
|
14782 | chartType: 8,
|
14783 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14784 | });
|
14785 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.stackedAreaChart, function() {
|
14786 | return new visuals.CartesianChart({
|
14787 | chartType: 2,
|
14788 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14789 | });
|
14790 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.waterfallChart, function() {
|
14791 | return new visuals.CartesianChart({
|
14792 | chartType: 12,
|
14793 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14794 | });
|
14795 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.lineChart, function() {
|
14796 | return new visuals.CartesianChart({
|
14797 | chartType: 0,
|
14798 | cartesianSmallViewPortProperties: _this.smallViewPortProperties.CartesianSmallViewPortProperties,
|
14799 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14800 | });
|
14801 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.lineClusteredColumnComboChart, function() {
|
14802 | return new visuals.CartesianChart({
|
14803 | chartType: 13,
|
14804 | cartesianSmallViewPortProperties: _this.smallViewPortProperties.CartesianSmallViewPortProperties,
|
14805 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14806 | });
|
14807 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.lineStackedColumnComboChart, function() {
|
14808 | return new visuals.CartesianChart({
|
14809 | chartType: 14,
|
14810 | cartesianSmallViewPortProperties: _this.smallViewPortProperties.CartesianSmallViewPortProperties,
|
14811 | trimOrdinalDataOnOverflow: trimOrdinalDataOnOverflow
|
14812 | });
|
14813 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.scatterChart, function() {
|
14814 | return new visuals.CartesianChart({
|
14815 | chartType: 9,
|
14816 | cartesianSmallViewPortProperties: _this.smallViewPortProperties.CartesianSmallViewPortProperties,
|
14817 | behavior: new visuals.CartesianChartBehavior([ new visuals.ScatterChartMobileBehavior() ])
|
14818 | });
|
14819 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.gauge, function() {
|
14820 | return new visuals.Gauge({
|
14821 | gaugeSmallViewPortProperties: _this.smallViewPortProperties.GaugeSmallViewPortProperties
|
14822 | });
|
14823 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.funnel, function() {
|
14824 | return new visuals.FunnelChart({
|
14825 | animator: null,
|
14826 | funnelSmallViewPortProperties: _this.smallViewPortProperties.FunnelSmallViewPortProperties
|
14827 | });
|
14828 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.donutChart, function() {
|
14829 | return new visuals.DonutChart({
|
14830 | disableGeometricCulling: !0,
|
14831 | smallViewPortProperties: _this.smallViewPortProperties.DonutSmallViewPortProperties
|
14832 | });
|
14833 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.pieChart, function() {
|
14834 | return new visuals.DonutChart({
|
14835 | sliceWidthRatio: 0,
|
14836 | disableGeometricCulling: !0,
|
14837 | smallViewPortProperties: _this.smallViewPortProperties.DonutSmallViewPortProperties
|
14838 | });
|
14839 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.matrix, function() {
|
14840 | return new visuals.Matrix({
|
14841 | isTouchEnabled: !0
|
14842 | });
|
14843 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.table, function() {
|
14844 | return new visuals.Table({
|
14845 | isTouchEnabled: !0
|
14846 | });
|
14847 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.map, function() {
|
14848 | return new visuals.Map({
|
14849 | viewChangeThrottleInterval: mapThrottleInterval,
|
14850 | enableCurrentLocation: featureSwitches ? featureSwitches.mapCurrentLocationEnabled : !1
|
14851 | });
|
14852 | }), createPlugin(this.visualPlugins, powerbi.visuals.plugins.filledMap, function() {
|
14853 | return new visuals.Map({
|
14854 | filledMap: !0,
|
14855 | viewChangeThrottleInterval: mapThrottleInterval
|
14856 | });
|
14857 | });
|
14858 | }
|
14859 | return __extends(MobileVisualPluginService, _super), MobileVisualPluginService.prototype.getPlugin = function(type) {
|
14860 | return this.visualPlugins[type] ? this.visualPlugins[type] : _super.prototype.getPlugin.call(this, type);
|
14861 | }, MobileVisualPluginService.prototype.requireSandbox = function(plugin) {
|
14862 | return this.featureSwitches ? this.featureSwitches.sandboxVisualsEnabled && (!plugin || plugin && plugin.custom) : _super.prototype.requireSandbox.call(this, plugin);
|
14863 | }, MobileVisualPluginService.prototype.getMapThrottleInterval = function() {
|
14864 | var windowsPhoneThrottleInterval = 100, userAgentLowerCase = navigator.userAgent.toLowerCase();
|
14865 | return -1 !== userAgentLowerCase.indexOf("windows phone") ? windowsPhoneThrottleInterval : void 0;
|
14866 | }, MobileVisualPluginService.prototype.getInteractivityOptions = function(visualType) {
|
14867 | var mobileOptions = {
|
14868 | overflow: this.getMobileOverflowString(visualType),
|
14869 | isInteractiveLegend: this.isChartSupportInteractivity(visualType),
|
14870 | selection: !0
|
14871 | };
|
14872 | return mobileOptions;
|
14873 | }, MobileVisualPluginService.prototype.getMobileOverflowString = function(visualType) {
|
14874 | switch (visualType) {
|
14875 | case "multiRowCard":
|
14876 | return "visible";
|
14877 |
|
14878 | default:
|
14879 | return "hidden";
|
14880 | }
|
14881 | }, MobileVisualPluginService.prototype.isChartSupportInteractivity = function(visualType) {
|
14882 | switch (visualType) {
|
14883 | case "areaChart":
|
14884 | case "barChart":
|
14885 | case "clusteredBarChart":
|
14886 | case "clusteredColumnChart":
|
14887 | case "columnChart":
|
14888 | case "donutChart":
|
14889 | case "hundredPercentStackedBarChart":
|
14890 | case "hundredPercentStackedColumnChart":
|
14891 | case "lineChart":
|
14892 | case "pieChart":
|
14893 | case "scatterChart":
|
14894 | case "table":
|
14895 | case "matrix":
|
14896 | case "multiRowCard":
|
14897 | return !0;
|
14898 |
|
14899 | default:
|
14900 | return !1;
|
14901 | }
|
14902 | }, MobileVisualPluginService.MinHeightLegendVisible = 125, MobileVisualPluginService.MinHeightAxesVisible = 125,
|
14903 | MobileVisualPluginService.MinHeightGaugeSideNumbersVisible = 80, MobileVisualPluginService.GaugeMarginsOnSmallViewPort = 10,
|
14904 | MobileVisualPluginService.MinHeightFunnelCategoryLabelsVisible = 80, MobileVisualPluginService.MaxHeightToScaleDonutLegend = 300,
|
14905 | MobileVisualPluginService;
|
14906 | }(VisualPluginService);
|
14907 | visualPluginFactory.MobileVisualPluginService = MobileVisualPluginService, visualPluginFactory.create = create,
|
14908 | visualPluginFactory.createVisualPluginService = createVisualPluginService, visualPluginFactory.createDashboard = createDashboard,
|
14909 | visualPluginFactory.createInsights = createInsights, visualPluginFactory.createMobile = createMobile;
|
14910 | }(visualPluginFactory = visuals.visualPluginFactory || (visuals.visualPluginFactory = {}));
|
14911 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
14912 | }(powerbi || (powerbi = {}));
|
14913 |
|
14914 | var powerbi;
|
14915 |
|
14916 | !function(powerbi) {
|
14917 | var visuals;
|
14918 | !function(visuals) {
|
14919 | var controls;
|
14920 | !function(controls) {
|
14921 | function fire(eventHandlers, eventArgs) {
|
14922 | if (eventHandlers) for (var i = 0; i < eventHandlers.length; i++) {
|
14923 | var h = eventHandlers[i];
|
14924 | h(eventArgs);
|
14925 | }
|
14926 | }
|
14927 | var UNSELECTABLE_CLASS_NAME = "unselectable";
|
14928 | controls.fire = fire;
|
14929 | var ScrollbarButton = function() {
|
14930 | function ScrollbarButton(owner, direction) {
|
14931 | this._owner = owner, this._direction = direction, this._timerHandle = void 0, this.createView();
|
14932 | var that = this;
|
14933 | this._element.addEventListener("mousedown", function(e) {
|
14934 | that.onMouseDown(e);
|
14935 | }), $(this._element).addClass(UNSELECTABLE_CLASS_NAME), $(this._svg).addClass(UNSELECTABLE_CLASS_NAME),
|
14936 | $(this._polygon).addClass(UNSELECTABLE_CLASS_NAME);
|
14937 | }
|
14938 | return Object.defineProperty(ScrollbarButton.prototype, "element", {
|
14939 | get: function() {
|
14940 | return this._element;
|
14941 | },
|
14942 | enumerable: !0,
|
14943 | configurable: !0
|
14944 | }), ScrollbarButton.prototype.createView = function() {
|
14945 | var svgns = "http://www.w3.org/2000/svg";
|
14946 | this._polygon = document.createElementNS(svgns, "polygon"), this._polygon.setAttributeNS(null, "points", "3,3 6,3 13,8 6,13 3,13 10,8"),
|
14947 | this._polygon.setAttributeNS(null, "fill", ScrollbarButton.ARROW_COLOR), this._svg = document.createElementNS(svgns, "svg");
|
14948 | var svgStyle = this._svg.style;
|
14949 | svgStyle.position = "absolute", svgStyle.left = "0px", svgStyle.top = "0px", this._svg.appendChild(this._polygon),
|
14950 | this._element = document.createElement("div"), this._element.className = Scrollbar.arrowClassName,
|
14951 | this._element.appendChild(this._svg), this._owner.element.appendChild(this._element);
|
14952 | }, ScrollbarButton.prototype.onMouseDown = function(event) {
|
14953 | var that = this;
|
14954 | if (clearTimeout(this._timerHandle), !this._mouseUpWrapper) {
|
14955 | event.cancelBubble = !0;
|
14956 | var that_1 = this;
|
14957 | this._mouseUpWrapper = function(event) {
|
14958 | that_1.onMouseUp(event);
|
14959 | }, Scrollbar.addDocumentMouseUpEvent(this._mouseUpWrapper);
|
14960 | }
|
14961 | this._owner._scrollSmallIncrement(this._direction), this._owner.refresh(), this._timerHandle = setTimeout(function() {
|
14962 | that.onMouseDown(event);
|
14963 | }, 100), event.preventDefault && event.preventDefault();
|
14964 | }, ScrollbarButton.prototype.onMouseUp = function(event) {
|
14965 | clearTimeout(this._timerHandle), Scrollbar.removeDocumentMouseUpEvent(this._mouseUpWrapper),
|
14966 | this._mouseUpWrapper = void 0;
|
14967 | }, ScrollbarButton.prototype.arrange = function(width, height, angle) {
|
14968 | var size = Math.min(width, height), scale = size / 16, x = (width - size) / 2, y = (height - size) / 2;
|
14969 | this._polygon.setAttributeNS(null, "transform", "translate(" + x + ", " + y + ") scale(" + scale + ") rotate(" + angle + ",8,8)"),
|
14970 | this._svg.setAttributeNS(null, "width", width + "px"), this._svg.setAttributeNS(null, "height", height + "px"),
|
14971 | controls.HTMLElementUtils.setElementWidth(this._element, width), controls.HTMLElementUtils.setElementHeight(this._element, height);
|
14972 | }, ScrollbarButton.MIN_WIDTH = 26, ScrollbarButton.ARROW_COLOR = "#404040", ScrollbarButton;
|
14973 | }();
|
14974 | controls.ScrollbarButton = ScrollbarButton;
|
14975 | var Scrollbar = function() {
|
14976 | function Scrollbar(parentElement, layoutKind) {
|
14977 | this.MIN_BAR_SIZE = 10, this.min = 0, this.max = 10, this.viewMin = 0, this.viewSize = 2,
|
14978 | this.smallIncrement = 1, this._onscroll = [], this._screenToOffsetScale = 1, this.createView(parentElement, layoutKind);
|
14979 | var that = this;
|
14980 | this._element.addEventListener("mousedown", function(e) {
|
14981 | that.onBackgroundMouseDown(e);
|
14982 | }), this._middleBar.addEventListener("mousedown", function(e) {
|
14983 | that.onMiddleBarMouseDown(e);
|
14984 | }), this._timerHandle = void 0, this._visible = !0, this.element.winControl = this,
|
14985 | $(this._touchPanel).addClass(UNSELECTABLE_CLASS_NAME);
|
14986 | }
|
14987 | return Scrollbar.prototype.scrollBy = function(delta) {
|
14988 | this.scrollTo(this.viewMin + delta);
|
14989 | }, Scrollbar.prototype.scrollUp = function() {
|
14990 | this.scrollBy(-this.smallIncrement);
|
14991 | }, Scrollbar.prototype.scrollDown = function() {
|
14992 | this.scrollBy(this.smallIncrement);
|
14993 | }, Scrollbar.prototype.scrollPageUp = function() {
|
14994 | this.scrollBy(-this.viewSize);
|
14995 | }, Scrollbar.prototype.scrollPageDown = function() {
|
14996 | this.scrollBy(this.viewSize);
|
14997 | }, Object.defineProperty(Scrollbar.prototype, "width", {
|
14998 | get: function() {
|
14999 | return this._width;
|
15000 | },
|
15001 | set: function(value) {
|
15002 | this._width = value, this._element.style.width = value, this.invalidateArrange();
|
15003 | },
|
15004 | enumerable: !0,
|
15005 | configurable: !0
|
15006 | }), Object.defineProperty(Scrollbar.prototype, "height", {
|
15007 | get: function() {
|
15008 | return this._height;
|
15009 | },
|
15010 | set: function(value) {
|
15011 | this._height = value, this._element.style.height = value, this.invalidateArrange();
|
15012 | },
|
15013 | enumerable: !0,
|
15014 | configurable: !0
|
15015 | }), Scrollbar.prototype.refresh = function() {}, Object.defineProperty(Scrollbar.prototype, "element", {
|
15016 | get: function() {
|
15017 | return this._element;
|
15018 | },
|
15019 | enumerable: !0,
|
15020 | configurable: !0
|
15021 | }), Object.defineProperty(Scrollbar.prototype, "maxButton", {
|
15022 | get: function() {
|
15023 | return this._maxButton;
|
15024 | },
|
15025 | enumerable: !0,
|
15026 | configurable: !0
|
15027 | }), Object.defineProperty(Scrollbar.prototype, "middleBar", {
|
15028 | get: function() {
|
15029 | return this._middleBar;
|
15030 | },
|
15031 | enumerable: !0,
|
15032 | configurable: !0
|
15033 | }), Scrollbar.prototype._scrollSmallIncrement = function(direction) {
|
15034 | this.scrollBy(this.smallIncrement * direction);
|
15035 | }, Object.defineProperty(Scrollbar.prototype, "visible", {
|
15036 | get: function() {
|
15037 | return this._visible;
|
15038 | },
|
15039 | enumerable: !0,
|
15040 | configurable: !0
|
15041 | }), Object.defineProperty(Scrollbar.prototype, "isInMouseCapture", {
|
15042 | get: function() {
|
15043 | return void 0 !== this._timerHandle;
|
15044 | },
|
15045 | enumerable: !0,
|
15046 | configurable: !0
|
15047 | }), Scrollbar.prototype.show = function(value) {
|
15048 | this._visible = value, this.element.style.visibility = value ? "visible" : "hidden",
|
15049 | this.invalidateArrange();
|
15050 | }, Scrollbar.prototype._getMouseOffset = function(event) {
|
15051 | return void 0 !== event.offsetX ? {
|
15052 | x: event.offsetX,
|
15053 | y: event.offsetY
|
15054 | } : void 0 !== event.layerX ? {
|
15055 | x: event.layerX,
|
15056 | y: event.layerY
|
15057 | } : {
|
15058 | x: event.screenX,
|
15059 | y: event.screenY
|
15060 | };
|
15061 | }, Scrollbar.prototype._getOffsetXDelta = function(event) {
|
15062 | return (event.screenX - this._screenPrevMousePos.x) / this._screenToOffsetScale;
|
15063 | }, Scrollbar.prototype._getOffsetYDelta = function(event) {
|
15064 | return (event.screenY - this._screenPrevMousePos.y) / this._screenToOffsetScale;
|
15065 | }, Scrollbar.prototype._getOffsetXTouchDelta = function(event) {
|
15066 | return this._getMouseOffset(event).x - this._offsetTouchPrevPos.x;
|
15067 | }, Scrollbar.prototype._getOffsetYTouchDelta = function(event) {
|
15068 | return this._getMouseOffset(event).y - this._offsetTouchPrevPos.y;
|
15069 | }, Scrollbar.prototype.initTouch = function(panel, allowMouseDrag) {
|
15070 | var _this = this;
|
15071 | this._touchPanel = panel, this._allowMouseDrag = void 0 === allowMouseDrag ? !0 : allowMouseDrag,
|
15072 | "ontouchmove" in panel ? (panel.addEventListener("touchstart", function(e) {
|
15073 | return _this.onTouchStart(e);
|
15074 | }), panel.addEventListener("touchmove", function(e) {
|
15075 | return _this.onTouchMove(e);
|
15076 | }), panel.addEventListener("touchend", function(e) {
|
15077 | return _this.onTouchEnd(e);
|
15078 | })) : (panel.addEventListener("mousedown", function(e) {
|
15079 | return _this.onTouchMouseDown(e);
|
15080 | }), panel.addEventListener("mousemove", function(e) {
|
15081 | return _this.onTouchMouseMove(e);
|
15082 | }), panel.addEventListener("mouseup", function(e) {
|
15083 | return _this.onTouchMouseUp(e);
|
15084 | }));
|
15085 | }, Scrollbar.prototype.onTouchStart = function(e) {
|
15086 | 1 === e.touches.length && this.onTouchMouseDown(e.touches[0]);
|
15087 | }, Scrollbar.prototype.onTouchMove = function(e) {
|
15088 | 1 === e.touches.length && (e.preventDefault && e.preventDefault(), this.onTouchMouseMove(e.touches[0]));
|
15089 | }, Scrollbar.prototype.onTouchEnd = function(e) {
|
15090 | this.onTouchMouseUp(1 === e.touches.length ? e.touches[0] : e, !0);
|
15091 | }, Scrollbar.prototype.onTouchMouseDown = function(e) {
|
15092 | (this._allowMouseDrag || e.pointerType !== MSPointerEvent.MSPOINTER_TYPE_MOUSE) && ("setCapture" in this._touchPanel && this._touchPanel.setCapture(!0),
|
15093 | this._offsetTouchPrevPos = this._offsetTouchStartPos = null, this._touchStarted = !0);
|
15094 | }, Scrollbar.prototype._getOffsetTouchDelta = function(e) {
|
15095 | return null;
|
15096 | }, Scrollbar.prototype.onTouchMouseMove = function(e) {
|
15097 | if (this._touchStarted) {
|
15098 | this._offsetTouchStartPos || (this._offsetTouchPrevPos = this._offsetTouchStartPos = this._getMouseOffset(e));
|
15099 | var delta = this._getOffsetTouchDelta(e);
|
15100 | 0 !== delta && (this.scrollBy(-delta / this._getRunningSize(!1) * this.viewSize),
|
15101 | this._offsetTouchPrevPos = this._getMouseOffset(e)), e.preventDefault && e.preventDefault(),
|
15102 | e.cancelBubble = !0;
|
15103 | }
|
15104 | }, Scrollbar.prototype.onTouchMouseUp = function(e, bubble) {
|
15105 | if (this._touchStarted && this._offsetTouchStartPos) {
|
15106 | var end = this._getMouseOffset(e);
|
15107 | !bubble && (Math.abs(this._offsetTouchStartPos.x - end.x) > 3 || Math.abs(this._offsetTouchStartPos.y - end.y) > 3) && (e.preventDefault && e.preventDefault(),
|
15108 | e.cancelBubble = !0);
|
15109 | }
|
15110 | "releaseCapture" in this._touchPanel && this._touchPanel.releaseCapture(), this._touchStarted = !1;
|
15111 | }, Scrollbar.prototype.registerElementForMouseWheelScrolling = function(element) {
|
15112 | var _this = this;
|
15113 | element.addEventListener("mousewheel", function(e) {
|
15114 | _this.onMouseWheel(e);
|
15115 | }), element.addEventListener("DOMMouseScroll", function(e) {
|
15116 | _this.onFireFoxMouseWheel(e);
|
15117 | });
|
15118 | }, Scrollbar.prototype.createView = function(parentElement, layoutKind) {
|
15119 | this._element = document.createElement("div"), this._element.className = Scrollbar.className,
|
15120 | this._element.setAttribute("drag-resize-disabled", "true"), 0 === layoutKind && parentElement.appendChild(this._element),
|
15121 | this._minButton = new ScrollbarButton(this, -1), this._maxButton = new ScrollbarButton(this, 1),
|
15122 | this._middleBar = document.createElement("div"), this._middleBar.className = Scrollbar.barClassName,
|
15123 | this._element.appendChild(this._middleBar);
|
15124 | }, Scrollbar.prototype.scrollTo = function(pos) {
|
15125 | var viewMin = Math.min(this.max - this.viewSize, Math.max(this.min, pos));
|
15126 | viewMin !== this.viewMin && (this.viewMin = viewMin, fire(this._onscroll, null));
|
15127 | }, Scrollbar.prototype._scrollByPage = function(event) {}, Scrollbar.prototype._getRunningSize = function(net) {
|
15128 | return null;
|
15129 | }, Scrollbar.prototype._getOffsetDelta = function(event) {
|
15130 | return null;
|
15131 | }, Scrollbar.prototype.scroll = function(event) {
|
15132 | var delta = this._getOffsetDelta(event) / this._getRunningSize(!0) * (this.max - this.min);
|
15133 | if (0 > delta) {
|
15134 | if (this._getScreenMousePos(event) >= this._screenMaxMousePos) return;
|
15135 | } else if (delta > 0 && this._getScreenMousePos(event) <= this._screenMinMousePos) return;
|
15136 | this.scrollBy(delta);
|
15137 | }, Object.defineProperty(Scrollbar.prototype, "actualWidth", {
|
15138 | get: function() {
|
15139 | return void 0 === this._actualWidth && this.arrange(), this._actualWidth;
|
15140 | },
|
15141 | enumerable: !0,
|
15142 | configurable: !0
|
15143 | }), Object.defineProperty(Scrollbar.prototype, "actualHeight", {
|
15144 | get: function() {
|
15145 | return void 0 === !this._actualHeight && this.arrange(), this._actualHeight;
|
15146 | },
|
15147 | enumerable: !0,
|
15148 | configurable: !0
|
15149 | }), Object.defineProperty(Scrollbar.prototype, "actualButtonWidth", {
|
15150 | get: function() {
|
15151 | return void 0 === !this._actualButtonWidth && this.arrange(), this._actualButtonWidth;
|
15152 | },
|
15153 | enumerable: !0,
|
15154 | configurable: !0
|
15155 | }), Object.defineProperty(Scrollbar.prototype, "actualButtonHeight", {
|
15156 | get: function() {
|
15157 | return void 0 === !this._actualButtonHeight && this.arrange(), this._actualButtonHeight;
|
15158 | },
|
15159 | enumerable: !0,
|
15160 | configurable: !0
|
15161 | }), Scrollbar.prototype.arrange = function() {
|
15162 | this._actualWidth || (this._actualWidth = this._element.offsetWidth, this._actualHeight = this._element.offsetHeight,
|
15163 | this._actualButtonWidth = this._calculateButtonWidth(), this._actualButtonHeight = this._calculateButtonHeight(),
|
15164 | this._minButton.arrange(this._actualButtonWidth, this._actualButtonHeight, this._getMinButtonAngle()),
|
15165 | this._maxButton.arrange(this._actualButtonWidth, this._actualButtonHeight, this._getMaxButtonAngle()),
|
15166 | this._setMaxButtonPosition());
|
15167 | }, Scrollbar.prototype._calculateButtonWidth = function() {
|
15168 | return null;
|
15169 | }, Scrollbar.prototype._calculateButtonHeight = function() {
|
15170 | return null;
|
15171 | }, Scrollbar.prototype._getMinButtonAngle = function() {
|
15172 | return null;
|
15173 | }, Scrollbar.prototype._getMaxButtonAngle = function() {
|
15174 | return null;
|
15175 | }, Scrollbar.prototype._setMaxButtonPosition = function() {}, Scrollbar.prototype.invalidateArrange = function() {
|
15176 | this._actualWidth = void 0, this._actualHeight = void 0, this._actualButtonWidth = void 0,
|
15177 | this._actualButtonHeight = void 0;
|
15178 | }, Scrollbar.prototype.onHoldBackgroundMouseDown = function(event) {
|
15179 | var _this = this, holdDelay = this._timerHandle ? Scrollbar.ScrollbarBackgroundMousedownHoldDelay : Scrollbar.ScrollbarBackgroundFirstTimeMousedownHoldDelay;
|
15180 | this._timerHandle = setTimeout(function() {
|
15181 | _this.onBackgroundMouseDown(event);
|
15182 | }, holdDelay);
|
15183 | }, Scrollbar.prototype.onBackgroundMouseDown = function(event) {
|
15184 | var that = this;
|
15185 | clearTimeout(this._timerHandle), this._backgroundMouseUpWrapper || (event.cancelBubble = !0,
|
15186 | this._backgroundMouseUpWrapper = function(event) {
|
15187 | that.onBackgroundMouseUp(event);
|
15188 | }, Scrollbar.addDocumentMouseUpEvent(this._backgroundMouseUpWrapper)), this._scrollByPage(event),
|
15189 | this.refresh(), this.onHoldBackgroundMouseDown(event), event.preventDefault && event.preventDefault();
|
15190 | }, Scrollbar.prototype.onBackgroundMouseUp = function(event) {
|
15191 | clearTimeout(this._timerHandle), this._timerHandle = void 0, Scrollbar.removeDocumentMouseUpEvent(this._backgroundMouseUpWrapper),
|
15192 | this._backgroundMouseUpWrapper = void 0;
|
15193 | }, Scrollbar.prototype.getPinchZoomY = function() {
|
15194 | return document.documentElement.clientHeight / window.innerHeight;
|
15195 | }, Scrollbar.prototype.onMiddleBarMouseDown = function(event) {
|
15196 | event.cancelBubble = !0, this._screenPrevMousePos = {
|
15197 | x: event.screenX,
|
15198 | y: event.screenY
|
15199 | }, this._screenMinMousePos = this._getScreenMousePos(event) - (this._getScreenContextualLeft(this._middleBar) - this._getScreenContextualRight(this._minButton.element)),
|
15200 | this._screenMaxMousePos = this._getScreenMousePos(event) + (this._getScreenContextualLeft(this._maxButton.element) - this._getScreenContextualRight(this._middleBar)),
|
15201 | this._screenToOffsetScale = controls.HTMLElementUtils.getAccumulatedScale(this.element) * this.getPinchZoomY();
|
15202 | var that = this;
|
15203 | this._middleBarMouseMoveWrapper = function(e) {
|
15204 | that.onMiddleBarMouseMove(e);
|
15205 | }, Scrollbar.addDocumentMouseMoveEvent(this._middleBarMouseMoveWrapper), this._middleBarMouseUpWrapper = function(e) {
|
15206 | that.onMiddleBarMouseUp(e);
|
15207 | }, Scrollbar.addDocumentMouseUpEvent(this._middleBarMouseUpWrapper), event.preventDefault && event.preventDefault();
|
15208 | }, Scrollbar.prototype.onMiddleBarMouseMove = function(event) {
|
15209 | this._screenPrevMousePos && (this.scroll(event), this.refresh(), this._screenPrevMousePos = {
|
15210 | x: event.screenX,
|
15211 | y: event.screenY
|
15212 | });
|
15213 | }, Scrollbar.prototype.onMiddleBarMouseUp = function(event) {
|
15214 | this._screenPrevMousePos = void 0, Scrollbar.removeDocumentMouseMoveEvent(this._middleBarMouseMoveWrapper),
|
15215 | this._middleBarMouseMoveWrapper = void 0, Scrollbar.removeDocumentMouseUpEvent(this._middleBarMouseUpWrapper),
|
15216 | this._middleBarMouseUpWrapper = void 0, event.preventDefault && event.preventDefault();
|
15217 | }, Scrollbar.prototype._getScreenContextualLeft = function(element) {
|
15218 | return null;
|
15219 | }, Scrollbar.prototype._getScreenContextualRight = function(element) {
|
15220 | return null;
|
15221 | }, Scrollbar.prototype.onMouseWheel = function(e) {
|
15222 | e.wheelDelta && this.mouseWheel(e.wheelDelta), e.preventDefault();
|
15223 | }, Scrollbar.prototype.onFireFoxMouseWheel = function(e) {
|
15224 | e.detail && this.mouseWheel(-e.detail), e.preventDefault();
|
15225 | }, Scrollbar.prototype.mouseWheel = function(delta) {
|
15226 | this.visible && (0 > delta ? delta = Math.min(-Scrollbar.MouseWheelRange, delta) : delta > 0 && (delta = Math.max(Scrollbar.MouseWheelRange, delta)),
|
15227 | this.scrollBy(-delta / Scrollbar.MouseWheelRange * this.smallIncrement));
|
15228 | }, Scrollbar.prototype._getScreenMousePos = function(event) {
|
15229 | return null;
|
15230 | }, Scrollbar.addDocumentMouseUpEvent = function(func) {
|
15231 | document.addEventListener("mouseup", func);
|
15232 | }, Scrollbar.removeDocumentMouseUpEvent = function(func) {
|
15233 | document.removeEventListener("mouseup", func);
|
15234 | }, Scrollbar.addDocumentMouseMoveEvent = function(func) {
|
15235 | document.addEventListener("mousemove", func);
|
15236 | }, Scrollbar.removeDocumentMouseMoveEvent = function(func) {
|
15237 | document.removeEventListener("mousemove", func);
|
15238 | }, Scrollbar.DefaultScrollbarWidth = "15px", Scrollbar.ScrollbarBackgroundFirstTimeMousedownHoldDelay = 500,
|
15239 | Scrollbar.ScrollbarBackgroundMousedownHoldDelay = 50, Scrollbar.MouseWheelRange = 120,
|
15240 | Scrollbar.className = "scroll-bar-div", Scrollbar.barClassName = "scroll-bar-part-bar",
|
15241 | Scrollbar.arrowClassName = "scroll-bar-part-arrow", Scrollbar;
|
15242 | }();
|
15243 | controls.Scrollbar = Scrollbar;
|
15244 | var HorizontalScrollbar = function(_super) {
|
15245 | function HorizontalScrollbar(parentElement, layoutKind) {
|
15246 | _super.call(this, parentElement, layoutKind), this.height = Scrollbar.DefaultScrollbarWidth;
|
15247 | }
|
15248 | return __extends(HorizontalScrollbar, _super), HorizontalScrollbar.prototype._calculateButtonWidth = function() {
|
15249 | return Math.min(this.actualWidth / 2, Math.max(this.actualHeight, ScrollbarButton.MIN_WIDTH));
|
15250 | }, HorizontalScrollbar.prototype._calculateButtonHeight = function() {
|
15251 | return this.actualHeight;
|
15252 | }, HorizontalScrollbar.prototype._getMinButtonAngle = function() {
|
15253 | return -180;
|
15254 | }, HorizontalScrollbar.prototype._getMaxButtonAngle = function() {
|
15255 | return 0;
|
15256 | }, HorizontalScrollbar.prototype._setMaxButtonPosition = function() {
|
15257 | controls.HTMLElementUtils.setElementLeft(this.maxButton.element, this.actualWidth - this.actualButtonWidth);
|
15258 | }, HorizontalScrollbar.prototype.refresh = function() {
|
15259 | this.arrange();
|
15260 | var runningSize = this.actualWidth - 2 * this.actualButtonWidth - 2, barSize = this.viewSize / (this.max - this.min) * runningSize;
|
15261 | barSize < this.MIN_BAR_SIZE && (runningSize -= this.MIN_BAR_SIZE - barSize, barSize = this.MIN_BAR_SIZE),
|
15262 | 0 > runningSize && (runningSize = 0, barSize = 0), barSize = Math.min(barSize, runningSize);
|
15263 | var barPos = this.viewMin / (this.max - this.min) * runningSize;
|
15264 | controls.HTMLElementUtils.setElementWidth(this.middleBar, barSize), controls.HTMLElementUtils.setElementHeight(this.middleBar, this.actualHeight),
|
15265 | controls.HTMLElementUtils.setElementLeft(this.middleBar, this.actualButtonWidth + 1 + barPos);
|
15266 | }, HorizontalScrollbar.prototype.show = function(visible) {
|
15267 | visible !== this.visible && (_super.prototype.show.call(this, visible), visible ? this.element.style.height = this.height : controls.HTMLElementUtils.setElementHeight(this.element, 0));
|
15268 | }, HorizontalScrollbar.prototype._scrollByPage = function(event) {
|
15269 | var left = this.middleBar.offsetLeft, right = left + this.middleBar.offsetWidth, x = void 0 === event.offsetX ? event.layerX : event.offsetX;
|
15270 | x > right ? this.scrollPageDown() : left > x && this.scrollPageUp();
|
15271 | }, HorizontalScrollbar.prototype._getRunningSize = function(net) {
|
15272 | var result = this.actualWidth;
|
15273 | if (net) {
|
15274 | var barMinPos = this.actualButtonWidth + 1;
|
15275 | result -= 2 * barMinPos;
|
15276 | var barSize = result * (this.viewSize / (this.max - this.min));
|
15277 | barSize < this.MIN_BAR_SIZE && (result -= this.MIN_BAR_SIZE - barSize);
|
15278 | }
|
15279 | return result;
|
15280 | }, HorizontalScrollbar.prototype._getOffsetDelta = function(event) {
|
15281 | return this._getOffsetXDelta(event);
|
15282 | }, HorizontalScrollbar.prototype._getOffsetTouchDelta = function(e) {
|
15283 | return this._getOffsetXTouchDelta(e);
|
15284 | }, HorizontalScrollbar.prototype._getScreenContextualLeft = function(element) {
|
15285 | return element.getBoundingClientRect().left;
|
15286 | }, HorizontalScrollbar.prototype._getScreenContextualRight = function(element) {
|
15287 | return element.getBoundingClientRect().right;
|
15288 | }, HorizontalScrollbar.prototype._getScreenMousePos = function(event) {
|
15289 | return event.screenX;
|
15290 | }, HorizontalScrollbar;
|
15291 | }(Scrollbar);
|
15292 | controls.HorizontalScrollbar = HorizontalScrollbar;
|
15293 | var VerticalScrollbar = function(_super) {
|
15294 | function VerticalScrollbar(parentElement, layoutKind) {
|
15295 | _super.call(this, parentElement, layoutKind), this.width = Scrollbar.DefaultScrollbarWidth;
|
15296 | }
|
15297 | return __extends(VerticalScrollbar, _super), VerticalScrollbar.prototype._calculateButtonWidth = function() {
|
15298 | return this.actualWidth;
|
15299 | }, VerticalScrollbar.prototype._calculateButtonHeight = function() {
|
15300 | return Math.min(this.actualHeight / 2, Math.max(this.actualWidth, ScrollbarButton.MIN_WIDTH));
|
15301 | }, VerticalScrollbar.prototype._getMinButtonAngle = function() {
|
15302 | return -90;
|
15303 | }, VerticalScrollbar.prototype._getMaxButtonAngle = function() {
|
15304 | return 90;
|
15305 | }, VerticalScrollbar.prototype._setMaxButtonPosition = function() {
|
15306 | controls.HTMLElementUtils.setElementTop(this.maxButton.element, this.actualHeight - this.actualButtonHeight);
|
15307 | }, VerticalScrollbar.prototype.refresh = function() {
|
15308 | this.arrange();
|
15309 | var runningSize = this.actualHeight - 2 * this.actualButtonHeight - 2, barSize = this.viewSize / (this.max - this.min) * runningSize;
|
15310 | barSize < this.MIN_BAR_SIZE && (runningSize -= this.MIN_BAR_SIZE - barSize, barSize = this.MIN_BAR_SIZE),
|
15311 | 0 > runningSize && (runningSize = 0, barSize = 0);
|
15312 | var barPos = this.viewMin / (this.max - this.min) * runningSize;
|
15313 | controls.HTMLElementUtils.setElementWidth(this.middleBar, this.actualWidth), controls.HTMLElementUtils.setElementHeight(this.middleBar, barSize),
|
15314 | controls.HTMLElementUtils.setElementTop(this.middleBar, this.actualButtonHeight + 1 + barPos);
|
15315 | }, VerticalScrollbar.prototype.show = function(visible) {
|
15316 | visible !== this.visible && (_super.prototype.show.call(this, visible), visible ? this.element.style.width = this.width : controls.HTMLElementUtils.setElementWidth(this.element, 0));
|
15317 | }, VerticalScrollbar.prototype._scrollByPage = function(event) {
|
15318 | var top = this.middleBar.offsetTop, bottom = top + this.middleBar.offsetHeight, y = void 0 === event.offsetY ? event.layerY : event.offsetY;
|
15319 | y > bottom ? this.scrollPageDown() : top > y && this.scrollPageUp();
|
15320 | }, VerticalScrollbar.prototype._getRunningSize = function(net) {
|
15321 | var result = this.actualHeight;
|
15322 | if (net) {
|
15323 | var barMinPos = this.actualButtonHeight + 1;
|
15324 | result -= 2 * barMinPos;
|
15325 | var barSize = result * (this.viewSize / (this.max - this.min));
|
15326 | barSize < this.MIN_BAR_SIZE && (result -= this.MIN_BAR_SIZE - barSize);
|
15327 | }
|
15328 | return result;
|
15329 | }, VerticalScrollbar.prototype._getOffsetDelta = function(event) {
|
15330 | return this._getOffsetYDelta(event);
|
15331 | }, VerticalScrollbar.prototype._getOffsetTouchDelta = function(e) {
|
15332 | return this._getOffsetYTouchDelta(e);
|
15333 | }, VerticalScrollbar.prototype._getScreenContextualLeft = function(element) {
|
15334 | return element.getBoundingClientRect().top;
|
15335 | }, VerticalScrollbar.prototype._getScreenContextualRight = function(element) {
|
15336 | return element.getBoundingClientRect().bottom;
|
15337 | }, VerticalScrollbar.prototype._getScreenMousePos = function(event) {
|
15338 | return event.screenY;
|
15339 | }, VerticalScrollbar;
|
15340 | }(Scrollbar);
|
15341 | controls.VerticalScrollbar = VerticalScrollbar;
|
15342 | }(controls = visuals.controls || (visuals.controls = {}));
|
15343 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
15344 | }(powerbi || (powerbi = {}));
|
15345 |
|
15346 | var powerbi;
|
15347 |
|
15348 | !function(powerbi) {
|
15349 | var visuals;
|
15350 | !function(visuals) {
|
15351 | var controls;
|
15352 | !function(controls) {
|
15353 | var internal;
|
15354 | !function(internal) {
|
15355 | var UNSELECTABLE_CLASS_NAME = "unselectable", TablixResizer = function() {
|
15356 | function TablixResizer(element, handler) {
|
15357 | this._element = element, this._handler = handler, this._elementMouseDownWrapper = null,
|
15358 | this._elementMouseMoveWrapper = null, this._elementMouseOutWrapper = null, this._documentMouseMoveWrapper = null,
|
15359 | this._documentMouseUpWrapper = null, this._startMousePosition = null, this._originalCursor = null;
|
15360 | }
|
15361 | return TablixResizer.addDocumentMouseUpEvent = function(listener) {
|
15362 | document.addEventListener("mouseup", listener);
|
15363 | }, TablixResizer.removeDocumentMouseUpEvent = function(listener) {
|
15364 | document.removeEventListener("mouseup", listener);
|
15365 | }, TablixResizer.addDocumentMouseMoveEvent = function(listener) {
|
15366 | document.addEventListener("mousemove", listener);
|
15367 | }, TablixResizer.removeDocumentMouseMoveEvent = function(listener) {
|
15368 | document.removeEventListener("mousemove", listener);
|
15369 | }, TablixResizer.getMouseCoordinates = function(event) {
|
15370 | return {
|
15371 | x: event.pageX,
|
15372 | y: event.pageY
|
15373 | };
|
15374 | }, TablixResizer.getMouseCoordinateDelta = function(previous, current) {
|
15375 | return {
|
15376 | x: current.x - previous.x,
|
15377 | y: current.y - previous.y
|
15378 | };
|
15379 | }, TablixResizer.prototype.initialize = function() {
|
15380 | var _this = this;
|
15381 | this._elementMouseDownWrapper = function(e) {
|
15382 | return _this.onElementMouseDown(e);
|
15383 | }, this._element.addEventListener("mousedown", this._elementMouseDownWrapper), this._elementMouseMoveWrapper = function(e) {
|
15384 | return _this.onElementMouseMove(e);
|
15385 | }, this._element.addEventListener("mousemove", this._elementMouseMoveWrapper), this._elementMouseOutWrapper = function(e) {
|
15386 | return _this.onElementMouseOut(e);
|
15387 | }, this._element.addEventListener("mouseout", this._elementMouseOutWrapper), this._elementMouseDoubleClickOutWrapper = function(e) {
|
15388 | return _this.onElementMouseDoubleClick(e);
|
15389 | }, this._element.addEventListener("dblclick", this._elementMouseDoubleClickOutWrapper);
|
15390 | }, TablixResizer.prototype.uninitialize = function() {
|
15391 | this._element.removeEventListener("mousedown", this._elementMouseDownWrapper), this._elementMouseDownWrapper = null,
|
15392 | this._element.removeEventListener("mousemove", this._elementMouseMoveWrapper), this._elementMouseMoveWrapper = null,
|
15393 | this._element.removeEventListener("mouseout", this._elementMouseOutWrapper), this._elementMouseOutWrapper = null,
|
15394 | this._element.removeEventListener("dblclick", this._elementMouseDoubleClickOutWrapper),
|
15395 | this._elementMouseDoubleClickOutWrapper = null;
|
15396 | }, Object.defineProperty(TablixResizer.prototype, "cell", {
|
15397 | get: function() {
|
15398 | return null;
|
15399 | },
|
15400 | enumerable: !0,
|
15401 | configurable: !0
|
15402 | }), Object.defineProperty(TablixResizer.prototype, "element", {
|
15403 | get: function() {
|
15404 | return this._element;
|
15405 | },
|
15406 | enumerable: !0,
|
15407 | configurable: !0
|
15408 | }), TablixResizer.prototype._hotSpot = function(position) {
|
15409 | return !1;
|
15410 | }, TablixResizer.prototype.onElementMouseDown = function(event) {
|
15411 | var _this = this, position = TablixResizer.getMouseCoordinates(event);
|
15412 | this._hotSpot(position) && ("setCapture" in this._element && this._element.setCapture(),
|
15413 | event.cancelBubble = !0, this._startMousePosition = position, this._documentMouseMoveWrapper = function(e) {
|
15414 | return _this.onDocumentMouseMove(e);
|
15415 | }, TablixResizer.addDocumentMouseMoveEvent(this._documentMouseMoveWrapper), this._documentMouseUpWrapper = function(e) {
|
15416 | return _this.onDocumentMouseUp(e);
|
15417 | }, TablixResizer.addDocumentMouseUpEvent(this._documentMouseUpWrapper), document.documentElement && (this._originalCursor = document.documentElement.style.cursor,
|
15418 | document.documentElement.style.cursor = TablixResizer.resizeCursor), this._handler.onStartResize(this.cell, this._startMousePosition.x, this._startMousePosition.y));
|
15419 | }, TablixResizer.prototype.onElementMouseMove = function(event) {
|
15420 | this._startMousePosition || (this._hotSpot(TablixResizer.getMouseCoordinates(event)) ? null === this._originalCursor && (this._originalCursor = this._element.style.cursor,
|
15421 | this._element.style.cursor = TablixResizer.resizeCursor) : null !== this._originalCursor && (this._element.style.cursor = this._originalCursor,
|
15422 | this._originalCursor = null));
|
15423 | }, TablixResizer.prototype.onElementMouseOut = function(event) {
|
15424 | this._startMousePosition || null !== this._originalCursor && (this._element.style.cursor = this._originalCursor,
|
15425 | this._originalCursor = null);
|
15426 | }, TablixResizer.prototype.onElementMouseDoubleClick = function(event) {
|
15427 | this._hotSpot(TablixResizer.getMouseCoordinates(event)) && this._handler.onReset(this.cell);
|
15428 | }, TablixResizer.prototype.onDocumentMouseMove = function(event) {
|
15429 | if (this._startMousePosition) {
|
15430 | var delta = TablixResizer.getMouseCoordinateDelta(this._startMousePosition, TablixResizer.getMouseCoordinates(event));
|
15431 | this._handler.onResize(this.cell, delta.x, delta.y), event.preventDefault();
|
15432 | }
|
15433 | }, TablixResizer.prototype.onDocumentMouseUp = function(event) {
|
15434 | this._startMousePosition = null, "releaseCapture" in this._element && this._element.releaseCapture(),
|
15435 | TablixResizer.removeDocumentMouseMoveEvent(this._documentMouseMoveWrapper), this._documentMouseMoveWrapper = null,
|
15436 | TablixResizer.removeDocumentMouseUpEvent(this._documentMouseUpWrapper), this._documentMouseUpWrapper = null,
|
15437 | document.documentElement && (document.documentElement.style.cursor = this._originalCursor),
|
15438 | event.preventDefault && event.preventDefault(), this._handler.onEndResize(this.cell);
|
15439 | }, TablixResizer.resizeHandleSize = 4, TablixResizer.resizeCursor = "e-resize",
|
15440 | TablixResizer;
|
15441 | }();
|
15442 | internal.TablixResizer = TablixResizer;
|
15443 | var TablixDomResizer = function(_super) {
|
15444 | function TablixDomResizer(cell, element, handler) {
|
15445 | _super.call(this, element, handler), this._cell = cell;
|
15446 | }
|
15447 | return __extends(TablixDomResizer, _super), Object.defineProperty(TablixDomResizer.prototype, "cell", {
|
15448 | get: function() {
|
15449 | return this._cell;
|
15450 | },
|
15451 | enumerable: !0,
|
15452 | configurable: !0
|
15453 | }), TablixDomResizer.prototype._hotSpot = function(position) {
|
15454 | return position.x >= this.element.getBoundingClientRect().right - TablixResizer.resizeHandleSize;
|
15455 | }, TablixDomResizer;
|
15456 | }(TablixResizer);
|
15457 | internal.TablixDomResizer = TablixDomResizer;
|
15458 | var TablixCellPresenter = function() {
|
15459 | function TablixCellPresenter(fitProportionally, layoutKind) {
|
15460 | this._tableCell = null, this._contentElement = internal.TablixUtils.createDiv(),
|
15461 | this._contentHost = internal.TablixUtils.createDiv(), this.layoutKind = layoutKind,
|
15462 | this._contentElement.appendChild(this._contentHost), this._resizer = null;
|
15463 | }
|
15464 | return TablixCellPresenter.prototype.initialize = function(owner) {
|
15465 | this._owner = owner;
|
15466 | }, Object.defineProperty(TablixCellPresenter.prototype, "owner", {
|
15467 | get: function() {
|
15468 | return this._owner;
|
15469 | },
|
15470 | enumerable: !0,
|
15471 | configurable: !0
|
15472 | }), TablixCellPresenter.prototype.registerTableCell = function(tableCell) {
|
15473 | this._tableCell = tableCell, tableCell.appendChild(this._contentElement);
|
15474 | }, Object.defineProperty(TablixCellPresenter.prototype, "tableCell", {
|
15475 | get: function() {
|
15476 | return this._tableCell;
|
15477 | },
|
15478 | enumerable: !0,
|
15479 | configurable: !0
|
15480 | }), Object.defineProperty(TablixCellPresenter.prototype, "contentElement", {
|
15481 | get: function() {
|
15482 | return this._contentElement;
|
15483 | },
|
15484 | enumerable: !0,
|
15485 | configurable: !0
|
15486 | }), Object.defineProperty(TablixCellPresenter.prototype, "contentHost", {
|
15487 | get: function() {
|
15488 | return this._contentHost;
|
15489 | },
|
15490 | enumerable: !0,
|
15491 | configurable: !0
|
15492 | }), TablixCellPresenter.prototype.registerClickHandler = function(handler) {
|
15493 | this._contentElement.onclick = handler;
|
15494 | }, TablixCellPresenter.prototype.unregisterClickHandler = function() {
|
15495 | this._contentElement.onclick = null;
|
15496 | }, TablixCellPresenter.prototype.onContainerWidthChanged = function(value) {
|
15497 | controls.HTMLElementUtils.setElementWidth(this._contentElement, value);
|
15498 | }, TablixCellPresenter.prototype.onContinerHeightChanged = function(height) {
|
15499 | controls.HTMLElementUtils.setElementHeight(this._contentElement, height);
|
15500 | }, TablixCellPresenter.prototype.onColumnSpanChanged = function(value) {
|
15501 | this._tableCell.colSpan = value;
|
15502 | }, TablixCellPresenter.prototype.onRowSpanChanged = function(value) {
|
15503 | this._tableCell.rowSpan = value;
|
15504 | }, TablixCellPresenter.prototype.onTextAlignChanged = function(value) {
|
15505 | this._tableCell.style.textAlign = value;
|
15506 | }, TablixCellPresenter.prototype.onClear = function() {
|
15507 | this._contentHost.className = "", this._tableCell.className = "";
|
15508 | }, TablixCellPresenter.prototype.onHorizontalScroll = function(width, offset) {
|
15509 | controls.HTMLElementUtils.setElementLeft(this._contentHost, offset), controls.HTMLElementUtils.setElementWidth(this._contentHost, width);
|
15510 | }, TablixCellPresenter.prototype.onVerticalScroll = function(height, offset) {
|
15511 | controls.HTMLElementUtils.setElementTop(this._contentHost, offset), controls.HTMLElementUtils.setElementHeight(this._contentHost, height);
|
15512 | }, TablixCellPresenter.prototype.onInitializeScrolling = function() {
|
15513 | controls.HTMLElementUtils.setElementLeft(this._contentHost, 0), controls.HTMLElementUtils.setElementTop(this._contentHost, 0),
|
15514 | controls.HTMLElementUtils.setElementWidth(this._contentHost, -1), controls.HTMLElementUtils.setElementHeight(this._contentHost, -1);
|
15515 | }, TablixCellPresenter.prototype.enableHorizontalResize = function(enable, handler) {
|
15516 | enable !== (null !== this._resizer) && (enable ? (this._resizer = new TablixDomResizer(this._owner, this._tableCell, handler),
|
15517 | this._resizer.initialize()) : (this._resizer.uninitialize(), this._resizer = null));
|
15518 | }, TablixCellPresenter.prototype.disableDragResize = function() {
|
15519 | this._tableCell.setAttribute(TablixCellPresenter._dragResizeDisabledAttributeName, "true");
|
15520 | }, TablixCellPresenter._dragResizeDisabledAttributeName = "drag-resize-disabled",
|
15521 | TablixCellPresenter;
|
15522 | }();
|
15523 | internal.TablixCellPresenter = TablixCellPresenter;
|
15524 | var TablixRowPresenter = function() {
|
15525 | function TablixRowPresenter(fitProportionally) {
|
15526 | this._tableRow = null, this._fitProportionally = fitProportionally;
|
15527 | }
|
15528 | return TablixRowPresenter.prototype.initialize = function(row) {
|
15529 | this._row = row;
|
15530 | }, TablixRowPresenter.prototype.createCellPresenter = function(layoutKind) {
|
15531 | return new TablixCellPresenter(this._fitProportionally, layoutKind);
|
15532 | }, TablixRowPresenter.prototype.registerRow = function(tableRow) {
|
15533 | this._tableRow = tableRow;
|
15534 | }, TablixRowPresenter.prototype.onAppendCell = function(cell) {
|
15535 | var presenter = cell._presenter;
|
15536 | if (null === presenter.tableCell) {
|
15537 | var tableCell = this._tableRow.insertCell(-1);
|
15538 | presenter.registerTableCell(tableCell);
|
15539 | } else this._tableRow.appendChild(presenter.tableCell);
|
15540 | }, TablixRowPresenter.prototype.onInsertCellBefore = function(cell, refCell) {
|
15541 | var presenter = cell._presenter;
|
15542 | if (null === presenter.tableCell) {
|
15543 | var tableCell = this._tableRow.insertCell(Math.max(0, refCell._presenter.tableCell.cellIndex - 1));
|
15544 | presenter.registerTableCell(tableCell);
|
15545 | } else this._tableRow.insertBefore(cell._presenter.tableCell, refCell._presenter.tableCell);
|
15546 | }, TablixRowPresenter.prototype.onRemoveCell = function(cell) {
|
15547 | this._tableRow.removeChild(cell._presenter.tableCell);
|
15548 | }, TablixRowPresenter.prototype.getHeight = function() {
|
15549 | return this.getCellHeight(this._row.getTablixCell());
|
15550 | }, TablixRowPresenter.prototype.getCellHeight = function(cell) {
|
15551 | return -1;
|
15552 | }, TablixRowPresenter.prototype.getCellContentHeight = function(cell) {
|
15553 | return -1;
|
15554 | }, Object.defineProperty(TablixRowPresenter.prototype, "tableRow", {
|
15555 | get: function() {
|
15556 | return this._tableRow;
|
15557 | },
|
15558 | enumerable: !0,
|
15559 | configurable: !0
|
15560 | }), TablixRowPresenter;
|
15561 | }();
|
15562 | internal.TablixRowPresenter = TablixRowPresenter;
|
15563 | var DashboardRowPresenter = function(_super) {
|
15564 | function DashboardRowPresenter(gridPresenter, fitProportionally) {
|
15565 | _super.call(this, fitProportionally), this._gridPresenter = gridPresenter;
|
15566 | }
|
15567 | return __extends(DashboardRowPresenter, _super), DashboardRowPresenter.prototype.getCellHeight = function(cell) {
|
15568 | return cell.containerHeight;
|
15569 | }, DashboardRowPresenter.prototype.getCellContentHeight = function(cell) {
|
15570 | return cell.contentHeight;
|
15571 | }, DashboardRowPresenter;
|
15572 | }(TablixRowPresenter);
|
15573 | internal.DashboardRowPresenter = DashboardRowPresenter;
|
15574 | var CanvasRowPresenter = function(_super) {
|
15575 | function CanvasRowPresenter() {
|
15576 | _super.apply(this, arguments);
|
15577 | }
|
15578 | return __extends(CanvasRowPresenter, _super), CanvasRowPresenter.prototype.getCellHeight = function(cell) {
|
15579 | return cell.containerHeight;
|
15580 | }, CanvasRowPresenter.prototype.getCellContentHeight = function(cell) {
|
15581 | return cell.contentHeight;
|
15582 | }, CanvasRowPresenter;
|
15583 | }(TablixRowPresenter);
|
15584 | internal.CanvasRowPresenter = CanvasRowPresenter;
|
15585 | var TablixColumnPresenter = function() {
|
15586 | function TablixColumnPresenter() {}
|
15587 | return TablixColumnPresenter.prototype.initialize = function(column) {
|
15588 | this._column = column;
|
15589 | }, TablixColumnPresenter.prototype.getWidth = function() {
|
15590 | return this.getCellWidth(this._column.getTablixCell());
|
15591 | }, TablixColumnPresenter.prototype.getCellWidth = function(cell) {
|
15592 | return -1;
|
15593 | }, TablixColumnPresenter.prototype.getCellContentWidth = function(cell) {
|
15594 | return -1;
|
15595 | }, TablixColumnPresenter;
|
15596 | }();
|
15597 | internal.TablixColumnPresenter = TablixColumnPresenter;
|
15598 | var DashboardColumnPresenter = function(_super) {
|
15599 | function DashboardColumnPresenter(gridPresenter) {
|
15600 | _super.call(this), this._gridPresenter = gridPresenter;
|
15601 | }
|
15602 | return __extends(DashboardColumnPresenter, _super), DashboardColumnPresenter.prototype.getCellWidth = function(cell) {
|
15603 | return this._gridPresenter.sizeComputationManager.cellWidth;
|
15604 | }, DashboardColumnPresenter.prototype.getCellContentWidth = function(cell) {
|
15605 | return this._gridPresenter.sizeComputationManager.contentWidth;
|
15606 | }, DashboardColumnPresenter;
|
15607 | }(TablixColumnPresenter);
|
15608 | internal.DashboardColumnPresenter = DashboardColumnPresenter;
|
15609 | var CanvasColumnPresenter = function(_super) {
|
15610 | function CanvasColumnPresenter(gridPresenter, index) {
|
15611 | _super.call(this), this._gridPresenter = gridPresenter, this._columnIndex = index;
|
15612 | }
|
15613 | return __extends(CanvasColumnPresenter, _super), CanvasColumnPresenter.prototype.getCellWidth = function(cell) {
|
15614 | var persistedWidth = this._gridPresenter.getPersistedCellWidth(this._columnIndex);
|
15615 | return _.isNumber(persistedWidth) ? persistedWidth : cell._presenter ? controls.HTMLElementUtils.getElementWidth(cell._presenter.tableCell) : 0;
|
15616 | }, CanvasColumnPresenter.prototype.getCellContentWidth = function(cell) {
|
15617 | var persistedWidth = this._gridPresenter.getPersistedCellWidth(this._columnIndex);
|
15618 | if (_.isNumber(persistedWidth)) return persistedWidth;
|
15619 | if (!cell._presenter) return 0;
|
15620 | var requiredWidth = controls.HTMLElementUtils.getElementWidth(cell._presenter.contentElement);
|
15621 | return requiredWidth > 0 && 1 === cell.colSpan && (requiredWidth += 1), requiredWidth;
|
15622 | }, CanvasColumnPresenter;
|
15623 | }(TablixColumnPresenter);
|
15624 | internal.CanvasColumnPresenter = CanvasColumnPresenter;
|
15625 | var TablixGridPresenter = function() {
|
15626 | function TablixGridPresenter(columnWidthManager) {
|
15627 | this._table = internal.TablixUtils.createTable(), this._table.className = UNSELECTABLE_CLASS_NAME,
|
15628 | this._footerTable = internal.TablixUtils.createTable(), this._footerTable.className = UNSELECTABLE_CLASS_NAME,
|
15629 | this._columnWidthManager = columnWidthManager;
|
15630 | }
|
15631 | return TablixGridPresenter.prototype.initialize = function(owner, gridHost, footerHost, control) {
|
15632 | this._owner = owner, gridHost.appendChild(this._table), footerHost.appendChild(this._footerTable);
|
15633 | }, TablixGridPresenter.prototype.getWidth = function() {
|
15634 | return -1;
|
15635 | }, TablixGridPresenter.prototype.getHeight = function() {
|
15636 | return -1;
|
15637 | }, TablixGridPresenter.prototype.getScreenToCssRatioX = function() {
|
15638 | return 1;
|
15639 | }, TablixGridPresenter.prototype.getScreenToCssRatioY = function() {
|
15640 | return 1;
|
15641 | }, TablixGridPresenter.prototype.createRowPresenter = function() {
|
15642 | return null;
|
15643 | }, TablixGridPresenter.prototype.createColumnPresenter = function(index) {
|
15644 | return null;
|
15645 | }, TablixGridPresenter.prototype.onAppendRow = function(row) {
|
15646 | var presenter = row.presenter;
|
15647 | if (null === presenter.tableRow) {
|
15648 | var tableRow = this._table.insertRow(-1);
|
15649 | presenter.registerRow(tableRow);
|
15650 | } else this._table.tBodies[0].appendChild(row.presenter.tableRow);
|
15651 | }, TablixGridPresenter.prototype.onInsertRowBefore = function(row, refRow) {
|
15652 | var presenter = row.presenter;
|
15653 | if (null === presenter.tableRow) {
|
15654 | var tableRow = this._table.insertRow(Math.max(0, refRow.presenter.tableRow.rowIndex - 1));
|
15655 | presenter.registerRow(tableRow);
|
15656 | } else this._table.tBodies[0].insertBefore(row.presenter.tableRow, refRow.presenter.tableRow);
|
15657 | }, TablixGridPresenter.prototype.onRemoveRow = function(row) {
|
15658 | this._table.tBodies[0].removeChild(row.presenter.tableRow);
|
15659 | }, TablixGridPresenter.prototype.onAddFooterRow = function(row) {
|
15660 | var presenter = row.presenter;
|
15661 | if (null === presenter.tableRow) {
|
15662 | var tableRow = this._footerTable.insertRow(-1);
|
15663 | presenter.registerRow(tableRow);
|
15664 | } else this._footerTable.tBodies[0].appendChild(row.presenter.tableRow);
|
15665 | }, TablixGridPresenter.prototype.onClear = function() {
|
15666 | controls.HTMLElementUtils.clearChildren(this._table), controls.HTMLElementUtils.clearChildren(this._footerTable);
|
15667 | }, TablixGridPresenter.prototype.onFillColumnsProportionallyChanged = function(value) {
|
15668 | value ? (this._table.style.width = "100%", this._footerTable.style.width = "100%") : (this._table.style.width = "auto",
|
15669 | this._footerTable.style.width = "auto");
|
15670 | }, TablixGridPresenter.prototype.invokeColumnResizeEndCallback = function(columnIndex, width) {
|
15671 | this._columnWidthManager && this._columnWidthManager.onColumnWidthChanged(columnIndex, width);
|
15672 | }, TablixGridPresenter.prototype.getPersistedCellWidth = function(columnIndex) {
|
15673 | return this._columnWidthManager ? this._columnWidthManager.getPersistedColumnWidth(columnIndex) : void 0;
|
15674 | }, TablixGridPresenter;
|
15675 | }();
|
15676 | internal.TablixGridPresenter = TablixGridPresenter;
|
15677 | var DashboardTablixGridPresenter = function(_super) {
|
15678 | function DashboardTablixGridPresenter(sizeComputationManager) {
|
15679 | _super.call(this), this._sizeComputationManager = sizeComputationManager;
|
15680 | }
|
15681 | return __extends(DashboardTablixGridPresenter, _super), DashboardTablixGridPresenter.prototype.createRowPresenter = function() {
|
15682 | return new DashboardRowPresenter(this, this._owner.fillColumnsProportionally);
|
15683 | }, DashboardTablixGridPresenter.prototype.createColumnPresenter = function(index) {
|
15684 | return new DashboardColumnPresenter(this);
|
15685 | }, Object.defineProperty(DashboardTablixGridPresenter.prototype, "sizeComputationManager", {
|
15686 | get: function() {
|
15687 | return this._sizeComputationManager;
|
15688 | },
|
15689 | enumerable: !0,
|
15690 | configurable: !0
|
15691 | }), DashboardTablixGridPresenter.prototype.getWidth = function() {
|
15692 | return this._sizeComputationManager.gridWidth;
|
15693 | }, DashboardTablixGridPresenter.prototype.getHeight = function() {
|
15694 | return this._sizeComputationManager.gridHeight;
|
15695 | }, DashboardTablixGridPresenter;
|
15696 | }(TablixGridPresenter);
|
15697 | internal.DashboardTablixGridPresenter = DashboardTablixGridPresenter;
|
15698 | var CanvasTablixGridPresenter = function(_super) {
|
15699 | function CanvasTablixGridPresenter(columnWidthManager) {
|
15700 | _super.call(this, columnWidthManager);
|
15701 | }
|
15702 | return __extends(CanvasTablixGridPresenter, _super), CanvasTablixGridPresenter.prototype.createRowPresenter = function() {
|
15703 | return new CanvasRowPresenter(this._owner.fillColumnsProportionally);
|
15704 | }, CanvasTablixGridPresenter.prototype.createColumnPresenter = function(index) {
|
15705 | return new CanvasColumnPresenter(this, index);
|
15706 | }, CanvasTablixGridPresenter.prototype.getWidth = function() {
|
15707 | return controls.HTMLElementUtils.getElementWidth(this._table);
|
15708 | }, CanvasTablixGridPresenter.prototype.getHeight = function() {
|
15709 | return controls.HTMLElementUtils.getElementHeight(this._table);
|
15710 | }, CanvasTablixGridPresenter;
|
15711 | }(TablixGridPresenter);
|
15712 | internal.CanvasTablixGridPresenter = CanvasTablixGridPresenter;
|
15713 | }(internal = controls.internal || (controls.internal = {}));
|
15714 | }(controls = visuals.controls || (visuals.controls = {}));
|
15715 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
15716 | }(powerbi || (powerbi = {}));
|
15717 |
|
15718 | var powerbi;
|
15719 |
|
15720 | !function(powerbi) {
|
15721 | var visuals;
|
15722 | !function(visuals) {
|
15723 | var controls;
|
15724 | !function(controls) {
|
15725 | var internal;
|
15726 | !function(internal) {
|
15727 | var TablixDimensionRealizationManager = function() {
|
15728 | function TablixDimensionRealizationManager(binder) {
|
15729 | this._binder = binder, this._adjustmentFactor = 1;
|
15730 | }
|
15731 | return TablixDimensionRealizationManager.prototype._getOwner = function() {
|
15732 | return null;
|
15733 | }, Object.defineProperty(TablixDimensionRealizationManager.prototype, "binder", {
|
15734 | get: function() {
|
15735 | return this._binder;
|
15736 | },
|
15737 | enumerable: !0,
|
15738 | configurable: !0
|
15739 | }), Object.defineProperty(TablixDimensionRealizationManager.prototype, "adjustmentFactor", {
|
15740 | get: function() {
|
15741 | return this._adjustmentFactor;
|
15742 | },
|
15743 | enumerable: !0,
|
15744 | configurable: !0
|
15745 | }), Object.defineProperty(TablixDimensionRealizationManager.prototype, "itemsToRealizeCount", {
|
15746 | get: function() {
|
15747 | return this._itemsToRealizeCount;
|
15748 | },
|
15749 | set: function(count) {
|
15750 | this._itemsToRealizeCount = count;
|
15751 | },
|
15752 | enumerable: !0,
|
15753 | configurable: !0
|
15754 | }), Object.defineProperty(TablixDimensionRealizationManager.prototype, "itemsEstimatedContextualWidth", {
|
15755 | get: function() {
|
15756 | return this._itemsEstimatedContextualWidth;
|
15757 | },
|
15758 | set: function(contextualWidth) {
|
15759 | this._itemsEstimatedContextualWidth = contextualWidth;
|
15760 | },
|
15761 | enumerable: !0,
|
15762 | configurable: !0
|
15763 | }), TablixDimensionRealizationManager.prototype.onStartRenderingIteration = function() {
|
15764 | var owner = this._getOwner();
|
15765 | owner.measureEnabled && !owner.done && this._getEstimatedItemsToRealizeCount(),
|
15766 | this._realizedLeavesCount = 0;
|
15767 | }, TablixDimensionRealizationManager.prototype.onEndRenderingIteration = function(gridContextualWidth, filled) {
|
15768 | filled || this._getOwner().allItemsRealized || (this._adjustmentFactor *= this._getSizeAdjustment(gridContextualWidth));
|
15769 | }, TablixDimensionRealizationManager.prototype.onEndRenderingSession = function() {
|
15770 | this._adjustmentFactor = 1;
|
15771 | }, TablixDimensionRealizationManager.prototype.onCornerCellRealized = function(item, cell) {},
|
15772 | TablixDimensionRealizationManager.prototype.onHeaderRealized = function(item, cell, leaf) {
|
15773 | leaf && this._realizedLeavesCount++;
|
15774 | }, Object.defineProperty(TablixDimensionRealizationManager.prototype, "needsToRealize", {
|
15775 | get: function() {
|
15776 | return this._realizedLeavesCount < this._itemsToRealizeCount;
|
15777 | },
|
15778 | enumerable: !0,
|
15779 | configurable: !0
|
15780 | }), TablixDimensionRealizationManager.prototype._getEstimatedItemsToRealizeCount = function() {},
|
15781 | TablixDimensionRealizationManager.prototype._getSizeAdjustment = function(gridContextualWidth) {
|
15782 | return 1;
|
15783 | }, TablixDimensionRealizationManager;
|
15784 | }();
|
15785 | internal.TablixDimensionRealizationManager = TablixDimensionRealizationManager;
|
15786 | var RowRealizationManager = function(_super) {
|
15787 | function RowRealizationManager() {
|
15788 | _super.apply(this, arguments);
|
15789 | }
|
15790 | return __extends(RowRealizationManager, _super), Object.defineProperty(RowRealizationManager.prototype, "owner", {
|
15791 | set: function(owner) {
|
15792 | this._owner = owner;
|
15793 | },
|
15794 | enumerable: !0,
|
15795 | configurable: !0
|
15796 | }), RowRealizationManager.prototype._getOwner = function() {
|
15797 | return this._owner;
|
15798 | }, RowRealizationManager.prototype._getEstimatedItemsToRealizeCount = function() {
|
15799 | this.estimateRowsToRealizeCount();
|
15800 | }, RowRealizationManager.prototype.estimateRowsToRealizeCount = function() {
|
15801 | 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);
|
15802 | }, RowRealizationManager.prototype.getEstimatedRowHierarchyWidth = function() {
|
15803 | if (!this._owner.dimension.model || 0 === this._owner.dimension.getItemsCount()) return 0;
|
15804 | var levels = new RowWidths();
|
15805 | this.updateRowHiearchyEstimatedWidth(this._owner.dimension.model, this._owner.dimension._hierarchyNavigator.getIndex(this._owner.dimension.getFirstVisibleItem(0)), levels);
|
15806 | for (var levelsArray = levels.items, levelCount = levelsArray.length, width = 0, i = 0; levelCount > i; i++) {
|
15807 | var level = levelsArray[i];
|
15808 | width += 0 !== level.maxNonLeafWidth ? level.maxNonLeafWidth : level.maxLeafWidth;
|
15809 | }
|
15810 | return width;
|
15811 | }, RowRealizationManager.prototype.updateRowHiearchyEstimatedWidth = function(items, firstVisibleIndex, levels) {
|
15812 | for (var hierarchyNavigator = this._owner.owner.owner.hierarchyNavigator, binder = this.binder, length = hierarchyNavigator.getCount(items), i = firstVisibleIndex; length > i; i++) {
|
15813 | if (levels.leafCount === this.itemsToRealizeCount) return;
|
15814 | 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];
|
15815 | level || (level = new RowWidth(), levels.items[l] = level), isLeaf ? (level.maxLeafWidth = Math.max(level.maxLeafWidth, itemWidth),
|
15816 | levels.leafCount = levels.leafCount + 1) : (level.maxNonLeafWidth = Math.max(level.maxNonLeafWidth, itemWidth),
|
15817 | this.updateRowHiearchyEstimatedWidth(hierarchyNavigator.getChildren(item), this._owner.dimension.getFirstVisibleChildIndex(item), levels));
|
15818 | }
|
15819 | }, RowRealizationManager.prototype._getSizeAdjustment = function(gridContextualWidth) {
|
15820 | return gridContextualWidth / ((this._owner.getRealizedItemsCount() - this._owner.dimension.getFractionScrollOffset()) * this._owner.owner.getEstimatedRowHeight());
|
15821 | }, RowRealizationManager;
|
15822 | }(TablixDimensionRealizationManager);
|
15823 | internal.RowRealizationManager = RowRealizationManager;
|
15824 | var ColumnRealizationManager = function(_super) {
|
15825 | function ColumnRealizationManager() {
|
15826 | _super.apply(this, arguments);
|
15827 | }
|
15828 | return __extends(ColumnRealizationManager, _super), Object.defineProperty(ColumnRealizationManager.prototype, "owner", {
|
15829 | set: function(owner) {
|
15830 | this._owner = owner;
|
15831 | },
|
15832 | enumerable: !0,
|
15833 | configurable: !0
|
15834 | }), ColumnRealizationManager.prototype._getOwner = function() {
|
15835 | return this._owner;
|
15836 | }, ColumnRealizationManager.prototype._getEstimatedItemsToRealizeCount = function() {
|
15837 | this.estimateColumnsToRealizeCount(this.getEstimatedRowHierarchyWidth());
|
15838 | }, Object.defineProperty(ColumnRealizationManager.prototype, "rowRealizationManager", {
|
15839 | get: function() {
|
15840 | return this._owner.otherLayoutManager.realizationManager;
|
15841 | },
|
15842 | enumerable: !0,
|
15843 | configurable: !0
|
15844 | }), ColumnRealizationManager.prototype.getEstimatedRowHierarchyWidth = function() {
|
15845 | return this._owner.otherLayoutManager.done ? this._owner.getOtherHierarchyContextualHeight() : this.rowRealizationManager.getEstimatedRowHierarchyWidth() * this.adjustmentFactor;
|
15846 | }, ColumnRealizationManager.prototype.estimateColumnsToRealizeCount = function(rowHierarchyWidth) {
|
15847 | var widthToFill = this._owner.contextualWidthToFill - rowHierarchyWidth;
|
15848 | if (!this._owner.dimension.model || powerbi.Double.lessOrEqualWithPrecision(widthToFill, 0, internal.DimensionLayoutManager._pixelPrecision)) return void (this.itemsToRealizeCount = 0);
|
15849 | 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();
|
15850 | if (this.itemsEstimatedContextualWidth = 0, this._owner.alignToEnd) return void (this.itemsToRealizeCount = columnCount);
|
15851 | for (var i = startColumnIndex; endColumnIndex > i; i++) {
|
15852 | if (powerbi.Double.greaterOrEqualWithPrecision(this.itemsEstimatedContextualWidth, widthToFill, internal.DimensionLayoutManager._pixelPrecision)) return void (this.itemsToRealizeCount = i - startColumnIndex);
|
15853 | var maxWidth = 0, visibleSizeRatio = void 0;
|
15854 | visibleSizeRatio = i === startColumnIndex ? this._owner.getVisibleSizeRatio() : 1;
|
15855 | var columnMember = hierarchyNavigator.getLeafAt(this._owner.dimension.model, i), label = binder.getHeaderLabel(columnMember);
|
15856 | maxWidth = Math.max(maxWidth, this._owner.getEstimatedHeaderWidth(label, i));
|
15857 | for (var j = startRowIndex; endRowIndex > j; j++) {
|
15858 | var intersection = hierarchyNavigator.getIntersection(hierarchyNavigator.getLeafAt(this._owner.otherLayoutManager.dimension.model, j), columnMember);
|
15859 | label = binder.getCellContent(intersection), maxWidth = Math.max(maxWidth, this._owner.getEstimatedBodyCellWidth(label));
|
15860 | }
|
15861 | this.itemsEstimatedContextualWidth += maxWidth * visibleSizeRatio * this.adjustmentFactor;
|
15862 | }
|
15863 | this.itemsToRealizeCount = columnCount;
|
15864 | }, ColumnRealizationManager.prototype._getSizeAdjustment = function(gridContextualWidth) {
|
15865 | return gridContextualWidth / (this.getEstimatedRowHierarchyWidth() + this.itemsEstimatedContextualWidth);
|
15866 | }, ColumnRealizationManager;
|
15867 | }(TablixDimensionRealizationManager);
|
15868 | internal.ColumnRealizationManager = ColumnRealizationManager;
|
15869 | var RowWidths = function() {
|
15870 | function RowWidths() {
|
15871 | this.items = [], this.leafCount = 0;
|
15872 | }
|
15873 | return RowWidths;
|
15874 | }();
|
15875 | internal.RowWidths = RowWidths;
|
15876 | var RowWidth = function() {
|
15877 | function RowWidth() {
|
15878 | this.maxLeafWidth = 0, this.maxNonLeafWidth = 0;
|
15879 | }
|
15880 | return RowWidth;
|
15881 | }();
|
15882 | internal.RowWidth = RowWidth;
|
15883 | }(internal = controls.internal || (controls.internal = {}));
|
15884 | }(controls = visuals.controls || (visuals.controls = {}));
|
15885 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
15886 | }(powerbi || (powerbi = {}));
|
15887 |
|
15888 | var powerbi;
|
15889 |
|
15890 | !function(powerbi) {
|
15891 | var visuals;
|
15892 | !function(visuals) {
|
15893 | var controls;
|
15894 | !function(controls) {
|
15895 | var internal;
|
15896 | !function(internal) {
|
15897 | var TablixCell = function() {
|
15898 | function TablixCell(presenter, extension, row) {
|
15899 | this._scrollable = !1, this._presenter = presenter, this.extension = extension,
|
15900 | this._presenter.initialize(this), this._row = row, this.item = null, this.type = null,
|
15901 | this._horizontalOffset = 0, this._verticalOffset = 0, this._colSpan = 1, this._rowSpan = 1,
|
15902 | this._containerWidth = -1, this._containerHeight = -1, this.contentHeight = this.contentWidth = 0,
|
15903 | this.position = new internal.TablixUtils.CellPosition();
|
15904 | }
|
15905 | return TablixCell.prototype.unfixRowHeight = function() {
|
15906 | this._row.unfixSize();
|
15907 | }, Object.defineProperty(TablixCell.prototype, "colSpan", {
|
15908 | get: function() {
|
15909 | return this._colSpan;
|
15910 | },
|
15911 | set: function(value) {
|
15912 | this._colSpan !== value && (this._presenter.onColumnSpanChanged(value), this._colSpan = value);
|
15913 | },
|
15914 | enumerable: !0,
|
15915 | configurable: !0
|
15916 | }), Object.defineProperty(TablixCell.prototype, "rowSpan", {
|
15917 | get: function() {
|
15918 | return this._rowSpan;
|
15919 | },
|
15920 | set: function(value) {
|
15921 | this._rowSpan !== value && (this._presenter.onRowSpanChanged(value), this._rowSpan = value,
|
15922 | this._row.unfixSize());
|
15923 | },
|
15924 | enumerable: !0,
|
15925 | configurable: !0
|
15926 | }), TablixCell.prototype.getCellSpanningHeight = function() {
|
15927 | return this._row.getCellSpanningHeight(this);
|
15928 | }, Object.defineProperty(TablixCell.prototype, "textAlign", {
|
15929 | get: function() {
|
15930 | return this._textAlign;
|
15931 | },
|
15932 | set: function(value) {
|
15933 | value !== this._textAlign && (this._presenter.onTextAlignChanged(value), this._textAlign = value);
|
15934 | },
|
15935 | enumerable: !0,
|
15936 | configurable: !0
|
15937 | }), Object.defineProperty(TablixCell.prototype, "horizontalOffset", {
|
15938 | get: function() {
|
15939 | return this._horizontalOffset;
|
15940 | },
|
15941 | enumerable: !0,
|
15942 | configurable: !0
|
15943 | }), Object.defineProperty(TablixCell.prototype, "verticalOffset", {
|
15944 | get: function() {
|
15945 | return this._verticalOffset;
|
15946 | },
|
15947 | enumerable: !0,
|
15948 | configurable: !0
|
15949 | }), TablixCell.prototype.isScrollable = function() {
|
15950 | return this._scrollable;
|
15951 | }, TablixCell.prototype.clear = function() {
|
15952 | this.isScrollable() && this.initializeScrolling(), this._presenter.onClear(), this.setContainerWidth(-1),
|
15953 | this.setContainerHeight(-1), this.contentHeight = this.contentWidth = 0;
|
15954 | }, TablixCell.prototype.initializeScrolling = function() {
|
15955 | this._presenter.onInitializeScrolling(), this._horizontalOffset = 0, this._verticalOffset = 0,
|
15956 | 1 === this.colSpan && this.setContainerWidth(-1), 1 === this.rowSpan && this.setContainerHeight(-1);
|
15957 | }, TablixCell.prototype.prepare = function(scrollable) {
|
15958 | this.isScrollable() && this.initializeScrolling(), this._scrollable = scrollable;
|
15959 | }, TablixCell.prototype.scrollVertically = function(height, offset) {
|
15960 | var offsetInPixels = Math.ceil(-height * offset);
|
15961 | this._verticalOffset = offsetInPixels, this.isScrollable() ? (this._presenter.onVerticalScroll(height, offsetInPixels),
|
15962 | this.setContainerHeight(height + offsetInPixels)) : this.setContainerHeight(this._row.getCellSpanningHeight(this) + offsetInPixels);
|
15963 | }, TablixCell.prototype.scrollHorizontally = function(width, offset) {
|
15964 | if (this.isScrollable()) {
|
15965 | var offsetInPixels = Math.ceil(-width * offset);
|
15966 | this._horizontalOffset = offsetInPixels, this._presenter.onHorizontalScroll(width, offsetInPixels),
|
15967 | this.setContainerWidth(width + offsetInPixels);
|
15968 | }
|
15969 | }, TablixCell.prototype.setContainerWidth = function(value) {
|
15970 | value !== this._containerWidth && (this._containerWidth = value, this._presenter.onContainerWidthChanged(value));
|
15971 | }, Object.defineProperty(TablixCell.prototype, "containerWidth", {
|
15972 | get: function() {
|
15973 | return this._containerWidth;
|
15974 | },
|
15975 | enumerable: !0,
|
15976 | configurable: !0
|
15977 | }), TablixCell.prototype.setContainerHeight = function(value) {
|
15978 | 0 > value && (value = -1), value !== this._containerHeight && (this._containerHeight = value,
|
15979 | this._presenter.onContinerHeightChanged(value));
|
15980 | }, Object.defineProperty(TablixCell.prototype, "containerHeight", {
|
15981 | get: function() {
|
15982 | return this._containerHeight;
|
15983 | },
|
15984 | enumerable: !0,
|
15985 | configurable: !0
|
15986 | }), TablixCell.prototype.applyStyle = function(style) {
|
15987 | style && (style.applyStyle(this), this.contentHeight += style.getExtraBottom() + style.getExtraTop(),
|
15988 | this.contentWidth += style.getExtraLeft() + style.getExtraRight());
|
15989 | }, TablixCell.prototype.enableHorizontalResize = function(enable, handler) {
|
15990 | this._presenter.enableHorizontalResize(enable, handler);
|
15991 | }, TablixCell;
|
15992 | }();
|
15993 | internal.TablixCell = TablixCell;
|
15994 | var TablixColumn = function() {
|
15995 | function TablixColumn(presenter, columnIndex) {
|
15996 | this._presenter = presenter, this._presenter.initialize(this), this._containerWidth = -1,
|
15997 | this._width = -1, this._sizeFixed = !1, this._aligningWidth = -1, this._fixedToAligningWidth = !1,
|
15998 | this._items = [], this._itemType = null, this._footerCell = null, this._columnIndex = columnIndex;
|
15999 | }
|
16000 | return TablixColumn.prototype.initialize = function(owner) {
|
16001 | this._owner = owner, this._realizedRowHeaders = [], this._realizedColumnHeaders = [],
|
16002 | this._realizedCornerCells = [], this._realizedBodyCells = [];
|
16003 | }, Object.defineProperty(TablixColumn.prototype, "owner", {
|
16004 | get: function() {
|
16005 | return this._owner;
|
16006 | },
|
16007 | enumerable: !0,
|
16008 | configurable: !0
|
16009 | }), TablixColumn.prototype.getType = function() {
|
16010 | return this._realizedCornerCells.length > 0 ? 0 : 2;
|
16011 | }, TablixColumn.prototype.getColumnHeadersOrCorners = function() {
|
16012 | return this._realizedCornerCells.length > 0 ? this._realizedCornerCells : this._realizedColumnHeaders;
|
16013 | }, TablixColumn.prototype.columnHeadersOrCornersEqual = function(newType, headers, hierarchyNavigator) {
|
16014 | if (this._items.length !== headers.length) return !1;
|
16015 | 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;
|
16016 | return !0;
|
16017 | }, Object.defineProperty(TablixColumn.prototype, "itemType", {
|
16018 | get: function() {
|
16019 | return this._itemType;
|
16020 | },
|
16021 | enumerable: !0,
|
16022 | configurable: !0
|
16023 | }), TablixColumn.prototype.getLeafItem = function() {
|
16024 | return 0 === this._items.length ? null : this._items[this._items.length - 1];
|
16025 | }, TablixColumn.prototype.columnHeaderOrCornerEquals = function(type1, item1, type2, item2, hierarchyNavigator) {
|
16026 | if (type1 !== type2) return !1;
|
16027 | if (0 === type1) {
|
16028 | if (!hierarchyNavigator.cornerCellItemEquals(item1, item2)) return !1;
|
16029 | } else if (!hierarchyNavigator.headerItemEquals(item1, item2)) return !1;
|
16030 | return !0;
|
16031 | }, TablixColumn.prototype.OnLeafRealized = function(hierarchyNavigator) {
|
16032 | var type = this.getType(), columnHeadersOrCorners = this.getColumnHeadersOrCorners();
|
16033 | if (this.columnHeadersOrCornersEqual(type, columnHeadersOrCorners, hierarchyNavigator)) this.clearSpanningCellsWidth(this._realizedColumnHeaders); else {
|
16034 | var count = columnHeadersOrCorners.length;
|
16035 | this._items = [];
|
16036 | for (var i = 0; count > i; i++) this._items.push(columnHeadersOrCorners[i].item);
|
16037 | this._itemType = type, this.clearSize();
|
16038 | }
|
16039 | }, TablixColumn.prototype.clearSpanningCellsWidth = function(cells) {
|
16040 | for (var i = 0; i < cells.length; i++) {
|
16041 | var cell = cells[i];
|
16042 | cell.colSpan > 1 && cell.setContainerWidth(-1);
|
16043 | }
|
16044 | }, TablixColumn.prototype.addCornerCell = function(cell) {
|
16045 | cell._column = this, this._realizedCornerCells.push(cell), cell.setContainerWidth(this._containerWidth);
|
16046 | }, TablixColumn.prototype.addRowHeader = function(cell) {
|
16047 | cell._column = this, this._realizedRowHeaders.push(cell), cell.setContainerWidth(this._containerWidth);
|
16048 | }, TablixColumn.prototype.addColumnHeader = function(cell, isLeaf) {
|
16049 | cell._column = this, this._realizedColumnHeaders.push(cell), isLeaf && cell.setContainerWidth(this._containerWidth);
|
16050 | }, TablixColumn.prototype.addBodyCell = function(cell) {
|
16051 | cell._column = this, this._realizedBodyCells.push(cell), cell.setContainerWidth(this._containerWidth);
|
16052 | }, Object.defineProperty(TablixColumn.prototype, "footer", {
|
16053 | get: function() {
|
16054 | return this._footerCell;
|
16055 | },
|
16056 | set: function(footerCell) {
|
16057 | this._footerCell = footerCell, footerCell._column = this, footerCell.setContainerWidth(this._containerWidth);
|
16058 | },
|
16059 | enumerable: !0,
|
16060 | configurable: !0
|
16061 | }), TablixColumn.prototype.onResize = function(width) {
|
16062 | width !== this.getContentContextualWidth() && (this._containerWidth = width, this.setContainerWidth(this._containerWidth),
|
16063 | this._sizeFixed = !0, this._fixedToAligningWidth = !1, this._aligningWidth = -1);
|
16064 | }, TablixColumn.prototype.onResizeEnd = function(width) {
|
16065 | var gridPresenter = this.owner._presenter;
|
16066 | gridPresenter && gridPresenter.invokeColumnResizeEndCallback(this._columnIndex, width);
|
16067 | }, TablixColumn.prototype.fixSize = function() {
|
16068 | var shouldAlign = -1 !== this._aligningWidth, switched = shouldAlign !== this._fixedToAligningWidth;
|
16069 | (!this._sizeFixed || switched || shouldAlign) && (-1 === this._aligningWidth ? this.setContainerWidth(this._containerWidth) : this.setContainerWidth(this._aligningWidth),
|
16070 | this._sizeFixed = !0, this._fixedToAligningWidth = -1 !== this._aligningWidth);
|
16071 | }, TablixColumn.prototype.clearSize = function() {
|
16072 | this._containerWidth = -1, this.setContainerWidth(this._containerWidth), this._sizeFixed = !1;
|
16073 | }, TablixColumn.prototype.getContentContextualWidth = function() {
|
16074 | return this._containerWidth;
|
16075 | }, TablixColumn.prototype.getCellIContentContextualWidth = function(cell) {
|
16076 | return this._presenter.getCellContentWidth(cell);
|
16077 | }, TablixColumn.prototype.getCellSpanningWidthWithScrolling = function(cell, tablixGrid) {
|
16078 | var width = this.getContextualWidth() + this.getScrollingOffset();
|
16079 | if (cell.colSpan > 1) for (var index = this.getIndex(tablixGrid), columns = tablixGrid.realizedColumns, i = 1; i < cell.colSpan; i++) width += columns[i + index].getContextualWidth();
|
16080 | return width;
|
16081 | }, TablixColumn.prototype.getScrollingOffset = function() {
|
16082 | var offset = 0;
|
16083 | return this._realizedColumnHeaders.length > 0 && (offset = this._realizedColumnHeaders[this._realizedColumnHeaders.length - 1].horizontalOffset),
|
16084 | offset;
|
16085 | }, TablixColumn.prototype.getContextualWidth = function() {
|
16086 | return -1 !== this._width && -1 !== this._containerWidth || (this._width = this._presenter.getWidth()),
|
16087 | this._width;
|
16088 | }, TablixColumn.prototype.calculateSize = function() {
|
16089 | if (this._sizeFixed) return this._containerWidth;
|
16090 | for (var contentWidth = 0, _i = 0, _a = this._realizedColumnHeaders; _i < _a.length; _i++) {
|
16091 | var cell = _a[_i];
|
16092 | 1 === cell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellContentWidth(cell)));
|
16093 | }
|
16094 | for (var _b = 0, _c = this._realizedRowHeaders; _b < _c.length; _b++) {
|
16095 | var cell = _c[_b];
|
16096 | 1 === cell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellContentWidth(cell)));
|
16097 | }
|
16098 | for (var _d = 0, _e = this._realizedCornerCells; _d < _e.length; _d++) {
|
16099 | var cell = _e[_d];
|
16100 | contentWidth = Math.max(contentWidth, this._presenter.getCellContentWidth(cell));
|
16101 | }
|
16102 | for (var _f = 0, _g = this._realizedBodyCells; _f < _g.length; _f++) {
|
16103 | var cell = _g[_f];
|
16104 | contentWidth = Math.max(contentWidth, this._presenter.getCellContentWidth(cell));
|
16105 | }
|
16106 | return null !== this._footerCell && 1 === this._footerCell.colSpan && (contentWidth = Math.max(contentWidth, this._presenter.getCellContentWidth(this._footerCell))),
|
16107 | this._containerWidth = contentWidth;
|
16108 | }, TablixColumn.prototype.setAligningContextualWidth = function(size) {
|
16109 | this._aligningWidth = size;
|
16110 | }, TablixColumn.prototype.getAligningContextualWidth = function() {
|
16111 | return this._aligningWidth;
|
16112 | }, TablixColumn.prototype.setContainerWidth = function(value) {
|
16113 | for (var _i = 0, _a = this._realizedColumnHeaders; _i < _a.length; _i++) {
|
16114 | var cell = _a[_i];
|
16115 | 1 === cell.colSpan && cell.setContainerWidth(value);
|
16116 | }
|
16117 | for (var _b = 0, _c = this._realizedRowHeaders; _b < _c.length; _b++) {
|
16118 | var cell = _c[_b];
|
16119 | 1 === cell.colSpan && cell.setContainerWidth(value);
|
16120 | }
|
16121 | for (var _d = 0, _e = this._realizedCornerCells; _d < _e.length; _d++) {
|
16122 | var cell = _e[_d];
|
16123 | cell.setContainerWidth(value);
|
16124 | }
|
16125 | for (var _f = 0, _g = this._realizedBodyCells; _f < _g.length; _f++) {
|
16126 | var cell = _g[_f];
|
16127 | cell.setContainerWidth(value);
|
16128 | }
|
16129 | null !== this._footerCell && 1 === this._footerCell.colSpan && this._footerCell.setContainerWidth(value),
|
16130 | this._width = value;
|
16131 | }, TablixColumn.prototype.getTablixCell = function() {
|
16132 | var realizedCells = this._realizedColumnHeaders.length > 0 ? this._realizedColumnHeaders : this._realizedCornerCells;
|
16133 | return realizedCells[realizedCells.length - 1];
|
16134 | }, TablixColumn.prototype.getIndex = function(grid) {
|
16135 | return grid.realizedColumns.indexOf(this);
|
16136 | }, TablixColumn.prototype.getHeaders = function() {
|
16137 | return this._realizedColumnHeaders;
|
16138 | }, TablixColumn.prototype.getOtherDimensionHeaders = function() {
|
16139 | return this._realizedRowHeaders;
|
16140 | }, TablixColumn.prototype.getCellContextualSpan = function(cell) {
|
16141 | return cell.colSpan;
|
16142 | }, TablixColumn.prototype.getOtherDimensionOwner = function(cell) {
|
16143 | return cell._row;
|
16144 | }, TablixColumn;
|
16145 | }();
|
16146 | internal.TablixColumn = TablixColumn;
|
16147 | var TablixRow = function() {
|
16148 | function TablixRow(presenter) {
|
16149 | this._containerHeight = -1, this._presenter = presenter, this._presenter.initialize(this),
|
16150 | this._allocatedCells = [], this._heightFixed = !1, this._containerHeight = -1, this._height = -1;
|
16151 | }
|
16152 | return TablixRow.prototype.initialize = function(owner) {
|
16153 | this._owner = owner, this._realizedRowHeaders = [], this._realizedBodyCells = [],
|
16154 | this._realizedCornerCells = [], this._realizedColumnHeaders = [], this._realizedCellsCount = 0;
|
16155 | }, Object.defineProperty(TablixRow.prototype, "presenter", {
|
16156 | get: function() {
|
16157 | return this._presenter;
|
16158 | },
|
16159 | enumerable: !0,
|
16160 | configurable: !0
|
16161 | }), Object.defineProperty(TablixRow.prototype, "owner", {
|
16162 | get: function() {
|
16163 | return this._owner;
|
16164 | },
|
16165 | enumerable: !0,
|
16166 | configurable: !0
|
16167 | }), TablixRow.prototype.releaseUnusedCells = function(owner) {
|
16168 | this.releaseCells(owner, this._realizedCellsCount);
|
16169 | }, TablixRow.prototype.releaseAllCells = function(owner) {
|
16170 | this.releaseCells(owner, 0);
|
16171 | }, TablixRow.prototype.releaseCells = function(owner, startIndex) {
|
16172 | for (var cells = this._allocatedCells, length = cells.length, i = startIndex; length > i; i++) {
|
16173 | var cell = cells[i];
|
16174 | owner._unbindCell(cell), cell.clear();
|
16175 | }
|
16176 | }, TablixRow.prototype.moveScrollableCellsToEnd = function(count) {
|
16177 | for (var frontIndex = Math.max(this._realizedRowHeaders.length, this._realizedCornerCells.length), i = frontIndex; frontIndex + count > i; i++) {
|
16178 | var cell = this._allocatedCells[i];
|
16179 | this._presenter.onRemoveCell(cell), this._presenter.onAppendCell(cell), this._allocatedCells.push(cell);
|
16180 | }
|
16181 | this._allocatedCells.splice(frontIndex, count);
|
16182 | }, TablixRow.prototype.moveScrollableCellsToStart = function(count) {
|
16183 | for (var frontIndex = Math.max(this._realizedRowHeaders.length, this._realizedCornerCells.length), i = frontIndex; frontIndex + count > i; i++) {
|
16184 | var cell = this._allocatedCells.pop();
|
16185 | this._presenter.onRemoveCell(cell), this._presenter.onInsertCellBefore(cell, this._allocatedCells[frontIndex]),
|
16186 | this._allocatedCells.splice(frontIndex, 0, cell);
|
16187 | }
|
16188 | }, TablixRow.prototype.getOrCreateCornerCell = function(column) {
|
16189 | var cell = this.getOrCreateCell();
|
16190 | return cell.prepare(!1), column.addCornerCell(cell), this._realizedCornerCells.push(cell),
|
16191 | cell.setContainerHeight(this._containerHeight), cell;
|
16192 | }, TablixRow.prototype.getOrCreateRowHeader = function(column, scrollable, leaf) {
|
16193 | var cell = this.getOrCreateCell();
|
16194 | return cell.prepare(scrollable), column.addRowHeader(cell), this._realizedRowHeaders.push(cell),
|
16195 | leaf && cell.setContainerHeight(this._containerHeight), cell;
|
16196 | }, TablixRow.prototype.getOrCreateColumnHeader = function(column, scrollable, leaf) {
|
16197 | var cell = this.getOrCreateCell();
|
16198 | return cell.prepare(scrollable), column.addColumnHeader(cell, leaf), this._realizedColumnHeaders.push(cell),
|
16199 | cell.setContainerHeight(this._containerHeight), cell;
|
16200 | }, TablixRow.prototype.getOrCreateBodyCell = function(column, scrollable) {
|
16201 | var cell = this.getOrCreateCell();
|
16202 | return cell.prepare(scrollable), column.addBodyCell(cell), this._realizedBodyCells.push(cell),
|
16203 | cell.setContainerHeight(this._containerHeight), cell;
|
16204 | }, TablixRow.prototype.getOrCreateFooterRowHeader = function(column) {
|
16205 | var cell = this.getOrCreateCell();
|
16206 | return cell.prepare(!1), column.footer = cell, this._realizedRowHeaders.push(cell),
|
16207 | cell.setContainerHeight(this._containerHeight), cell;
|
16208 | }, TablixRow.prototype.getOrCreateFooterBodyCell = function(column, scrollable) {
|
16209 | var cell = this.getOrCreateCell();
|
16210 | return cell.prepare(scrollable), column.footer = cell, this._realizedBodyCells.push(cell),
|
16211 | cell.setContainerHeight(this._containerHeight), cell;
|
16212 | }, TablixRow.prototype.getRowHeaderLeafIndex = function() {
|
16213 | for (var index = -1, count = this._allocatedCells.length, i = 0; count > i && 1 === this._allocatedCells[i].type; i++) index++;
|
16214 | return index;
|
16215 | }, TablixRow.prototype.getAllocatedCellAt = function(index) {
|
16216 | return this._allocatedCells[index];
|
16217 | }, TablixRow.prototype.moveCellsBy = function(delta) {
|
16218 | if (0 !== this._allocatedCells.length) if (delta > 0) for (var refCell = this._allocatedCells[0], i = 0; delta > i; i++) {
|
16219 | var cell = this.createCell(this);
|
16220 | this._presenter.onInsertCellBefore(cell, refCell), this._allocatedCells.unshift(cell),
|
16221 | refCell = cell;
|
16222 | } else {
|
16223 | delta = -delta;
|
16224 | for (var i = 0; delta > i; i++) this._presenter.onRemoveCell(this._allocatedCells[i]);
|
16225 | this._allocatedCells.splice(0, delta);
|
16226 | }
|
16227 | }, TablixRow.prototype.getRealizedCellCount = function() {
|
16228 | return this._realizedCellsCount;
|
16229 | }, TablixRow.prototype.getRealizedHeadersCount = function() {
|
16230 | return this._realizedRowHeaders.length;
|
16231 | }, TablixRow.prototype.getRealizedHeaderAt = function(index) {
|
16232 | return this._realizedRowHeaders[index];
|
16233 | }, TablixRow.prototype.getTablixCell = function() {
|
16234 | var realizedCells;
|
16235 | return realizedCells = this._realizedRowHeaders.length > 0 ? this._realizedRowHeaders : this._realizedCornerCells.length > 0 ? this._realizedCornerCells : this._realizedColumnHeaders,
|
16236 | realizedCells[realizedCells.length - 1];
|
16237 | }, TablixRow.prototype.getOrCreateEmptySpaceCell = function() {
|
16238 | var cell = this._allocatedCells[this._realizedCellsCount];
|
16239 | return void 0 === cell && (cell = this.createCell(this), this._allocatedCells[this._realizedCellsCount] = cell,
|
16240 | this._presenter.onAppendCell(cell)), cell;
|
16241 | }, TablixRow.prototype.createCell = function(row) {
|
16242 | var presenter = this._presenter.createCellPresenter(this._owner.owner.layoutManager.getLayoutKind());
|
16243 | return new TablixCell(presenter, presenter, this);
|
16244 | }, TablixRow.prototype.getOrCreateCell = function() {
|
16245 | var cell = this._allocatedCells[this._realizedCellsCount];
|
16246 | return void 0 === cell ? (cell = this.createCell(this), this._allocatedCells[this._realizedCellsCount] = cell,
|
16247 | this._presenter.onAppendCell(cell)) : (cell.colSpan = 1, cell.rowSpan = 1), this._realizedCellsCount = this._realizedCellsCount + 1,
|
16248 | cell;
|
16249 | }, TablixRow.prototype.onResize = function(height) {
|
16250 | height !== this.getContentContextualWidth() && (this._containerHeight = height,
|
16251 | this.setContentHeight(), this._heightFixed = !0, this.setAligningContextualWidth(-1));
|
16252 | }, TablixRow.prototype.onResizeEnd = function(height) {}, TablixRow.prototype.fixSize = function() {
|
16253 | this.sizeFixed() || (this.setContentHeight(), this._heightFixed = !0);
|
16254 | }, TablixRow.prototype.unfixSize = function() {
|
16255 | this._heightFixed = !1, this._height = -1;
|
16256 | }, TablixRow.prototype.getContentContextualWidth = function() {
|
16257 | return this._containerHeight;
|
16258 | }, TablixRow.prototype.getCellIContentContextualWidth = function(cell) {
|
16259 | return this.presenter.getCellContentHeight(cell);
|
16260 | }, TablixRow.prototype.getCellSpanningHeight = function(cell) {
|
16261 | var height = this.getContextualWidth();
|
16262 | 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();
|
16263 | return height;
|
16264 | }, TablixRow.prototype.getContextualWidth = function() {
|
16265 | return -1 !== this._height && -1 !== this._containerHeight || (this._height = this._presenter.getHeight()),
|
16266 | this._height;
|
16267 | }, TablixRow.prototype.sizeFixed = function() {
|
16268 | return this._heightFixed;
|
16269 | }, TablixRow.prototype.calculateSize = function() {
|
16270 | if (this._heightFixed) return this._containerHeight;
|
16271 | for (var contentHeight = 0, count = this._realizedRowHeaders.length, i = 0; count > i; i++) {
|
16272 | var cell = this._realizedRowHeaders[i];
|
16273 | 1 === cell.rowSpan && (contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(cell)));
|
16274 | }
|
16275 | count = this._realizedCornerCells.length;
|
16276 | for (var i = 0; count > i; i++) contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(this._realizedCornerCells[i]));
|
16277 | count = this._realizedColumnHeaders.length;
|
16278 | for (var i = 0; count > i; i++) {
|
16279 | var cell = this._realizedColumnHeaders[i];
|
16280 | 1 === cell.rowSpan && (contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(cell)));
|
16281 | }
|
16282 | count = this._realizedBodyCells.length;
|
16283 | for (var i = 0; count > i; i++) contentHeight = Math.max(contentHeight, this._presenter.getCellContentHeight(this._realizedBodyCells[i]));
|
16284 | return this._containerHeight = contentHeight;
|
16285 | }, TablixRow.prototype.setAligningContextualWidth = function(size) {}, TablixRow.prototype.getAligningContextualWidth = function() {
|
16286 | return -1;
|
16287 | }, TablixRow.prototype.setContentHeight = function() {
|
16288 | for (var count = this._realizedRowHeaders.length, i = count - 1; i >= 0; i--) {
|
16289 | var cell = this._realizedRowHeaders[i];
|
16290 | cell.setContainerHeight(this._containerHeight), cell.rowSpan > 1 && cell.setContainerHeight(this.getCellSpanningHeight(cell));
|
16291 | }
|
16292 | count = this._realizedCornerCells.length;
|
16293 | for (var i = 0; count > i; i++) this._realizedCornerCells[i].setContainerHeight(this._containerHeight);
|
16294 | count = this._realizedColumnHeaders.length;
|
16295 | for (var i = 0; count > i; i++) {
|
16296 | var cell = this._realizedColumnHeaders[i];
|
16297 | cell.setContainerHeight(this._containerHeight), cell.rowSpan > 1 && cell.setContainerHeight(this.getCellSpanningHeight(cell));
|
16298 | }
|
16299 | count = this._realizedBodyCells.length;
|
16300 | for (var i = 0; count > i; i++) this._realizedBodyCells[i].setContainerHeight(this._containerHeight);
|
16301 | this._height = -1;
|
16302 | }, TablixRow.prototype.getIndex = function(grid) {
|
16303 | return grid.realizedRows.indexOf(this);
|
16304 | }, TablixRow.prototype.getHeaders = function() {
|
16305 | return this._realizedRowHeaders;
|
16306 | }, TablixRow.prototype.getOtherDimensionHeaders = function() {
|
16307 | return this._realizedColumnHeaders;
|
16308 | }, TablixRow.prototype.getCellContextualSpan = function(cell) {
|
16309 | return cell.rowSpan;
|
16310 | }, TablixRow.prototype.getOtherDimensionOwner = function(cell) {
|
16311 | return cell._column;
|
16312 | }, TablixRow;
|
16313 | }();
|
16314 | internal.TablixRow = TablixRow;
|
16315 | var TablixGrid = function() {
|
16316 | function TablixGrid(presenter) {
|
16317 | this._presenter = presenter, this._footerRow = null;
|
16318 | }
|
16319 | return TablixGrid.prototype.initialize = function(owner, gridHost, footerHost) {
|
16320 | this._owner = owner, this._presenter.initialize(this, gridHost, footerHost, owner),
|
16321 | this.fillColumnsProportionally = !1, this._realizedRows = [], this._realizedColumns = [],
|
16322 | this._emptySpaceHeaderCell = null, this._emptyFooterSpaceCell = null;
|
16323 | }, Object.defineProperty(TablixGrid.prototype, "owner", {
|
16324 | get: function() {
|
16325 | return this._owner;
|
16326 | },
|
16327 | enumerable: !0,
|
16328 | configurable: !0
|
16329 | }), Object.defineProperty(TablixGrid.prototype, "fillColumnsProportionally", {
|
16330 | get: function() {
|
16331 | return this._fillColumnsProportionally;
|
16332 | },
|
16333 | set: function(value) {
|
16334 | this._fillColumnsProportionally !== value && (this._fillColumnsProportionally = value,
|
16335 | this._presenter.onFillColumnsProportionallyChanged(value));
|
16336 | },
|
16337 | enumerable: !0,
|
16338 | configurable: !0
|
16339 | }), Object.defineProperty(TablixGrid.prototype, "realizedColumns", {
|
16340 | get: function() {
|
16341 | return this._realizedColumns;
|
16342 | },
|
16343 | set: function(columns) {
|
16344 | this._realizedColumns = columns;
|
16345 | },
|
16346 | enumerable: !0,
|
16347 | configurable: !0
|
16348 | }), Object.defineProperty(TablixGrid.prototype, "realizedRows", {
|
16349 | get: function() {
|
16350 | return this._realizedRows;
|
16351 | },
|
16352 | set: function(rows) {
|
16353 | this._realizedRows = rows;
|
16354 | },
|
16355 | enumerable: !0,
|
16356 | configurable: !0
|
16357 | }), Object.defineProperty(TablixGrid.prototype, "footerRow", {
|
16358 | get: function() {
|
16359 | return this._footerRow;
|
16360 | },
|
16361 | enumerable: !0,
|
16362 | configurable: !0
|
16363 | }), Object.defineProperty(TablixGrid.prototype, "emptySpaceHeaderCell", {
|
16364 | get: function() {
|
16365 | return this._emptySpaceHeaderCell;
|
16366 | },
|
16367 | enumerable: !0,
|
16368 | configurable: !0
|
16369 | }), Object.defineProperty(TablixGrid.prototype, "emptySpaceFooterCell", {
|
16370 | get: function() {
|
16371 | return this._emptyFooterSpaceCell;
|
16372 | },
|
16373 | enumerable: !0,
|
16374 | configurable: !0
|
16375 | }), TablixGrid.prototype.ShowEmptySpaceCells = function(rowSpan, width) {
|
16376 | 0 !== this._realizedRows.length && (0 === this._realizedRows.length || this._emptySpaceHeaderCell || (this._emptySpaceHeaderCell = this._realizedRows[0].getOrCreateEmptySpaceCell(),
|
16377 | this._emptySpaceHeaderCell.rowSpan = rowSpan, this._emptySpaceHeaderCell.colSpan = 1,
|
16378 | this._emptySpaceHeaderCell.setContainerWidth(width)), this._footerRow && null === this._emptyFooterSpaceCell && (this._emptyFooterSpaceCell = this._footerRow.getOrCreateEmptySpaceCell(),
|
16379 | this._emptyFooterSpaceCell.rowSpan = 1, this._emptyFooterSpaceCell.colSpan = 1,
|
16380 | this._emptyFooterSpaceCell.setContainerWidth(width)));
|
16381 | }, TablixGrid.prototype.HideEmptySpaceCells = function() {
|
16382 | this._emptySpaceHeaderCell && (this._emptySpaceHeaderCell.clear(), this._emptySpaceHeaderCell = null),
|
16383 | this._emptyFooterSpaceCell && (this._emptyFooterSpaceCell.clear(), this._emptyFooterSpaceCell = null);
|
16384 | }, TablixGrid.prototype.onStartRenderingSession = function(clear) {
|
16385 | clear && (this.clearRows(), this.clearColumns());
|
16386 | }, TablixGrid.prototype.onStartRenderingIteration = function() {
|
16387 | this.initializeRows(), this.initializeColumns();
|
16388 | }, TablixGrid.prototype.onEndRenderingIteration = function() {
|
16389 | var rows = this._rows;
|
16390 | if (void 0 !== rows) for (var rowCount = rows.length, i = 0; rowCount > i; i++) rows[i].releaseUnusedCells(this._owner);
|
16391 | this._footerRow && this._footerRow.releaseUnusedCells(this._owner);
|
16392 | }, TablixGrid.prototype.getOrCreateRow = function(rowIndex) {
|
16393 | var currentRow = this._rows[rowIndex];
|
16394 | return void 0 === currentRow && (currentRow = new TablixRow(this._presenter.createRowPresenter()),
|
16395 | currentRow.initialize(this), this._presenter.onAppendRow(currentRow), this._rows[rowIndex] = currentRow),
|
16396 | void 0 === this._realizedRows[rowIndex] && (this._realizedRows[rowIndex] = currentRow),
|
16397 | currentRow;
|
16398 | }, TablixGrid.prototype.getOrCreateFootersRow = function() {
|
16399 | return null === this._footerRow && (this._footerRow = new TablixRow(this._presenter.createRowPresenter()),
|
16400 | this._footerRow.initialize(this), this._presenter.onAddFooterRow(this._footerRow)),
|
16401 | this._footerRow;
|
16402 | }, TablixGrid.prototype.moveRowsToEnd = function(moveFromIndex, count) {
|
16403 | for (var i = 0; count > i; i++) {
|
16404 | var row = this._rows[i + moveFromIndex];
|
16405 | row.unfixSize(), this._presenter.onRemoveRow(row), this._presenter.onAppendRow(row),
|
16406 | this._rows.push(row);
|
16407 | }
|
16408 | this._rows.splice(moveFromIndex, count);
|
16409 | }, TablixGrid.prototype.moveRowsToStart = function(moveToIndex, count) {
|
16410 | for (var refRow = this._rows[moveToIndex], i = 0; count > i; i++) {
|
16411 | var row = this._rows.pop();
|
16412 | row.unfixSize(), this._presenter.onRemoveRow(row), this._presenter.onInsertRowBefore(row, refRow),
|
16413 | this._rows.splice(moveToIndex + i, 0, row);
|
16414 | }
|
16415 | }, TablixGrid.prototype.moveColumnsToEnd = function(moveFromIndex, count) {
|
16416 | 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);
|
16417 | for (var i = 0; count > i; i++) {
|
16418 | var column = this._columns[i + moveFromIndex];
|
16419 | this._columns.push(column);
|
16420 | }
|
16421 | this._columns.splice(moveFromIndex, count);
|
16422 | }, TablixGrid.prototype.moveColumnsToStart = function(moveToIndex, count) {
|
16423 | 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);
|
16424 | for (var i = 0; count > i; i++) {
|
16425 | var column = this._columns.pop();
|
16426 | this._columns.splice(moveToIndex + i, 0, column);
|
16427 | }
|
16428 | }, TablixGrid.prototype.getOrCreateColumn = function(columnIndex) {
|
16429 | var currentColumn = this._columns[columnIndex];
|
16430 | return void 0 === currentColumn && (currentColumn = new TablixColumn(this._presenter.createColumnPresenter(columnIndex), columnIndex),
|
16431 | currentColumn.initialize(this), this._columns[columnIndex] = currentColumn), void 0 === this._realizedColumns[columnIndex] && (this._realizedColumns[columnIndex] = currentColumn),
|
16432 | currentColumn;
|
16433 | }, TablixGrid.prototype.initializeColumns = function() {
|
16434 | this._columns || (this._columns = []);
|
16435 | for (var length = this._columns.length, i = 0; length > i; i++) this._columns[i].initialize(this);
|
16436 | this._realizedColumns = [];
|
16437 | }, TablixGrid.prototype.clearColumns = function() {
|
16438 | this._columns = null, this._realizedColumns = null;
|
16439 | }, TablixGrid.prototype.initializeRows = function() {
|
16440 | var hasFooter = this._owner.rowDimension.hasFooter() && null !== this._footerRow;
|
16441 | this._realizedRows = [], this._rows || (this._rows = []);
|
16442 | for (var rows = this._rows, length = rows.length, i = 0; length > i; i++) rows[i].initialize(this);
|
16443 | hasFooter && (this._footerRow || this.getOrCreateFootersRow(), this._footerRow.initialize(this));
|
16444 | }, TablixGrid.prototype.clearRows = function() {
|
16445 | var rows = this._rows;
|
16446 | if (rows) {
|
16447 | for (var length_1 = rows.length, i = 0; length_1 > i; i++) rows[i].releaseAllCells(this._owner);
|
16448 | this._footerRow && this._footerRow.releaseAllCells(this._owner), this._presenter.onClear(),
|
16449 | this._footerRow = null, this._rows = null, this._realizedRows = null;
|
16450 | }
|
16451 | }, TablixGrid.prototype.getWidth = function() {
|
16452 | return this._presenter.getWidth();
|
16453 | }, TablixGrid.prototype.getHeight = function() {
|
16454 | return this._presenter.getHeight();
|
16455 | }, TablixGrid;
|
16456 | }();
|
16457 | internal.TablixGrid = TablixGrid;
|
16458 | }(internal = controls.internal || (controls.internal = {}));
|
16459 | }(controls = visuals.controls || (visuals.controls = {}));
|
16460 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
16461 | }(powerbi || (powerbi = {}));
|
16462 |
|
16463 | var powerbi;
|
16464 |
|
16465 | !function(powerbi) {
|
16466 | var visuals;
|
16467 | !function(visuals) {
|
16468 | var controls;
|
16469 | !function(controls) {
|
16470 | var internal;
|
16471 | !function(internal) {
|
16472 | var PixelConverter = jsCommon.PixelConverter, SizeComputationManager = function() {
|
16473 | function SizeComputationManager() {}
|
16474 | return Object.defineProperty(SizeComputationManager.prototype, "visibleWidth", {
|
16475 | get: function() {
|
16476 | return this._viewport ? this._viewport.width : 0;
|
16477 | },
|
16478 | enumerable: !0,
|
16479 | configurable: !0
|
16480 | }), Object.defineProperty(SizeComputationManager.prototype, "visibleHeight", {
|
16481 | get: function() {
|
16482 | return this._viewport ? this._viewport.height : 0;
|
16483 | },
|
16484 | enumerable: !0,
|
16485 | configurable: !0
|
16486 | }), Object.defineProperty(SizeComputationManager.prototype, "gridWidth", {
|
16487 | get: function() {
|
16488 | return this.visibleWidth;
|
16489 | },
|
16490 | enumerable: !0,
|
16491 | configurable: !0
|
16492 | }), Object.defineProperty(SizeComputationManager.prototype, "gridHeight", {
|
16493 | get: function() {
|
16494 | return this.visibleHeight;
|
16495 | },
|
16496 | enumerable: !0,
|
16497 | configurable: !0
|
16498 | }), Object.defineProperty(SizeComputationManager.prototype, "rowHeight", {
|
16499 | get: function() {
|
16500 | return this._cellHeight;
|
16501 | },
|
16502 | enumerable: !0,
|
16503 | configurable: !0
|
16504 | }), Object.defineProperty(SizeComputationManager.prototype, "cellWidth", {
|
16505 | get: function() {
|
16506 | return this._cellWidth;
|
16507 | },
|
16508 | enumerable: !0,
|
16509 | configurable: !0
|
16510 | }), Object.defineProperty(SizeComputationManager.prototype, "cellHeight", {
|
16511 | get: function() {
|
16512 | return this._cellHeight;
|
16513 | },
|
16514 | enumerable: !0,
|
16515 | configurable: !0
|
16516 | }), Object.defineProperty(SizeComputationManager.prototype, "contentWidth", {
|
16517 | get: function() {
|
16518 | return this._cellWidth;
|
16519 | },
|
16520 | enumerable: !0,
|
16521 | configurable: !0
|
16522 | }), Object.defineProperty(SizeComputationManager.prototype, "contentHeight", {
|
16523 | get: function() {
|
16524 | return this._cellHeight;
|
16525 | },
|
16526 | enumerable: !0,
|
16527 | configurable: !0
|
16528 | }), SizeComputationManager.prototype.updateColumnCount = function(columnCount) {
|
16529 | this._columnCount = columnCount;
|
16530 | }, SizeComputationManager.prototype.updateRowHeight = function(rowHeight) {
|
16531 | this._cellHeight = rowHeight;
|
16532 | }, SizeComputationManager.prototype.updateScalingFactor = function(scalingFactor) {
|
16533 | this._scalingFactor = scalingFactor, this._cellWidth = this.computeColumnWidth(this._columnCount);
|
16534 | }, SizeComputationManager.prototype.updateViewport = function(viewport) {
|
16535 | this._viewport = viewport, this._cellWidth = this.computeColumnWidth(this._columnCount),
|
16536 | this._cellHeight = this.computeColumnHeight();
|
16537 | }, SizeComputationManager.prototype.computeColumnWidth = function(totalColumnCount) {
|
16538 | var scalingFactor = this._scalingFactor;
|
16539 | scalingFactor || (scalingFactor = 1);
|
16540 | var minimumColumnWidth = scalingFactor * SizeComputationManager.TablixMinimumColumnWidth, maxAllowedColumns = Math.floor(this._viewport.width / minimumColumnWidth);
|
16541 | return this.fitToColumnCount(maxAllowedColumns, totalColumnCount);
|
16542 | }, SizeComputationManager.prototype.computeColumnHeight = function() {
|
16543 | if (!this.hasImageContent) return this._cellHeight;
|
16544 | var width = this._viewport.width;
|
16545 | return 250 >= width ? 20 : 510 >= width ? 51 : 770 >= width ? 52 : void 0;
|
16546 | }, SizeComputationManager.prototype.fitToColumnCount = function(maxAllowedColumnCount, totalColumnCount) {
|
16547 | var columnsToFit = Math.min(maxAllowedColumnCount, totalColumnCount);
|
16548 | return Math.floor(this._viewport.width / columnsToFit);
|
16549 | }, SizeComputationManager.TablixMinimumColumnWidth = 75, SizeComputationManager;
|
16550 | }();
|
16551 | internal.SizeComputationManager = SizeComputationManager;
|
16552 | var DimensionLayoutManager = function() {
|
16553 | function DimensionLayoutManager(owner, grid, realizationManager) {
|
16554 | this._owner = owner, this._grid = grid, this._lastScrollOffset = null, this._isScrolling = !1,
|
16555 | this._fixedSizeEnabled = !0, this._done = !1, this._realizationManager = realizationManager;
|
16556 | }
|
16557 | return Object.defineProperty(DimensionLayoutManager.prototype, "owner", {
|
16558 | get: function() {
|
16559 | return this._owner;
|
16560 | },
|
16561 | set: function(owner) {
|
16562 | this._owner = owner;
|
16563 | },
|
16564 | enumerable: !0,
|
16565 | configurable: !0
|
16566 | }), Object.defineProperty(DimensionLayoutManager.prototype, "realizationManager", {
|
16567 | get: function() {
|
16568 | return this._realizationManager;
|
16569 | },
|
16570 | enumerable: !0,
|
16571 | configurable: !0
|
16572 | }), Object.defineProperty(DimensionLayoutManager.prototype, "fixedSizeEnabled", {
|
16573 | get: function() {
|
16574 | return this._fixedSizeEnabled;
|
16575 | },
|
16576 | set: function(enable) {
|
16577 | this._fixedSizeEnabled = enable;
|
16578 | },
|
16579 | enumerable: !0,
|
16580 | configurable: !0
|
16581 | }), DimensionLayoutManager.prototype.onCornerCellRealized = function(item, cell, leaf) {
|
16582 | this._realizationManager.onCornerCellRealized(item, cell);
|
16583 | }, DimensionLayoutManager.prototype.onHeaderRealized = function(item, cell, leaf) {
|
16584 | this._realizationManager.onHeaderRealized(item, cell, leaf);
|
16585 | }, Object.defineProperty(DimensionLayoutManager.prototype, "needsToRealize", {
|
16586 | get: function() {
|
16587 | return this._realizationManager.needsToRealize;
|
16588 | },
|
16589 | enumerable: !0,
|
16590 | configurable: !0
|
16591 | }), DimensionLayoutManager.prototype.getVisibleSizeRatio = function() {
|
16592 | return 1 - this.dimension.getFractionScrollOffset();
|
16593 | }, Object.defineProperty(DimensionLayoutManager.prototype, "alignToEnd", {
|
16594 | get: function() {
|
16595 | return this._alignToEnd;
|
16596 | },
|
16597 | enumerable: !0,
|
16598 | configurable: !0
|
16599 | }), Object.defineProperty(DimensionLayoutManager.prototype, "done", {
|
16600 | get: function() {
|
16601 | return this._done;
|
16602 | },
|
16603 | enumerable: !0,
|
16604 | configurable: !0
|
16605 | }), DimensionLayoutManager.prototype._requiresMeasure = function() {
|
16606 | return !0;
|
16607 | }, DimensionLayoutManager.prototype.startScrollingSession = function() {
|
16608 | this._isScrolling = !0;
|
16609 | }, DimensionLayoutManager.prototype.endScrollingSession = function() {
|
16610 | this._isScrolling = !1;
|
16611 | }, DimensionLayoutManager.prototype.isScrolling = function() {
|
16612 | return this._isScrolling;
|
16613 | }, DimensionLayoutManager.prototype.isResizing = function() {
|
16614 | return !1;
|
16615 | }, DimensionLayoutManager.prototype.getOtherHierarchyContextualHeight = function() {
|
16616 | var otherDimension = this.dimension.otherDimension, count = otherDimension.getDepth(), contextualHeight = 0, items = this._getRealizedItems();
|
16617 | if (items.length > 0) for (var i = 0; count > i; i++) contextualHeight += items[i].getContextualWidth();
|
16618 | return contextualHeight;
|
16619 | }, DimensionLayoutManager.prototype._isAutoSized = function() {
|
16620 | return !1;
|
16621 | }, DimensionLayoutManager.prototype.onStartRenderingSession = function() {
|
16622 | this._measureEnabled = this._requiresMeasure(), this._gridOffset = this.dimension.otherDimension.getDepth();
|
16623 | }, DimensionLayoutManager.prototype.onEndRenderingSession = function() {
|
16624 | this._realizationManager.onEndRenderingSession(), this._alignToEnd = !1, this._done = !1,
|
16625 | this._measureEnabled = !0, this._sendDimensionsToControl();
|
16626 | }, DimensionLayoutManager.prototype._sendDimensionsToControl = function() {}, Object.defineProperty(DimensionLayoutManager.prototype, "measureEnabled", {
|
16627 | get: function() {
|
16628 | return this._measureEnabled;
|
16629 | },
|
16630 | enumerable: !0,
|
16631 | configurable: !0
|
16632 | }), DimensionLayoutManager.prototype.getFooterContextualWidth = function() {
|
16633 | return 0;
|
16634 | }, DimensionLayoutManager.prototype.onStartRenderingIteration = function(clear, contextualWidth) {
|
16635 | this._measureEnabled && !this._done && (this._contextualWidthToFill = (contextualWidth - this.otherScrollbarContextualWidth) * this.getGridScale() - this.getFooterContextualWidth()),
|
16636 | this._realizationManager.onStartRenderingIteration(), clear ? this._lastScrollOffset = null : null !== this._lastScrollOffset && this.swapElements();
|
16637 | }, Object.defineProperty(DimensionLayoutManager.prototype, "allItemsRealized", {
|
16638 | get: function() {
|
16639 | return this.getRealizedItemsCount() - this._gridOffset === this.dimension.getItemsCount() || 0 === this.dimension.getItemsCount();
|
16640 | },
|
16641 | enumerable: !0,
|
16642 | configurable: !0
|
16643 | }), DimensionLayoutManager.prototype.onEndRenderingIteration = function() {
|
16644 | if (!this._done) {
|
16645 | if (!this._measureEnabled) return this._lastScrollOffset = this.dimension.scrollOffset,
|
16646 | void (this._done = !0);
|
16647 | var newScrollOffset, gridContextualWidth = this.getGridContextualWidth(), filled = powerbi.Double.greaterOrEqualWithPrecision(gridContextualWidth, this._contextualWidthToFill, DimensionLayoutManager._pixelPrecision), allRealized = this.allItemsRealized;
|
16648 | newScrollOffset = filled ? this.scrollForwardToAlignEnd(gridContextualWidth) : this.scrollBackwardToFill(gridContextualWidth),
|
16649 | this._realizationManager.onEndRenderingIteration(gridContextualWidth, filled);
|
16650 | var originalScrollbarVisible = this.dimension.scrollbar.visible;
|
16651 | this.updateScrollbar(gridContextualWidth), this._done = (filled || allRealized) && this.dimension.scrollbar.visible === originalScrollbarVisible && powerbi.Double.equalWithPrecision(newScrollOffset, this.dimension.scrollOffset, DimensionLayoutManager._scrollOffsetPrecision),
|
16652 | this.dimension.scrollOffset = newScrollOffset, this._lastScrollOffset = this.dimension.scrollOffset;
|
16653 | }
|
16654 | }, DimensionLayoutManager.prototype.getScrollDeltaWithinPage = function() {
|
16655 | if (null !== this._lastScrollOffset) {
|
16656 | var delta = this.dimension.getIntegerScrollOffset() - Math.floor(this._lastScrollOffset);
|
16657 | if (Math.abs(delta) < this.getRealizedItemsCount() - this.dimension.otherDimension.getDepth()) return delta;
|
16658 | }
|
16659 | return null;
|
16660 | }, DimensionLayoutManager.prototype.swapElements = function() {
|
16661 | var delta = this.getScrollDeltaWithinPage();
|
16662 | if (null !== delta) {
|
16663 | var otherHierarchyDepth = this.dimension.otherDimension.getDepth();
|
16664 | Math.abs(delta) < this.getRealizedItemsCount() - otherHierarchyDepth && (delta > 0 ? this._moveElementsToBottom(otherHierarchyDepth, delta) : 0 > delta && this._moveElementsToTop(otherHierarchyDepth, -delta));
|
16665 | }
|
16666 | }, DimensionLayoutManager.prototype._getRealizedItems = function() {
|
16667 | return null;
|
16668 | }, DimensionLayoutManager.prototype.getRealizedItemsCount = function() {
|
16669 | var realizedItems = this._getRealizedItems();
|
16670 | return realizedItems.length;
|
16671 | }, DimensionLayoutManager.prototype._moveElementsToBottom = function(moveFromIndex, count) {},
|
16672 | DimensionLayoutManager.prototype._moveElementsToTop = function(moveToIndex, count) {},
|
16673 | DimensionLayoutManager.prototype.isScrollingWithinPage = function() {
|
16674 | return null !== this.getScrollDeltaWithinPage();
|
16675 | }, DimensionLayoutManager.prototype.getGridContextualWidth = function() {
|
16676 | return 0;
|
16677 | }, DimensionLayoutManager.prototype.updateScrollbar = function(gridContextualWidth) {
|
16678 | var scrollbar = this.dimension.scrollbar;
|
16679 | scrollbar.viewMin = this.dimension.scrollOffset, scrollbar.min = 0, scrollbar.max = this.dimension.getItemsCount(),
|
16680 | scrollbar.viewSize = this.getViewSize(gridContextualWidth), this.dimension.scrollbar.show(this.canScroll(gridContextualWidth));
|
16681 | }, DimensionLayoutManager.prototype.getViewSize = function(gridContextualWidth) {
|
16682 | var count = this.getRealizedItemsCount();
|
16683 | if (0 === count) return 0;
|
16684 | 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++) {
|
16685 | var visibleRatio = void 0;
|
16686 | visibleRatio = i === startIndex ? this.getVisibleSizeRatio() : 1;
|
16687 | var itemContextualWidth = this.getItemContextualWidthWithScrolling(i) * error;
|
16688 | if (sizeInPixels += itemContextualWidth, sizeInItems += visibleRatio, powerbi.Double.greaterWithPrecision(sizeInPixels, scrollableArea, DimensionLayoutManager._pixelPrecision)) {
|
16689 | sizeInItems -= (sizeInPixels - scrollableArea) / itemContextualWidth * visibleRatio;
|
16690 | break;
|
16691 | }
|
16692 | }
|
16693 | return sizeInItems;
|
16694 | }, DimensionLayoutManager.prototype.isScrollableHeader = function(item, items, index) {
|
16695 | if (0 !== index || 0 === this.dimension.getFractionScrollOffset()) return !1;
|
16696 | var hierarchyNavigator = this.dimension._hierarchyNavigator;
|
16697 | if (hierarchyNavigator.isLeaf(item)) return !0;
|
16698 | var currentItem = item, currentItems = items;
|
16699 | do {
|
16700 | if (currentItems = hierarchyNavigator.getChildren(currentItem), currentItem = this.dimension.getFirstVisibleItem(hierarchyNavigator.getLevel(currentItem) + 1),
|
16701 | void 0 === currentItem) break;
|
16702 | if (!hierarchyNavigator.isLastItem(currentItem, currentItems)) return !1;
|
16703 | } while (!hierarchyNavigator.isLeaf(currentItem));
|
16704 | return !0;
|
16705 | }, DimensionLayoutManager.prototype.reachedEnd = function() {
|
16706 | return this.dimension.getIntegerScrollOffset() + (this.getRealizedItemsCount() - this._gridOffset) >= this.dimension.getItemsCount();
|
16707 | }, DimensionLayoutManager.prototype.scrollBackwardToFill = function(gridContextualWidth) {
|
16708 | var newScrollOffset = this.dimension.scrollOffset;
|
16709 | if (this.reachedEnd()) {
|
16710 | var widthToFill = this._contextualWidthToFill - gridContextualWidth;
|
16711 | if (this.dimension.getItemsCount() > 0) {
|
16712 | var averageColumnwidth = gridContextualWidth / (this.getRealizedItemsCount() - this.dimension.getFractionScrollOffset());
|
16713 | newScrollOffset = this.dimension.getValidScrollOffset(Math.floor(this.dimension.scrollOffset - widthToFill / averageColumnwidth));
|
16714 | }
|
16715 | this._alignToEnd = !powerbi.Double.equalWithPrecision(newScrollOffset, this.dimension.scrollOffset, DimensionLayoutManager._scrollOffsetPrecision);
|
16716 | }
|
16717 | return newScrollOffset;
|
16718 | }, DimensionLayoutManager.prototype.getItemContextualWidth = function(index) {
|
16719 | var realizedItems = this._getRealizedItems();
|
16720 | return index >= realizedItems.length ? null : realizedItems[index].getContextualWidth();
|
16721 | }, DimensionLayoutManager.prototype.getItemContextualWidthWithScrolling = function(index) {
|
16722 | return this.getSizeWithScrolling(this.getItemContextualWidth(index), index);
|
16723 | }, DimensionLayoutManager.prototype.getSizeWithScrolling = function(size, index) {
|
16724 | var ratio;
|
16725 | return ratio = this._gridOffset === index ? this.getVisibleSizeRatio() : 1, size * ratio;
|
16726 | }, DimensionLayoutManager.prototype.getGridContextualWidthFromItems = function() {
|
16727 | for (var count = this.getRealizedItemsCount(), contextualWidth = 0, i = 0; count > i; i++) contextualWidth += this.getItemContextualWidthWithScrolling(i);
|
16728 | return contextualWidth;
|
16729 | }, DimensionLayoutManager.prototype.getMeaurementError = function(gridContextualWidth) {
|
16730 | return gridContextualWidth / this.getGridContextualWidthFromItems();
|
16731 | }, DimensionLayoutManager.prototype.scrollForwardToAlignEnd = function(gridContextualWidth) {
|
16732 | var newScrollOffset = this.dimension.scrollOffset;
|
16733 | if (this._alignToEnd) {
|
16734 | var withinThreshold = powerbi.Double.equalWithPrecision(gridContextualWidth, this._contextualWidthToFill, DimensionLayoutManager._pixelPrecision);
|
16735 | if (!withinThreshold) for (var count = this.getRealizedItemsCount(), startIndex = this._gridOffset, widthToScroll = gridContextualWidth - this._contextualWidthToFill, error = this.getMeaurementError(gridContextualWidth), i = startIndex; count > i; i++) {
|
16736 | var itemContextualWidth = this.getItemContextualWidth(i) * error;
|
16737 | if (!powerbi.Double.lessWithPrecision(itemContextualWidth, widthToScroll, DimensionLayoutManager._pixelPrecision)) {
|
16738 | var visibleRatio = startIndex === i ? 1 - this.dimension.getFractionScrollOffset() : 1;
|
16739 | newScrollOffset = this.dimension.getValidScrollOffset(this.dimension.scrollOffset + (i - startIndex) + widthToScroll * visibleRatio / itemContextualWidth);
|
16740 | break;
|
16741 | }
|
16742 | widthToScroll -= itemContextualWidth;
|
16743 | }
|
16744 | this._alignToEnd = !withinThreshold;
|
16745 | }
|
16746 | return newScrollOffset;
|
16747 | }, Object.defineProperty(DimensionLayoutManager.prototype, "dimension", {
|
16748 | get: function() {
|
16749 | return null;
|
16750 | },
|
16751 | enumerable: !0,
|
16752 | configurable: !0
|
16753 | }), Object.defineProperty(DimensionLayoutManager.prototype, "otherLayoutManager", {
|
16754 | get: function() {
|
16755 | return this.dimension.otherDimension.layoutManager;
|
16756 | },
|
16757 | enumerable: !0,
|
16758 | configurable: !0
|
16759 | }), Object.defineProperty(DimensionLayoutManager.prototype, "contextualWidthToFill", {
|
16760 | get: function() {
|
16761 | return this._contextualWidthToFill;
|
16762 | },
|
16763 | enumerable: !0,
|
16764 | configurable: !0
|
16765 | }), DimensionLayoutManager.prototype.getGridScale = function() {
|
16766 | return 0;
|
16767 | }, Object.defineProperty(DimensionLayoutManager.prototype, "otherScrollbarContextualWidth", {
|
16768 | get: function() {
|
16769 | return 0;
|
16770 | },
|
16771 | enumerable: !0,
|
16772 | configurable: !0
|
16773 | }), DimensionLayoutManager.prototype.getActualContextualWidth = function(gridContextualWidth) {
|
16774 | return this._isAutoSized() && !this.canScroll(gridContextualWidth) ? gridContextualWidth : this._contextualWidthToFill;
|
16775 | }, DimensionLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16776 | return !1;
|
16777 | }, DimensionLayoutManager.prototype.calculateSizes = function() {
|
16778 | this.fixedSizeEnabled && (this.calculateContextualWidths(), this.calculateSpans());
|
16779 | }, DimensionLayoutManager.prototype._calculateSize = function(item) {
|
16780 | return null;
|
16781 | }, DimensionLayoutManager.prototype.calculateContextualWidths = function() {
|
16782 | for (var items = this._getRealizedItems(), count = items.length, i = 0; count > i; i++) {
|
16783 | var item = items[i];
|
16784 | this.measureEnabled && item.setAligningContextualWidth(-1), this._calculateSize(item);
|
16785 | }
|
16786 | }, DimensionLayoutManager.prototype.calculateSpans = function() {
|
16787 | this.measureEnabled && (this.updateNonScrollableItemsSpans(), this.updateScrollableItemsSpans());
|
16788 | }, DimensionLayoutManager.prototype.updateNonScrollableItemsSpans = function() {
|
16789 | for (var otherDimensionItems = this.otherLayoutManager._getRealizedItems(), otherDimensionItemsCount = otherDimensionItems.length, startIndex = this.dimension.getDepth(), i = startIndex; otherDimensionItemsCount > i; i++) {
|
16790 | var otherDimensionItem = otherDimensionItems[i];
|
16791 | this.updateSpans(otherDimensionItem, otherDimensionItem.getHeaders());
|
16792 | }
|
16793 | }, DimensionLayoutManager.prototype.updateScrollableItemsSpans = function() {
|
16794 | for (var otherRealizedItems = this.otherLayoutManager._getRealizedItems(), otherRealizedItemsCount = Math.min(this.dimension.getDepth(), otherRealizedItems.length), i = 0; otherRealizedItemsCount > i; i++) {
|
16795 | var otherRealizedItem = otherRealizedItems[i];
|
16796 | this.updateSpans(otherRealizedItem, otherRealizedItem.getOtherDimensionHeaders());
|
16797 | }
|
16798 | }, DimensionLayoutManager.prototype.fixSizes = function() {
|
16799 | if (this.fixedSizeEnabled) for (var items = this._getRealizedItems(), count = items.length, i = count - 1; i >= 0; i--) items[i].fixSize();
|
16800 | }, DimensionLayoutManager.prototype.updateSpans = function(otherRealizedItem, cells) {
|
16801 | for (var realizedItems = this._getRealizedItems(), cellCount = cells.length, j = 0; cellCount > j; j++) {
|
16802 | var cell = cells[j], owner = otherRealizedItem.getOtherDimensionOwner(cell), span = owner.getCellContextualSpan(cell);
|
16803 | if (span > 1) for (var totalSizeInSpan = 0, startIndex = owner.getIndex(this._grid), k = 0; span > k; k++) {
|
16804 | var item = realizedItems[k + startIndex];
|
16805 | totalSizeInSpan += item.getContentContextualWidth(), k === span - 1 && this.updateLastChildSize(cell, item, totalSizeInSpan);
|
16806 | }
|
16807 | }
|
16808 | }, DimensionLayoutManager.prototype.updateLastChildSize = function(spanningCell, item, totalSpanSize) {
|
16809 | var delta = item.getCellIContentContextualWidth(spanningCell) - totalSpanSize;
|
16810 | delta > 0 && item.setAligningContextualWidth(Math.max(item.getAligningContextualWidth(), delta + item.getContentContextualWidth()));
|
16811 | }, DimensionLayoutManager._pixelPrecision = 1.0001, DimensionLayoutManager._scrollOffsetPrecision = .01,
|
16812 | DimensionLayoutManager;
|
16813 | }();
|
16814 | internal.DimensionLayoutManager = DimensionLayoutManager;
|
16815 | var ResizeState = function() {
|
16816 | function ResizeState(column, width, scale) {
|
16817 | this.column = column, this.item = column.getLeafItem(), this.itemType = column.itemType,
|
16818 | this.startColumnWidth = width, this.resizingDelta = 0, this.animationFrame = null,
|
16819 | this.scale = scale;
|
16820 | }
|
16821 | return ResizeState.prototype.getNewSize = function() {
|
16822 | return this.startColumnWidth + this.resizingDelta;
|
16823 | }, ResizeState;
|
16824 | }();
|
16825 | internal.ResizeState = ResizeState;
|
16826 | var ColumnLayoutManager = function(_super) {
|
16827 | function ColumnLayoutManager(owner, grid, realizationManager) {
|
16828 | _super.call(this, owner, grid, realizationManager), realizationManager.owner = this,
|
16829 | this.fillProportionally = !1, this._resizeState = null;
|
16830 | }
|
16831 | return __extends(ColumnLayoutManager, _super), Object.defineProperty(ColumnLayoutManager.prototype, "dimension", {
|
16832 | get: function() {
|
16833 | return this.owner.owner.columnDimension;
|
16834 | },
|
16835 | enumerable: !0,
|
16836 | configurable: !0
|
16837 | }), ColumnLayoutManager.prototype.isResizing = function() {
|
16838 | return null !== this._resizeState;
|
16839 | }, Object.defineProperty(ColumnLayoutManager.prototype, "fillProportionally", {
|
16840 | get: function() {
|
16841 | return this._grid.fillColumnsProportionally;
|
16842 | },
|
16843 | set: function(value) {
|
16844 | this._grid.fillColumnsProportionally = value;
|
16845 | },
|
16846 | enumerable: !0,
|
16847 | configurable: !0
|
16848 | }), ColumnLayoutManager.prototype.getGridScale = function() {
|
16849 | return this._grid._presenter.getScreenToCssRatioX();
|
16850 | }, Object.defineProperty(ColumnLayoutManager.prototype, "otherScrollbarContextualWidth", {
|
16851 | get: function() {
|
16852 | return this.dimension.otherDimension.scrollbar.visible ? controls.HTMLElementUtils.getElementWidth(this.dimension.otherDimension.scrollbar.element) : 0;
|
16853 | },
|
16854 | enumerable: !0,
|
16855 | configurable: !0
|
16856 | }), ColumnLayoutManager.prototype._getRealizedItems = function() {
|
16857 | return this._grid.realizedColumns || (this._grid.realizedColumns = []), this._grid.realizedColumns;
|
16858 | }, ColumnLayoutManager.prototype._moveElementsToBottom = function(moveFromIndex, count) {
|
16859 | this._grid.moveColumnsToEnd(moveFromIndex, count);
|
16860 | }, ColumnLayoutManager.prototype._moveElementsToTop = function(moveToIndex, count) {
|
16861 | this._grid.moveColumnsToStart(moveToIndex, count);
|
16862 | }, ColumnLayoutManager.prototype._requiresMeasure = function() {
|
16863 | return !this.isScrolling() && !this.otherLayoutManager.isScrolling() || this.isScrolling() || this.isResizing();
|
16864 | }, ColumnLayoutManager.prototype.getGridContextualWidth = function() {
|
16865 | return this._grid.getWidth();
|
16866 | }, ColumnLayoutManager.prototype.getFirstVisibleColumn = function() {
|
16867 | return this._grid.realizedColumns[this._gridOffset];
|
16868 | }, ColumnLayoutManager.prototype._isAutoSized = function() {
|
16869 | return this.owner.owner.autoSizeWidth;
|
16870 | }, ColumnLayoutManager.prototype.applyScrolling = function() {
|
16871 | var columnOffset = this.dimension.getFractionScrollOffset(), firstVisibleColumnWidth = 0;
|
16872 | if (0 !== columnOffset) {
|
16873 | var firstVisibleColumn = this.getFirstVisibleColumn();
|
16874 | void 0 !== firstVisibleColumn && (firstVisibleColumnWidth = firstVisibleColumn.getContextualWidth(),
|
16875 | this.scroll(firstVisibleColumn, firstVisibleColumnWidth, columnOffset));
|
16876 | }
|
16877 | }, ColumnLayoutManager.prototype.scroll = function(firstVisibleColumn, width, offset) {
|
16878 | this.scrollCells(firstVisibleColumn._realizedColumnHeaders, width, offset), this.scrollBodyCells(this._grid.realizedRows, width, offset),
|
16879 | null !== firstVisibleColumn.footer && firstVisibleColumn.footer.scrollHorizontally(width, offset);
|
16880 | }, ColumnLayoutManager.prototype.scrollCells = function(cells, width, offset) {
|
16881 | for (var length = cells.length, i = 0; length > i; i++) cells[i].scrollHorizontally(width, offset);
|
16882 | }, ColumnLayoutManager.prototype.scrollBodyCells = function(rows, width, offset) {
|
16883 | for (var cells, cell, length = rows.length, i = 0; length > i; i++) cells = rows[i]._realizedBodyCells,
|
16884 | void 0 !== cells && (cell = cells[0], void 0 !== cell && cell.scrollHorizontally(width, offset));
|
16885 | }, ColumnLayoutManager.prototype.onStartResize = function(cell, currentX, currentY) {
|
16886 | this._resizeState = new ResizeState(cell._column, cell._column.getContentContextualWidth(), controls.HTMLElementUtils.getAccumulatedScale(this.owner.owner.container));
|
16887 | }, ColumnLayoutManager.prototype.onResize = function(cell, deltaX, deltaY) {
|
16888 | var _this = this;
|
16889 | this.isResizing() && (this._resizeState.resizingDelta = Math.round(Math.max(deltaX / this._resizeState.scale, ColumnLayoutManager.minColumnWidth - this._resizeState.startColumnWidth)),
|
16890 | null === this._resizeState.animationFrame && (this._resizeState.animationFrame = requestAnimationFrame(function() {
|
16891 | return _this.performResizing();
|
16892 | })));
|
16893 | }, ColumnLayoutManager.prototype.onEndResize = function(cell) {
|
16894 | this.isResizing() && null !== this._resizeState.animationFrame && this.performResizing(),
|
16895 | this.endResizing(), this._resizeState = null;
|
16896 | }, ColumnLayoutManager.prototype.onReset = function(cell) {
|
16897 | this._resizeState = new ResizeState(cell._column, -1, 1), cell._column.clearSize(),
|
16898 | this.endResizing(), this.owner.owner.refresh(!1), this._resizeState = null;
|
16899 | }, ColumnLayoutManager.prototype.updateItemToResizeState = function(realizedColumns) {
|
16900 | if (null !== this._resizeState) for (var columnCount = realizedColumns.length, hierarchyNavigator = this.owner.owner.hierarchyNavigator, startIndex = this.otherLayoutManager.dimension.getDepth(), i = startIndex; columnCount > i; i++) {
|
16901 | var column = realizedColumns[i];
|
16902 | if (column.columnHeaderOrCornerEquals(this._resizeState.itemType, this._resizeState.item, column.itemType, column.getLeafItem(), hierarchyNavigator) && column !== this._resizeState.column) {
|
16903 | this._resizeState.column = column, column.onResize(this._resizeState.getNewSize());
|
16904 | break;
|
16905 | }
|
16906 | }
|
16907 | }, ColumnLayoutManager.prototype.performResizing = function() {
|
16908 | if (null !== this._resizeState) {
|
16909 | this._resizeState.animationFrame = null;
|
16910 | var newSize = this._resizeState.getNewSize();
|
16911 | this._resizeState.column.onResize(newSize), this.owner.owner.refresh(!1);
|
16912 | }
|
16913 | }, ColumnLayoutManager.prototype.endResizing = function() {
|
16914 | if (null !== this._resizeState) {
|
16915 | var newSize = this._resizeState.getNewSize();
|
16916 | this._resizeState.column.onResizeEnd(newSize);
|
16917 | }
|
16918 | }, ColumnLayoutManager.prototype._sendDimensionsToControl = function() {
|
16919 | var gridContextualWidth = this.getGridContextualWidth(), widthToFill = this.getActualContextualWidth(gridContextualWidth), otherContextualHeight = this.getOtherHierarchyContextualHeight(), scale = this.getGridScale();
|
16920 | this.owner.owner.updateColumnDimensions(otherContextualHeight / scale, (widthToFill - otherContextualHeight) / scale, this.getViewSize(gridContextualWidth));
|
16921 | }, ColumnLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16922 | return -1;
|
16923 | }, ColumnLayoutManager.prototype.getEstimatedBodyCellWidth = function(content) {
|
16924 | return -1;
|
16925 | }, ColumnLayoutManager.minColumnWidth = 10, ColumnLayoutManager;
|
16926 | }(DimensionLayoutManager);
|
16927 | internal.ColumnLayoutManager = ColumnLayoutManager;
|
16928 | var DashboardColumnLayoutManager = function(_super) {
|
16929 | function DashboardColumnLayoutManager() {
|
16930 | _super.apply(this, arguments);
|
16931 | }
|
16932 | return __extends(DashboardColumnLayoutManager, _super), DashboardColumnLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16933 | return this.ignoreColumn(headerIndex) ? 0 : this.owner.getCellWidth(void 0);
|
16934 | }, DashboardColumnLayoutManager.prototype.getEstimatedBodyCellWidth = function(content) {
|
16935 | return this.owner.getCellWidth(void 0);
|
16936 | }, DashboardColumnLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16937 | return !1;
|
16938 | }, DashboardColumnLayoutManager.prototype._calculateSize = function(item) {
|
16939 | var headerIndex = item.getIndex(this._grid), computedSize = 0;
|
16940 | return this.ignoreColumn(headerIndex) || (computedSize = this.owner.getContentWidth(void 0)),
|
16941 | item.onResize(computedSize), item.onResizeEnd(computedSize), computedSize;
|
16942 | }, DashboardColumnLayoutManager.prototype.ignoreColumn = function(headerIndex) {
|
16943 | return 0 === headerIndex && !this.owner.binder.hasRowGroups();
|
16944 | }, DashboardColumnLayoutManager;
|
16945 | }(ColumnLayoutManager);
|
16946 | internal.DashboardColumnLayoutManager = DashboardColumnLayoutManager;
|
16947 | var CanvasColumnLayoutManager = function(_super) {
|
16948 | function CanvasColumnLayoutManager() {
|
16949 | _super.apply(this, arguments);
|
16950 | }
|
16951 | return __extends(CanvasColumnLayoutManager, _super), CanvasColumnLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
16952 | return this.owner.getEstimatedTextWidth(label);
|
16953 | }, CanvasColumnLayoutManager.prototype.getEstimatedBodyCellWidth = function(content) {
|
16954 | return this.owner.getEstimatedTextWidth(content);
|
16955 | }, CanvasColumnLayoutManager.prototype.calculateContextualWidths = function() {
|
16956 | for (var items = this._getRealizedItems(), columnWidths = [], _i = 0, items_1 = items; _i < items_1.length; _i++) {
|
16957 | var item = items_1[_i];
|
16958 | this.measureEnabled && item.setAligningContextualWidth(-1), columnWidths.push(this._calculateSize(item));
|
16959 | }
|
16960 | this.owner.columnWidthsToPersist = columnWidths;
|
16961 | }, CanvasColumnLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
16962 | 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);
|
16963 | }, CanvasColumnLayoutManager.prototype._calculateSize = function(item) {
|
16964 | return item.calculateSize();
|
16965 | }, CanvasColumnLayoutManager;
|
16966 | }(ColumnLayoutManager);
|
16967 | internal.CanvasColumnLayoutManager = CanvasColumnLayoutManager;
|
16968 | var RowLayoutManager = function(_super) {
|
16969 | function RowLayoutManager(owner, grid, realizationManager) {
|
16970 | _super.call(this, owner, grid, realizationManager), realizationManager.owner = this;
|
16971 | }
|
16972 | return __extends(RowLayoutManager, _super), Object.defineProperty(RowLayoutManager.prototype, "dimension", {
|
16973 | get: function() {
|
16974 | return this.owner.owner.rowDimension;
|
16975 | },
|
16976 | enumerable: !0,
|
16977 | configurable: !0
|
16978 | }), RowLayoutManager.prototype.getGridScale = function() {
|
16979 | return this._grid._presenter.getScreenToCssRatioY();
|
16980 | }, Object.defineProperty(RowLayoutManager.prototype, "otherScrollbarContextualWidth", {
|
16981 | get: function() {
|
16982 | return this.dimension.otherDimension.scrollbar.visible ? controls.HTMLElementUtils.getElementHeight(this.dimension.otherDimension.scrollbar.element) : 0;
|
16983 | },
|
16984 | enumerable: !0,
|
16985 | configurable: !0
|
16986 | }), RowLayoutManager.prototype.startScrollingSession = function() {
|
16987 | _super.prototype.startScrollingSession.call(this);
|
16988 | }, RowLayoutManager.prototype._getRealizedItems = function() {
|
16989 | return this._grid.realizedRows || (this._grid.realizedRows = []), this._grid.realizedRows;
|
16990 | }, RowLayoutManager.prototype._moveElementsToBottom = function(moveFromIndex, count) {
|
16991 | this._grid.moveRowsToEnd(moveFromIndex, count);
|
16992 | }, RowLayoutManager.prototype._moveElementsToTop = function(moveToIndex, count) {
|
16993 | this._grid.moveRowsToStart(moveToIndex, count);
|
16994 | }, RowLayoutManager.prototype._requiresMeasure = function() {
|
16995 | return !this.isScrolling() && !this.otherLayoutManager.isScrolling() && !this.otherLayoutManager.isResizing() || this.isScrolling() && this.dimension.getIntegerScrollOffset() + (this.getRealizedItemsCount() - this._gridOffset) >= this.dimension.getItemsCount();
|
16996 | }, RowLayoutManager.prototype.getGridContextualWidth = function() {
|
16997 | return this._grid.getHeight();
|
16998 | }, RowLayoutManager.prototype.getFirstVisibleRow = function() {
|
16999 | return this._grid.realizedRows[this._gridOffset];
|
17000 | }, RowLayoutManager.prototype._isAutoSized = function() {
|
17001 | return this.owner.owner.autoSizeHeight;
|
17002 | }, RowLayoutManager.prototype.applyScrolling = function() {
|
17003 | var rowOffset = this.dimension.getFractionScrollOffset(), firstVisibleRowHeight = 0;
|
17004 | if (0 !== rowOffset) {
|
17005 | var firstVisibleRow = this.getFirstVisibleRow();
|
17006 | firstVisibleRow && (firstVisibleRowHeight = firstVisibleRow.getContextualWidth(),
|
17007 | this.scroll(firstVisibleRow, firstVisibleRowHeight, rowOffset));
|
17008 | }
|
17009 | }, RowLayoutManager.prototype.scroll = function(firstVisibleRow, height, offset) {
|
17010 | this.scrollCells(firstVisibleRow._realizedRowHeaders, height, offset), this.scrollCells(firstVisibleRow._realizedBodyCells, height, offset);
|
17011 | }, RowLayoutManager.prototype.scrollCells = function(cells, height, offset) {
|
17012 | for (var length = cells.length, i = 0; length > i; i++) cells[i].scrollVertically(height, offset);
|
17013 | }, RowLayoutManager.prototype.getFooterContextualWidth = function() {
|
17014 | return this.owner.owner.rowDimension.hasFooter() && this.owner.grid.footerRow ? this.owner.grid.footerRow.getContextualWidth() : 0;
|
17015 | }, RowLayoutManager.prototype.calculateContextualWidths = function() {
|
17016 | if (_super.prototype.calculateContextualWidths.call(this), this.fixedSizeEnabled) {
|
17017 | var footerRow = this._grid.footerRow;
|
17018 | footerRow && this._calculateSize(footerRow);
|
17019 | }
|
17020 | }, RowLayoutManager.prototype.fixSizes = function() {
|
17021 | _super.prototype.fixSizes.call(this), this.fixedSizeEnabled && this._grid.footerRow && this._grid.footerRow.fixSize();
|
17022 | }, RowLayoutManager.prototype._sendDimensionsToControl = function() {
|
17023 | var gridContextualWidth = this.getGridContextualWidth(), widthToFill = this.getActualContextualWidth(gridContextualWidth), otherContextualHeight = this.getOtherHierarchyContextualHeight(), scale = this.getGridScale();
|
17024 | this.owner.owner.updateRowDimensions(otherContextualHeight / scale, (widthToFill - otherContextualHeight) / scale, gridContextualWidth / scale, this.getViewSize(gridContextualWidth), this._grid.footerRow ? this._grid.footerRow.getContextualWidth() / scale : 0);
|
17025 | }, RowLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
17026 | return -1;
|
17027 | }, RowLayoutManager;
|
17028 | }(DimensionLayoutManager);
|
17029 | internal.RowLayoutManager = RowLayoutManager;
|
17030 | var DashboardRowLayoutManager = function(_super) {
|
17031 | function DashboardRowLayoutManager() {
|
17032 | _super.apply(this, arguments);
|
17033 | }
|
17034 | return __extends(DashboardRowLayoutManager, _super), DashboardRowLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
17035 | return this.getHeaderWidth(headerIndex);
|
17036 | }, DashboardRowLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
17037 | return !1;
|
17038 | }, DashboardRowLayoutManager.prototype._calculateSize = function(item) {
|
17039 | return item.calculateSize();
|
17040 | }, DashboardRowLayoutManager.prototype.getHeaderWidth = function(headerIndex) {
|
17041 | return 0 !== headerIndex || this.owner.binder.hasRowGroups() ? this.owner.getEstimatedTextWidth(void 0) : 0;
|
17042 | }, DashboardRowLayoutManager;
|
17043 | }(RowLayoutManager);
|
17044 | internal.DashboardRowLayoutManager = DashboardRowLayoutManager;
|
17045 | var CanvasRowLayoutManager = function(_super) {
|
17046 | function CanvasRowLayoutManager() {
|
17047 | _super.apply(this, arguments);
|
17048 | }
|
17049 | return __extends(CanvasRowLayoutManager, _super), CanvasRowLayoutManager.prototype.getEstimatedHeaderWidth = function(label, headerIndex) {
|
17050 | return this.owner.getEstimatedTextWidth(label);
|
17051 | }, CanvasRowLayoutManager.prototype.canScroll = function(gridContextualWidth) {
|
17052 | 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);
|
17053 | }, CanvasRowLayoutManager.prototype._calculateSize = function(item) {
|
17054 | return item.calculateSize();
|
17055 | }, CanvasRowLayoutManager;
|
17056 | }(RowLayoutManager);
|
17057 | internal.CanvasRowLayoutManager = CanvasRowLayoutManager;
|
17058 | var TablixLayoutManager = function() {
|
17059 | function TablixLayoutManager(binder, grid, columnLayoutManager, rowLayoutManager) {
|
17060 | this._allowHeaderResize = !0, this._binder = binder, this._grid = grid, this._columnLayoutManager = columnLayoutManager,
|
17061 | this._rowLayoutManager = rowLayoutManager, this._columnWidthsToPersist = [];
|
17062 | }
|
17063 | return TablixLayoutManager.prototype.initialize = function(owner) {
|
17064 | this._owner = owner, this._container = owner.container, this._gridHost = owner.contentHost,
|
17065 | this._footersHost = owner.footerHost, this._grid.initialize(owner, this._gridHost, this._footersHost);
|
17066 | }, Object.defineProperty(TablixLayoutManager.prototype, "owner", {
|
17067 | get: function() {
|
17068 | return this._owner;
|
17069 | },
|
17070 | enumerable: !0,
|
17071 | configurable: !0
|
17072 | }), Object.defineProperty(TablixLayoutManager.prototype, "binder", {
|
17073 | get: function() {
|
17074 | return this._binder;
|
17075 | },
|
17076 | enumerable: !0,
|
17077 | configurable: !0
|
17078 | }), Object.defineProperty(TablixLayoutManager.prototype, "columnWidthsToPersist", {
|
17079 | get: function() {
|
17080 | return this._columnWidthsToPersist;
|
17081 | },
|
17082 | set: function(columnWidths) {
|
17083 | this._columnWidthsToPersist = columnWidths;
|
17084 | },
|
17085 | enumerable: !0,
|
17086 | configurable: !0
|
17087 | }), TablixLayoutManager.prototype.getTablixClassName = function() {
|
17088 | return null;
|
17089 | }, TablixLayoutManager.prototype.getLayoutKind = function() {
|
17090 | return null;
|
17091 | }, TablixLayoutManager.prototype.getOrCreateColumnHeader = function(item, items, rowIndex, columnIndex) {
|
17092 | 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);
|
17093 | cell.position.row.index = cell.position.row.indexInSiblings = rowIdx, cell.position.row.isFirst = 0 === rowIdx,
|
17094 | cell.position.row.isLast = isLeaf;
|
17095 | var colIdx = hierarchyNav.getIndex(item);
|
17096 | return cell.position.column.index = cell.position.row.indexInSiblings = colIdx,
|
17097 | cell.position.column.isFirst = hierarchyNav.areAllParentsFirst(item, items), cell.position.column.isLast = hierarchyNav.areAllParentsLast(item, items),
|
17098 | this.enableCellHorizontalResize(isLeaf, cell), cell;
|
17099 | }, TablixLayoutManager.prototype.getOrCreateRowHeader = function(item, items, rowIndex, columnIndex) {
|
17100 | 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);
|
17101 | 0 === row.getRealizedCellCount() && this.alignRowHeaderCells(item, row);
|
17102 | var cell = row.getOrCreateRowHeader(column, scrollable, hierarchyNav.isLeaf(item)), rowIdx = hierarchyNav.getIndex(item);
|
17103 | cell.position.row.index = cell.position.row.indexInSiblings = rowIdx, cell.position.row.isFirst = hierarchyNav.areAllParentsFirst(item, items),
|
17104 | cell.position.row.isLast = hierarchyNav.areAllParentsLast(item, items);
|
17105 | var colIdx = hierarchyNav.getLevel(item);
|
17106 | return cell.position.column.index = cell.position.column.indexInSiblings = colIdx,
|
17107 | cell.position.column.isFirst = 0 === colIdx, cell.position.column.isLast = isLeaf,
|
17108 | cell.enableHorizontalResize(!1, this._columnLayoutManager), cell;
|
17109 | }, TablixLayoutManager.prototype.getOrCreateCornerCell = function(item, rowLevel, columnLevel) {
|
17110 | 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;
|
17111 | cell.position.row.index = cell.position.row.indexInSiblings = rowIdx, cell.position.row.isFirst = 0 === rowIdx,
|
17112 | cell.position.row.isLast = isLeaf;
|
17113 | var colIdx = rowLevel;
|
17114 | return cell.position.column.index = cell.position.column.indexInSiblings = colIdx,
|
17115 | cell.position.column.isFirst = 0 === colIdx, cell.position.column.isLast = colIdx === this._rowLayoutManager.dimension.getDepth() - 1,
|
17116 | this.enableCellHorizontalResize(isLeaf, cell), cell;
|
17117 | }, TablixLayoutManager.prototype.getOrCreateBodyCell = function(cellItem, rowItem, rowItems, rowIndex, columnIndex) {
|
17118 | var scrollable, row = this._grid.getOrCreateRow(rowIndex + this._rowLayoutManager._gridOffset), column = this._grid.getOrCreateColumn(columnIndex + this._columnLayoutManager._gridOffset);
|
17119 | scrollable = 0 === row._realizedBodyCells.length && 0 !== this._owner.columnDimension.getFractionScrollOffset() ? !0 : this._rowLayoutManager.isScrollableHeader(rowItem, rowItems, rowIndex);
|
17120 | var cell = row.getOrCreateBodyCell(column, scrollable);
|
17121 | return cell.position = cellItem.position, cell.enableHorizontalResize(!1, this._columnLayoutManager),
|
17122 | cell;
|
17123 | }, TablixLayoutManager.prototype.getOrCreateFooterBodyCell = function(cellItem, columnIndex) {
|
17124 | var scrollable, row = this._grid.getOrCreateFootersRow(), column = this._grid.getOrCreateColumn(columnIndex + this._columnLayoutManager._gridOffset);
|
17125 | scrollable = 0 === row._realizedBodyCells.length && 0 !== this._owner.columnDimension.getFractionScrollOffset();
|
17126 | var cell = row.getOrCreateFooterBodyCell(column, scrollable);
|
17127 | return cell.position = cellItem.position, cell.enableHorizontalResize(!1, this._columnLayoutManager),
|
17128 | cell;
|
17129 | }, TablixLayoutManager.prototype.getOrCreateFooterRowHeader = function(item, items) {
|
17130 | var row = this._grid.getOrCreateFootersRow(), column = this._grid.getOrCreateColumn(0), cell = row.getOrCreateFooterRowHeader(column);
|
17131 | return cell.position = void 0, cell.enableHorizontalResize(!1, this._columnLayoutManager),
|
17132 | cell;
|
17133 | }, TablixLayoutManager.prototype.getVisibleWidth = function() {
|
17134 | return -1;
|
17135 | }, TablixLayoutManager.prototype.getVisibleHeight = function() {
|
17136 | return -1;
|
17137 | }, TablixLayoutManager.prototype.updateColumnCount = function(rowDimension, columnDimension) {},
|
17138 | TablixLayoutManager.prototype.updateViewport = function(viewport) {}, TablixLayoutManager.prototype.getEstimatedRowHeight = function() {
|
17139 | return -1;
|
17140 | }, TablixLayoutManager.prototype.getCellWidth = function(cell) {
|
17141 | return -1;
|
17142 | }, TablixLayoutManager.prototype.getContentWidth = function(cell) {
|
17143 | return -1;
|
17144 | }, TablixLayoutManager.prototype.adjustContentSize = function(hasImage) {}, TablixLayoutManager.prototype.alignRowHeaderCells = function(item, currentRow) {
|
17145 | var index = currentRow.getRowHeaderLeafIndex();
|
17146 | if (-1 !== index) {
|
17147 | var rowDimension = this._owner.rowDimension, leaf = rowDimension.getFirstVisibleChildLeaf(item);
|
17148 | this.owner.hierarchyNavigator.headerItemEquals(leaf, currentRow.getAllocatedCellAt(index).item) && currentRow.moveCellsBy(this.owner.hierarchyNavigator.getLevel(leaf) - this.owner.hierarchyNavigator.getLevel(item) - index);
|
17149 | }
|
17150 | }, Object.defineProperty(TablixLayoutManager.prototype, "grid", {
|
17151 | get: function() {
|
17152 | return this._grid;
|
17153 | },
|
17154 | enumerable: !0,
|
17155 | configurable: !0
|
17156 | }), Object.defineProperty(TablixLayoutManager.prototype, "rowLayoutManager", {
|
17157 | get: function() {
|
17158 | return this._rowLayoutManager;
|
17159 | },
|
17160 | enumerable: !0,
|
17161 | configurable: !0
|
17162 | }), Object.defineProperty(TablixLayoutManager.prototype, "columnLayoutManager", {
|
17163 | get: function() {
|
17164 | return this._columnLayoutManager;
|
17165 | },
|
17166 | enumerable: !0,
|
17167 | configurable: !0
|
17168 | }), TablixLayoutManager.prototype.showEmptySpaceHeader = function() {
|
17169 | return !1;
|
17170 | }, TablixLayoutManager.prototype.onStartRenderingSession = function(scrollingDimension, parentElement, clear) {
|
17171 | if (this.showEmptySpaceHeader()) {
|
17172 | var cell = this._grid.emptySpaceHeaderCell;
|
17173 | cell && this._binder.unbindEmptySpaceHeaderCell(cell), cell = this._grid.emptySpaceFooterCell,
|
17174 | cell && this._binder.unbindEmptySpaceFooterCell(cell), this._grid.HideEmptySpaceCells();
|
17175 | }
|
17176 | this._scrollingDimension = scrollingDimension, this._scrollingDimension && this._scrollingDimension.layoutManager.startScrollingSession(),
|
17177 | this._rowLayoutManager.onStartRenderingSession(), this._columnLayoutManager.onStartRenderingSession(),
|
17178 | this._grid.onStartRenderingSession(clear);
|
17179 | var measureEnabled = this._columnLayoutManager.measureEnabled || this._rowLayoutManager.measureEnabled;
|
17180 | measureEnabled && this.measureSampleText(parentElement);
|
17181 | }, TablixLayoutManager.prototype.onEndRenderingSession = function() {
|
17182 | if (this._rowLayoutManager.onEndRenderingSession(), this._columnLayoutManager.onEndRenderingSession(),
|
17183 | this._scrollingDimension && this._scrollingDimension.layoutManager.endScrollingSession(),
|
17184 | this._scrollingDimension = null, this.showEmptySpaceHeader()) {
|
17185 | var emptySpace = this._columnLayoutManager.contextualWidthToFill - this._columnLayoutManager.getGridContextualWidth();
|
17186 | if (emptySpace > 0) {
|
17187 | this._grid.ShowEmptySpaceCells(this._owner.columnDimension.getDepth(), emptySpace);
|
17188 | var cell = this._grid.emptySpaceHeaderCell;
|
17189 | cell && this._binder.bindEmptySpaceHeaderCell(cell), cell = this._grid.emptySpaceFooterCell,
|
17190 | cell && this._binder.bindEmptySpaceFooterCell(cell);
|
17191 | }
|
17192 | }
|
17193 | }, TablixLayoutManager.prototype.onStartRenderingIteration = function(clear) {
|
17194 | this._rowLayoutManager.onStartRenderingIteration(clear, this.getVisibleHeight()),
|
17195 | this._columnLayoutManager.onStartRenderingIteration(clear, this.getVisibleWidth()),
|
17196 | this._grid.onStartRenderingIteration();
|
17197 | }, TablixLayoutManager.prototype.onEndRenderingIteration = function() {
|
17198 | return this._grid.onEndRenderingIteration(), this._columnLayoutManager.calculateSizes(),
|
17199 | this._rowLayoutManager.calculateSizes(), this._columnLayoutManager.fixSizes(), this._rowLayoutManager.fixSizes(),
|
17200 | this._columnLayoutManager.updateItemToResizeState(this._grid.realizedColumns), this._columnLayoutManager.applyScrolling(),
|
17201 | this._rowLayoutManager.applyScrolling(), this._columnLayoutManager.onEndRenderingIteration(),
|
17202 | this._rowLayoutManager.onEndRenderingIteration(), this._columnLayoutManager.done && this._rowLayoutManager.done;
|
17203 | }, TablixLayoutManager.prototype.onCornerCellRealized = function(item, cell) {
|
17204 | var columnLeaf = this.owner.hierarchyNavigator.isColumnHierarchyLeaf(item), rowLeaf = this.owner.hierarchyNavigator.isRowHierarchyLeaf(item);
|
17205 | columnLeaf && cell._column.OnLeafRealized(this._owner.hierarchyNavigator), this._columnLayoutManager.onCornerCellRealized(item, cell, columnLeaf),
|
17206 | this._rowLayoutManager.onCornerCellRealized(item, cell, rowLeaf);
|
17207 | }, TablixLayoutManager.prototype.onRowHeaderRealized = function(item, cell) {
|
17208 | var hierarchyNavigator = this._owner.hierarchyNavigator, leaf = hierarchyNavigator.isLeaf(item), tablixCell = cell;
|
17209 | tablixCell.colSpan > 1 && tablixCell.setContainerWidth(-1), this._rowLayoutManager.onHeaderRealized(item, cell, leaf);
|
17210 | }, TablixLayoutManager.prototype.onRowHeaderFooterRealized = function(item, cell) {},
|
17211 | TablixLayoutManager.prototype.onColumnHeaderRealized = function(item, cell) {
|
17212 | var hierarchyNavigator = this._owner.hierarchyNavigator, leaf = hierarchyNavigator.isLeaf(item);
|
17213 | leaf && cell._column.OnLeafRealized(this._owner.hierarchyNavigator), this._columnLayoutManager.onHeaderRealized(item, cell, leaf);
|
17214 | }, TablixLayoutManager.prototype.onBodyCellRealized = function(item, cell) {}, TablixLayoutManager.prototype.onBodyCellFooterRealized = function(item, cell) {},
|
17215 | TablixLayoutManager.prototype.setAllowHeaderResize = function(value) {
|
17216 | this._allowHeaderResize = value;
|
17217 | }, TablixLayoutManager.prototype.enableCellHorizontalResize = function(isLeaf, cell) {
|
17218 | var enableCellHorizontalResize = isLeaf && this._allowHeaderResize;
|
17219 | cell.enableHorizontalResize(enableCellHorizontalResize, this._columnLayoutManager);
|
17220 | }, TablixLayoutManager.prototype.getEstimatedTextWidth = function(label) {
|
17221 | return -1;
|
17222 | }, TablixLayoutManager.prototype.measureSampleText = function(parentElement) {},
|
17223 | TablixLayoutManager;
|
17224 | }();
|
17225 | internal.TablixLayoutManager = TablixLayoutManager;
|
17226 | var DashboardTablixLayoutManager = function(_super) {
|
17227 | function DashboardTablixLayoutManager(binder, sizeComputationManager, grid, rowRealizationManager, columnRealizationManager) {
|
17228 | var dashboardColumnLayoutManager = new DashboardColumnLayoutManager(null, grid, columnRealizationManager), dashboardRowLayoutManager = new DashboardRowLayoutManager(null, grid, rowRealizationManager);
|
17229 | _super.call(this, binder, grid, dashboardColumnLayoutManager, dashboardRowLayoutManager),
|
17230 | dashboardColumnLayoutManager.owner = this, dashboardRowLayoutManager.owner = this,
|
17231 | this._sizeComputationManager = sizeComputationManager;
|
17232 | }
|
17233 | return __extends(DashboardTablixLayoutManager, _super), DashboardTablixLayoutManager.createLayoutManager = function(binder) {
|
17234 | var sizeComputationManager = new SizeComputationManager();
|
17235 | return new DashboardTablixLayoutManager(binder, sizeComputationManager, new internal.TablixGrid(new internal.DashboardTablixGridPresenter(sizeComputationManager)), new internal.RowRealizationManager(binder), new internal.ColumnRealizationManager(binder));
|
17236 | }, DashboardTablixLayoutManager.prototype.getTablixClassName = function() {
|
17237 | return "tablixDashboard";
|
17238 | }, DashboardTablixLayoutManager.prototype.getLayoutKind = function() {
|
17239 | return 1;
|
17240 | }, DashboardTablixLayoutManager.prototype.showEmptySpaceHeader = function() {
|
17241 | return !1;
|
17242 | }, DashboardTablixLayoutManager.prototype.measureSampleText = function(parentElement) {
|
17243 | var textProperties = powerbi.TextMeasurementService.getSvgMeasurementProperties(parentElement);
|
17244 | this._characterHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties),
|
17245 | this._sizeComputationManager.updateRowHeight(this._characterHeight);
|
17246 | var actualTextSize = PixelConverter.toPoint(parseFloat(textProperties.fontSize)), scalingFactor = actualTextSize / controls.TablixDefaultTextSize;
|
17247 | this._sizeComputationManager.updateScalingFactor(powerbi.Double.toIncrement(scalingFactor, .05));
|
17248 | }, DashboardTablixLayoutManager.prototype.getVisibleWidth = function() {
|
17249 | return this._sizeComputationManager.visibleWidth;
|
17250 | }, DashboardTablixLayoutManager.prototype.getVisibleHeight = function() {
|
17251 | return this._sizeComputationManager.visibleHeight;
|
17252 | }, DashboardTablixLayoutManager.prototype.getCellWidth = function(cell) {
|
17253 | return this._sizeComputationManager.cellWidth;
|
17254 | }, DashboardTablixLayoutManager.prototype.getContentWidth = function(cell) {
|
17255 | return this._sizeComputationManager.contentWidth;
|
17256 | }, DashboardTablixLayoutManager.prototype.getEstimatedTextWidth = function(label) {
|
17257 | return this._sizeComputationManager.contentWidth;
|
17258 | }, DashboardTablixLayoutManager.prototype.adjustContentSize = function(hasImage) {
|
17259 | this._sizeComputationManager.hasImageContent = hasImage;
|
17260 | }, DashboardTablixLayoutManager.prototype.updateColumnCount = function(rowDimension, columnDimension) {
|
17261 | var rowDimensionDepth = rowDimension ? rowDimension.getDepth() : 0, columnInstances = columnDimension ? columnDimension.getItemsCount() : 0, totalColumnCount = rowDimensionDepth + columnInstances;
|
17262 | this.binder.hasRowGroups() || totalColumnCount--, this._sizeComputationManager.updateColumnCount(totalColumnCount);
|
17263 | }, DashboardTablixLayoutManager.prototype.updateViewport = function(viewport) {
|
17264 | this._sizeComputationManager.updateViewport(viewport);
|
17265 | }, DashboardTablixLayoutManager.prototype.getEstimatedRowHeight = function() {
|
17266 | return this._characterHeight;
|
17267 | }, DashboardTablixLayoutManager;
|
17268 | }(TablixLayoutManager);
|
17269 | internal.DashboardTablixLayoutManager = DashboardTablixLayoutManager;
|
17270 | var CanvasTablixLayoutManager = function(_super) {
|
17271 | function CanvasTablixLayoutManager(binder, grid, rowRealizationManager, columnRealizationManager) {
|
17272 | var canvasColumnLayoutManager = new CanvasColumnLayoutManager(null, grid, columnRealizationManager), canvasRowLayoutManager = new CanvasRowLayoutManager(null, grid, rowRealizationManager);
|
17273 | _super.call(this, binder, grid, canvasColumnLayoutManager, canvasRowLayoutManager),
|
17274 | canvasColumnLayoutManager.owner = this, canvasRowLayoutManager.owner = this;
|
17275 | }
|
17276 | return __extends(CanvasTablixLayoutManager, _super), CanvasTablixLayoutManager.createLayoutManager = function(binder, columnWidthManager) {
|
17277 | return new CanvasTablixLayoutManager(binder, new internal.TablixGrid(new controls.internal.CanvasTablixGridPresenter(columnWidthManager)), new internal.RowRealizationManager(binder), new internal.ColumnRealizationManager(binder));
|
17278 | }, CanvasTablixLayoutManager.prototype.getTablixClassName = function() {
|
17279 | return "tablixCanvas";
|
17280 | }, CanvasTablixLayoutManager.prototype.getLayoutKind = function() {
|
17281 | return 0;
|
17282 | }, CanvasTablixLayoutManager.prototype.measureSampleText = function(parentElement) {
|
17283 | var textDiv = controls.internal.TablixUtils.createDiv();
|
17284 | textDiv.style.cssFloat = "left", textDiv.style.whiteSpace = "nowrap", textDiv.style.overflow = "hidden",
|
17285 | textDiv.style.lineHeight = "normal", parentElement.appendChild(textDiv);
|
17286 | var textNode = document.createTextNode("a");
|
17287 | textDiv.appendChild(textNode), this.characterWidth = controls.HTMLElementUtils.getElementWidth(textDiv),
|
17288 | this.characterHeight = controls.HTMLElementUtils.getElementHeight(textDiv), textDiv.removeChild(textNode),
|
17289 | parentElement.removeChild(textDiv);
|
17290 | }, CanvasTablixLayoutManager.prototype.showEmptySpaceHeader = function() {
|
17291 | return !this._columnLayoutManager.fillProportionally;
|
17292 | }, CanvasTablixLayoutManager.prototype.getVisibleWidth = function() {
|
17293 | return this._columnLayoutManager.measureEnabled ? this._owner.autoSizeWidth && this._owner.maxWidth ? this._owner.maxWidth : controls.HTMLElementUtils.getElementWidth(this._container) : -1;
|
17294 | }, CanvasTablixLayoutManager.prototype.getVisibleHeight = function() {
|
17295 | return this._rowLayoutManager.measureEnabled ? this._owner.autoSizeHeight && this._owner.maxHeight ? this._owner.maxHeight : controls.HTMLElementUtils.getElementHeight(this._container) : -1;
|
17296 | }, CanvasTablixLayoutManager.prototype.getCellWidth = function(cell) {
|
17297 | return controls.HTMLElementUtils.getElementWidth(cell._presenter.tableCell);
|
17298 | }, CanvasTablixLayoutManager.prototype.getContentWidth = function(cell) {
|
17299 | return controls.HTMLElementUtils.getElementWidth(cell._presenter.contentElement);
|
17300 | }, CanvasTablixLayoutManager.prototype.getEstimatedTextWidth = function(text) {
|
17301 | return text ? text.length * this.characterWidth : 0;
|
17302 | }, CanvasTablixLayoutManager.prototype.updateColumnCount = function(rowDimension, columnDimension) {},
|
17303 | CanvasTablixLayoutManager.prototype.updateViewport = function(viewport) {}, CanvasTablixLayoutManager.prototype.getEstimatedRowHeight = function() {
|
17304 | return this.characterHeight;
|
17305 | }, CanvasTablixLayoutManager;
|
17306 | }(TablixLayoutManager);
|
17307 | internal.CanvasTablixLayoutManager = CanvasTablixLayoutManager;
|
17308 | }(internal = controls.internal || (controls.internal = {}));
|
17309 | }(controls = visuals.controls || (visuals.controls = {}));
|
17310 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
17311 | }(powerbi || (powerbi = {}));
|
17312 |
|
17313 | var powerbi;
|
17314 |
|
17315 | !function(powerbi) {
|
17316 | var visuals;
|
17317 | !function(visuals) {
|
17318 | var controls;
|
17319 | !function(controls) {
|
17320 | var HTMLElementUtils;
|
17321 | !function(HTMLElementUtils) {
|
17322 | function clearChildren(element) {
|
17323 | if (element) for (;element.hasChildNodes(); ) element.removeChild(element.firstChild);
|
17324 | }
|
17325 | function setElementTop(element, top) {
|
17326 | element.style.top = top + "px";
|
17327 | }
|
17328 | function setElementLeft(element, left) {
|
17329 | element.style.left = left + "px";
|
17330 | }
|
17331 | function setElementHeight(element, height) {
|
17332 | HTMLElementUtils.isAutoSize(height) ? element.style.height = "" : element.style.height = height + "px";
|
17333 | }
|
17334 | function setElementWidth(element, width) {
|
17335 | HTMLElementUtils.isAutoSize(width) ? element.style.width = "" : element.style.width = width + "px";
|
17336 | }
|
17337 | function getElementWidth(element) {
|
17338 | return element.offsetWidth;
|
17339 | }
|
17340 | function getElementHeight(element) {
|
17341 | return element.offsetHeight;
|
17342 | }
|
17343 | function isAutoSize(size) {
|
17344 | return -1 === size;
|
17345 | }
|
17346 | function getAccumulatedScale(element) {
|
17347 | for (var scale = 1; element; ) scale *= HTMLElementUtils.getScale(element), element = element.parentElement;
|
17348 | return scale;
|
17349 | }
|
17350 | function getScale(element) {
|
17351 | element = $(element);
|
17352 | var str = element.css("-webkit-transform") || element.css("-moz-transform") || element.css("-ms-transform") || element.css("-o-transform") || element.css("transform");
|
17353 | return str && (str.match(/\d*\.\d*/) && Number(str.match(/\d*\.\d*/)[0]) || str.match(/\d+/) && Number(str.match(/\d+/)[0])) || 1;
|
17354 | }
|
17355 | HTMLElementUtils.clearChildren = clearChildren, HTMLElementUtils.setElementTop = setElementTop,
|
17356 | HTMLElementUtils.setElementLeft = setElementLeft, HTMLElementUtils.setElementHeight = setElementHeight,
|
17357 | HTMLElementUtils.setElementWidth = setElementWidth, HTMLElementUtils.getElementWidth = getElementWidth,
|
17358 | HTMLElementUtils.getElementHeight = getElementHeight, HTMLElementUtils.isAutoSize = isAutoSize,
|
17359 | HTMLElementUtils.getAccumulatedScale = getAccumulatedScale, HTMLElementUtils.getScale = getScale;
|
17360 | }(HTMLElementUtils = controls.HTMLElementUtils || (controls.HTMLElementUtils = {}));
|
17361 | }(controls = visuals.controls || (visuals.controls = {}));
|
17362 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
17363 | }(powerbi || (powerbi = {}));
|
17364 |
|
17365 | var powerbi;
|
17366 |
|
17367 | !function(powerbi) {
|
17368 | var visuals;
|
17369 | !function(visuals) {
|
17370 | var controls;
|
17371 | !function(controls) {
|
17372 | var internal;
|
17373 | !function(internal) {
|
17374 | var TablixObjects, DomFactory = InJs.DomFactory, DataViewObjectDefinitions = powerbi.data.DataViewObjectDefinitions, DataViewRoleWildCard = powerbi.data.DataViewRoleWildcard;
|
17375 | !function(TablixObjects) {
|
17376 | function getMetadadataObjects(dataview) {
|
17377 | return dataview && dataview.metadata ? dataview.metadata.objects : null;
|
17378 | }
|
17379 | function enumerateObjectRepetition(enumeration, dataView, tablixType) {
|
17380 | if (tablixType === controls.TablixType.Table) {
|
17381 | for (var columns = getTableColumnMetadata(dataView), _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {
|
17382 | var column = columns_1[_i], repetition = {
|
17383 | selector: {
|
17384 | data: [ DataViewRoleWildCard.fromRoles([ "Values" ]) ],
|
17385 | metadata: column.queryName
|
17386 | },
|
17387 | objects: (_a = {}, _a[TablixObjects.ObjectValues] = {
|
17388 | formattingProperties: [ TablixObjects.PropValuesBackColor.propertyName ]
|
17389 | }, _a)
|
17390 | };
|
17391 | enumeration.push(repetition);
|
17392 | }
|
17393 | var _a;
|
17394 | }
|
17395 | }
|
17396 | function enumerateObjectInstances(options, enumeration, dataView, tablixType) {
|
17397 | var objects = getMetadadataObjects(dataView), totalsShown = !0;
|
17398 | switch (totalsShown = tablixType === controls.TablixType.Table ? shouldShowTableTotalsOption(dataView) && shouldShowTableTotals(objects) : shouldShowColumnSubtotalsOption(dataView) && shouldShowColumnSubtotals(objects) || shouldShowRowSubtotalsOption(dataView) && shouldShowRowSubtotals(objects),
|
17399 | options.objectName) {
|
17400 | case TablixObjects.ObjectGeneral:
|
17401 | enumerateGeneralOptions(enumeration, objects, tablixType, dataView);
|
17402 | break;
|
17403 |
|
17404 | case TablixObjects.ObjectGrid:
|
17405 | enumerateGridOptions(enumeration, objects, tablixType);
|
17406 | break;
|
17407 |
|
17408 | case TablixObjects.ObjectColumnHeaders:
|
17409 | enumerateColumnHeadersOptions(enumeration, objects);
|
17410 | break;
|
17411 |
|
17412 | case TablixObjects.ObjectRowHeaders:
|
17413 | enumerateRowHeadersOptions(enumeration, objects);
|
17414 | break;
|
17415 |
|
17416 | case TablixObjects.ObjectValues:
|
17417 | enumerateValuesOptions(enumeration, objects, tablixType);
|
17418 | break;
|
17419 |
|
17420 | case TablixObjects.ObjectTotal:
|
17421 | totalsShown && enumerateTotalOptions(enumeration, objects);
|
17422 | break;
|
17423 |
|
17424 | case TablixObjects.ObjectSubTotals:
|
17425 | totalsShown && enumerateSubTotalsOptions(enumeration, objects);
|
17426 | }
|
17427 | }
|
17428 | function enumerateGeneralOptions(enumeration, objects, tablixType, dataView) {
|
17429 | var visualObjectinstance = {
|
17430 | selector: null,
|
17431 | objectName: TablixObjects.ObjectGeneral,
|
17432 | properties: {
|
17433 | autoSizeColumnWidth: TablixObjects.PropGeneralAutoSizeColumns.getValue(objects),
|
17434 | textSize: TablixObjects.PropGeneralTextSize.getValue(objects)
|
17435 | }
|
17436 | }, properties = visualObjectinstance.properties;
|
17437 | switch (tablixType) {
|
17438 | case controls.TablixType.Table:
|
17439 | shouldShowTableTotalsOption(dataView) && (properties[TablixObjects.PropGeneralTableTotals.propertyName] = shouldShowTableTotals(objects));
|
17440 | break;
|
17441 |
|
17442 | case controls.TablixType.Matrix:
|
17443 | shouldShowRowSubtotalsOption(dataView) && (properties[TablixObjects.PropGeneralMatrixRowSubtotals.propertyName] = shouldShowRowSubtotals(objects)),
|
17444 | shouldShowColumnSubtotalsOption(dataView) && (properties[TablixObjects.PropGeneralMatrixColumnSubtotals.propertyName] = shouldShowColumnSubtotals(objects));
|
17445 | }
|
17446 | enumeration.pushInstance(visualObjectinstance);
|
17447 | }
|
17448 | function enumerateGridOptions(enumeration, objects, tablixType) {
|
17449 | var visualObjectinstance = {
|
17450 | selector: null,
|
17451 | objectName: TablixObjects.ObjectGeneral,
|
17452 | properties: {}
|
17453 | }, properties = visualObjectinstance.properties, verticalGridEnabled = TablixObjects.PropGridVertical.getValue(objects);
|
17454 | properties[TablixObjects.PropGridVertical.propertyName] = verticalGridEnabled, verticalGridEnabled && (properties[TablixObjects.PropGridVerticalColor.propertyName] = TablixObjects.PropGridVerticalColor.getValue(objects),
|
17455 | properties[TablixObjects.PropGridVerticalWeight.propertyName] = TablixObjects.PropGridVerticalWeight.getValue(objects));
|
17456 | var horizontalGridEnabled = (tablixType === controls.TablixType.Table ? TablixObjects.PropGridHorizontalTable : TablixObjects.PropGridHorizontalMatrix).getValue(objects);
|
17457 | properties[(tablixType === controls.TablixType.Table ? TablixObjects.PropGridHorizontalTable : TablixObjects.PropGridHorizontalMatrix).propertyName] = horizontalGridEnabled,
|
17458 | horizontalGridEnabled && (properties[TablixObjects.PropGridHorizontalColor.propertyName] = TablixObjects.PropGridHorizontalColor.getValue(objects),
|
17459 | properties[TablixObjects.PropGridHorizontalWeight.propertyName] = TablixObjects.PropGridHorizontalWeight.getValue(objects)),
|
17460 | properties[TablixObjects.PropGridRowPadding.propertyName] = TablixObjects.PropGridRowPadding.getValue(objects),
|
17461 | properties[TablixObjects.PropGridOutlineColor.propertyName] = TablixObjects.PropGridOutlineColor.getValue(objects),
|
17462 | properties[TablixObjects.PropGridOutlineWeight.propertyName] = TablixObjects.PropGridOutlineWeight.getValue(objects),
|
17463 | properties[TablixObjects.PropGridImageHeight.propertyName] = TablixObjects.PropGridImageHeight.getValue(objects),
|
17464 | enumeration.pushInstance(visualObjectinstance);
|
17465 | }
|
17466 | function enumerateColumnHeadersOptions(enumeration, objects) {
|
17467 | enumeration.pushInstance({
|
17468 | selector: null,
|
17469 | objectName: TablixObjects.ObjectColumnHeaders,
|
17470 | properties: {
|
17471 | fontColor: TablixObjects.PropColumnsFontColor.getValue(objects),
|
17472 | backColor: TablixObjects.PropColumnsBackColor.getValue(objects),
|
17473 | outline: TablixObjects.PropColumnsOutline.getValue(objects)
|
17474 | }
|
17475 | });
|
17476 | }
|
17477 | function enumerateRowHeadersOptions(enumeration, objects) {
|
17478 | enumeration.pushInstance({
|
17479 | selector: null,
|
17480 | objectName: TablixObjects.ObjectRowHeaders,
|
17481 | properties: {
|
17482 | fontColor: TablixObjects.PropRowsFontColor.getValue(objects),
|
17483 | backColor: TablixObjects.PropRowsBackColor.getValue(objects),
|
17484 | outline: TablixObjects.PropRowsOutline.getValue(objects)
|
17485 | }
|
17486 | });
|
17487 | }
|
17488 | function enumerateValuesOptions(enumeration, objects, tablixType) {
|
17489 | var instance = {
|
17490 | selector: null,
|
17491 | objectName: TablixObjects.ObjectValues,
|
17492 | properties: {
|
17493 | fontColorPrimary: TablixObjects.PropValuesFontColorPrimary.getValue(objects),
|
17494 | backColorPrimary: TablixObjects.PropValuesBackColorPrimary.getValue(objects),
|
17495 | fontColorSecondary: TablixObjects.PropValuesFontColorSecondary.getValue(objects),
|
17496 | backColorSecondary: TablixObjects.PropValuesBackColorSecondary.getValue(objects),
|
17497 | outline: TablixObjects.PropValuesOutline.getValue(objects)
|
17498 | }
|
17499 | };
|
17500 | tablixType === controls.TablixType.Table && (instance.properties[TablixObjects.PropValuesUrlIconProp.propertyName] = TablixObjects.PropValuesUrlIconProp.getValue(objects)),
|
17501 | enumeration.pushInstance(instance);
|
17502 | }
|
17503 | function enumerateTotalOptions(enumeration, objects) {
|
17504 | enumeration.pushInstance({
|
17505 | selector: null,
|
17506 | objectName: TablixObjects.ObjectTotal,
|
17507 | properties: {
|
17508 | fontColor: TablixObjects.PropTotalFontColor.getValue(objects),
|
17509 | backColor: TablixObjects.PropTotalBackColor.getValue(objects),
|
17510 | outline: TablixObjects.PropTotalOutline.getValue(objects)
|
17511 | }
|
17512 | });
|
17513 | }
|
17514 | function enumerateSubTotalsOptions(enumeration, objects) {
|
17515 | enumeration.pushInstance({
|
17516 | selector: null,
|
17517 | objectName: TablixObjects.ObjectSubTotals,
|
17518 | properties: {
|
17519 | fontColor: TablixObjects.PropSubTotalsFontColor.getValue(objects),
|
17520 | backColor: TablixObjects.PropSubTotalsBackColor.getValue(objects)
|
17521 | }
|
17522 | });
|
17523 | }
|
17524 | function getTableObjects(dataView) {
|
17525 | var objects = getMetadadataObjects(dataView), formattingProperties = {
|
17526 | general: {
|
17527 | autoSizeColumnWidth: TablixObjects.PropGeneralAutoSizeColumns.getValue(objects),
|
17528 | textSize: TablixObjects.PropGeneralTextSize.getValue(objects),
|
17529 | totals: shouldShowTableTotals(objects)
|
17530 | }
|
17531 | };
|
17532 | return formattingProperties.grid = {
|
17533 | gridVertical: TablixObjects.PropGridVertical.getValue(objects),
|
17534 | gridVerticalColor: TablixObjects.PropGridVerticalColor.getValue(objects),
|
17535 | gridVerticalWeight: TablixObjects.PropGridVerticalWeight.getValue(objects),
|
17536 | gridHorizontal: TablixObjects.PropGridHorizontalTable.getValue(objects),
|
17537 | gridHorizontalColor: TablixObjects.PropGridHorizontalColor.getValue(objects),
|
17538 | gridHorizontalWeight: TablixObjects.PropGridHorizontalWeight.getValue(objects),
|
17539 | outlineColor: TablixObjects.PropGridOutlineColor.getValue(objects),
|
17540 | outlineWeight: TablixObjects.PropGridOutlineWeight.getValue(objects),
|
17541 | rowPadding: TablixObjects.PropGridRowPadding.getValue(objects),
|
17542 | imageHeight: TablixObjects.PropGridImageHeight.getValue(objects)
|
17543 | }, formattingProperties.columnHeaders = {
|
17544 | fontColor: TablixObjects.PropColumnsFontColor.getValue(objects),
|
17545 | backColor: TablixObjects.PropColumnsBackColor.getValue(objects),
|
17546 | outline: TablixObjects.PropColumnsOutline.getValue(objects)
|
17547 | }, formattingProperties.values = {
|
17548 | fontColorPrimary: TablixObjects.PropValuesFontColorPrimary.getValue(objects),
|
17549 | backColorPrimary: TablixObjects.PropValuesBackColorPrimary.getValue(objects),
|
17550 | fontColorSecondary: TablixObjects.PropValuesFontColorSecondary.getValue(objects),
|
17551 | backColorSecondary: TablixObjects.PropValuesBackColorSecondary.getValue(objects),
|
17552 | outline: TablixObjects.PropValuesOutline.getValue(objects),
|
17553 | urlIcon: TablixObjects.PropValuesUrlIconProp.getValue(objects)
|
17554 | }, formattingProperties.total = {
|
17555 | fontColor: TablixObjects.PropTotalFontColor.getValue(objects),
|
17556 | backColor: TablixObjects.PropTotalBackColor.getValue(objects),
|
17557 | outline: TablixObjects.PropTotalOutline.getValue(objects)
|
17558 | }, formattingProperties;
|
17559 | }
|
17560 | function getMatrixObjects(dataView) {
|
17561 | var objects = getMetadadataObjects(dataView), formattingProperties = {
|
17562 | general: {
|
17563 | autoSizeColumnWidth: TablixObjects.PropGeneralAutoSizeColumns.getValue(objects),
|
17564 | textSize: TablixObjects.PropGeneralTextSize.getValue(objects),
|
17565 | rowSubtotals: shouldShowRowSubtotals(objects),
|
17566 | columnSubtotals: shouldShowColumnSubtotals(objects)
|
17567 | }
|
17568 | };
|
17569 | return formattingProperties.grid = {
|
17570 | gridVertical: TablixObjects.PropGridVertical.getValue(objects),
|
17571 | gridVerticalColor: TablixObjects.PropGridVerticalColor.getValue(objects),
|
17572 | gridVerticalWeight: TablixObjects.PropGridVerticalWeight.getValue(objects),
|
17573 | gridHorizontal: TablixObjects.PropGridHorizontalMatrix.getValue(objects),
|
17574 | gridHorizontalColor: TablixObjects.PropGridHorizontalColor.getValue(objects),
|
17575 | gridHorizontalWeight: TablixObjects.PropGridHorizontalWeight.getValue(objects),
|
17576 | outlineColor: TablixObjects.PropGridOutlineColor.getValue(objects),
|
17577 | outlineWeight: TablixObjects.PropGridOutlineWeight.getValue(objects),
|
17578 | rowPadding: TablixObjects.PropGridRowPadding.getValue(objects),
|
17579 | imageHeight: TablixObjects.PropGridImageHeight.getValue(objects)
|
17580 | }, formattingProperties.columnHeaders = {
|
17581 | fontColor: TablixObjects.PropColumnsFontColor.getValue(objects),
|
17582 | backColor: TablixObjects.PropColumnsBackColor.getValue(objects),
|
17583 | outline: TablixObjects.PropColumnsOutline.getValue(objects)
|
17584 | }, formattingProperties.rowHeaders = {
|
17585 | fontColor: TablixObjects.PropRowsFontColor.getValue(objects),
|
17586 | backColor: TablixObjects.PropRowsBackColor.getValue(objects),
|
17587 | outline: TablixObjects.PropRowsOutline.getValue(objects)
|
17588 | }, formattingProperties.values = {
|
17589 | fontColorPrimary: TablixObjects.PropValuesFontColorPrimary.getValue(objects),
|
17590 | backColorPrimary: TablixObjects.PropValuesBackColorPrimary.getValue(objects),
|
17591 | fontColorSecondary: TablixObjects.PropValuesFontColorSecondary.getValue(objects),
|
17592 | backColorSecondary: TablixObjects.PropValuesBackColorSecondary.getValue(objects),
|
17593 | outline: TablixObjects.PropValuesOutline.getValue(objects)
|
17594 | }, formattingProperties.subtotals = {
|
17595 | fontColor: TablixObjects.PropSubTotalsFontColor.getValue(objects),
|
17596 | backColor: TablixObjects.PropSubTotalsBackColor.getValue(objects),
|
17597 | outline: TablixObjects.PropSubTotalsOutline.getValue(objects)
|
17598 | }, formattingProperties;
|
17599 | }
|
17600 | function generateTablixDefaultObjects(tablixType) {
|
17601 | return {
|
17602 | general: [ {
|
17603 | selector: null,
|
17604 | properties: {
|
17605 | textSize: DataViewObjectDefinitions.encodePropertyValue(12, {
|
17606 | numeric: !0
|
17607 | }),
|
17608 | totals: DataViewObjectDefinitions.encodePropertyValue(!1, {
|
17609 | bool: !0
|
17610 | })
|
17611 | }
|
17612 | } ]
|
17613 | };
|
17614 | }
|
17615 | function getTextSizeInPx(textSize) {
|
17616 | return jsCommon.PixelConverter.fromPoint(textSize);
|
17617 | }
|
17618 | function shouldShowTableTotals(objects) {
|
17619 | return TablixObjects.PropGeneralTableTotals.getValue(objects);
|
17620 | }
|
17621 | function shouldShowTableTotalsOption(dataView) {
|
17622 | if (dataView && dataView.table && !_.isEmpty(dataView.table.columns)) {
|
17623 | var columns = dataView.table.columns;
|
17624 | if (_.some(columns, function(column) {
|
17625 | return column.discourageAggregationAcrossGroups;
|
17626 | })) return !1;
|
17627 | }
|
17628 | return !0;
|
17629 | }
|
17630 | function getTableColumnMetadata(dataView) {
|
17631 | return dataView && dataView.table && !_.isEmpty(dataView.table.columns) ? dataView.table.columns : void 0;
|
17632 | }
|
17633 | function shouldShowRowSubtotals(objects) {
|
17634 | return TablixObjects.PropGeneralMatrixRowSubtotals.getValue(objects);
|
17635 | }
|
17636 | function shouldShowRowSubtotalsOption(dataView) {
|
17637 | return !(dataView && dataView.matrix && dataView.matrix.rows && isDiscourageAggregationAcrossGroups(dataView.matrix.rows.levels));
|
17638 | }
|
17639 | function shouldShowColumnSubtotals(objects) {
|
17640 | return TablixObjects.PropGeneralMatrixColumnSubtotals.getValue(objects);
|
17641 | }
|
17642 | function shouldShowColumnSubtotalsOption(dataView) {
|
17643 | return !(dataView && dataView.matrix && dataView.matrix.columns && isDiscourageAggregationAcrossGroups(dataView.matrix.columns.levels));
|
17644 | }
|
17645 | function isDiscourageAggregationAcrossGroups(levels) {
|
17646 | var lastLevel = _.last(levels);
|
17647 | return lastLevel && _.some(lastLevel.sources, function(source) {
|
17648 | return source.discourageAggregationAcrossGroups;
|
17649 | });
|
17650 | }
|
17651 | TablixObjects.ObjectGeneral = "general", TablixObjects.ObjectGrid = "grid", TablixObjects.ObjectColumnHeaders = "columnHeaders",
|
17652 | TablixObjects.ObjectRowHeaders = "rowHeaders", TablixObjects.ObjectValues = "values",
|
17653 | TablixObjects.ObjectTotal = "total", TablixObjects.ObjectSubTotals = "subTotals";
|
17654 | var TablixProperty = function() {
|
17655 | function TablixProperty(objectName, propertyName, defaultValue, getterFuntion) {
|
17656 | this.objectName = objectName, this.propertyName = propertyName, this.defaultValue = defaultValue,
|
17657 | this.getterFuntion = getterFuntion;
|
17658 | }
|
17659 | return TablixProperty.prototype.getPropertyID = function() {
|
17660 | return {
|
17661 | objectName: this.objectName,
|
17662 | propertyName: this.propertyName
|
17663 | };
|
17664 | }, TablixProperty.prototype.getValue = function(objects) {
|
17665 | return this.getterFuntion(objects, this.getPropertyID(), this.defaultValue);
|
17666 | }, TablixProperty;
|
17667 | }();
|
17668 | TablixObjects.TablixProperty = TablixProperty, TablixObjects.PropColumnFormatString = new TablixProperty(TablixObjects.ObjectGeneral, "formatString", void 0, powerbi.DataViewObjects.getValue),
|
17669 | TablixObjects.PropGeneralAutoSizeColumns = new TablixProperty(TablixObjects.ObjectGeneral, "autoSizeColumnWidth", !0, powerbi.DataViewObjects.getValue),
|
17670 | TablixObjects.PropGeneralTextSize = new TablixProperty(TablixObjects.ObjectGeneral, "textSize", 8, powerbi.DataViewObjects.getValue),
|
17671 | TablixObjects.PropGeneralTableTotals = new TablixProperty(TablixObjects.ObjectGeneral, "totals", !0, powerbi.DataViewObjects.getValue),
|
17672 | TablixObjects.PropGeneralMatrixRowSubtotals = new TablixProperty(TablixObjects.ObjectGeneral, "rowSubtotals", !0, powerbi.DataViewObjects.getValue),
|
17673 | TablixObjects.PropGeneralMatrixColumnSubtotals = new TablixProperty(TablixObjects.ObjectGeneral, "columnSubtotals", !0, powerbi.DataViewObjects.getValue),
|
17674 | TablixObjects.PropGridVertical = new TablixProperty(TablixObjects.ObjectGrid, "gridVertical", !1, powerbi.DataViewObjects.getValue),
|
17675 | TablixObjects.PropGridVerticalColor = new TablixProperty(TablixObjects.ObjectGrid, "gridVerticalColor", "#E8E8E8", powerbi.DataViewObjects.getFillColor),
|
17676 | TablixObjects.PropGridVerticalWeight = new TablixProperty(TablixObjects.ObjectGrid, "gridVerticalWeight", 1, powerbi.DataViewObjects.getValue),
|
17677 | TablixObjects.PropGridHorizontalTable = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontal", !0, powerbi.DataViewObjects.getValue),
|
17678 | TablixObjects.PropGridHorizontalMatrix = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontal", !1, powerbi.DataViewObjects.getValue),
|
17679 | TablixObjects.PropGridHorizontalColor = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontalColor", "#E8E8E8", powerbi.DataViewObjects.getFillColor),
|
17680 | TablixObjects.PropGridHorizontalWeight = new TablixProperty(TablixObjects.ObjectGrid, "gridHorizontalWeight", 1, powerbi.DataViewObjects.getValue),
|
17681 | TablixObjects.PropGridRowPadding = new TablixProperty(TablixObjects.ObjectGrid, "rowPadding", 0, powerbi.DataViewObjects.getValue),
|
17682 | TablixObjects.PropGridOutlineColor = new TablixProperty(TablixObjects.ObjectGrid, "outlineColor", "#CCC", powerbi.DataViewObjects.getFillColor),
|
17683 | TablixObjects.PropGridOutlineWeight = new TablixProperty(TablixObjects.ObjectGrid, "outlineWeight", 1, powerbi.DataViewObjects.getValue),
|
17684 | TablixObjects.PropGridImageHeight = new TablixProperty(TablixObjects.ObjectGrid, "imageHeight", 75, powerbi.DataViewObjects.getValue),
|
17685 | TablixObjects.PropColumnsFontColor = new TablixProperty(TablixObjects.ObjectColumnHeaders, "fontColor", "#666", powerbi.DataViewObjects.getFillColor),
|
17686 | TablixObjects.PropColumnsBackColor = new TablixProperty(TablixObjects.ObjectColumnHeaders, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17687 | TablixObjects.PropColumnsOutline = new TablixProperty(TablixObjects.ObjectColumnHeaders, "outline", "BottomOnly", powerbi.DataViewObjects.getValue),
|
17688 | TablixObjects.PropRowsFontColor = new TablixProperty(TablixObjects.ObjectRowHeaders, "fontColor", "#666", powerbi.DataViewObjects.getFillColor),
|
17689 | TablixObjects.PropRowsBackColor = new TablixProperty(TablixObjects.ObjectRowHeaders, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17690 | TablixObjects.PropRowsOutline = new TablixProperty(TablixObjects.ObjectRowHeaders, "outline", "RightOnly", powerbi.DataViewObjects.getValue),
|
17691 | TablixObjects.PropValuesBackColor = new TablixProperty(TablixObjects.ObjectValues, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17692 | TablixObjects.PropValuesFontColorPrimary = new TablixProperty(TablixObjects.ObjectValues, "fontColorPrimary", "#333", powerbi.DataViewObjects.getFillColor),
|
17693 | TablixObjects.PropValuesBackColorPrimary = new TablixProperty(TablixObjects.ObjectValues, "backColorPrimary", void 0, powerbi.DataViewObjects.getFillColor),
|
17694 | TablixObjects.PropValuesFontColorSecondary = new TablixProperty(TablixObjects.ObjectValues, "fontColorSecondary", "#333", powerbi.DataViewObjects.getFillColor),
|
17695 | TablixObjects.PropValuesBackColorSecondary = new TablixProperty(TablixObjects.ObjectValues, "backColorSecondary", void 0, powerbi.DataViewObjects.getFillColor),
|
17696 | TablixObjects.PropValuesOutline = new TablixProperty(TablixObjects.ObjectValues, "outline", "None", powerbi.DataViewObjects.getValue),
|
17697 | TablixObjects.PropValuesUrlIconProp = new TablixProperty(TablixObjects.ObjectValues, "urlIcon", !1, powerbi.DataViewObjects.getValue),
|
17698 | TablixObjects.PropTotalFontColor = new TablixProperty(TablixObjects.ObjectTotal, "fontColor", "#333", powerbi.DataViewObjects.getFillColor),
|
17699 | TablixObjects.PropTotalBackColor = new TablixProperty(TablixObjects.ObjectTotal, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17700 | TablixObjects.PropTotalOutline = new TablixProperty(TablixObjects.ObjectTotal, "outline", "TopOnly", powerbi.DataViewObjects.getValue),
|
17701 | TablixObjects.PropSubTotalsFontColor = new TablixProperty(TablixObjects.ObjectSubTotals, "fontColor", "#333", powerbi.DataViewObjects.getFillColor),
|
17702 | TablixObjects.PropSubTotalsBackColor = new TablixProperty(TablixObjects.ObjectSubTotals, "backColor", void 0, powerbi.DataViewObjects.getFillColor),
|
17703 | TablixObjects.PropSubTotalsOutline = new TablixProperty(TablixObjects.ObjectSubTotals, "outline", "TopOnly", powerbi.DataViewObjects.getValue),
|
17704 | TablixObjects.getMetadadataObjects = getMetadadataObjects, TablixObjects.enumerateObjectRepetition = enumerateObjectRepetition,
|
17705 | TablixObjects.enumerateObjectInstances = enumerateObjectInstances, TablixObjects.enumerateGeneralOptions = enumerateGeneralOptions,
|
17706 | TablixObjects.enumerateGridOptions = enumerateGridOptions, TablixObjects.enumerateColumnHeadersOptions = enumerateColumnHeadersOptions,
|
17707 | TablixObjects.enumerateRowHeadersOptions = enumerateRowHeadersOptions, TablixObjects.enumerateValuesOptions = enumerateValuesOptions,
|
17708 | TablixObjects.enumerateTotalOptions = enumerateTotalOptions, TablixObjects.enumerateSubTotalsOptions = enumerateSubTotalsOptions,
|
17709 | TablixObjects.getTableObjects = getTableObjects, TablixObjects.getMatrixObjects = getMatrixObjects,
|
17710 | TablixObjects.generateTablixDefaultObjects = generateTablixDefaultObjects, TablixObjects.getTextSizeInPx = getTextSizeInPx,
|
17711 | TablixObjects.shouldShowTableTotals = shouldShowTableTotals, TablixObjects.shouldShowRowSubtotals = shouldShowRowSubtotals,
|
17712 | TablixObjects.shouldShowColumnSubtotals = shouldShowColumnSubtotals, TablixObjects.shouldShowColumnSubtotalsOption = shouldShowColumnSubtotalsOption,
|
17713 | TablixObjects.isDiscourageAggregationAcrossGroups = isDiscourageAggregationAcrossGroups;
|
17714 | }(TablixObjects = internal.TablixObjects || (internal.TablixObjects = {}));
|
17715 | var TablixUtils;
|
17716 | !function(TablixUtils) {
|
17717 | function createTable() {
|
17718 | return document.createElement("table");
|
17719 | }
|
17720 | function createDiv() {
|
17721 | var div = document.createElement("div");
|
17722 | return div.className = "tablixDiv", div;
|
17723 | }
|
17724 | function resetCellCssClass(cell) {
|
17725 | cell.extension.contentElement.className = TablixUtils.CssClassTablixDiv + " " + TablixUtils.CssClassContentElement,
|
17726 | cell.extension.contentHost.className = TablixUtils.CssClassTablixDiv + " " + TablixUtils.CssClassContentHost;
|
17727 | }
|
17728 | function addCellCssClass(cell, style) {
|
17729 | cell.extension.contentHost.className += " " + style;
|
17730 | }
|
17731 | function clearCellStyle(cell) {
|
17732 | cell.extension.contentHost.className = "", cell.extension.contentHost.style.cssText = "";
|
17733 | }
|
17734 | function clearCellTextAndTooltip(cell) {
|
17735 | cell.extension.contentHost.textContent = "", cell.extension.contentHost.removeAttribute("title"),
|
17736 | cell.contentHeight = cell.contentWidth = 0, controls.HTMLElementUtils.clearChildren(cell.extension.contentHost);
|
17737 | }
|
17738 | function setCellTextAndTooltip(cell, text) {
|
17739 | var val = visuals.TextUtil.replaceSpaceWithNBSP(text);
|
17740 | cell.extension.contentHost.textContent = val, cell.extension.contentHost.title = val;
|
17741 | }
|
17742 | function isValidSortClick(e) {
|
17743 | var colHeader = e.target, x = e.offsetX;
|
17744 | return x >= 0 && x < colHeader.offsetWidth - internal.TablixResizer.resizeHandleSize;
|
17745 | }
|
17746 | function appendATagToBodyCell(value, cell, urlIcon) {
|
17747 | var element = cell.extension.contentHost, atag = null;
|
17748 | 0 === element.childElementCount ? (atag = document.createElement("a"), element.appendChild(atag)) : atag = element.children[0],
|
17749 | atag.href = value, atag.target = "_blank", atag.title = value, urlIcon === !0 ? (atag.className = TablixUtils.CssClassValueURLIcon,
|
17750 | element.className = TablixUtils.CssClassValueURLIconContainer) : atag.innerText = value;
|
17751 | }
|
17752 | function appendImgTagToBodyCell(value, cell, imageHeight) {
|
17753 | var element = cell.extension.contentHost, imgContainer = TablixUtils.createDiv(), imgTag = document.createElement("img");
|
17754 | imgContainer.style.height = imageHeight + "px", imgContainer.style.width = "100%",
|
17755 | imgContainer.style.textAlign = "center", imgTag.src = value, imgTag.style.maxHeight = "100%",
|
17756 | imgTag.style.maxWidth = "100%", imgContainer.appendChild(imgTag), element.appendChild(imgContainer);
|
17757 | }
|
17758 | function createKpiDom(kpi, kpiValue) {
|
17759 | var className = visuals.KpiUtil.getClassForKpi(kpi, kpiValue) || "";
|
17760 | return DomFactory.div().addClass(className).css({
|
17761 | display: "inline-block",
|
17762 | "vertical-align": "bottom",
|
17763 | margin: "0"
|
17764 | });
|
17765 | }
|
17766 | function isValidStatusGraphic(kpi, kpiValue) {
|
17767 | return kpi && void 0 !== kpiValue ? !!visuals.KpiUtil.getClassForKpi(kpi, kpiValue) : !1;
|
17768 | }
|
17769 | function getCustomSortEventArgs(queryName, sortDirection) {
|
17770 | var sortDescriptors = [ {
|
17771 | queryName: queryName,
|
17772 | sortDirection: sortDirection
|
17773 | } ];
|
17774 | return {
|
17775 | sortDescriptors: sortDescriptors
|
17776 | };
|
17777 | }
|
17778 | function reverseSort(sortDirection) {
|
17779 | return 2 === sortDirection ? 1 : 2;
|
17780 | }
|
17781 | function createColumnHeaderWithSortIcon(item, cell) {
|
17782 | var colHeaderContainer = TablixUtils.createDiv();
|
17783 | if (item.sort) {
|
17784 | var itemSort = item.sort;
|
17785 | colHeaderContainer.appendChild(createSortIcon(itemSort, !0)), colHeaderContainer.appendChild(createSortIcon(reverseSort(itemSort), !1));
|
17786 | } else colHeaderContainer.appendChild(createSortIcon(2, !1));
|
17787 | var colHeaderTitle = TablixUtils.createDiv(), title = item ? visuals.TextUtil.replaceSpaceWithNBSP(item.displayName) : "";
|
17788 | colHeaderTitle.textContent = title, colHeaderContainer.appendChild(colHeaderTitle),
|
17789 | cell.extension.contentHost.title = title, cell.extension.contentHost.appendChild(colHeaderContainer);
|
17790 | }
|
17791 | function createSortIcon(sort, isSorted) {
|
17792 | var imgSort = document.createElement("i");
|
17793 | return imgSort.className = SortIconContainerClassName + " " + (isSorted ? "sorted" : "future") + " " + (1 === sort ? "powervisuals-glyph caret-up" : "powervisuals-glyph caret-down"),
|
17794 | imgSort;
|
17795 | }
|
17796 | function checkSortIconExists(cell) {
|
17797 | for (var i = 0, len = cell.extension.contentElement.childElementCount; len > i; i++) {
|
17798 | var element = cell.extension.contentElement.children.item(i);
|
17799 | if (element.classList.contains(SortIconContainerClassName)) return !0;
|
17800 | }
|
17801 | return !1;
|
17802 | }
|
17803 | function removeSortIcons(cell) {
|
17804 | checkSortIconExists(cell) && $(cell.extension.contentElement).find("." + SortIconContainerClassName).remove();
|
17805 | }
|
17806 | TablixUtils.CssClassTablixDiv = "tablixDiv", TablixUtils.CssClassContentElement = "tablixCellContentElement",
|
17807 | TablixUtils.CssClassContentHost = "tablixCellContentHost", TablixUtils.CssClassTablixHeader = "tablixHeader",
|
17808 | TablixUtils.CssClassTablixColumnHeaderLeaf = "tablixColumnHeaderLeaf", TablixUtils.CssClassTablixValueNumeric = "tablixValueNumeric",
|
17809 | TablixUtils.CssClassTablixValueTotal = "tablixValueTotal", TablixUtils.CssClassValueURLIcon = "powervisuals-glyph url-icon tablixUrlIconGlyph",
|
17810 | TablixUtils.CssClassValueURLIconContainer = "tablixValueUrlIcon", TablixUtils.CssClassMatrixRowHeaderLeaf = "matrixRowHeaderLeaf",
|
17811 | TablixUtils.CssClassMatrixRowHeaderSubTotal = "matrixRowHeaderSubTotal", TablixUtils.CssClassTableFooter = "tableFooterCell",
|
17812 | TablixUtils.CssClassTableBodyCell = "tableBodyCell", TablixUtils.CssClassTableBodyCellBottom = "tableBodyCellBottom",
|
17813 | TablixUtils.StringNonBreakingSpace = " ", TablixUtils.UnitOfMeasurement = "px";
|
17814 | var SortIconContainerClassName = "tablixSortIconContainer";
|
17815 | TablixUtils.CellPaddingLeft = 10, TablixUtils.CellPaddingRight = 5, TablixUtils.CellPaddingLeftMatrixTotal = 5,
|
17816 | TablixUtils.FontFamilyCell = "'Segoe UI','wf_segoe-ui_normal', helvetica, arial, sans-serif",
|
17817 | TablixUtils.FontFamilyHeader = "'Segoe UI','wf_segoe-ui_normal', helvetica, arial, sans-serif",
|
17818 | TablixUtils.FontFamilyTotal = "'Segoe UI Bold','wf_segoe-ui_bold', helvetica, arial, sans-serif",
|
17819 | TablixUtils.FontColorCells = "#333", TablixUtils.FontColorHeaders = "#666";
|
17820 | var EdgeSettings = function() {
|
17821 | function EdgeSettings(weight, color) {
|
17822 | this.applyParams(!0, weight, color);
|
17823 | }
|
17824 | return EdgeSettings.prototype.applyParams = function(shown, weight, color) {
|
17825 | shown ? (this.weight = null == weight ? 0 : weight, this.color = null == color ? "black" : color) : (this.weight = 0,
|
17826 | this.color = "black");
|
17827 | }, EdgeSettings.prototype.getCSS = function() {
|
17828 | var css = [];
|
17829 | return _.isNumber(this.weight) && (css.push(this.weight + TablixUtils.UnitOfMeasurement),
|
17830 | this.color && css.push(this.color), css.push("solid")), css.join(" ");
|
17831 | }, EdgeSettings;
|
17832 | }();
|
17833 | TablixUtils.EdgeSettings = EdgeSettings;
|
17834 | var CellStyle = function() {
|
17835 | function CellStyle() {
|
17836 | this.borders = {}, this.paddings = {
|
17837 | top: 0,
|
17838 | left: TablixUtils.CellPaddingLeft,
|
17839 | bottom: 0,
|
17840 | right: TablixUtils.CellPaddingRight
|
17841 | }, this.fontFamily = "", this.fontColor = "", this.backColor = "", this.hasImage = !1;
|
17842 | }
|
17843 | return CellStyle.prototype.applyStyle = function(cell) {
|
17844 | var div = cell.extension.contentHost, style = div.style;
|
17845 | style.fontFamily = this.fontFamily, style.color = this.fontColor, style.backgroundColor = this.backColor;
|
17846 | var borderShadow = [];
|
17847 | style.border = "none", this.borders.left && borderShadow.push("inset " + this.borders.left.weight + TablixUtils.UnitOfMeasurement + " 0 0 0 " + this.borders.left.color),
|
17848 | this.borders.right && borderShadow.push("inset -" + this.borders.right.weight + TablixUtils.UnitOfMeasurement + " 0 0 0 " + this.borders.right.color),
|
17849 | this.borders.top && borderShadow.push("inset 0 " + this.borders.top.weight + TablixUtils.UnitOfMeasurement + " 0 0 " + this.borders.top.color),
|
17850 | this.borders.bottom && borderShadow.push("inset 0 -" + this.borders.bottom.weight + TablixUtils.UnitOfMeasurement + " 0 0 " + this.borders.bottom.color),
|
17851 | style.boxShadow = borderShadow.join(", "), style.paddingTop = (null == this.paddings.top ? 0 : this.paddings.top) + (null == this.borders.top ? 0 : this.borders.top.weight) + TablixUtils.UnitOfMeasurement,
|
17852 | style.paddingRight = (null == this.paddings.right ? TablixUtils.CellPaddingRight : this.paddings.right) + (null == this.borders.right ? 0 : this.borders.right.weight) + TablixUtils.UnitOfMeasurement,
|
17853 | style.paddingBottom = (null == this.paddings.bottom ? 0 : this.paddings.bottom) + (null == this.borders.bottom ? 0 : this.borders.bottom.weight) + TablixUtils.UnitOfMeasurement,
|
17854 | style.paddingLeft = (null == this.paddings.left ? TablixUtils.CellPaddingLeft : this.paddings.left) + (null == this.borders.left ? 0 : this.borders.left.weight) + TablixUtils.UnitOfMeasurement;
|
17855 | }, CellStyle.prototype.getExtraTop = function() {
|
17856 | var extra = 0;
|
17857 | return this.paddings.top && (extra += this.paddings.top), this.borders.top && (extra += this.borders.top.weight),
|
17858 | extra;
|
17859 | }, CellStyle.prototype.getExtraBottom = function() {
|
17860 | var extra = 0;
|
17861 | return this.paddings.bottom && (extra += this.paddings.bottom), this.borders.bottom && (extra += this.borders.bottom.weight),
|
17862 | extra;
|
17863 | }, CellStyle.prototype.getExtraRight = function() {
|
17864 | var extra = 0;
|
17865 | return this.paddings.right && (extra += this.paddings.right), this.borders.right && (extra += this.borders.right.weight),
|
17866 | extra;
|
17867 | }, CellStyle.prototype.getExtraLeft = function() {
|
17868 | var extra = 0;
|
17869 | return this.paddings.left && (extra += this.paddings.left), this.borders.left && (extra += this.borders.left.weight),
|
17870 | extra;
|
17871 | }, CellStyle;
|
17872 | }();
|
17873 | TablixUtils.CellStyle = CellStyle;
|
17874 | var DimensionPosition = function() {
|
17875 | function DimensionPosition() {}
|
17876 | return DimensionPosition;
|
17877 | }();
|
17878 | TablixUtils.DimensionPosition = DimensionPosition;
|
17879 | var CellPosition = function() {
|
17880 | function CellPosition() {
|
17881 | this.row = new DimensionPosition(), this.column = new DimensionPosition();
|
17882 | }
|
17883 | return CellPosition.prototype.isMatch = function(position) {
|
17884 | return this.column.index === position.column.index && this.row.index === position.row.index;
|
17885 | }, CellPosition;
|
17886 | }();
|
17887 | TablixUtils.CellPosition = CellPosition;
|
17888 | var TablixVisualCell = function() {
|
17889 | function TablixVisualCell(dataPoint, isTotal, columnMetadata, formatter) {
|
17890 | this.dataPoint = dataPoint, this.columnMetadata = columnMetadata, this.formatter = formatter,
|
17891 | this.isTotal = isTotal, this.position = new TablixUtils.CellPosition();
|
17892 | }
|
17893 | return Object.defineProperty(TablixVisualCell.prototype, "textContent", {
|
17894 | get: function() {
|
17895 | return null == this.dataPoint ? "" : this.formatter ? this.formatter(this.dataPoint, this.columnMetadata, TablixObjects.PropColumnFormatString.getPropertyID()) : this.dataPoint;
|
17896 | },
|
17897 | enumerable: !0,
|
17898 | configurable: !0
|
17899 | }), Object.defineProperty(TablixVisualCell.prototype, "domContent", {
|
17900 | get: function() {
|
17901 | return this.columnMetadata && isValidStatusGraphic(this.columnMetadata.kpi, this.textContent) ? createKpiDom(this.columnMetadata.kpi, this.textContent) : void 0;
|
17902 | },
|
17903 | enumerable: !0,
|
17904 | configurable: !0
|
17905 | }), Object.defineProperty(TablixVisualCell.prototype, "isNumeric", {
|
17906 | get: function() {
|
17907 | return this.columnMetadata ? this.columnMetadata.type.numeric && !this.columnMetadata.kpi : void 0;
|
17908 | },
|
17909 | enumerable: !0,
|
17910 | configurable: !0
|
17911 | }), Object.defineProperty(TablixVisualCell.prototype, "isUrl", {
|
17912 | get: function() {
|
17913 | return this.columnMetadata ? visuals.converterHelper.isWebUrlColumn(this.columnMetadata) : void 0;
|
17914 | },
|
17915 | enumerable: !0,
|
17916 | configurable: !0
|
17917 | }), Object.defineProperty(TablixVisualCell.prototype, "isImage", {
|
17918 | get: function() {
|
17919 | return this.columnMetadata ? visuals.converterHelper.isImageUrlColumn(this.columnMetadata) : void 0;
|
17920 | },
|
17921 | enumerable: !0,
|
17922 | configurable: !0
|
17923 | }), Object.defineProperty(TablixVisualCell.prototype, "isValidUrl", {
|
17924 | get: function() {
|
17925 | return jsCommon.UrlUtils.isValidImageUrl(this.textContent);
|
17926 | },
|
17927 | enumerable: !0,
|
17928 | configurable: !0
|
17929 | }), TablixVisualCell.prototype.isMatch = function(item) {
|
17930 | return this.position.isMatch(item.position) && this.backColor === item.backColor;
|
17931 | }, TablixVisualCell;
|
17932 | }();
|
17933 | TablixUtils.TablixVisualCell = TablixVisualCell, TablixUtils.createTable = createTable,
|
17934 | TablixUtils.createDiv = createDiv, TablixUtils.resetCellCssClass = resetCellCssClass,
|
17935 | TablixUtils.addCellCssClass = addCellCssClass, TablixUtils.clearCellStyle = clearCellStyle,
|
17936 | TablixUtils.clearCellTextAndTooltip = clearCellTextAndTooltip, TablixUtils.setCellTextAndTooltip = setCellTextAndTooltip,
|
17937 | TablixUtils.isValidSortClick = isValidSortClick, TablixUtils.appendATagToBodyCell = appendATagToBodyCell,
|
17938 | TablixUtils.appendImgTagToBodyCell = appendImgTagToBodyCell, TablixUtils.createKpiDom = createKpiDom,
|
17939 | TablixUtils.isValidStatusGraphic = isValidStatusGraphic, TablixUtils.getCustomSortEventArgs = getCustomSortEventArgs,
|
17940 | TablixUtils.reverseSort = reverseSort, TablixUtils.createColumnHeaderWithSortIcon = createColumnHeaderWithSortIcon,
|
17941 | TablixUtils.removeSortIcons = removeSortIcons;
|
17942 | }(TablixUtils = internal.TablixUtils || (internal.TablixUtils = {}));
|
17943 | }(internal = controls.internal || (controls.internal = {}));
|
17944 | }(controls = visuals.controls || (visuals.controls = {}));
|
17945 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
17946 | }(powerbi || (powerbi = {}));
|
17947 |
|
17948 | var powerbi;
|
17949 |
|
17950 | !function(powerbi) {
|
17951 | var visuals;
|
17952 | !function(visuals) {
|
17953 | var controls;
|
17954 | !function(controls) {
|
17955 | controls.TablixDefaultTextSize = jsCommon.TextSizeDefaults.TextSizeMin;
|
17956 | var TablixControl = function() {
|
17957 | function TablixControl(hierarchyNavigator, layoutManager, binder, parentDomElement, options) {
|
17958 | var _this = this;
|
17959 | this.scrollBarElementWidth = 9, this.options = options;
|
17960 | var isInteractive = options.interactive;
|
17961 | this.isTouchEnabled = isInteractive && options.enableTouchSupport, this.mainDiv = controls.internal.TablixUtils.createDiv(),
|
17962 | this.mainDiv.classList.add(TablixControl.TablixTableAreaClassName), this.footerDiv = controls.internal.TablixUtils.createDiv(),
|
17963 | this.footerDiv.classList.add(TablixControl.TablixFooterClassName), this.isTouchEnabled && this.InitializeTouchSupport(),
|
17964 | this.gridDimensions = {}, this.containerElement = controls.internal.TablixUtils.createDiv(),
|
17965 | this.className = layoutManager.getTablixClassName(), this.autoSizeWidth = !1, this.autoSizeHeight = !1,
|
17966 | this.fontFamily = controls.internal.TablixUtils.FontFamilyCell, this.fontColor = controls.internal.TablixUtils.FontColorCells,
|
17967 | this.fontSize = options.fontSize, parentDomElement.className = TablixControl.TablixContainerClassName,
|
17968 | parentDomElement.appendChild(this.containerElement), this.containerElement.addEventListener("mousewheel", function(e) {
|
17969 | _this.onMouseWheel(e);
|
17970 | }), this.containerElement.addEventListener("DOMMouseScroll", function(e) {
|
17971 | _this.onFireFoxMouseWheel(e);
|
17972 | }), this.containerElement.appendChild(this.mainDiv), this.containerElement.appendChild(this.footerDiv),
|
17973 | this.isTouchEnabled && (this.touchInterpreter.initTouch(this.mainDiv, null, !1),
|
17974 | this.footerTouchInterpreter.initTouch(this.footerDiv, this.mainDiv, !1)), this.controlLayoutManager = layoutManager,
|
17975 | this.controlLayoutManager.initialize(this), this.hierarchyTablixNavigator = hierarchyNavigator,
|
17976 | this.binder = binder, this.columnDim = new controls.TablixColumnDimension(this),
|
17977 | this.rowDim = new controls.TablixRowDimension(this), this.columnDim._otherDimension = this.rowDimension,
|
17978 | this.rowDim._otherDimension = this.columnDimension, this.InitializeScrollbars(),
|
17979 | isInteractive || (this.scrollbarWidth = 0), this.updateHorizontalPosition(), this.updateVerticalPosition(),
|
17980 | this.updateFooterVisibility(), this.lastRenderingArgs = {};
|
17981 | }
|
17982 | return TablixControl.prototype.InitializeTouchSupport = function() {
|
17983 | this.touchManager = new controls.TouchUtils.TouchManager(), this.touchInterpreter = new controls.TouchUtils.TouchEventInterpreter(this.touchManager),
|
17984 | this.footerTouchInterpreter = new controls.TouchUtils.TouchEventInterpreter(this.touchManager),
|
17985 | this.columnTouchDelegate = new controls.ColumnTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17986 | this.rowTouchDelegate = new controls.RowTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17987 | this.bodyTouchDelegate = new controls.BodyTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17988 | this.footerTouchDelegate = new controls.ColumnTouchDelegate(new controls.TouchUtils.Rectangle()),
|
17989 | this.columnTouchDelegate.setHandler(this, this.onTouchEvent), this.rowTouchDelegate.setHandler(this, this.onTouchEvent),
|
17990 | this.bodyTouchDelegate.setHandler(this, this.onTouchEvent), this.footerTouchDelegate.setHandler(this, this.onTouchEvent),
|
17991 | this.touchManager.addTouchRegion(this.columnTouchDelegate.dimension, this.columnTouchDelegate, this.columnTouchDelegate),
|
17992 | this.touchManager.addTouchRegion(this.rowTouchDelegate.dimension, this.rowTouchDelegate, this.rowTouchDelegate),
|
17993 | this.touchManager.addTouchRegion(this.bodyTouchDelegate.dimension, this.bodyTouchDelegate, this.bodyTouchDelegate),
|
17994 | this.touchManager.addTouchRegion(this.footerTouchDelegate.dimension, this.footerTouchDelegate, this.footerTouchDelegate);
|
17995 | }, TablixControl.prototype.InitializeScrollbars = function() {
|
17996 | this.rowDim._initializeScrollbar(this.containerElement, null, this.options.layoutKind);
|
17997 | var rowDimensionScrollbarStyle = this.rowDim.scrollbar.element.style;
|
17998 | rowDimensionScrollbarStyle.position = "absolute", rowDimensionScrollbarStyle.top = "0" + TablixControl.UnitOfMeasurement,
|
17999 | rowDimensionScrollbarStyle.right = "0" + TablixControl.UnitOfMeasurement, this.rowDim.scrollbar.width = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
18000 | this.rowDim.scrollbar.show(!0), this.columnDim._initializeScrollbar(this.containerElement, null, this.options.layoutKind);
|
18001 | var columnDimensionScrollbarStyle = this.columnDim.scrollbar.element.style;
|
18002 | columnDimensionScrollbarStyle.position = "absolute", columnDimensionScrollbarStyle.left = "0" + TablixControl.UnitOfMeasurement,
|
18003 | columnDimensionScrollbarStyle.bottom = "0" + TablixControl.UnitOfMeasurement, this.columnDim.scrollbar.height = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
18004 | this.columnDim.scrollbar.show(!1);
|
18005 | }, Object.defineProperty(TablixControl.prototype, "container", {
|
18006 | get: function() {
|
18007 | return this.containerElement;
|
18008 | },
|
18009 | enumerable: !0,
|
18010 | configurable: !0
|
18011 | }), Object.defineProperty(TablixControl.prototype, "contentHost", {
|
18012 | get: function() {
|
18013 | return this.mainDiv;
|
18014 | },
|
18015 | enumerable: !0,
|
18016 | configurable: !0
|
18017 | }), Object.defineProperty(TablixControl.prototype, "footerHost", {
|
18018 | get: function() {
|
18019 | return this.footerDiv;
|
18020 | },
|
18021 | enumerable: !0,
|
18022 | configurable: !0
|
18023 | }), Object.defineProperty(TablixControl.prototype, "className", {
|
18024 | set: function(value) {
|
18025 | this.containerElement.className = value;
|
18026 | },
|
18027 | enumerable: !0,
|
18028 | configurable: !0
|
18029 | }), Object.defineProperty(TablixControl.prototype, "hierarchyNavigator", {
|
18030 | get: function() {
|
18031 | return this.hierarchyTablixNavigator;
|
18032 | },
|
18033 | enumerable: !0,
|
18034 | configurable: !0
|
18035 | }), TablixControl.prototype.getBinder = function() {
|
18036 | return this.binder;
|
18037 | }, Object.defineProperty(TablixControl.prototype, "autoSizeWidth", {
|
18038 | get: function() {
|
18039 | return this._autoSizeWidth;
|
18040 | },
|
18041 | set: function(value) {
|
18042 | this._autoSizeWidth = value, value || (this.containerElement.style.minWidth = this.containerElement.style.maxWidth = "none");
|
18043 | },
|
18044 | enumerable: !0,
|
18045 | configurable: !0
|
18046 | }), Object.defineProperty(TablixControl.prototype, "autoSizeHeight", {
|
18047 | get: function() {
|
18048 | return this._autoSizeHeight;
|
18049 | },
|
18050 | set: function(value) {
|
18051 | value || (this.containerElement.style.minHeight = this.containerElement.style.maxHeight = "none");
|
18052 | },
|
18053 | enumerable: !0,
|
18054 | configurable: !0
|
18055 | }), Object.defineProperty(TablixControl.prototype, "maxWidth", {
|
18056 | get: function() {
|
18057 | return this.maximumWidth;
|
18058 | },
|
18059 | set: function(value) {
|
18060 | this.maximumWidth = value, this.containerElement.style.maxWidth = this.maximumWidth + TablixControl.UnitOfMeasurement;
|
18061 | },
|
18062 | enumerable: !0,
|
18063 | configurable: !0
|
18064 | }), Object.defineProperty(TablixControl.prototype, "viewport", {
|
18065 | get: function() {
|
18066 | return this.viewPort;
|
18067 | },
|
18068 | set: function(value) {
|
18069 | this.viewPort = value, this.containerElement.style.width = this.viewPort.width + TablixControl.UnitOfMeasurement,
|
18070 | this.containerElement.style.height = this.viewPort.height + TablixControl.UnitOfMeasurement,
|
18071 | this.rowDim.scrollbar.invalidateArrange(), this.columnDim.scrollbar.invalidateArrange(),
|
18072 | this.controlLayoutManager.updateViewport(this.viewPort);
|
18073 | },
|
18074 | enumerable: !0,
|
18075 | configurable: !0
|
18076 | }), Object.defineProperty(TablixControl.prototype, "maxHeight", {
|
18077 | get: function() {
|
18078 | return this.maximumHeight;
|
18079 | },
|
18080 | set: function(value) {
|
18081 | this.maximumHeight = value, this.containerElement.style.maxHeight = this.maximumHeight + TablixControl.UnitOfMeasurement;
|
18082 | },
|
18083 | enumerable: !0,
|
18084 | configurable: !0
|
18085 | }), Object.defineProperty(TablixControl.prototype, "minWidth", {
|
18086 | get: function() {
|
18087 | return this.minimumWidth;
|
18088 | },
|
18089 | set: function(value) {
|
18090 | this.minimumWidth = value, this.containerElement.style.minWidth = this.minimumWidth + TablixControl.UnitOfMeasurement;
|
18091 | },
|
18092 | enumerable: !0,
|
18093 | configurable: !0
|
18094 | }), Object.defineProperty(TablixControl.prototype, "minHeight", {
|
18095 | get: function() {
|
18096 | return this.minimumHeight;
|
18097 | },
|
18098 | set: function(value) {
|
18099 | this.minimumHeight = value, this.containerElement.style.minHeight = this.minimumHeight + TablixControl.UnitOfMeasurement;
|
18100 | },
|
18101 | enumerable: !0,
|
18102 | configurable: !0
|
18103 | }), Object.defineProperty(TablixControl.prototype, "fontSize", {
|
18104 | get: function() {
|
18105 | return this.textFontSize;
|
18106 | },
|
18107 | set: function(value) {
|
18108 | this.textFontSize = value ? value : TablixControl.DefaultFontSize, this.containerElement.style.fontSize = this.textFontSize;
|
18109 | },
|
18110 | enumerable: !0,
|
18111 | configurable: !0
|
18112 | }), Object.defineProperty(TablixControl.prototype, "fontFamily", {
|
18113 | get: function() {
|
18114 | return this.textFontFamily;
|
18115 | },
|
18116 | set: function(value) {
|
18117 | this.textFontFamily = value, this.containerElement.style.fontFamily = value;
|
18118 | },
|
18119 | enumerable: !0,
|
18120 | configurable: !0
|
18121 | }), Object.defineProperty(TablixControl.prototype, "fontColor", {
|
18122 | get: function() {
|
18123 | return this.textFontColor;
|
18124 | },
|
18125 | set: function(value) {
|
18126 | this.textFontColor = value, this.containerElement.style.color = value;
|
18127 | },
|
18128 | enumerable: !0,
|
18129 | configurable: !0
|
18130 | }), Object.defineProperty(TablixControl.prototype, "scrollbarWidth", {
|
18131 | set: function(value) {
|
18132 | this.scrollBarElementWidth = value, this.rowDim.scrollbar.width = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
18133 | this.columnDim.scrollbar.height = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement;
|
18134 | },
|
18135 | enumerable: !0,
|
18136 | configurable: !0
|
18137 | }), TablixControl.prototype.updateModels = function(resetScrollOffsets, rowModel, columnModel) {
|
18138 | this.rowDim.model = rowModel, this.rowDim.modelDepth = this.hierarchyNavigator.getRowHierarchyDepth(),
|
18139 | this.columnDim.model = columnModel, this.columnDim.modelDepth = this.hierarchyNavigator.getColumnHierarchyDepth(),
|
18140 | resetScrollOffsets && (this.rowDim.scrollOffset = 0, this.columnDim.scrollOffset = 0),
|
18141 | this.layoutManager.updateColumnCount(this.rowDim, this.columnDim);
|
18142 | }, TablixControl.prototype.updateColumnDimensions = function(rowHierarchyWidth, columnHierarchyWidth, count) {
|
18143 | var gridDimensions = this.gridDimensions;
|
18144 | gridDimensions.columnCount = count, gridDimensions.rowHierarchyWidth = rowHierarchyWidth,
|
18145 | gridDimensions.columnHierarchyWidth = columnHierarchyWidth;
|
18146 | }, TablixControl.prototype.updateRowDimensions = function(columnHierarchyHeight, rowHierarchyHeight, rowHierarchyContentHeight, count, footerHeight) {
|
18147 | var gridDimensions = this.gridDimensions;
|
18148 | gridDimensions.rowCount = count, gridDimensions.rowHierarchyHeight = rowHierarchyHeight,
|
18149 | gridDimensions.rowHierarchyContentHeight = rowHierarchyContentHeight, gridDimensions.columnHierarchyHeight = columnHierarchyHeight,
|
18150 | gridDimensions.footerHeight = footerHeight;
|
18151 | }, TablixControl.prototype.updateTouchDimensions = function() {
|
18152 | var gridDimensions = this.gridDimensions;
|
18153 | this.columnTouchDelegate.resize(gridDimensions.rowHierarchyWidth, 0, gridDimensions.columnHierarchyWidth, gridDimensions.columnHierarchyHeight),
|
18154 | this.columnTouchDelegate.setScrollDensity(gridDimensions.columnCount / gridDimensions.columnHierarchyWidth),
|
18155 | this.rowTouchDelegate.resize(0, gridDimensions.columnHierarchyHeight, gridDimensions.rowHierarchyWidth, gridDimensions.rowHierarchyHeight),
|
18156 | this.rowTouchDelegate.setScrollDensity(gridDimensions.rowCount / gridDimensions.rowHierarchyHeight),
|
18157 | this.bodyTouchDelegate.resize(gridDimensions.rowHierarchyWidth, gridDimensions.columnHierarchyHeight, gridDimensions.columnHierarchyWidth, gridDimensions.rowHierarchyHeight),
|
18158 | this.bodyTouchDelegate.setScrollDensity(gridDimensions.columnCount / gridDimensions.columnHierarchyWidth, gridDimensions.rowCount / gridDimensions.rowHierarchyHeight),
|
18159 | this.footerTouchDelegate.resize(gridDimensions.rowHierarchyWidth, gridDimensions.columnHierarchyHeight + gridDimensions.rowHierarchyHeight, gridDimensions.columnHierarchyWidth, gridDimensions.footerHeight),
|
18160 | this.footerTouchDelegate.setScrollDensity(gridDimensions.columnCount / gridDimensions.columnHierarchyWidth);
|
18161 | }, TablixControl.prototype.onMouseWheel = function(e) {
|
18162 | var dimension = this.determineDimensionToScroll();
|
18163 | dimension && dimension.scrollbar.onMouseWheel(e);
|
18164 | }, TablixControl.prototype.onFireFoxMouseWheel = function(e) {
|
18165 | var dimension = this.determineDimensionToScroll();
|
18166 | dimension && dimension.scrollbar.onFireFoxMouseWheel(e);
|
18167 | }, TablixControl.prototype.determineDimensionToScroll = function() {
|
18168 | return this.rowDim.scrollbar.visible ? this.rowDim : this.columnDim.scrollbar.visible ? this.columnDim : null;
|
18169 | }, Object.defineProperty(TablixControl.prototype, "layoutManager", {
|
18170 | get: function() {
|
18171 | return this.controlLayoutManager;
|
18172 | },
|
18173 | enumerable: !0,
|
18174 | configurable: !0
|
18175 | }), Object.defineProperty(TablixControl.prototype, "columnDimension", {
|
18176 | get: function() {
|
18177 | return this.columnDim;
|
18178 | },
|
18179 | enumerable: !0,
|
18180 | configurable: !0
|
18181 | }), Object.defineProperty(TablixControl.prototype, "rowDimension", {
|
18182 | get: function() {
|
18183 | return this.rowDim;
|
18184 | },
|
18185 | enumerable: !0,
|
18186 | configurable: !0
|
18187 | }), TablixControl.prototype.refresh = function(clear) {
|
18188 | this.render(clear, null);
|
18189 | }, TablixControl.prototype._onScrollAsync = function(dimension) {
|
18190 | var _this = this;
|
18191 | requestAnimationFrame(function() {
|
18192 | _this.performPendingScroll(dimension);
|
18193 | });
|
18194 | }, TablixControl.prototype.performPendingScroll = function(dimension) {
|
18195 | this.render(!1, dimension);
|
18196 | }, TablixControl.prototype.updateHorizontalPosition = function() {
|
18197 | this.rowDim.scrollbar.visible ? (this.columnDim.scrollbar.element.style.right = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
18198 | this.footerDiv.style.right = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement,
|
18199 | this.mainDiv.style.right = this.scrollBarElementWidth + TablixControl.UnitOfMeasurement) : (this.columnDim.scrollbar.element.style.right = "0" + TablixControl.UnitOfMeasurement,
|
18200 | this.mainDiv.style.right = "0" + TablixControl.UnitOfMeasurement, this.footerDiv.style.right = "0" + TablixControl.UnitOfMeasurement);
|
18201 | }, TablixControl.prototype.updateFooterVisibility = function() {
|
18202 | (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");
|
18203 | }, TablixControl.prototype.updateVerticalPosition = function() {
|
18204 | var hasVerticalScrollbar = this.rowDim.scrollbar.visible, isDashboardTile = 1 === this.controlLayoutManager.getLayoutKind(), showFooter = hasVerticalScrollbar || isDashboardTile;
|
18205 | if (showFooter) {
|
18206 | var mainBottom = this.footerDiv.offsetHeight, footerBottom = 0, verticalScrollbarBottom = 0, hasHorizontalScrollbar = this.columnDim.scrollbar.visible;
|
18207 | hasHorizontalScrollbar && (mainBottom += this.scrollBarElementWidth, footerBottom += this.scrollBarElementWidth,
|
18208 | verticalScrollbarBottom = this.scrollBarElementWidth), this.mainDiv.style.bottom = mainBottom + TablixControl.UnitOfMeasurement,
|
18209 | this.rowDim.scrollbar.element.style.bottom = verticalScrollbarBottom + TablixControl.UnitOfMeasurement,
|
18210 | this.footerDiv.style.bottom = footerBottom + TablixControl.UnitOfMeasurement, this.footerDiv.style.removeProperty("top");
|
18211 | } else this.footerDiv.style.top = this.gridDimensions.rowHierarchyContentHeight + TablixControl.UnitOfMeasurement,
|
18212 | this.footerDiv.style.removeProperty("bottom"), this.mainDiv.style.removeProperty("bottom");
|
18213 | }, TablixControl.prototype.alreadyRendered = function(scrollingDimension) {
|
18214 | return scrollingDimension === this.lastRenderingArgs.scrollingDimension && this.rowDimension.scrollOffset === this.lastRenderingArgs.rowScrollOffset && this.columnDimension.scrollOffset === this.lastRenderingArgs.columnScrollOffset;
|
18215 | }, TablixControl.prototype.render = function(clear, scrollingDimension) {
|
18216 | if (this.columnDim.makeScrollOffsetValid(), this.rowDim.makeScrollOffsetValid(),
|
18217 | clear || null === scrollingDimension) this.lastRenderingArgs = {}; else if (this.alreadyRendered(scrollingDimension)) return;
|
18218 | var done = !1;
|
18219 | this.renderIterationCount = 0, this.controlLayoutManager.onStartRenderingSession(scrollingDimension, this.mainDiv, clear);
|
18220 | var binder = this.binder;
|
18221 | binder.onStartRenderingSession();
|
18222 | for (var priorFooterHeight = this.gridDimensions.footerHeight, priorRowHierarchyHeight = this.gridDimensions.rowHierarchyHeight, priorRowHierarchyContentHeight = this.gridDimensions.rowHierarchyContentHeight; !done && this.renderIterationCount < TablixControl.MaxRenderIterationCount; ) {
|
18223 | var hScrollbarVisibility = this.columnDim.scrollbar.visible, vScrollbarVisibility = this.rowDim.scrollbar.visible;
|
18224 | this.columnDim._onStartRenderingIteration(), this.rowDim._onStartRenderingIteration(),
|
18225 | this.controlLayoutManager.onStartRenderingIteration(clear), this.renderCorner(),
|
18226 | this.columnDim._render(), this.rowDim._render(), done = this.controlLayoutManager.onEndRenderingIteration(),
|
18227 | this.columnDim._onEndRenderingIteration(), this.rowDim._onEndRenderingIteration(),
|
18228 | hScrollbarVisibility !== this.columnDim.scrollbar.visible && this.updateVerticalPosition(),
|
18229 | vScrollbarVisibility !== this.rowDim.scrollbar.visible && this.updateHorizontalPosition(),
|
18230 | this.renderIterationCount++;
|
18231 | }
|
18232 | this.controlLayoutManager.onEndRenderingSession(), binder.onEndRenderingSession(),
|
18233 | this.isTouchEnabled && this.updateTouchDimensions(), this.lastRenderingArgs.rowScrollOffset = this.rowDimension.scrollOffset,
|
18234 | this.lastRenderingArgs.columnScrollOffset = this.columnDimension.scrollOffset, this.updateContainerDimensions();
|
18235 | var lastRenderingArgs = this.lastRenderingArgs;
|
18236 | lastRenderingArgs.rowScrollOffset = this.rowDimension.scrollOffset, lastRenderingArgs.columnScrollOffset = this.columnDimension.scrollOffset,
|
18237 | lastRenderingArgs.scrollingDimension = scrollingDimension, priorFooterHeight === this.gridDimensions.footerHeight && priorRowHierarchyHeight === this.gridDimensions.rowHierarchyHeight && priorRowHierarchyContentHeight === this.gridDimensions.rowHierarchyContentHeight || this.updateVerticalPosition(),
|
18238 | this.options.interactive && (this.columnDim.scrollbar.refresh(), this.rowDim.scrollbar.refresh());
|
18239 | }, TablixControl.prototype.updateContainerDimensions = function() {
|
18240 | var gridDimensions = this.gridDimensions;
|
18241 | if (this._autoSizeWidth) {
|
18242 | var vScrollBarWidth = this.rowDim.scrollbar.visible ? this.scrollBarElementWidth : 0;
|
18243 | this.containerElement.style.width = gridDimensions.rowHierarchyWidth + gridDimensions.columnHierarchyWidth + vScrollBarWidth + TablixControl.UnitOfMeasurement;
|
18244 | }
|
18245 | if (this._autoSizeHeight) {
|
18246 | var hScrollBarHeight = this.columnDim.scrollbar.visible ? this.scrollBarElementWidth : 0;
|
18247 | this.containerElement.style.height = gridDimensions.columnHierarchyHeight + gridDimensions.rowHierarchyHeight + gridDimensions.footerHeight + hScrollBarHeight + TablixControl.UnitOfMeasurement;
|
18248 | }
|
18249 | }, TablixControl.prototype.cornerCellMatch = function(item, cell) {
|
18250 | var previousItem = cell.item;
|
18251 | return 0 === cell.type && previousItem && this.hierarchyTablixNavigator.cornerCellItemEquals(item, previousItem);
|
18252 | }, TablixControl.prototype.renderCorner = function() {
|
18253 | for (var columnDepth = this.columnDim.getDepth(), rowDepth = this.rowDim.getDepth(), i = 0; columnDepth > i; i++) for (var j = 0; rowDepth > j; j++) {
|
18254 | var item = this.hierarchyTablixNavigator.getCorner(j, i), cell = this.controlLayoutManager.getOrCreateCornerCell(item, j, i), match = this.cornerCellMatch(item, cell);
|
18255 | match || (this._unbindCell(cell), cell.type = 0, cell.item = item, this.binder.bindCornerCell(item, cell)),
|
18256 | this.controlLayoutManager.onCornerCellRealized(item, cell);
|
18257 | }
|
18258 | }, TablixControl.prototype._unbindCell = function(cell) {
|
18259 | switch (cell.type) {
|
18260 | case 3:
|
18261 | this.binder.unbindBodyCell(cell.item, cell);
|
18262 | break;
|
18263 |
|
18264 | case 2:
|
18265 | this.binder.unbindColumnHeader(cell.item, cell);
|
18266 | break;
|
18267 |
|
18268 | case 1:
|
18269 | this.binder.unbindRowHeader(cell.item, cell);
|
18270 | break;
|
18271 |
|
18272 | case 0:
|
18273 | this.binder.unbindCornerCell(cell.item, cell);
|
18274 | }
|
18275 | cell.item = null, cell.type = null;
|
18276 | }, TablixControl.prototype.onTouchEvent = function(args) {
|
18277 | var colShift, rowShift, that;
|
18278 | args && args.length > 0 && "columnDim" in args[0] && "rowDim" in args[0] && (that = args[0],
|
18279 | colShift = that.columnDim.scrollbar.visible ? args[1] : 0, rowShift = that.rowDim.scrollbar.visible ? args[2] : 0,
|
18280 | that.columnDim.scrollbar.viewMin = Math.max(0, that.columnDim.scrollbar.viewMin + colShift),
|
18281 | that.columnDim.scrollOffset = Math.max(0, that.columnDim.scrollOffset + colShift),
|
18282 | that.rowDim.scrollbar.viewMin = Math.max(0, that.rowDim.scrollbar.viewMin + rowShift),
|
18283 | 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));
|
18284 | }, TablixControl.UnitOfMeasurement = "px", TablixControl.TablixContainerClassName = "tablixContainer",
|
18285 | TablixControl.TablixTableAreaClassName = "tablixTableArea", TablixControl.TablixFooterClassName = "tableFooterArea",
|
18286 | TablixControl.DefaultFontSize = jsCommon.PixelConverter.fromPoint(controls.TablixDefaultTextSize),
|
18287 | TablixControl.MaxRenderIterationCount = 10, TablixControl;
|
18288 | }();
|
18289 | controls.TablixControl = TablixControl;
|
18290 | }(controls = visuals.controls || (visuals.controls = {}));
|
18291 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18292 | }(powerbi || (powerbi = {}));
|
18293 |
|
18294 | var powerbi;
|
18295 |
|
18296 | !function(powerbi) {
|
18297 | var visuals;
|
18298 | !function(visuals) {
|
18299 | var controls;
|
18300 | !function(controls) {
|
18301 | var TablixDimension = function() {
|
18302 | function TablixDimension(tablixControl) {
|
18303 | this._scrollStep = .1, this._owner = tablixControl, this._hierarchyNavigator = tablixControl.hierarchyNavigator,
|
18304 | this._binder = tablixControl.getBinder(), this._tablixLayoutManager = tablixControl.layoutManager,
|
18305 | this.scrollOffset = 0;
|
18306 | }
|
18307 | return TablixDimension.prototype._onStartRenderingIteration = function() {
|
18308 | this.updateScrollPosition();
|
18309 | }, TablixDimension.prototype._onEndRenderingIteration = function() {}, TablixDimension.prototype.getValidScrollOffset = function(scrollOffset) {
|
18310 | return Math.min(Math.max(scrollOffset, 0), Math.max(this.getItemsCount() - this._scrollStep, 0));
|
18311 | }, TablixDimension.prototype.makeScrollOffsetValid = function() {
|
18312 | this.scrollOffset = this.getValidScrollOffset(this.scrollOffset);
|
18313 | }, TablixDimension.prototype.getIntegerScrollOffset = function() {
|
18314 | return Math.floor(this.scrollOffset);
|
18315 | }, TablixDimension.prototype.getFractionScrollOffset = function() {
|
18316 | return this.scrollOffset - this.getIntegerScrollOffset();
|
18317 | }, Object.defineProperty(TablixDimension.prototype, "scrollbar", {
|
18318 | get: function() {
|
18319 | return this._scrollbar;
|
18320 | },
|
18321 | enumerable: !0,
|
18322 | configurable: !0
|
18323 | }), TablixDimension.prototype.getFirstVisibleItem = function(level) {
|
18324 | return this._scrollItems[level];
|
18325 | }, TablixDimension.prototype.getFirstVisibleChild = function(item) {
|
18326 | return this._hierarchyNavigator.getAt(this._hierarchyNavigator.getChildren(item), this.getFirstVisibleChildIndex(item));
|
18327 | }, TablixDimension.prototype.getFirstVisibleChildIndex = function(item) {
|
18328 | var firstVisibleIndex, startItem = this.getFirstVisibleItem(this._hierarchyNavigator.getLevel(item) + 1);
|
18329 | return firstVisibleIndex = void 0 === startItem || void 0 !== startItem && this._hierarchyNavigator.getParent(startItem) !== item ? 0 : this._hierarchyNavigator.getIndex(startItem);
|
18330 | }, TablixDimension.prototype._initializeScrollbar = function(parentElement, touchDiv, layoutKind) {
|
18331 | var _this = this;
|
18332 | this._scrollbar = this._createScrollbar(parentElement, layoutKind), this._scrollbar._onscroll.push(function(e) {
|
18333 | return _this.onScroll();
|
18334 | }), touchDiv && (this.scrollbar.initTouch(touchDiv, !0), touchDiv.style.setProperty("-ms-touch-action", "pinch-zoom"));
|
18335 | }, TablixDimension.prototype.getItemsCount = function() {
|
18336 | return this.model ? this._hierarchyNavigator.getLeafCount(this.model) : 0;
|
18337 | }, TablixDimension.prototype.getDepth = function() {
|
18338 | return this.modelDepth;
|
18339 | }, TablixDimension.prototype.onScroll = function() {
|
18340 | this.scrollOffset = this._scrollbar.viewMin, this._owner._onScrollAsync(this);
|
18341 | }, Object.defineProperty(TablixDimension.prototype, "otherDimension", {
|
18342 | get: function() {
|
18343 | return this._otherDimension;
|
18344 | },
|
18345 | enumerable: !0,
|
18346 | configurable: !0
|
18347 | }), Object.defineProperty(TablixDimension.prototype, "layoutManager", {
|
18348 | get: function() {
|
18349 | return this._layoutManager;
|
18350 | },
|
18351 | enumerable: !0,
|
18352 | configurable: !0
|
18353 | }), TablixDimension.prototype._createScrollbar = function(parentElement, layoutKind) {
|
18354 | return null;
|
18355 | }, TablixDimension.prototype.updateScrollPosition = function() {
|
18356 | if (this._scrollItems = [], this.model) {
|
18357 | var firstVisibleScrollIndex = this.getIntegerScrollOffset(), firstVisible = this._hierarchyNavigator.getLeafAt(this.model, firstVisibleScrollIndex);
|
18358 | if (firstVisible) {
|
18359 | this._firstVisibleScrollIndex = firstVisibleScrollIndex;
|
18360 | do this._scrollItems[this._hierarchyNavigator.getLevel(firstVisible)] = firstVisible,
|
18361 | firstVisible = this._hierarchyNavigator.getParent(firstVisible); while (null !== firstVisible);
|
18362 | }
|
18363 | }
|
18364 | }, TablixDimension;
|
18365 | }();
|
18366 | controls.TablixDimension = TablixDimension;
|
18367 | var TablixRowDimension = function(_super) {
|
18368 | function TablixRowDimension(tablixControl) {
|
18369 | _super.call(this, tablixControl), this._layoutManager = this._tablixLayoutManager.rowLayoutManager,
|
18370 | this._footer = null;
|
18371 | }
|
18372 | return __extends(TablixRowDimension, _super), TablixRowDimension.prototype.setFooter = function(footerHeader) {
|
18373 | this._footer = footerHeader, this._owner.updateFooterVisibility();
|
18374 | }, TablixRowDimension.prototype.hasFooter = function() {
|
18375 | return null !== this._footer;
|
18376 | }, TablixRowDimension.prototype._render = function() {
|
18377 | var firstVisibleRowItem = this.getFirstVisibleItem(0);
|
18378 | this.hasFooter() && (this.addFooterRowHeader(this._footer), this.addFooterBodyCells(this._footer)),
|
18379 | void 0 !== firstVisibleRowItem && this.addNodes(this.model, 0, this.getDepth(), this._hierarchyNavigator.getIndex(firstVisibleRowItem));
|
18380 | }, TablixRowDimension.prototype._createScrollbar = function(parentElement, layoutKind) {
|
18381 | return new controls.VerticalScrollbar(parentElement, layoutKind);
|
18382 | }, TablixRowDimension.prototype.addNodes = function(items, rowIndex, depth, firstVisibleIndex) {
|
18383 | for (var count = this._hierarchyNavigator.getCount(items), i = firstVisibleIndex; count > i; i++) {
|
18384 | if (!this._layoutManager.needsToRealize) return;
|
18385 | var item = this._hierarchyNavigator.getAt(items, i), cell = this.addNode(item, items, rowIndex, depth);
|
18386 | rowIndex += cell.rowSpan;
|
18387 | }
|
18388 | }, TablixRowDimension.prototype.getFirstVisibleChildLeaf = function(item) {
|
18389 | for (var leaf = item; !this._hierarchyNavigator.isLeaf(leaf); ) leaf = this.getFirstVisibleChild(leaf);
|
18390 | return leaf;
|
18391 | }, TablixRowDimension.prototype.bindRowHeader = function(item, cell) {
|
18392 | this._binder.bindRowHeader(item, cell);
|
18393 | }, TablixRowDimension.prototype.addNode = function(item, items, rowIndex, depth) {
|
18394 | var previousCount, rowHeaderCell = this._tablixLayoutManager.getOrCreateRowHeader(item, items, rowIndex, this._hierarchyNavigator.getLevel(item)), match = this.rowHeaderMatch(item, rowHeaderCell);
|
18395 | return match || (this._owner._unbindCell(rowHeaderCell), rowHeaderCell.type = 1,
|
18396 | rowHeaderCell.item = item, rowHeaderCell.unfixRowHeight()), this._hierarchyNavigator.isLeaf(item) ? (rowHeaderCell.colSpan = depth - this._hierarchyNavigator.getLevel(item),
|
18397 | rowHeaderCell.rowSpan = 1, match || this.bindRowHeader(item, rowHeaderCell), this._tablixLayoutManager.onRowHeaderRealized(item, rowHeaderCell),
|
18398 | this.addBodyCells(item, items, rowIndex)) : (previousCount = this._layoutManager.getRealizedItemsCount(),
|
18399 | this.addNodes(this._hierarchyNavigator.getChildren(item), rowIndex, depth, this.getFirstVisibleChildIndex(item)),
|
18400 | rowHeaderCell.colSpan = 1, rowHeaderCell.rowSpan = this._layoutManager.getRealizedItemsCount() - previousCount + 1,
|
18401 | match || this.bindRowHeader(item, rowHeaderCell), this._tablixLayoutManager.onRowHeaderRealized(item, rowHeaderCell)),
|
18402 | rowHeaderCell;
|
18403 | }, TablixRowDimension.prototype.rowHeaderMatch = function(item, cell) {
|
18404 | var previousItem = cell.item;
|
18405 | return 1 === cell.type && previousItem && this._hierarchyNavigator.headerItemEquals(item, previousItem);
|
18406 | }, TablixRowDimension.prototype.addBodyCells = function(item, items, rowIndex) {
|
18407 | 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++) {
|
18408 | var cellItem = hierarchyNavigator.getIntersection(item, hierarchyNavigator.getLeafAt(otherModel, firstVisibleColumnIndex + i)), cell = layoutManager.getOrCreateBodyCell(cellItem, item, items, rowIndex, i);
|
18409 | this.bindBodyCell(cellItem, cell), layoutManager.onBodyCellRealized(cellItem, cell);
|
18410 | }
|
18411 | }, TablixRowDimension.prototype.bindBodyCell = function(item, cell) {
|
18412 | var match = this.bodyCelMatch(item, cell);
|
18413 | match || (this._owner._unbindCell(cell), cell.type = 3, cell.item = item, cell.unfixRowHeight(),
|
18414 | this._binder.bindBodyCell(item, cell));
|
18415 | }, TablixRowDimension.prototype.addFooterRowHeader = function(item) {
|
18416 | var cell = this._tablixLayoutManager.getOrCreateFooterRowHeader(item, this.model);
|
18417 | cell.colSpan = this.getDepth();
|
18418 | var match = this.rowHeaderMatch(item, cell);
|
18419 | match || (this._owner._unbindCell(cell), cell.type = 1, cell.item = item, cell.unfixRowHeight(),
|
18420 | this.bindRowHeader(item, cell), this._tablixLayoutManager.onRowHeaderFooterRealized(item, cell));
|
18421 | }, TablixRowDimension.prototype.addFooterBodyCells = function(rowItem) {
|
18422 | for (var firstVisibleColumnIndex = this._otherDimension.getIntegerScrollOffset(), columnCount = this._otherDimension.layoutManager.getRealizedItemsCount() - this.getDepth(), layoutManager = this._tablixLayoutManager, i = 0; columnCount > i; i++) {
|
18423 | var columnItem = this._hierarchyNavigator.getLeafAt(this._otherDimension.model, firstVisibleColumnIndex + i), item = this._hierarchyNavigator.getIntersection(rowItem, columnItem), cell = layoutManager.getOrCreateFooterBodyCell(item, i);
|
18424 | this.bindBodyCell(item, cell), layoutManager.onBodyCellFooterRealized(item, cell);
|
18425 | }
|
18426 | }, TablixRowDimension.prototype.bodyCelMatch = function(item, cell) {
|
18427 | var previousItem = cell.item;
|
18428 | return 3 === cell.type && previousItem && this._hierarchyNavigator.bodyCellItemEquals(item, previousItem);
|
18429 | }, TablixRowDimension;
|
18430 | }(TablixDimension);
|
18431 | controls.TablixRowDimension = TablixRowDimension;
|
18432 | var TablixColumnDimension = function(_super) {
|
18433 | function TablixColumnDimension(tablixControl) {
|
18434 | _super.call(this, tablixControl), this._layoutManager = this._tablixLayoutManager.columnLayoutManager;
|
18435 | }
|
18436 | return __extends(TablixColumnDimension, _super), TablixColumnDimension.prototype._render = function() {
|
18437 | var firstVisibleColumnItem = this.getFirstVisibleItem(0);
|
18438 | void 0 !== firstVisibleColumnItem && this.addNodes(this.model, 0, this.getDepth(), this._hierarchyNavigator.getIndex(firstVisibleColumnItem));
|
18439 | }, TablixColumnDimension.prototype._createScrollbar = function(parentElement, layoutKind) {
|
18440 | var scrollbar = new controls.HorizontalScrollbar(parentElement, layoutKind);
|
18441 | return scrollbar.smallIncrement = .2, scrollbar;
|
18442 | }, TablixColumnDimension.prototype.addNodes = function(items, columnIndex, depth, firstVisibleIndex) {
|
18443 | for (var count = this._hierarchyNavigator.getCount(items), i = firstVisibleIndex; count > i; i++) {
|
18444 | if (!this._layoutManager.needsToRealize) return;
|
18445 | var cell = this.addNode(this._hierarchyNavigator.getAt(items, i), items, columnIndex, depth);
|
18446 | columnIndex += cell.colSpan;
|
18447 | }
|
18448 | }, TablixColumnDimension.prototype.addNode = function(item, items, columnIndex, depth) {
|
18449 | var cell = this._tablixLayoutManager.getOrCreateColumnHeader(item, items, this._hierarchyNavigator.getLevel(item), columnIndex), match = this.columnHeaderMatch(item, cell);
|
18450 | if (match || (this._owner._unbindCell(cell), cell.type = 2, cell.item = item, cell.unfixRowHeight()),
|
18451 | this._hierarchyNavigator.isLeaf(item)) cell.rowSpan = depth - this._hierarchyNavigator.getLevel(item); else {
|
18452 | var previousCount = this._layoutManager.getRealizedItemsCount();
|
18453 | this.addNodes(this._hierarchyNavigator.getChildren(item), columnIndex, depth, this.getFirstVisibleChildIndex(item));
|
18454 | var childrenLevelDifference = this._hierarchyNavigator.getChildrenLevelDifference(item);
|
18455 | childrenLevelDifference === 1 / 0 ? cell.rowSpan = 1 : cell.rowSpan = childrenLevelDifference,
|
18456 | cell.colSpan = this._layoutManager.getRealizedItemsCount() - previousCount + 1;
|
18457 | }
|
18458 | return match || this._binder.bindColumnHeader(item, cell), this._tablixLayoutManager.onColumnHeaderRealized(item, cell),
|
18459 | cell;
|
18460 | }, TablixColumnDimension.prototype.columnHeaderMatch = function(item, cell) {
|
18461 | var previousItem = cell.item;
|
18462 | return 2 === cell.type && previousItem && this._hierarchyNavigator.headerItemEquals(item, previousItem);
|
18463 | }, TablixColumnDimension;
|
18464 | }(TablixDimension);
|
18465 | controls.TablixColumnDimension = TablixColumnDimension;
|
18466 | }(controls = visuals.controls || (visuals.controls = {}));
|
18467 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18468 | }(powerbi || (powerbi = {}));
|
18469 |
|
18470 | var powerbi;
|
18471 |
|
18472 | !function(powerbi) {
|
18473 | var visuals;
|
18474 | !function(visuals) {
|
18475 | var controls;
|
18476 | !function(controls) {
|
18477 | var ColumnTouchDelegate = function() {
|
18478 | function ColumnTouchDelegate(region) {
|
18479 | this.dim = region, this.averageSize = 1, this.handlers = null, this.tablixControl = null;
|
18480 | }
|
18481 | return Object.defineProperty(ColumnTouchDelegate.prototype, "dimension", {
|
18482 | get: function() {
|
18483 | return this.dim;
|
18484 | },
|
18485 | enumerable: !0,
|
18486 | configurable: !0
|
18487 | }), ColumnTouchDelegate.prototype.setScrollDensity = function(xRatio) {
|
18488 | this.averageSize = xRatio;
|
18489 | }, ColumnTouchDelegate.prototype.resize = function(x, y, width, height) {
|
18490 | this.dim.x = x, this.dim.y = y, this.dim.width = width, this.dim.height = height;
|
18491 | }, ColumnTouchDelegate.prototype.getPixelToItem = function(x, y, dx, dy, down) {
|
18492 | return new controls.TouchUtils.TouchEvent(x * this.averageSize, 0, down, -dx * this.averageSize, 0);
|
18493 | }, ColumnTouchDelegate.prototype.touchEvent = function(e) {
|
18494 | var args = [];
|
18495 | args[0] = this.tablixControl, args[1] = e.dx, args[2] = e.dy, this.handlers && controls.fire([ this.handlers ], args);
|
18496 | }, ColumnTouchDelegate.prototype.setHandler = function(tablixObj, handlerCall) {
|
18497 | this.handlers = handlerCall, this.tablixControl = tablixObj;
|
18498 | }, ColumnTouchDelegate;
|
18499 | }();
|
18500 | controls.ColumnTouchDelegate = ColumnTouchDelegate;
|
18501 | var RowTouchDelegate = function() {
|
18502 | function RowTouchDelegate(region) {
|
18503 | this.dim = region, this.averageSize = 30, this.handlers = null, this.tablixControl = null;
|
18504 | }
|
18505 | return Object.defineProperty(RowTouchDelegate.prototype, "dimension", {
|
18506 | get: function() {
|
18507 | return this.dim;
|
18508 | },
|
18509 | enumerable: !0,
|
18510 | configurable: !0
|
18511 | }), RowTouchDelegate.prototype.setScrollDensity = function(yRatio) {
|
18512 | this.averageSize = yRatio;
|
18513 | }, RowTouchDelegate.prototype.resize = function(x, y, width, height) {
|
18514 | this.dim.x = x, this.dim.y = y, this.dim.width = width, this.dim.height = height;
|
18515 | }, RowTouchDelegate.prototype.getPixelToItem = function(x, y, dx, dy, down) {
|
18516 | var event = new controls.TouchUtils.TouchEvent(0, y * this.averageSize, down, 0, -dy * this.averageSize);
|
18517 | return event;
|
18518 | }, RowTouchDelegate.prototype.touchEvent = function(e) {
|
18519 | var args = [];
|
18520 | args[0] = this.tablixControl, args[1] = e.dx, args[2] = e.dy, this.handlers && controls.fire([ this.handlers ], args);
|
18521 | }, RowTouchDelegate.prototype.setHandler = function(tablixObj, handlerCall) {
|
18522 | this.handlers = handlerCall, this.tablixControl = tablixObj;
|
18523 | }, RowTouchDelegate;
|
18524 | }();
|
18525 | controls.RowTouchDelegate = RowTouchDelegate;
|
18526 | var BodyTouchDelegate = function() {
|
18527 | function BodyTouchDelegate(region) {
|
18528 | this.dim = region, this.averageSizeX = BodyTouchDelegate.DefaultAverageSizeX, this.averageSizeY = BodyTouchDelegate.DefaultAverageSizeY,
|
18529 | this.handlers = null, this.tablixControl = null;
|
18530 | }
|
18531 | return Object.defineProperty(BodyTouchDelegate.prototype, "dimension", {
|
18532 | get: function() {
|
18533 | return this.dim;
|
18534 | },
|
18535 | enumerable: !0,
|
18536 | configurable: !0
|
18537 | }), BodyTouchDelegate.prototype.setScrollDensity = function(xRatio, yRatio) {
|
18538 | this.averageSizeX = xRatio, this.averageSizeY = yRatio;
|
18539 | }, BodyTouchDelegate.prototype.resize = function(x, y, width, height) {
|
18540 | var dimension = this.dim;
|
18541 | dimension.x = x, dimension.y = y, dimension.width = width, dimension.height = height;
|
18542 | }, BodyTouchDelegate.prototype.getPixelToItem = function(x, y, dx, dy, down) {
|
18543 | return new controls.TouchUtils.TouchEvent(x * this.averageSizeX, y * this.averageSizeY, down, -dx * this.averageSizeX, -dy * this.averageSizeY);
|
18544 | }, BodyTouchDelegate.prototype.touchEvent = function(e) {
|
18545 | var args = [ this.tablixControl, e.dx, e.dy ];
|
18546 | this.handlers && controls.fire([ this.handlers ], args);
|
18547 | }, BodyTouchDelegate.prototype.setHandler = function(tablixObj, handlerCall) {
|
18548 | this.handlers = handlerCall, this.tablixControl = tablixObj;
|
18549 | }, BodyTouchDelegate.DefaultAverageSizeX = 30, BodyTouchDelegate.DefaultAverageSizeY = 30,
|
18550 | BodyTouchDelegate;
|
18551 | }();
|
18552 | controls.BodyTouchDelegate = BodyTouchDelegate;
|
18553 | }(controls = visuals.controls || (visuals.controls = {}));
|
18554 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18555 | }(powerbi || (powerbi = {}));
|
18556 |
|
18557 | var powerbi;
|
18558 |
|
18559 | !function(powerbi) {
|
18560 | var visuals;
|
18561 | !function(visuals) {
|
18562 | var controls;
|
18563 | !function(controls) {
|
18564 | var TouchUtils;
|
18565 | !function(TouchUtils) {
|
18566 | var Point = function() {
|
18567 | function Point(x, y) {
|
18568 | this.x = x || 0, this.y = y || 0;
|
18569 | }
|
18570 | return Point.prototype.offset = function(offsetX, offsetY) {
|
18571 | this.x += offsetX, this.y += offsetY;
|
18572 | }, Point;
|
18573 | }();
|
18574 | TouchUtils.Point = Point;
|
18575 | var Rectangle = function(_super) {
|
18576 | function Rectangle(x, y, width, height) {
|
18577 | _super.call(this, x, y), this.width = width || 0, this.height = height || 0;
|
18578 | }
|
18579 | return __extends(Rectangle, _super), Object.defineProperty(Rectangle.prototype, "point", {
|
18580 | get: function() {
|
18581 | return new Point(this.x, this.y);
|
18582 | },
|
18583 | enumerable: !0,
|
18584 | configurable: !0
|
18585 | }), Rectangle.prototype.contains = function(p) {
|
18586 | return Rectangle.contains(this, p);
|
18587 | }, Rectangle.contains = function(rect, p) {
|
18588 | 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;
|
18589 | }, Rectangle.isEmpty = function(rect) {
|
18590 | return !(void 0 !== rect && rect.width >= 0 && rect.height >= 0);
|
18591 | }, Rectangle;
|
18592 | }(Point);
|
18593 | TouchUtils.Rectangle = Rectangle, function(MouseButton) {
|
18594 | MouseButton[MouseButton.NoClick = 0] = "NoClick", MouseButton[MouseButton.LeftClick = 1] = "LeftClick",
|
18595 | MouseButton[MouseButton.RightClick = 2] = "RightClick", MouseButton[MouseButton.CenterClick = 3] = "CenterClick";
|
18596 | }(TouchUtils.MouseButton || (TouchUtils.MouseButton = {}));
|
18597 | var MouseButton = TouchUtils.MouseButton, TouchEvent = function() {
|
18598 | function TouchEvent(x, y, isMouseDown, dx, dy) {
|
18599 | this._x = x, this._y = y, this.isMouseButtonDown = isMouseDown, this._dx = dx || 0,
|
18600 | this._dy = dy || 0;
|
18601 | }
|
18602 | return Object.defineProperty(TouchEvent.prototype, "x", {
|
18603 | get: function() {
|
18604 | return this._x;
|
18605 | },
|
18606 | enumerable: !0,
|
18607 | configurable: !0
|
18608 | }), Object.defineProperty(TouchEvent.prototype, "y", {
|
18609 | get: function() {
|
18610 | return this._y;
|
18611 | },
|
18612 | enumerable: !0,
|
18613 | configurable: !0
|
18614 | }), Object.defineProperty(TouchEvent.prototype, "dx", {
|
18615 | get: function() {
|
18616 | return this._dx;
|
18617 | },
|
18618 | enumerable: !0,
|
18619 | configurable: !0
|
18620 | }), Object.defineProperty(TouchEvent.prototype, "dy", {
|
18621 | get: function() {
|
18622 | return this._dy;
|
18623 | },
|
18624 | enumerable: !0,
|
18625 | configurable: !0
|
18626 | }), Object.defineProperty(TouchEvent.prototype, "isMouseDown", {
|
18627 | get: function() {
|
18628 | return this.isMouseButtonDown;
|
18629 | },
|
18630 | enumerable: !0,
|
18631 | configurable: !0
|
18632 | }), TouchEvent;
|
18633 | }();
|
18634 | TouchUtils.TouchEvent = TouchEvent;
|
18635 | var TouchManager = function() {
|
18636 | function TouchManager() {
|
18637 | this.touchList = [], this.swipeDirection = 2, this.matchingDirectionCount = 0, this.lockThreshold = !0,
|
18638 | this.scrollThreshold = !0, this.lastTouchEvent = new TouchEvent(0, 0, !1);
|
18639 | }
|
18640 | return Object.defineProperty(TouchManager.prototype, "lastEvent", {
|
18641 | get: function() {
|
18642 | return this.lastTouchEvent;
|
18643 | },
|
18644 | enumerable: !0,
|
18645 | configurable: !0
|
18646 | }), TouchManager.prototype.addTouchRegion = function(region, handler, converter) {
|
18647 | var item = {
|
18648 | lastPoint: new TouchEvent(0, 0, !1),
|
18649 | handler: handler,
|
18650 | region: region,
|
18651 | converter: converter
|
18652 | };
|
18653 | this.touchList = this.touchList.concat([ item ]);
|
18654 | }, TouchManager.prototype.upAllTouches = function() {
|
18655 | var eventPoint, length;
|
18656 | length = this.touchList.length;
|
18657 | 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),
|
18658 | this.touchList[i].handler.touchEvent(eventPoint)), this.touchList[i].lastPoint = new TouchEvent(this.touchList[i].lastPoint.x, this.touchList[i].lastPoint.y, !1);
|
18659 | this.lastTouchEvent = new TouchEvent(0, 0, !1);
|
18660 | }, TouchManager.prototype.touchEvent = function(e) {
|
18661 | var list, length, x = 0, y = 0, dx = 0, dy = 0, angle = 0, eventPoint = null;
|
18662 | list = this._getActive(), !this.lastTouchEvent.isMouseDown && e.isMouseDown && (list = this._findRegions(e)),
|
18663 | dx = this.lastTouchEvent.x - e.x, dy = this.lastTouchEvent.y - e.y, this.lastTouchEvent = new TouchEvent(e.x, e.y, e.isMouseDown, dx, dy),
|
18664 | length = list.length;
|
18665 | for (var i = 0; length > i; i++) x = e.x - list[i].region.point.x, y = e.y - list[i].region.point.y,
|
18666 | list[i].lastPoint.isMouseDown && e.isMouseDown ? (dx = x - list[i].lastPoint.x,
|
18667 | dy = y - list[i].lastPoint.y, angle = Math.abs(180 / Math.PI * Math.atan(dy / dx)),
|
18668 | this.scrollThreshold && (this.lockThreshold && this.matchingDirectionCount > 5 ? 1 === this.swipeDirection ? dy = 0 : 0 === this.swipeDirection && (dx = 0) : 20 > angle ? (dy = 0,
|
18669 | 1 === this.swipeDirection ? this.matchingDirectionCount++ : (this.matchingDirectionCount = 1,
|
18670 | this.swipeDirection = 1)) : (angle = Math.abs(180 / Math.PI * Math.atan(dx / dy)),
|
18671 | 20 > angle ? (dx = 0, 0 === this.swipeDirection ? this.matchingDirectionCount++ : (this.matchingDirectionCount = 1,
|
18672 | this.swipeDirection = 0)) : 2 === this.swipeDirection ? this.matchingDirectionCount++ : (this.swipeDirection = 2,
|
18673 | this.matchingDirectionCount = 1)))) : (dx = 0, dy = 0, this.swipeDirection = 2,
|
18674 | this.matchingDirectionCount = 0), list[i].lastPoint = new TouchEvent(x, y, e.isMouseDown, dx, dy),
|
18675 | eventPoint = list[i].converter.getPixelToItem(x, y, dx, dy, e.isMouseDown), list[i].handler.touchEvent(eventPoint);
|
18676 | }, TouchManager.prototype._findRegions = function(e) {
|
18677 | var length, list = [];
|
18678 | length = this.touchList.length;
|
18679 | for (var i = 0; length > i; i++) this.touchList[i].region.contains(new Point(e.x, e.y)) && (list = list.concat([ this.touchList[i] ]));
|
18680 | return list;
|
18681 | }, TouchManager.prototype._getActive = function() {
|
18682 | var length, list = [];
|
18683 | length = this.touchList.length;
|
18684 | for (var i = 0; length > i; i++) this.touchList[i].lastPoint.isMouseDown && (list = list.concat([ this.touchList[i] ]));
|
18685 | return list;
|
18686 | }, TouchManager;
|
18687 | }();
|
18688 | TouchUtils.TouchManager = TouchManager;
|
18689 | var MinDistanceForSwipe = 80, MaxTimeForSwipe = 600, TouchEventInterpreter = function() {
|
18690 | function TouchEventInterpreter(manager) {
|
18691 | this.manager = manager, this.allowMouseDrag = !0, this.touchPanel = null, this.scale = 1,
|
18692 | this.documentMouseMoveWrapper = null, this.documentMouseUpWrapper = null, this.sliding = !1;
|
18693 | }
|
18694 | return TouchEventInterpreter.prototype.initTouch = function(panel, touchReferencePoint, allowMouseDrag) {
|
18695 | var _this = this;
|
18696 | panel.style.setProperty("-ms-touch-action", "pinch-zoom"), this.touchReferencePoint = touchReferencePoint,
|
18697 | this.touchPanel = panel, this.allowMouseDrag = void 0 === allowMouseDrag ? !0 : allowMouseDrag,
|
18698 | "ontouchmove" in panel ? (panel.addEventListener("touchstart", function(e) {
|
18699 | return _this.onTouchStart(e);
|
18700 | }), panel.addEventListener("touchend", function(e) {
|
18701 | return _this.onTouchEnd(e);
|
18702 | })) : (panel.addEventListener("mousedown", function(e) {
|
18703 | return _this.onTouchMouseDown(e);
|
18704 | }), panel.addEventListener("mouseup", function(e) {
|
18705 | return _this.onTouchMouseUp(e);
|
18706 | }));
|
18707 | }, TouchEventInterpreter.prototype.getXYByClient = function(pageX, pageY, rect) {
|
18708 | var x = rect.left, y = rect.top;
|
18709 | void 0 !== window.scrollX && (x += window.scrollX, y += window.scrollY);
|
18710 | var point = new Point(0, 0);
|
18711 | return point.offset(pageX - x, pageY - y), point;
|
18712 | }, TouchEventInterpreter.prototype.onTouchStart = function(e) {
|
18713 | if (1 === e.touches.length) {
|
18714 | e.cancelBubble = !0;
|
18715 | var mouchEvent = e.touches[0];
|
18716 | this.touchStartTime = new Date().getTime(), this.touchStartPageY = mouchEvent.pageY,
|
18717 | this.onTouchMouseDown(mouchEvent);
|
18718 | }
|
18719 | }, TouchEventInterpreter.prototype.onTouchMove = function(e) {
|
18720 | if (1 === e.touches.length) {
|
18721 | e.preventDefault && e.preventDefault();
|
18722 | var mouchEvent = e.touches[0];
|
18723 | this.touchLastPageY = mouchEvent.pageY, this.touchLastPageX = mouchEvent.pageX,
|
18724 | this.sliding || this.onTouchMouseMove(mouchEvent);
|
18725 | }
|
18726 | }, TouchEventInterpreter.prototype.onTouchEnd = function(e) {
|
18727 | this.clearTouchEvents();
|
18728 | var swipeInfo = this.getSwipeInfo();
|
18729 | this.didUserSwipe(swipeInfo) ? this.startSlideAffect(swipeInfo) : this.sliding || this.upAllTouches();
|
18730 | }, TouchEventInterpreter.prototype.onTouchMouseDown = function(e) {
|
18731 | var _this = this;
|
18732 | this.scale = controls.HTMLElementUtils.getAccumulatedScale(this.touchPanel), document.getSelection().removeAllRanges(),
|
18733 | this.rect = (this.touchReferencePoint ? this.touchReferencePoint : this.touchPanel).getBoundingClientRect(),
|
18734 | "ontouchmove" in this.touchPanel ? (this.documentMouseMoveWrapper = function(e) {
|
18735 | return _this.onTouchMove(e);
|
18736 | }, document.addEventListener("touchmove", this.documentMouseMoveWrapper), this.documentMouseUpWrapper = function(e) {
|
18737 | return _this.onTouchEnd(e);
|
18738 | }, document.addEventListener("touchend", this.documentMouseUpWrapper)) : (this.documentMouseMoveWrapper = function(e) {
|
18739 | return _this.onTouchMouseMove(e);
|
18740 | }, document.addEventListener("mousemove", this.documentMouseMoveWrapper), this.documentMouseUpWrapper = function(e) {
|
18741 | return _this.onTouchMouseUp(e);
|
18742 | }, document.addEventListener("mouseup", this.documentMouseUpWrapper)), "setCapture" in this.touchPanel && this.touchPanel.setCapture();
|
18743 | }, TouchEventInterpreter.prototype.onTouchMouseMove = function(e) {
|
18744 | var event, point, rect = this.rect, validMouseDragEvent = null !== rect && e.which !== MouseButton.NoClick;
|
18745 | validMouseDragEvent && !this.sliding && (point = this.getXYByClient(e.pageX, e.pageY, rect),
|
18746 | event = new TouchEvent(point.x / this.scale, point.y / this.scale, validMouseDragEvent),
|
18747 | this.manager.touchEvent(event), e.preventDefault ? e.preventDefault() : "returnValue" in e && (e.returnValue = !1));
|
18748 | }, TouchEventInterpreter.prototype.onTouchMouseUp = function(e, bubble) {
|
18749 | this.upAllTouches(), this.clearTouchEvents();
|
18750 | }, TouchEventInterpreter.prototype.getSwipeInfo = function() {
|
18751 | var touchEndTime = new Date().getTime(), touchTime = touchEndTime - this.touchStartTime, touchDist = this.touchLastPageY - this.touchStartPageY, touchDirection = 0 > touchDist ? -1 : 1;
|
18752 | return {
|
18753 | direction: touchDirection,
|
18754 | distance: touchDist,
|
18755 | endTime: touchEndTime,
|
18756 | time: touchTime
|
18757 | };
|
18758 | }, TouchEventInterpreter.prototype.didUserSwipe = function(swipeInfo) {
|
18759 | return swipeInfo.time < MaxTimeForSwipe && swipeInfo.distance * swipeInfo.direction > MinDistanceForSwipe;
|
18760 | }, TouchEventInterpreter.prototype.startSlideAffect = function(swipeInfo) {
|
18761 | var _this = this;
|
18762 | if (!this.sliding) {
|
18763 | this.sliding = !0;
|
18764 | var point = this.getXYByClient(this.touchLastPageX, this.touchLastPageY, this.rect);
|
18765 | this.slide(point, 300, swipeInfo), requestAnimationFrame(function() {
|
18766 | _this.didUserChangeDirection(swipeInfo) || _this.slide(point, 200, swipeInfo), _this.clearSlide();
|
18767 | });
|
18768 | }
|
18769 | }, TouchEventInterpreter.prototype.didUserChangeDirection = function(swipeInfo) {
|
18770 | if (this.touchStartTime <= swipeInfo.endTime) return !1;
|
18771 | var updatedDist = this.touchLastPageY - this.touchStartPageY, updatedDirection = 0 > updatedDist ? -1 : 1;
|
18772 | return updatedDirection !== swipeInfo.direction;
|
18773 | }, TouchEventInterpreter.prototype.slide = function(point, slideDist, swipeInfo) {
|
18774 | var updatedDist = this.touchStartTime > swipeInfo.endTime ? this.touchLastPageY - this.touchStartPageY : 0;
|
18775 | point.y += slideDist * swipeInfo.direction + updatedDist;
|
18776 | var event = new TouchEvent(point.x / this.scale, point.y / this.scale, !0);
|
18777 | this.manager.touchEvent(event);
|
18778 | }, TouchEventInterpreter.prototype.clearSlide = function() {
|
18779 | this.sliding = !1, this.upAllTouches();
|
18780 | }, TouchEventInterpreter.prototype.upAllTouches = function() {
|
18781 | null === this.documentMouseMoveWrapper && (this.rect = null, this.manager.upAllTouches());
|
18782 | }, TouchEventInterpreter.prototype.clearTouchEvents = function() {
|
18783 | "releaseCapture" in this.touchPanel && this.touchPanel.releaseCapture(), null !== this.documentMouseMoveWrapper && ("ontouchmove" in this.touchPanel ? (document.removeEventListener("touchmove", this.documentMouseMoveWrapper),
|
18784 | document.removeEventListener("touchend", this.documentMouseUpWrapper)) : (document.removeEventListener("mousemove", this.documentMouseMoveWrapper),
|
18785 | document.removeEventListener("mouseup", this.documentMouseUpWrapper)), this.documentMouseMoveWrapper = null,
|
18786 | this.documentMouseUpWrapper = null);
|
18787 | }, TouchEventInterpreter;
|
18788 | }();
|
18789 | TouchUtils.TouchEventInterpreter = TouchEventInterpreter;
|
18790 | }(TouchUtils = controls.TouchUtils || (controls.TouchUtils = {}));
|
18791 | }(controls = visuals.controls || (visuals.controls = {}));
|
18792 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18793 | }(powerbi || (powerbi = {}));
|
18794 |
|
18795 | var powerbi;
|
18796 |
|
18797 | !function(powerbi) {
|
18798 | var visuals;
|
18799 | !function(visuals) {
|
18800 | var controls;
|
18801 | !function(controls) {
|
18802 | !function(TablixType) {
|
18803 | TablixType[TablixType.Matrix = 0] = "Matrix", TablixType[TablixType.Table = 1] = "Table";
|
18804 | }(controls.TablixType || (controls.TablixType = {}));
|
18805 | controls.TablixType;
|
18806 | }(controls = visuals.controls || (visuals.controls = {}));
|
18807 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18808 | }(powerbi || (powerbi = {}));
|
18809 |
|
18810 | var powerbi;
|
18811 |
|
18812 | !function(powerbi) {
|
18813 | var visuals;
|
18814 | !function(visuals) {
|
18815 | var controls;
|
18816 | !function(controls) {
|
18817 | var PropAutoSizeWidth = controls.internal.TablixObjects.PropGeneralAutoSizeColumns, getMetadataObjects = controls.internal.TablixObjects.getMetadadataObjects, TablixColumnWidthManager = function() {
|
18818 | function TablixColumnWidthManager(dataView, isMatrix, hostPersistCallBack, matrixLeafNodes) {
|
18819 | this.columnWidthObjects = [], this.isMatrix = isMatrix, this.updateDataView(dataView, matrixLeafNodes),
|
18820 | this.hostPersistCallBack = hostPersistCallBack;
|
18821 | }
|
18822 | return TablixColumnWidthManager.prototype.updateDataView = function(dataView, matrixLeafNodes) {
|
18823 | this.previousDataView = this.currentDataView, this.previousDataView ? this.previousAutoColumnSizePropertyValue = PropAutoSizeWidth.getValue(getMetadataObjects(this.previousDataView)) : this.previousAutoColumnSizePropertyValue = void 0,
|
18824 | this.currentDataView = dataView, this.currentDataView ? this.currentAutoColumnSizePropertyValue = PropAutoSizeWidth.getValue(getMetadataObjects(this.currentDataView)) : this.currentAutoColumnSizePropertyValue = void 0,
|
18825 | this.matrixLeafNodes = matrixLeafNodes, this.updateColumnWidthObjects(), this.updateTablixColumnWidths();
|
18826 | }, TablixColumnWidthManager.prototype.updateColumnWidthObjects = function() {
|
18827 | this.columnWidthObjects.length = 0, this.isMatrix ? this.updateMatrixColumnWidthObjects() : this.updateTableColumnWidthObjects();
|
18828 | }, TablixColumnWidthManager.prototype.updateTableColumnWidthObjects = function() {
|
18829 | if (this.currentDataView && this.currentDataView.table) for (var columnMetaData = this.currentDataView.table.columns, i = 0, len = columnMetaData.length; len > i; i++) {
|
18830 | var query = columnMetaData[i].queryName;
|
18831 | this.columnWidthObjects.push({
|
18832 | queryName: query,
|
18833 | width: void 0
|
18834 | });
|
18835 | }
|
18836 | }, TablixColumnWidthManager.prototype.updateMatrixColumnWidthObjects = function() {
|
18837 | if (this.currentDataView && this.currentDataView.matrix && this.currentDataView.matrix.rows) for (var i = 0, len = this.currentDataView.matrix.rows.levels.length; len > i; i++) {
|
18838 | var rowGroup = this.currentDataView.matrix.rows.levels[i];
|
18839 | _.isEmpty(rowGroup.sources) || this.columnWidthObjects.push({
|
18840 | queryName: rowGroup.sources[0].queryName,
|
18841 | width: void 0
|
18842 | });
|
18843 | }
|
18844 | if (this.matrixLeafNodes) for (var i = 0, len = this.matrixLeafNodes.length; len > i; i++) {
|
18845 | var query = this.matrixLeafNodes[i].queryName;
|
18846 | this.columnWidthObjects.push({
|
18847 | queryName: query,
|
18848 | width: void 0
|
18849 | });
|
18850 | }
|
18851 | }, TablixColumnWidthManager.prototype.updateTablixColumnWidths = function() {
|
18852 | var columnMetaData = this.currentDataView && this.currentDataView.metadata && this.currentDataView.metadata.columns;
|
18853 | columnMetaData && (this.shouldClearAllColumnWidths() ? this.autoSizeAllColumns() : this.deserializeColumnWidths(columnMetaData));
|
18854 | }, TablixColumnWidthManager.prototype.deserializeColumnWidths = function(columnMetaData) {
|
18855 | this.columnWidthObjects.forEach(function(obj) {
|
18856 | obj.width = void 0;
|
18857 | });
|
18858 | for (var _i = 0, columnMetaData_1 = columnMetaData; _i < columnMetaData_1.length; _i++) {
|
18859 | var column = columnMetaData_1[_i], columnWidthPropValue = powerbi.DataViewObjects.getValue(column.objects, TablixColumnWidthManager.columnWidthProp);
|
18860 | if (_.isNumber(columnWidthPropValue)) for (var _a = 0, _b = this.columnWidthObjects; _a < _b.length; _a++) {
|
18861 | var obj = _b[_a];
|
18862 | obj.queryName === column.queryName && (obj.width = columnWidthPropValue);
|
18863 | }
|
18864 | }
|
18865 | }, TablixColumnWidthManager.prototype.shouldPersistAllColumnWidths = function() {
|
18866 | return this.previousDataView ? !this.currentAutoColumnSizePropertyValue && this.previousAutoColumnSizePropertyValue : !1;
|
18867 | }, TablixColumnWidthManager.prototype.shouldClearAllColumnWidths = function() {
|
18868 | return null != this.previousDataView && this.previousAutoColumnSizePropertyValue === !1 && null != this.currentDataView && this.currentAutoColumnSizePropertyValue === !0;
|
18869 | }, TablixColumnWidthManager.prototype.getColumnWidthObjects = function() {
|
18870 | return this.columnWidthObjects;
|
18871 | }, TablixColumnWidthManager.prototype.getFixedColumnWidthObjects = function() {
|
18872 | return this.columnWidthObjects.filter(function(obj) {
|
18873 | return null != obj.width;
|
18874 | });
|
18875 | }, TablixColumnWidthManager.prototype.getPersistedColumnWidth = function(index) {
|
18876 | var colIndex = this.isMatrix ? index : index - 1, item = this.columnWidthObjects[colIndex];
|
18877 | return item ? item.width : void 0;
|
18878 | }, TablixColumnWidthManager.prototype.callHostToPersist = function(generateInstances) {
|
18879 | generateInstances && this.generateVisualObjectInstancesToPersist(), this.hostPersistCallBack && this.hostPersistCallBack(this.visualObjectInstancesToPersist);
|
18880 | }, TablixColumnWidthManager.prototype.autoSizeAllColumns = function() {
|
18881 | this.visualObjectInstancesToPersist = {
|
18882 | merge: [ this.getAutoSizeColumnWidthObject() ],
|
18883 | remove: []
|
18884 | };
|
18885 | for (var _i = 0, _a = this.columnWidthObjects; _i < _a.length; _i++) {
|
18886 | var columnWidthObject = _a[_i];
|
18887 | this.visualObjectInstancesToPersist.remove.push({
|
18888 | selector: {
|
18889 | metadata: columnWidthObject.queryName
|
18890 | },
|
18891 | objectName: "general",
|
18892 | properties: {
|
18893 | columnWidth: void 0
|
18894 | }
|
18895 | });
|
18896 | }
|
18897 | this.callHostToPersist(!1);
|
18898 | }, TablixColumnWidthManager.prototype.onColumnAutosized = function(queryName) {
|
18899 | for (var width = this.currentAutoColumnSizePropertyValue ? void 0 : -1, _i = 0, _a = this.columnWidthObjects; _i < _a.length; _i++) {
|
18900 | var obj = _a[_i];
|
18901 | obj.queryName === queryName && (obj.width = width);
|
18902 | }
|
18903 | this.currentAutoColumnSizePropertyValue && (this.visualObjectInstancesToPersist = {
|
18904 | remove: [ {
|
18905 | selector: {
|
18906 | metadata: queryName
|
18907 | },
|
18908 | objectName: "general",
|
18909 | properties: {
|
18910 | columnWidth: void 0
|
18911 | }
|
18912 | } ]
|
18913 | }, this.callHostToPersist(!1));
|
18914 | }, TablixColumnWidthManager.prototype.onColumnWidthChanged = function(index, width) {
|
18915 | var colIndex = this.isMatrix ? index : index - 1;
|
18916 | if (!(_.isEmpty(this.columnWidthObjects) || 0 > colIndex || colIndex >= this.columnWidthObjects.length)) {
|
18917 | var queryName = this.columnWidthObjects[colIndex].queryName;
|
18918 | if (-1 === width) this.onColumnAutosized(queryName); else {
|
18919 | for (var _i = 0, _a = this.columnWidthObjects; _i < _a.length; _i++) {
|
18920 | var obj = _a[_i];
|
18921 | obj.queryName === queryName && (obj.width = width);
|
18922 | }
|
18923 | this.callHostToPersist(!0);
|
18924 | }
|
18925 | }
|
18926 | }, TablixColumnWidthManager.prototype.persistAllColumnWidths = function(widthsToPersist) {
|
18927 | var _this = this, widths = this.isMatrix ? widthsToPersist : widthsToPersist.slice(1, widthsToPersist.length);
|
18928 | if (this.columnWidthObjects.length === widths.length) {
|
18929 | var dictionary = new Array();
|
18930 | widths.forEach(function(w, i) {
|
18931 | var query = _this.columnWidthObjects[i].queryName;
|
18932 | null == dictionary[query] ? dictionary[query] = w : dictionary[query] = Math.max(w, dictionary[query]);
|
18933 | });
|
18934 | for (var _i = 0, _a = this.columnWidthObjects; _i < _a.length; _i++) {
|
18935 | var obj = _a[_i], width = dictionary[obj.queryName];
|
18936 | null != width && (obj.width = width);
|
18937 | }
|
18938 | this.callHostToPersist(!0);
|
18939 | }
|
18940 | }, TablixColumnWidthManager.prototype.getAutoSizeColumnWidthObject = function() {
|
18941 | return {
|
18942 | selector: null,
|
18943 | objectName: "general",
|
18944 | properties: {
|
18945 | autoSizeColumnWidth: this.currentAutoColumnSizePropertyValue
|
18946 | }
|
18947 | };
|
18948 | }, TablixColumnWidthManager.prototype.generateVisualObjectInstancesToPersist = function() {
|
18949 | this.visualObjectInstancesToPersist = {
|
18950 | merge: [ this.getAutoSizeColumnWidthObject() ]
|
18951 | };
|
18952 | for (var added = new Array(), _i = 0, _a = this.columnWidthObjects; _i < _a.length; _i++) {
|
18953 | var obj = _a[_i];
|
18954 | obj.queryName && _.isNumber(obj.width) && !added[obj.queryName] && (this.visualObjectInstancesToPersist.merge.push({
|
18955 | selector: {
|
18956 | metadata: obj.queryName
|
18957 | },
|
18958 | objectName: "general",
|
18959 | properties: {
|
18960 | columnWidth: obj.width
|
18961 | }
|
18962 | }), added[obj.queryName] = !0);
|
18963 | }
|
18964 | }, TablixColumnWidthManager.columnWidthProp = {
|
18965 | objectName: "general",
|
18966 | propertyName: "columnWidth"
|
18967 | }, TablixColumnWidthManager;
|
18968 | }();
|
18969 | controls.TablixColumnWidthManager = TablixColumnWidthManager;
|
18970 | }(controls = visuals.controls || (visuals.controls = {}));
|
18971 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
18972 | }(powerbi || (powerbi = {}));
|
18973 |
|
18974 | var powerbi;
|
18975 |
|
18976 | !function(powerbi) {
|
18977 | var visuals;
|
18978 | !function(visuals) {
|
18979 | var AnimatedText = function() {
|
18980 | function AnimatedText(name) {
|
18981 | this.mainText = jsCommon.CssConstants.createClassAndSelector("mainText"), this.name = name,
|
18982 | this.visualConfiguration = {
|
18983 | maxFontSize: 60
|
18984 | };
|
18985 | }
|
18986 | return AnimatedText.prototype.getMetaDataColumn = function(dataView) {
|
18987 | if (dataView && dataView.metadata && dataView.metadata.columns) for (var i = 0, ilen = dataView.metadata.columns.length; ilen > i; i++) {
|
18988 | var column = dataView.metadata.columns[i];
|
18989 | if (column.isMeasure) {
|
18990 | this.metaDataColumn = column;
|
18991 | break;
|
18992 | }
|
18993 | }
|
18994 | }, AnimatedText.prototype.getAdjustedFontHeight = function(availableWidth, textToMeasure, seedFontHeight) {
|
18995 | var textProperties = {
|
18996 | fontFamily: null,
|
18997 | fontSize: null,
|
18998 | text: textToMeasure
|
18999 | }, fontHeight = this.getAdjustedFontHeightCore(textProperties, availableWidth, seedFontHeight, 0);
|
19000 | return fontHeight;
|
19001 | }, AnimatedText.prototype.getAdjustedFontHeightCore = function(textProperties, availableWidth, seedFontHeight, iteration) {
|
19002 | if (iteration > 10) return seedFontHeight;
|
19003 | textProperties.fontSize = jsCommon.PixelConverter.toString(seedFontHeight);
|
19004 | var candidateLength = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties);
|
19005 | return availableWidth > candidateLength ? seedFontHeight : this.getAdjustedFontHeightCore(textProperties, availableWidth, .9 * seedFontHeight, iteration + 1);
|
19006 | }, AnimatedText.prototype.clear = function() {
|
19007 | this.svg.select(this.mainText.selector).text("");
|
19008 | }, AnimatedText.prototype.doValueTransition = function(startValue, endValue, displayUnitSystemType, animationOptions, duration, forceUpdate, formatter) {
|
19009 | if (forceUpdate || startValue !== endValue || null == endValue) {
|
19010 | startValue || (startValue = 0);
|
19011 | 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;
|
19012 | formatter || (formatter = visuals.valueFormatter.create({
|
19013 | format: this.getFormatString(metaDataColumn),
|
19014 | value: endValue,
|
19015 | displayUnitSystemType: displayUnitSystemType,
|
19016 | formatSingleValues: !0,
|
19017 | allowFormatBeautification: !0,
|
19018 | columnType: metaDataColumn ? metaDataColumn.type : void 0
|
19019 | }));
|
19020 | var startText = formatter.format(startValue), endText = formatter.format(endValue);
|
19021 | svg.attr("class", this.name);
|
19022 | var textElement = svg.selectAll("text").data(endValueArr);
|
19023 | textElement.enter().append("text").attr("class", this.mainText["class"]);
|
19024 | var fontHeight = this.getAdjustedFontHeight(width, endText, seedFontHeight);
|
19025 | translateY = this.getTranslateY(fontHeight + (height - fontHeight) / 2);
|
19026 | var textElementUpdate = textElement.text(startText).attr({
|
19027 | "text-anchor": this.getTextAnchor(),
|
19028 | "font-size": fontHeight,
|
19029 | transform: visuals.SVGUtil.translate(translateX, translateY)
|
19030 | }).style({
|
19031 | fill: this.style.titleText.color.value
|
19032 | }).call(visuals.tooltipUtils.tooltipUpdate, [ startText ]);
|
19033 | 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 {
|
19034 | var interpolatedValue_1 = startValue;
|
19035 | textElementUpdate.transition().duration(duration).tween("text", function(d) {
|
19036 | var i = d3.interpolate(interpolatedValue_1, d);
|
19037 | return function(t) {
|
19038 | var num = i(t);
|
19039 | this.textContent = formatter.format(num);
|
19040 | };
|
19041 | });
|
19042 | }
|
19043 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(animationOptions);
|
19044 | }
|
19045 | }, AnimatedText.prototype.setTextColor = function(color) {
|
19046 | this.style.titleText.color.value = color;
|
19047 | }, AnimatedText.prototype.getSeedFontHeight = function(boundingWidth, boundingHeight) {
|
19048 | var estimatedSize = Math.floor(.75 * Math.min(boundingWidth, boundingHeight)), maxFontSize = this.visualConfiguration.maxFontSize;
|
19049 | return maxFontSize ? Math.min(maxFontSize, estimatedSize) : estimatedSize;
|
19050 | }, AnimatedText.prototype.getTranslateX = function(width) {
|
19051 | if (this.visualConfiguration) switch (this.visualConfiguration.align) {
|
19052 | case "left":
|
19053 | return 0;
|
19054 |
|
19055 | case "right":
|
19056 | return width;
|
19057 | }
|
19058 | return width / 2;
|
19059 | }, AnimatedText.prototype.getTranslateY = function(height) {
|
19060 | return height;
|
19061 | }, AnimatedText.prototype.getTextAnchor = function() {
|
19062 | if (this.visualConfiguration) switch (this.visualConfiguration.align) {
|
19063 | case "left":
|
19064 | return "start";
|
19065 |
|
19066 | case "right":
|
19067 | return "end";
|
19068 | }
|
19069 | return "middle";
|
19070 | }, AnimatedText.prototype.getFormatString = function(column) {
|
19071 | return visuals.valueFormatter.getFormatString(column, AnimatedText.formatStringProp);
|
19072 | }, AnimatedText.formatStringProp = {
|
19073 | objectName: "general",
|
19074 | propertyName: "formatString"
|
19075 | }, AnimatedText;
|
19076 | }();
|
19077 | visuals.AnimatedText = AnimatedText;
|
19078 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
19079 | }(powerbi || (powerbi = {}));
|
19080 |
|
19081 | var powerbi;
|
19082 |
|
19083 | !function(powerbi) {
|
19084 | var visuals;
|
19085 | !function(visuals) {
|
19086 | var AnimatedNumber = function(_super) {
|
19087 | function AnimatedNumber(svg, animator) {
|
19088 | _super.call(this, "animatedNumber"), svg && (this.svg = svg), animator && (this.animator = animator);
|
19089 | }
|
19090 | return __extends(AnimatedNumber, _super), AnimatedNumber.prototype.init = function(options) {
|
19091 | this.options = options;
|
19092 | var element = options.element;
|
19093 | this.svg || (this.svg = d3.select(element.get(0)).append("svg")), this.currentViewport = options.viewport,
|
19094 | this.hostServices = options.host, this.style = options.style, this.updateViewportDependantProperties();
|
19095 | }, AnimatedNumber.prototype.updateViewportDependantProperties = function() {
|
19096 | var viewport = this.currentViewport;
|
19097 | this.svg.attr("width", viewport.width).attr("height", viewport.height);
|
19098 | }, AnimatedNumber.prototype.update = function(options) {
|
19099 | this.currentViewport = options.viewport;
|
19100 | var dataViews = this.dataViews = options.dataViews;
|
19101 | if (dataViews && dataViews[0]) {
|
19102 | var dataView = dataViews[0];
|
19103 | this.updateViewportDependantProperties(), this.getMetaDataColumn(dataView);
|
19104 | var newValue = dataView && dataView.single ? dataView.single.value : 0;
|
19105 | null != newValue && this.updateInternal(newValue, options.suppressAnimations, !0, this.formatter);
|
19106 | }
|
19107 | }, AnimatedNumber.prototype.setFormatter = function(formatter) {
|
19108 | this.formatter = formatter;
|
19109 | }, AnimatedNumber.prototype.onDataChanged = function(options) {
|
19110 | this.update({
|
19111 | dataViews: options.dataViews,
|
19112 | suppressAnimations: options.suppressAnimations,
|
19113 | viewport: this.currentViewport
|
19114 | });
|
19115 | }, AnimatedNumber.prototype.onResizing = function(viewport) {
|
19116 | this.update({
|
19117 | dataViews: this.dataViews,
|
19118 | suppressAnimations: !0,
|
19119 | viewport: viewport
|
19120 | });
|
19121 | }, AnimatedNumber.prototype.canResizeTo = function(viewport) {
|
19122 | return !0;
|
19123 | }, AnimatedNumber.prototype.updateInternal = function(target, suppressAnimations, forceUpdate, formatter) {
|
19124 | void 0 === forceUpdate && (forceUpdate = !1);
|
19125 | var start = this.value || 0, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
19126 | this.doValueTransition(start, target, null, this.options.animation, duration, forceUpdate, formatter),
|
19127 | this.value = target;
|
19128 | }, AnimatedNumber;
|
19129 | }(visuals.AnimatedText);
|
19130 | visuals.AnimatedNumber = AnimatedNumber;
|
19131 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
19132 | }(powerbi || (powerbi = {}));
|
19133 |
|
19134 | var powerbi;
|
19135 |
|
19136 | !function(powerbi) {
|
19137 | var visuals;
|
19138 | !function(visuals) {
|
19139 | var BasicShapeVisual = function() {
|
19140 | function BasicShapeVisual(options) {}
|
19141 | return Object.defineProperty(BasicShapeVisual.prototype, "shapeType", {
|
19142 | get: function() {
|
19143 | return this.data ? this.data.shapeType : BasicShapeVisual.DefaultShape;
|
19144 | },
|
19145 | set: function(shapeType) {
|
19146 | this.data.shapeType = shapeType;
|
19147 | },
|
19148 | enumerable: !0,
|
19149 | configurable: !0
|
19150 | }), Object.defineProperty(BasicShapeVisual.prototype, "lineColor", {
|
19151 | get: function() {
|
19152 | return this.data ? this.data.lineColor : BasicShapeVisual.DefaultStrokeColor;
|
19153 | },
|
19154 | set: function(color) {
|
19155 | this.data.lineColor = color;
|
19156 | },
|
19157 | enumerable: !0,
|
19158 | configurable: !0
|
19159 | }), Object.defineProperty(BasicShapeVisual.prototype, "lineTransparency", {
|
19160 | get: function() {
|
19161 | return this.data ? this.data.lineTransparency : BasicShapeVisual.DefaultLineTransValue;
|
19162 | },
|
19163 | set: function(trans) {
|
19164 | this.data.lineTransparency = trans;
|
19165 | },
|
19166 | enumerable: !0,
|
19167 | configurable: !0
|
19168 | }), Object.defineProperty(BasicShapeVisual.prototype, "lineWeight", {
|
19169 | get: function() {
|
19170 | return this.data ? this.data.lineWeight : BasicShapeVisual.DefaultWeightValue;
|
19171 | },
|
19172 | set: function(weight) {
|
19173 | this.data.lineWeight = weight;
|
19174 | },
|
19175 | enumerable: !0,
|
19176 | configurable: !0
|
19177 | }), Object.defineProperty(BasicShapeVisual.prototype, "roundEdge", {
|
19178 | get: function() {
|
19179 | return this.data ? this.data.roundEdge : BasicShapeVisual.DefaultRoundEdgeValue;
|
19180 | },
|
19181 | set: function(roundEdge) {
|
19182 | this.data.roundEdge = roundEdge;
|
19183 | },
|
19184 | enumerable: !0,
|
19185 | configurable: !0
|
19186 | }), Object.defineProperty(BasicShapeVisual.prototype, "showFill", {
|
19187 | get: function() {
|
19188 | return this.data ? this.data.showFill : BasicShapeVisual.DefaultFillShowValue;
|
19189 | },
|
19190 | set: function(show) {
|
19191 | this.data.showFill = show;
|
19192 | },
|
19193 | enumerable: !0,
|
19194 | configurable: !0
|
19195 | }), Object.defineProperty(BasicShapeVisual.prototype, "fillColor", {
|
19196 | get: function() {
|
19197 | return this.data ? this.data.fillColor : BasicShapeVisual.DefaultFillColor;
|
19198 | },
|
19199 | set: function(color) {
|
19200 | this.data.fillColor = color;
|
19201 | },
|
19202 | enumerable: !0,
|
19203 | configurable: !0
|
19204 | }), Object.defineProperty(BasicShapeVisual.prototype, "shapeTransparency", {
|
19205 | get: function() {
|
19206 | return this.data ? this.data.shapeTransparency : BasicShapeVisual.DefaultFillTransValue;
|
19207 | },
|
19208 | set: function(trans) {
|
19209 | this.data.shapeTransparency = trans;
|
19210 | },
|
19211 | enumerable: !0,
|
19212 | configurable: !0
|
19213 | }), Object.defineProperty(BasicShapeVisual.prototype, "angle", {
|
19214 | get: function() {
|
19215 | return this.data ? this.data.angle : BasicShapeVisual.DefaultAngle;
|
19216 | },
|
19217 | set: function(angle) {
|
19218 | this.data.angle = this.scaleTo360Deg(angle);
|
19219 | },
|
19220 | enumerable: !0,
|
19221 | configurable: !0
|
19222 | }), BasicShapeVisual.prototype.init = function(options) {
|
19223 | this.element = options.element, this.selection = d3.select(this.element.context),
|
19224 | this.currentViewport = options.viewport;
|
19225 | }, BasicShapeVisual.prototype.update = function(options) {
|
19226 | this.currentViewport = options.viewport;
|
19227 | var dataViews = options.dataViews;
|
19228 | if (!_.isEmpty(dataViews)) {
|
19229 | var dataView = options.dataViews[0];
|
19230 | if (dataView.metadata && dataView.metadata.objects) {
|
19231 | var dataViewObject = options.dataViews[0].metadata.objects;
|
19232 | this.data = this.getDataFromDataView(dataViewObject);
|
19233 | }
|
19234 | }
|
19235 | this.render();
|
19236 | }, BasicShapeVisual.prototype.getDataFromDataView = function(dataViewObject) {
|
19237 | return dataViewObject ? {
|
19238 | shapeType: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.general.shapeType, BasicShapeVisual.DefaultShape),
|
19239 | lineColor: this.getValueFromColor(powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.lineColor, BasicShapeVisual.DefaultStrokeColor)),
|
19240 | lineTransparency: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.transparency, BasicShapeVisual.DefaultLineTransValue),
|
19241 | lineWeight: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.weight, BasicShapeVisual.DefaultWeightValue),
|
19242 | roundEdge: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.line.roundEdge, BasicShapeVisual.DefaultRoundEdgeValue),
|
19243 | shapeTransparency: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.fill.transparency, BasicShapeVisual.DefaultFillTransValue),
|
19244 | fillColor: this.getValueFromColor(powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.fill.fillColor, BasicShapeVisual.DefaultFillColor)),
|
19245 | showFill: powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.fill.show, BasicShapeVisual.DefaultFillShowValue),
|
19246 | angle: this.scaleTo360Deg(powerbi.DataViewObjects.getValue(dataViewObject, visuals.basicShapeProps.rotation.angle, BasicShapeVisual.DefaultAngle))
|
19247 | } : null;
|
19248 | }, BasicShapeVisual.prototype.scaleTo360Deg = function(angle) {
|
19249 | return 0 !== angle && Math.abs(angle) % 360 === 0 ? angle : (angle %= 360, angle = (angle + 360) % 360);
|
19250 | }, BasicShapeVisual.prototype.getValueFromColor = function(color) {
|
19251 | return color.solid ? color.solid.color : color;
|
19252 | }, BasicShapeVisual.prototype.enumerateObjectInstances = function(options) {
|
19253 | var objectInstances = [];
|
19254 | switch (options.objectName) {
|
19255 | case "line":
|
19256 | var instance = {
|
19257 | selector: null,
|
19258 | properties: {
|
19259 | lineColor: this.lineColor,
|
19260 | transparency: this.lineTransparency,
|
19261 | weight: this.lineWeight
|
19262 | },
|
19263 | objectName: options.objectName
|
19264 | };
|
19265 | return this.data.shapeType === visuals.basicShapeType.rectangle && (instance.properties.roundEdge = this.roundEdge),
|
19266 | objectInstances.push(instance), objectInstances;
|
19267 |
|
19268 | case "fill":
|
19269 | return this.shapeType !== visuals.basicShapeType.line && objectInstances.push({
|
19270 | selector: null,
|
19271 | properties: {
|
19272 | show: this.showFill,
|
19273 | fillColor: this.fillColor,
|
19274 | transparency: this.shapeTransparency
|
19275 | },
|
19276 | objectName: options.objectName
|
19277 | }), objectInstances;
|
19278 |
|
19279 | case "rotation":
|
19280 | return objectInstances.push({
|
19281 | selector: null,
|
19282 | properties: {
|
19283 | angle: this.angle
|
19284 | },
|
19285 | objectName: options.objectName
|
19286 | }), objectInstances;
|
19287 | }
|
19288 | return null;
|
19289 | }, BasicShapeVisual.prototype.render = function() {
|
19290 | switch (this.selection.html(""), this.shapeType) {
|
19291 | case visuals.basicShapeType.rectangle:
|
19292 | visuals.ShapeFactory.createRectangle(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19293 | break;
|
19294 |
|
19295 | case visuals.basicShapeType.oval:
|
19296 | visuals.ShapeFactory.createOval(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19297 | break;
|
19298 |
|
19299 | case visuals.basicShapeType.line:
|
19300 | visuals.ShapeFactory.createLine(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19301 | break;
|
19302 |
|
19303 | case visuals.basicShapeType.arrow:
|
19304 | visuals.ShapeFactory.createUpArrow(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19305 | break;
|
19306 |
|
19307 | case visuals.basicShapeType.triangle:
|
19308 | visuals.ShapeFactory.createTriangle(this.data, this.currentViewport.height, this.currentViewport.width, this.selection, this.angle);
|
19309 | }
|
19310 | }, BasicShapeVisual.DefaultShape = visuals.basicShapeType.rectangle, BasicShapeVisual.DefaultStrokeColor = "#00B8AA",
|
19311 | BasicShapeVisual.DefaultFillColor = "#E6E6E6", BasicShapeVisual.DefaultFillShowValue = !0,
|
19312 | BasicShapeVisual.DefaultFillTransValue = 0, BasicShapeVisual.DefaultWeightValue = 3,
|
19313 | BasicShapeVisual.DefaultLineTransValue = 0, BasicShapeVisual.DefaultRoundEdgeValue = 0,
|
19314 | BasicShapeVisual.DefaultAngle = 0, BasicShapeVisual;
|
19315 | }();
|
19316 | visuals.BasicShapeVisual = BasicShapeVisual;
|
19317 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
19318 | }(powerbi || (powerbi = {}));
|
19319 |
|
19320 | var powerbi;
|
19321 |
|
19322 | !function(powerbi) {
|
19323 | var visuals;
|
19324 | !function(visuals) {
|
19325 | function getLayerDataViews(dataViews) {
|
19326 | return _.isEmpty(dataViews) ? [] : _.filter(dataViews, function(dataView) {
|
19327 | return !visuals.TrendLineHelper.isDataViewForRegression(dataView);
|
19328 | });
|
19329 | }
|
19330 | function hasMultipleYAxes(layers) {
|
19331 | return layers.length > 1;
|
19332 | }
|
19333 | function shouldShowYAxisLabel(layerNumber, valueAxisProperties, yAxisWillMerge) {
|
19334 | return 0 === layerNumber && !!valueAxisProperties && !!valueAxisProperties.showAxisTitle || 1 === layerNumber && !yAxisWillMerge && !!valueAxisProperties && !!valueAxisProperties.secShowAxisTitle;
|
19335 | }
|
19336 | function tryMergeYDomains(layers, visualOptions) {
|
19337 | var noMerge = {
|
19338 | domain: void 0,
|
19339 | merged: !1,
|
19340 | tickCount: void 0
|
19341 | };
|
19342 | if (layers.length < 2) return noMerge;
|
19343 | 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();
|
19344 | if (y1props.values && y1props.values.length > 0 && y2props.values && y2props.values.length > 0 && (noMerge.tickCount = Math.max(y1props.values.length, y2props.values.length)),
|
19345 | min = Math.min(firstYDomain[0], secondYDomain[0]), max = Math.max(firstYDomain[1], secondYDomain[1]),
|
19346 | visualOptions.forceMerge) return {
|
19347 | domain: [ min, max ],
|
19348 | merged: !0,
|
19349 | tickCount: noMerge.tickCount
|
19350 | };
|
19351 | if (firstYDomain[0] > secondYDomain[1] || firstYDomain[1] < secondYDomain[0]) return noMerge;
|
19352 | maxOfMin = Math.max(firstYDomain[0], secondYDomain[0]), minOfMax = Math.min(firstYDomain[1], secondYDomain[1]);
|
19353 | var range = max - min;
|
19354 | if (0 === range) return noMerge;
|
19355 | var intersection = Math.abs((minOfMax - maxOfMin) / range);
|
19356 | return COMBOCHART_DOMAIN_OVERLAP_TRESHOLD_PERCENTAGE > intersection ? noMerge : {
|
19357 | domain: [ min, max ],
|
19358 | merged: !0,
|
19359 | tickCount: noMerge.tickCount
|
19360 | };
|
19361 | }
|
19362 | 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;
|
19363 | visuals.DEFAULT_AXIS_COLOR = "#777";
|
19364 | var CartesianChart = function() {
|
19365 | function CartesianChart(options) {
|
19366 | this.xRefLine = createClassAndSelector("x-ref-line"), this.y1RefLine = createClassAndSelector("y1-ref-line");
|
19367 | var isScrollable = !1;
|
19368 | this.trimOrdinalDataOnOverflow = !0, options && (this.tooltipsEnabled = options.tooltipsEnabled,
|
19369 | this.type = options.chartType, this.isLabelInteractivityEnabled = options.isLabelInteractivityEnabled,
|
19370 | this.lineChartLabelDensityEnabled = options.lineChartLabelDensityEnabled, void 0 !== options.trimOrdinalDataOnOverflow && (this.trimOrdinalDataOnOverflow = options.trimOrdinalDataOnOverflow),
|
19371 | options.isScrollable && (isScrollable = options.isScrollable), this.animator = options.animator,
|
19372 | options.cartesianSmallViewPortProperties && (this.cartesianSmallViewPortProperties = options.cartesianSmallViewPortProperties),
|
19373 | options.behavior && (this.behavior = options.behavior)), this.axes = new CartesianAxes(isScrollable, ScrollableAxes.ScrollbarWidth, this.trimOrdinalDataOnOverflow),
|
19374 | this.svgAxes = new SvgCartesianAxes(this.axes), this.svgBrush = new SvgBrush(ScrollableAxes.ScrollbarWidth),
|
19375 | this.scrollableAxes = new ScrollableAxes(this.axes, this.svgBrush);
|
19376 | }
|
19377 | return CartesianChart.getAxisVisibility = function(type) {
|
19378 | switch (type) {
|
19379 | case 6:
|
19380 | case 5:
|
19381 | case 7:
|
19382 | return 1;
|
19383 |
|
19384 | case 9:
|
19385 | return 3;
|
19386 |
|
19387 | default:
|
19388 | return 2;
|
19389 | }
|
19390 | }, CartesianChart.prototype.init = function(options) {
|
19391 | this.visualInitOptions = options, this.layers = [];
|
19392 | var element = this.element = options.element;
|
19393 | this.currentViewport = options.viewport, this.hostServices = options.host;
|
19394 | var chartAreaSvg = this.chartAreaSvg = d3.select(element.get(0)).append("svg");
|
19395 | chartAreaSvg.classed(CartesianChart.ClassName, !0), chartAreaSvg.style("position", "absolute"),
|
19396 | this.behavior && (this.clearCatcher = visuals.appendClearCatcher(chartAreaSvg),
|
19397 | this.interactivityService = visuals.createInteractivityService(this.hostServices)),
|
19398 | null != options.style.maxMarginFactor && this.axes.setMaxMarginFactor(options.style.maxMarginFactor);
|
19399 | var axisLinesVisibility = CartesianChart.getAxisVisibility(this.type);
|
19400 | this.axes.setAxisLinesVisibility(axisLinesVisibility), this.svgAxes.init(chartAreaSvg),
|
19401 | this.svgBrush.init(chartAreaSvg), this.sharedColorPalette = new SharedColorPalette(options.style.colorPalette.dataColors),
|
19402 | this.legend = visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, 12 !== this.type ? this.interactivityService : void 0, this.axes.isScrollable),
|
19403 | this.isMobileChart = options.interactivity && options.interactivity.isInteractiveLegend;
|
19404 | }, CartesianChart.prototype.isPlayAxis = function() {
|
19405 | if (!this.dataViews || !this.dataViews[0]) return !1;
|
19406 | 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;
|
19407 | return 9 === this.type && (this.animator || this.isMobileChart) && null != dataView.matrix && (!dataView.categorical || categoryRoleIsPlay);
|
19408 | }, CartesianChart.getIsScalar = function(objects, propertyId, type) {
|
19409 | var axisTypeValue = powerbi.DataViewObjects.getValue(objects, propertyId);
|
19410 | return objects && void 0 !== axisTypeValue ? axisTypeValue === visuals.axisType.scalar && !visuals.AxisHelper.isOrdinal(type) : !visuals.AxisHelper.isOrdinal(type);
|
19411 | }, CartesianChart.getAdditionalTelemetry = function(dataView) {
|
19412 | var telemetry = {}, categoryColumn = dataView && dataView.categorical && _.first(dataView.categorical.categories);
|
19413 | return categoryColumn && (telemetry.axisType = visuals.CartesianChart.getIsScalar(dataView.metadata.objects, visuals.columnChartProps.categoryAxis.axisType, categoryColumn.source.type) ? "scalar" : "categorical"),
|
19414 | telemetry;
|
19415 | }, CartesianChart.detectScalarMapping = function(dataViewMapping) {
|
19416 | if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories) return !1;
|
19417 | var dataViewCategories = dataViewMapping.categorical.categories, categoryItems = dataViewCategories["for"]["in"].items;
|
19418 | if (_.isEmpty(categoryItems)) return !1;
|
19419 | var categoryType = categoryItems[0].type;
|
19420 | if (!dataViewMapping.metadata) return !1;
|
19421 | var objects = dataViewMapping.metadata.objects;
|
19422 | return CartesianChart.getIsScalar(objects, visuals.columnChartProps.categoryAxis.axisType, categoryType);
|
19423 | }, CartesianChart.prototype.populateObjectProperties = function(dataViews) {
|
19424 | if (dataViews && dataViews.length > 0) {
|
19425 | var dataViewMetadata = dataViews[0].metadata;
|
19426 | dataViewMetadata ? (this.legendObjectProperties = powerbi.DataViewObjects.getObject(dataViewMetadata.objects, "legend", {}),
|
19427 | this.xAxisReferenceLines = powerbi.DataViewObjects.getUserDefinedObjects(dataViewMetadata.objects, "xAxisReferenceLine"),
|
19428 | this.y1AxisReferenceLines = powerbi.DataViewObjects.getUserDefinedObjects(dataViewMetadata.objects, "y1AxisReferenceLine")) : this.legendObjectProperties = {},
|
19429 | this.categoryAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataViewMetadata),
|
19430 | this.valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataViewMetadata);
|
19431 | }
|
19432 | }, CartesianChart.prototype.updateInternal = function(options, dataChanged) {
|
19433 | var dataViews = this.dataViews = options.dataViews;
|
19434 | if (this.currentViewport = options.viewport, dataViews) {
|
19435 | if (0 === this.layers.length) {
|
19436 | var objects = this.extractMetadataObjects(dataViews);
|
19437 | this.layers = this.createAndInitLayers(objects);
|
19438 | }
|
19439 | var layers = this.layers;
|
19440 | if (dataChanged) {
|
19441 | if (!_.isEmpty(dataViews)) {
|
19442 | this.populateObjectProperties(dataViews), this.axes.update(dataViews), this.svgAxes.update(this.categoryAxisProperties, this.valueAxisProperties);
|
19443 | var dataView = dataViews[0];
|
19444 | dataView.metadata && (this.background = {
|
19445 | image: powerbi.DataViewObjects.getValue(dataView.metadata.objects, visuals.scatterChartProps.plotArea.image),
|
19446 | transparency: powerbi.DataViewObjects.getValue(dataView.metadata.objects, visuals.scatterChartProps.plotArea.transparency, visuals.visualBackgroundHelper.getDefaultTransparency())
|
19447 | });
|
19448 | }
|
19449 | this.sharedColorPalette.clearPreferredScale();
|
19450 | var layerDataViews = getLayerDataViews(dataViews), trendLineDataViews = _.filter(dataViews, function(dataView) {
|
19451 | return visuals.TrendLineHelper.isDataViewForRegression(dataView);
|
19452 | });
|
19453 | this.trendLines = [];
|
19454 | for (var i = 0, layerCount = layers.length; layerCount > i; i++) {
|
19455 | var layerDataView = layerDataViews[i];
|
19456 | if (layers[i].setData(layerDataView ? [ layerDataView ] : []), this.supportsTrendLines(i)) {
|
19457 | var trendLineDataView = trendLineDataViews[i];
|
19458 | if (trendLineDataView) {
|
19459 | var y2 = i > 0, trendLines = visuals.TrendLineHelper.readDataView(trendLineDataView, layerDataView, y2, this.sharedColorPalette);
|
19460 | (_a = this.trendLines).push.apply(_a, trendLines);
|
19461 | }
|
19462 | }
|
19463 | layerCount > 1 && this.sharedColorPalette.rotateScale();
|
19464 | }
|
19465 | }
|
19466 | if (this.render(!this.hasSetData || options.suppressAnimations, options.resizeMode),
|
19467 | this.hasSetData = this.hasSetData || dataViews && dataViews.length > 0, dataViews && dataViews.length > 0) {
|
19468 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
19469 | this.axes.addWarnings(warnings), warnings && warnings.length > 0 && this.hostServices.setWarnings(warnings);
|
19470 | }
|
19471 | var _a;
|
19472 | }
|
19473 | }, CartesianChart.prototype.onDataChanged = function(options) {
|
19474 | this.updateInternal({
|
19475 | dataViews: options.dataViews,
|
19476 | suppressAnimations: options.suppressAnimations,
|
19477 | viewport: this.currentViewport
|
19478 | }, !0);
|
19479 | }, CartesianChart.prototype.onResizing = function(viewport, resizeMode) {
|
19480 | this.updateInternal({
|
19481 | dataViews: this.dataViews,
|
19482 | suppressAnimations: !0,
|
19483 | viewport: viewport,
|
19484 | resizeMode: resizeMode
|
19485 | }, !1);
|
19486 | }, CartesianChart.prototype.scrollTo = function(position) {
|
19487 | this.scrollableAxes.scrollTo(position);
|
19488 | }, CartesianChart.prototype.enumerateObjectInstances = function(options) {
|
19489 | var enumeration = new visuals.ObjectEnumerationBuilder(), layersLength = this.layers ? this.layers.length : 0;
|
19490 | if ("legend" === options.objectName) {
|
19491 | if (!this.shouldShowLegendCard()) return;
|
19492 | 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);
|
19493 | enumeration.pushInstance({
|
19494 | selector: null,
|
19495 | properties: {
|
19496 | show: show,
|
19497 | position: visuals.LegendPosition[this.legend.getOrientation()],
|
19498 | showTitle: showTitle,
|
19499 | titleText: titleText,
|
19500 | labelColor: labelColor,
|
19501 | fontSize: fontSize
|
19502 | },
|
19503 | objectName: options.objectName
|
19504 | });
|
19505 | } else if ("categoryAxis" === options.objectName && this.axes.hasCategoryAxis()) this.getCategoryAxisValues(enumeration); else if ("valueAxis" === options.objectName) this.getValueAxisValues(enumeration); else if ("y1AxisReferenceLine" === options.objectName) {
|
19506 | var refLinedefaultColor = this.sharedColorPalette.getColorByIndex(0).value;
|
19507 | visuals.ReferenceLineHelper.enumerateObjectInstances(enumeration, this.y1AxisReferenceLines, refLinedefaultColor, options.objectName);
|
19508 | } else if ("xAxisReferenceLine" === options.objectName) {
|
19509 | var refLinedefaultColor = this.sharedColorPalette.getColorByIndex(0).value;
|
19510 | visuals.ReferenceLineHelper.enumerateObjectInstances(enumeration, this.xAxisReferenceLines, refLinedefaultColor, options.objectName);
|
19511 | } else "trend" === options.objectName ? this.supportsTrendLines() && visuals.TrendLineHelper.enumerateObjectInstances(enumeration, this.trendLines) : "plotArea" === options.objectName && visuals.visualBackgroundHelper.enumeratePlot(enumeration, this.background);
|
19512 | 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++) {
|
19513 | var layer = this.layers[i];
|
19514 | layer.enumerateObjectInstances && layer.enumerateObjectInstances(enumeration, options);
|
19515 | }
|
19516 | return enumeration.complete();
|
19517 | }, CartesianChart.prototype.supportsTrendLines = function(layerIndex) {
|
19518 | var layerDataViews = getLayerDataViews(this.dataViews);
|
19519 | if (_.isEmpty(this.layers)) return !1;
|
19520 | var layers = null == layerIndex ? this.layers : [ this.layers[layerIndex] ];
|
19521 | return _.all(layers, function(layer, index) {
|
19522 | return layerDataViews[index] ? layer.supportsTrendLine && layer.supportsTrendLine() : !0;
|
19523 | });
|
19524 | }, CartesianChart.prototype.shouldShowLegendCard = function() {
|
19525 | var layers = this.layers, dataViews = this.dataViews;
|
19526 | if (layers && dataViews) for (var layersLength = layers.length, layersWithValuesCtr = 0, i = 0; layersLength > i; i++) {
|
19527 | if (layers[i].hasLegend()) return !0;
|
19528 | var dataView = dataViews[i];
|
19529 | if (dataView && dataView.categorical && dataView.categorical.values && dataView.categorical.values.length > 0 && (layersWithValuesCtr++,
|
19530 | layersWithValuesCtr > 1)) return !0;
|
19531 | }
|
19532 | return !1;
|
19533 | }, CartesianChart.prototype.getAxisScaleOptions = function(axisType) {
|
19534 | var scaleOptions = [ DEFAULT_AXIS_SCALE_TYPE ];
|
19535 | return this.axes.isLogScaleAllowed(axisType) && scaleOptions.push(visuals.axisScale.log),
|
19536 | scaleOptions;
|
19537 | }, CartesianChart.prototype.getCategoryAxisValues = function(enumeration) {
|
19538 | if (this.categoryAxisProperties) {
|
19539 | var supportedType = visuals.axisType.both, isScalar = !1, scaleOptions = this.getAxisScaleOptions(0);
|
19540 | this.layers && this.layers[0].getSupportedCategoryAxisType && (supportedType = this.layers[0].getSupportedCategoryAxisType(),
|
19541 | isScalar = supportedType === visuals.axisType.scalar ? !0 : visuals.CartesianHelper.isScalar(supportedType === visuals.axisType.both, this.categoryAxisProperties)),
|
19542 | isScalar || (this.categoryAxisProperties.start = null, this.categoryAxisProperties.end = null);
|
19543 | var instance = {
|
19544 | selector: null,
|
19545 | properties: {},
|
19546 | objectName: "categoryAxis",
|
19547 | validValues: {
|
19548 | axisScale: scaleOptions,
|
19549 | axisStyle: this.axes.categoryAxisHasUnitType ? [ visuals.axisStyle.showTitleOnly, visuals.axisStyle.showUnitOnly, visuals.axisStyle.showBoth ] : [ visuals.axisStyle.showTitleOnly ]
|
19550 | }
|
19551 | };
|
19552 | if (instance.properties.show = null != this.categoryAxisProperties.show ? this.categoryAxisProperties.show : !0,
|
19553 | this.axes.isYAxisCategorical() && (instance.properties.position = this.valueAxisProperties && null != this.valueAxisProperties.position ? this.valueAxisProperties.position : visuals.yAxisPosition.left),
|
19554 | supportedType === visuals.axisType.both && (instance.properties.axisType = isScalar ? visuals.axisType.scalar : visuals.axisType.categorical),
|
19555 | isScalar && (instance.properties.axisScale = this.categoryAxisProperties.axisScale || DEFAULT_AXIS_SCALE_TYPE,
|
19556 | instance.properties.start = this.categoryAxisProperties.start, instance.properties.end = this.categoryAxisProperties.end),
|
19557 | instance.properties.showAxisTitle = null != this.categoryAxisProperties.showAxisTitle ? this.categoryAxisProperties.showAxisTitle : !1,
|
19558 | instance.properties.axisStyle = this.categoryAxisProperties.axisStyle ? this.categoryAxisProperties.axisStyle : visuals.axisStyle.showTitleOnly,
|
19559 | instance.properties.labelColor = this.categoryAxisProperties.labelColor || visuals.DEFAULT_AXIS_COLOR,
|
19560 | isScalar) {
|
19561 | instance.properties.labelDisplayUnits = this.categoryAxisProperties.labelDisplayUnits ? this.categoryAxisProperties.labelDisplayUnits : 0;
|
19562 | var labelPrecision = this.categoryAxisProperties.labelPrecision;
|
19563 | instance.properties.labelPrecision = void 0 === labelPrecision || 0 > labelPrecision ? visuals.dataLabelUtils.defaultLabelPrecision : labelPrecision;
|
19564 | }
|
19565 | enumeration.pushInstance(instance);
|
19566 | }
|
19567 | }, CartesianChart.prototype.getValueAxisValues = function(enumeration) {
|
19568 | if (this.valueAxisProperties) {
|
19569 | var scaleOptions = this.getAxisScaleOptions(1), secScaleOption = this.getAxisScaleOptions(2), instance = {
|
19570 | selector: null,
|
19571 | properties: {},
|
19572 | objectName: "valueAxis",
|
19573 | validValues: {
|
19574 | axisScale: scaleOptions,
|
19575 | secAxisScale: secScaleOption,
|
19576 | axisStyle: this.axes.valueAxisHasUnitType ? [ visuals.axisStyle.showTitleOnly, visuals.axisStyle.showUnitOnly, visuals.axisStyle.showBoth ] : [ visuals.axisStyle.showTitleOnly ]
|
19577 | }
|
19578 | };
|
19579 | if (instance.properties.show = null != this.valueAxisProperties.show ? this.valueAxisProperties.show : !0,
|
19580 | this.axes.isYAxisCategorical() || (instance.properties.position = null != this.valueAxisProperties.position ? this.valueAxisProperties.position : visuals.yAxisPosition.left),
|
19581 | instance.properties.axisScale = this.valueAxisProperties.axisScale || DEFAULT_AXIS_SCALE_TYPE,
|
19582 | instance.properties.start = this.valueAxisProperties.start, instance.properties.end = this.valueAxisProperties.end,
|
19583 | instance.properties.showAxisTitle = null != this.valueAxisProperties.showAxisTitle ? this.valueAxisProperties.showAxisTitle : !1,
|
19584 | instance.properties.axisStyle = null != this.valueAxisProperties.axisStyle ? this.valueAxisProperties.axisStyle : visuals.axisStyle.showTitleOnly,
|
19585 | instance.properties.labelColor = this.valueAxisProperties.labelColor || visuals.DEFAULT_AXIS_COLOR,
|
19586 | 7 !== this.type && 8 !== this.type) {
|
19587 | instance.properties.labelDisplayUnits = this.valueAxisProperties.labelDisplayUnits ? this.valueAxisProperties.labelDisplayUnits : 0;
|
19588 | var labelPrecision = this.valueAxisProperties.labelPrecision;
|
19589 | instance.properties.labelPrecision = void 0 === labelPrecision || 0 > labelPrecision ? visuals.dataLabelUtils.defaultLabelPrecision : labelPrecision;
|
19590 | }
|
19591 | if (enumeration.pushInstance(instance), 2 === this.layers.length && (instance.properties.secShow = null != this.valueAxisProperties.secShow ? this.valueAxisProperties.secShow : this.axes.hasY2Axis(),
|
19592 | instance.properties.secShow && (instance.properties.axisLabel = "")), this.axes.hasY2Axis() && instance.properties.secShow) {
|
19593 | enumeration.pushContainer({
|
19594 | displayName: powerbi.data.createDisplayNameGetter("Visual_YAxis_ShowSecondary")
|
19595 | });
|
19596 | var secInstance = {
|
19597 | selector: null,
|
19598 | properties: {},
|
19599 | objectName: "valueAxis"
|
19600 | };
|
19601 | secInstance.properties.secAxisLabel = "", secInstance.properties.secPosition = null != this.valueAxisProperties.secPosition ? this.valueAxisProperties.secPosition : visuals.yAxisPosition.right,
|
19602 | secInstance.properties.secAxisScale = this.valueAxisProperties.secAxisScale || DEFAULT_AXIS_SCALE_TYPE,
|
19603 | secInstance.properties.secStart = this.valueAxisProperties.secStart, secInstance.properties.secEnd = this.valueAxisProperties.secEnd,
|
19604 | secInstance.properties.secShowAxisTitle = null != this.valueAxisProperties.secShowAxisTitle ? this.valueAxisProperties.secShowAxisTitle : !1,
|
19605 | enumeration.pushInstance(secInstance).pushInstance({
|
19606 | selector: null,
|
19607 | properties: {
|
19608 | secAxisStyle: this.valueAxisProperties.secAxisStyle ? this.valueAxisProperties.secAxisStyle : visuals.axisStyle.showTitleOnly,
|
19609 | labelColor: this.valueAxisProperties.secLabelColor,
|
19610 | secLabelDisplayUnits: this.valueAxisProperties.secLabelDisplayUnits ? this.valueAxisProperties.secLabelDisplayUnits : 0,
|
19611 | secLabelPrecision: this.valueAxisProperties.secLabelPrecision < 0 ? 0 : this.valueAxisProperties.secLabelPrecision
|
19612 | },
|
19613 | objectName: "valueAxis",
|
19614 | validValues: {
|
19615 | secAxisStyle: this.axes.secondaryValueAxisHasUnitType ? [ visuals.axisStyle.showTitleOnly, visuals.axisStyle.showUnitOnly, visuals.axisStyle.showBoth ] : [ visuals.axisStyle.showTitleOnly ],
|
19616 | axisScale: scaleOptions
|
19617 | }
|
19618 | }), enumeration.popContainer();
|
19619 | }
|
19620 | }
|
19621 | }, CartesianChart.prototype.onClearSelection = function() {
|
19622 | if (this.hasSetData) for (var i = 0, len = this.layers.length; len > i; i++) {
|
19623 | var layer = this.layers[i];
|
19624 | layer.onClearSelection(), layer.render(!0);
|
19625 | }
|
19626 | }, CartesianChart.prototype.extractMetadataObjects = function(dataViews) {
|
19627 | var objects;
|
19628 | if (dataViews && dataViews.length > 0) {
|
19629 | var dataViewMetadata = dataViews[0].metadata;
|
19630 | dataViewMetadata && (objects = dataViewMetadata.objects);
|
19631 | }
|
19632 | return objects;
|
19633 | }, CartesianChart.prototype.createAndInitLayers = function(objects) {
|
19634 | var _this = this, layers = CartesianLayerFactory.createLayers(this.type, objects, this.interactivityService, this.animator, this.axes.isScrollable, this.tooltipsEnabled, this.lineChartLabelDensityEnabled), cartesianOptions = powerbi.Prototype.inherit(this.visualInitOptions);
|
19635 | cartesianOptions.svg = this.svgAxes.getScrollableRegion(), cartesianOptions.labelsContext = this.svgAxes.getLabelsRegion(),
|
19636 | cartesianOptions.cartesianHost = {
|
19637 | updateLegend: function(data) {
|
19638 | return _this.legend.drawLegend(data, _this.currentViewport);
|
19639 | },
|
19640 | getSharedColors: function() {
|
19641 | return _this.sharedColorPalette;
|
19642 | },
|
19643 | triggerRender: function(suppressAnimations) {
|
19644 | return _this.render(suppressAnimations);
|
19645 | }
|
19646 | }, cartesianOptions.chartType = this.type;
|
19647 | for (var i = 0, len = layers.length; len > i; i++) layers[i].init(cartesianOptions);
|
19648 | return layers;
|
19649 | }, CartesianChart.prototype.renderLegend = function() {
|
19650 | for (var layers = this.layers, legendData = {
|
19651 | title: "",
|
19652 | dataPoints: []
|
19653 | }, _loop_1 = function(i, len) {
|
19654 | this_1.layerLegendData = layers[i].calculateLegend(), this_1.layerLegendData && (legendData.title = 0 === i ? this_1.layerLegendData.title || "" : legendData.title,
|
19655 | legendData.labelColor = this_1.layerLegendData.labelColor, _.isEmpty(this_1.layerLegendData.dataPoints) || this_1.layerLegendData.dataPoints.forEach(function(dataPoint) {
|
19656 | return dataPoint.layerNumber = i;
|
19657 | }), legendData.dataPoints = legendData.dataPoints.concat(this_1.layerLegendData.dataPoints || []),
|
19658 | legendData.fontSize = this_1.layerLegendData.fontSize || visuals.SVGLegend.DefaultFontSizeInPt,
|
19659 | this_1.layerLegendData.grouped && (legendData.grouped = !0));
|
19660 | }, this_1 = this, i = 0, len = layers.length; len > i; i++) _loop_1(i, len);
|
19661 | var legendProperties = this.legendObjectProperties;
|
19662 | if (legendProperties) {
|
19663 | visuals.LegendData.update(legendData, legendProperties);
|
19664 | var position = legendProperties[visuals.legendProps.position];
|
19665 | position && this.legend.changeOrientation(visuals.LegendPosition[position]);
|
19666 | } else this.legend.changeOrientation(visuals.LegendPosition.Top);
|
19667 | (1 === legendData.dataPoints.length && !legendData.grouped || this.hideLegends()) && (legendData.dataPoints = []),
|
19668 | this.legend.drawLegend(legendData, this.currentViewport);
|
19669 | }, CartesianChart.prototype.hideLegends = function() {
|
19670 | return !!(this.cartesianSmallViewPortProperties && this.cartesianSmallViewPortProperties.hideLegendOnSmallViewPort && this.currentViewport.height < this.cartesianSmallViewPortProperties.MinHeightLegendVisible);
|
19671 | }, CartesianChart.prototype.render = function(suppressAnimations, resizeMode) {
|
19672 | var _this = this;
|
19673 | this.visualInitOptions.interactivity && this.visualInitOptions.interactivity.isInteractiveLegend || this.renderLegend();
|
19674 | var playAxisControlLayout, legendMargins = this.legendMargins = this.legend.getMargins(), legendOrientation = this.legend.getOrientation(), hideAxisLabels = this.hideAxisLabels(legendMargins), plotAreaViewport = {
|
19675 | height: this.currentViewport.height - legendMargins.height,
|
19676 | width: this.currentViewport.width - legendMargins.width
|
19677 | }, padding = powerbi.Prototype.inherit(SvgCartesianAxes.AxisPadding);
|
19678 | this.isPlayAxis() && (plotAreaViewport.height -= CartesianChart.PlayAxisBottomMargin,
|
19679 | playAxisControlLayout = {
|
19680 | left: visuals.Legend.isLeft(legendOrientation) ? legendMargins.width : 0,
|
19681 | top: visuals.Legend.isTop(legendOrientation) ? legendMargins.height + plotAreaViewport.height : plotAreaViewport.height,
|
19682 | height: CartesianChart.PlayAxisBottomMargin,
|
19683 | width: plotAreaViewport.width
|
19684 | }), this.chartAreaSvg.attr({
|
19685 | width: plotAreaViewport.width,
|
19686 | height: plotAreaViewport.height
|
19687 | }), visuals.Legend.positionChartArea(this.chartAreaSvg, this.legend);
|
19688 | 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), plotAreaHasChanged = !this.renderedPlotArea || this.renderedPlotArea.height !== axesLayout.plotArea.height || this.renderedPlotArea.width !== axesLayout.plotArea.width;
|
19689 | suppressAnimations = suppressAnimations || plotAreaHasChanged, this.scrollableAxes.render(axesLayout, this.layers, suppressAnimations, function(layers, axesLayout, suppressAnimations) {
|
19690 | return _this.renderPlotArea(layers, axesLayout, suppressAnimations, legendMargins, resizeMode);
|
19691 | }), this.chartAreaSvg.on("wheel", function() {
|
19692 | if (_this.axes.isXScrollBarVisible || _this.axes.isYScrollBarVisible) {
|
19693 | visuals.TooltipManager.ToolTipInstance.hide();
|
19694 | var wheelEvent = d3.event, dy = wheelEvent.deltaY;
|
19695 | _this.scrollableAxes.scrollDelta(dy);
|
19696 | }
|
19697 | }), this.renderedPlotArea = axesLayout.plotArea;
|
19698 | }, CartesianChart.prototype.getMinimumDomainExtents = function() {
|
19699 | var xs = [], ys = [];
|
19700 | if (!_.isEmpty(this.xAxisReferenceLines)) {
|
19701 | var xAxisReferenceLineProperties = this.xAxisReferenceLines[0].object, value = visuals.ReferenceLineHelper.extractReferenceLineValue(xAxisReferenceLineProperties);
|
19702 | xs.push(value);
|
19703 | }
|
19704 | if (!_.isEmpty(this.y1AxisReferenceLines)) {
|
19705 | var y1AxisReferenceLineProperties = this.y1AxisReferenceLines[0].object, value = visuals.ReferenceLineHelper.extractReferenceLineValue(y1AxisReferenceLineProperties);
|
19706 | ys.push(value);
|
19707 | }
|
19708 | var ensureXDomain = {
|
19709 | min: d3.min(xs),
|
19710 | max: d3.max(xs)
|
19711 | }, ensureYDomain = {
|
19712 | min: d3.min(ys),
|
19713 | max: d3.max(ys)
|
19714 | };
|
19715 | return [ ensureXDomain, ensureYDomain ];
|
19716 | }, CartesianChart.prototype.getPlotAreaRect = function(axesLayout, legendMargins) {
|
19717 | var rect = {
|
19718 | left: axesLayout.margin.left,
|
19719 | top: axesLayout.margin.top,
|
19720 | width: axesLayout.plotArea.width,
|
19721 | height: axesLayout.plotArea.height
|
19722 | };
|
19723 | if (this.legend) {
|
19724 | var legendPosition_1 = this.legend.getOrientation();
|
19725 | visuals.Legend.isTop(legendPosition_1) ? rect.top += legendMargins.height : visuals.Legend.isLeft(legendPosition_1) && (rect.left += legendMargins.width);
|
19726 | }
|
19727 | return rect;
|
19728 | }, CartesianChart.prototype.renderBackgroundImage = function(layout) {
|
19729 | visuals.visualBackgroundHelper.renderBackgroundImage(this.background, this.element, layout);
|
19730 | }, CartesianChart.prototype.hideAxisLabels = function(legendMargins) {
|
19731 | return !(!(this.cartesianSmallViewPortProperties && this.cartesianSmallViewPortProperties.hideAxesOnSmallViewPort && this.currentViewport.height < this.cartesianSmallViewPortProperties.MinHeightAxesVisible) || this.visualInitOptions.interactivity.isInteractiveLegend);
|
19732 | }, CartesianChart.prototype.calculateInteractivityRightMargin = function() {
|
19733 | return this.visualInitOptions.interactivity && this.visualInitOptions.interactivity.isInteractiveLegend && !this.trimOrdinalDataOnOverflow ? INTERACTIVITY_RIGHT_MARGIN : 0;
|
19734 | }, CartesianChart.prototype.renderPlotArea = function(layers, axesLayout, suppressAnimations, legendMargins, resizeMode) {
|
19735 | 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();
|
19736 | this.renderBackgroundImage(plotAreaRect), _.isEmpty(easing) ? this.svgAxes.renderAxes(axesLayout, duration) : this.svgAxes.renderAxes(axesLayout, duration, easing),
|
19737 | this.renderReferenceLines(axesLayout), this.renderLayers(layers, plotArea, axes, suppressAnimations, resizeMode),
|
19738 | this.renderTrendLines(axesLayout);
|
19739 | }, CartesianChart.prototype.renderTrendLines = function(axesLayout) {
|
19740 | var scrollableRegion = this.svgAxes.getScrollableRegion();
|
19741 | visuals.TrendLineHelper.render(this.trendLines, scrollableRegion, axesLayout.axes, axesLayout.plotArea);
|
19742 | }, CartesianChart.prototype.renderReferenceLines = function(axesLayout) {
|
19743 | var axes = axesLayout.axes, plotArea = axesLayout.plotArea, scrollableRegion = this.svgAxes.getScrollableRegion(), refLineDefaultColor = this.sharedColorPalette.getColorByIndex(0).value, showY1ReferenceLines = !1;
|
19744 | if (this.y1AxisReferenceLines) for (var _i = 0, _a = this.y1AxisReferenceLines; _i < _a.length; _i++) {
|
19745 | var referenceLineProperties = _a[_i], object = referenceLineProperties.object;
|
19746 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show]) {
|
19747 | var isHorizontal = !axes.y1.isCategoryAxis, y1RefLineOptions = {
|
19748 | graphicContext: scrollableRegion,
|
19749 | referenceLineProperties: object,
|
19750 | axes: axes,
|
19751 | viewport: plotArea,
|
19752 | classAndSelector: this.y1RefLine,
|
19753 | defaultColor: refLineDefaultColor,
|
19754 | isHorizontal: isHorizontal
|
19755 | };
|
19756 | visuals.ReferenceLineHelper.render(y1RefLineOptions), showY1ReferenceLines = !0;
|
19757 | }
|
19758 | }
|
19759 | showY1ReferenceLines || scrollableRegion.selectAll(this.y1RefLine.selector).remove();
|
19760 | var showXReferenceLines = !1;
|
19761 | if (this.xAxisReferenceLines) for (var _b = 0, _c = this.xAxisReferenceLines; _b < _c.length; _b++) {
|
19762 | var referenceLineProperties = _c[_b], object = referenceLineProperties.object;
|
19763 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show]) {
|
19764 | var isHorizontal = !1, xRefLineOptions = {
|
19765 | graphicContext: scrollableRegion,
|
19766 | referenceLineProperties: object,
|
19767 | axes: axes,
|
19768 | viewport: plotArea,
|
19769 | classAndSelector: this.xRefLine,
|
19770 | defaultColor: refLineDefaultColor,
|
19771 | isHorizontal: isHorizontal
|
19772 | };
|
19773 | visuals.ReferenceLineHelper.render(xRefLineOptions), showXReferenceLines = !0;
|
19774 | }
|
19775 | }
|
19776 | showXReferenceLines || scrollableRegion.selectAll(this.xRefLine.selector).remove();
|
19777 | }, CartesianChart.prototype.getReferenceLineLabels = function(axes, plotArea) {
|
19778 | var refLineDefaultColor = this.sharedColorPalette.getColorByIndex(0).value, referenceLineLabels = [];
|
19779 | if (this.y1AxisReferenceLines) for (var _i = 0, _a = this.y1AxisReferenceLines; _i < _a.length; _i++) {
|
19780 | var referenceLineProperties = _a[_i], object = referenceLineProperties.object;
|
19781 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show] && object[visuals.ReferenceLineHelper.referenceLineProps.dataLabelShow]) {
|
19782 | var isHorizontal = !axes.y1.isCategoryAxis, y1RefLineLabelOptions = {
|
19783 | referenceLineProperties: object,
|
19784 | axes: axes,
|
19785 | viewport: plotArea,
|
19786 | defaultColor: refLineDefaultColor,
|
19787 | isHorizontal: isHorizontal,
|
19788 | key: JSON.stringify({
|
19789 | type: "y1AxisReferenceLine",
|
19790 | id: referenceLineProperties.id
|
19791 | })
|
19792 | };
|
19793 | referenceLineLabels.push(visuals.ReferenceLineHelper.createLabelDataPoint(y1RefLineLabelOptions));
|
19794 | }
|
19795 | }
|
19796 | if (this.xAxisReferenceLines) for (var _b = 0, _c = this.xAxisReferenceLines; _b < _c.length; _b++) {
|
19797 | var referenceLineProperties = _c[_b], object = referenceLineProperties.object;
|
19798 | if (object[visuals.ReferenceLineHelper.referenceLineProps.show] && object[visuals.ReferenceLineHelper.referenceLineProps.dataLabelShow]) {
|
19799 | var isHorizontal = !1, xRefLineLabelOptions = {
|
19800 | referenceLineProperties: object,
|
19801 | axes: axes,
|
19802 | viewport: plotArea,
|
19803 | defaultColor: refLineDefaultColor,
|
19804 | isHorizontal: isHorizontal,
|
19805 | key: JSON.stringify({
|
19806 | type: "xAxisReferenceLine",
|
19807 | id: referenceLineProperties.id
|
19808 | })
|
19809 | };
|
19810 | referenceLineLabels.push(visuals.ReferenceLineHelper.createLabelDataPoint(xRefLineLabelOptions));
|
19811 | }
|
19812 | }
|
19813 | return referenceLineLabels;
|
19814 | }, CartesianChart.prototype.renderDataLabels = function(labelDataPointGroups, labelsAreNumeric, plotArea, suppressAnimations, isCombo) {
|
19815 | var labelBackgroundRegion = this.svgAxes.getLabelBackground(), labelRegion = this.svgAxes.getLabelsRegion();
|
19816 | if (this.behavior) {
|
19817 | var labelLayoutOptions = visuals.NewDataLabelUtils.getDataLabelLayoutOptions(this.type), labelLayout = new powerbi.LabelLayout(labelLayoutOptions), dataLabels = labelLayout.layout(labelDataPointGroups, plotArea);
|
19818 | isCombo && visuals.NewDataLabelUtils.drawLabelBackground(labelBackgroundRegion, dataLabels, "#FFFFFF", .7);
|
19819 | var svgLabels = void 0, animator = this.animator;
|
19820 | if (animator && !suppressAnimations) {
|
19821 | var isPlayAxis = this.isPlayAxis(), duration = isPlayAxis ? visuals.PlayChart.FrameAnimationDuration : animator.getDuration();
|
19822 | svgLabels = visuals.NewDataLabelUtils.animateDefaultLabels(labelRegion, dataLabels, duration, labelsAreNumeric, isPlayAxis ? "linear" : animator.getEasing());
|
19823 | } else svgLabels = visuals.NewDataLabelUtils.drawDefaultLabels(labelRegion, dataLabels, labelsAreNumeric);
|
19824 | if (labelLayoutOptions.allowLeaderLines) {
|
19825 | var filteredLabels = _.filter(dataLabels, function(d) {
|
19826 | return null != d.leaderLinePoints && !_.isEmpty(d.leaderLinePoints) && null != d.identity;
|
19827 | });
|
19828 | visuals.NewDataLabelUtils.drawLabelLeaderLines(labelRegion, filteredLabels, function(d) {
|
19829 | return d.identity.getKey();
|
19830 | });
|
19831 | }
|
19832 | if (this.interactivityService && this.isLabelInteractivityEnabled) {
|
19833 | var labelsBehaviorOptions = {
|
19834 | labelItems: svgLabels
|
19835 | };
|
19836 | this.interactivityService.bind(dataLabels, new visuals.LabelsBehavior(), labelsBehaviorOptions, {
|
19837 | isLabels: !0
|
19838 | });
|
19839 | }
|
19840 | } else {
|
19841 | var labelLayout = new powerbi.LabelLayout({
|
19842 | maximumOffset: visuals.NewDataLabelUtils.maxLabelOffset,
|
19843 | startingOffset: visuals.NewDataLabelUtils.startingLabelOffset,
|
19844 | attemptToMoveLabelsIntoViewport: !0
|
19845 | }), dataLabels = labelLayout.layout(labelDataPointGroups, plotArea);
|
19846 | isCombo && visuals.NewDataLabelUtils.drawLabelBackground(labelBackgroundRegion, dataLabels, "#FFFFFF", .7),
|
19847 | visuals.NewDataLabelUtils.drawDefaultLabels(labelRegion, dataLabels, labelsAreNumeric);
|
19848 | }
|
19849 | }, CartesianChart.prototype.renderLayers = function(layers, plotArea, axes, suppressAnimations, resizeMode) {
|
19850 | for (var labelDataPointGroups = [], dataPoints = [], layerBehaviorOptions = [], labelsAreNumeric = !0, i = 0, len = layers.length; len > i; i++) {
|
19851 | var result = layers[i].render(suppressAnimations, resizeMode);
|
19852 | if (result) {
|
19853 | if (this.behavior && (dataPoints = dataPoints.concat(result.dataPoints), layerBehaviorOptions.push(result.behaviorOptions)),
|
19854 | result.labelDataPointGroups) for (var resultLabelDataPointsGroups = result.labelDataPointGroups, _i = 0, resultLabelDataPointsGroups_1 = resultLabelDataPointsGroups; _i < resultLabelDataPointsGroups_1.length; _i++) {
|
19855 | var resultLabelDataPointsGroup = resultLabelDataPointsGroups_1[_i];
|
19856 | resultLabelDataPointsGroup && labelDataPointGroups.push({
|
19857 | labelDataPoints: visuals.NewDataLabelUtils.removeDuplicates(resultLabelDataPointsGroup.labelDataPoints || []),
|
19858 | maxNumberOfLabels: resultLabelDataPointsGroup.maxNumberOfLabels
|
19859 | });
|
19860 | } else {
|
19861 | var resultsLabelDataPoints = result.labelDataPoints || [];
|
19862 | labelDataPointGroups.push({
|
19863 | labelDataPoints: visuals.NewDataLabelUtils.removeDuplicates(resultsLabelDataPoints),
|
19864 | maxNumberOfLabels: resultsLabelDataPoints.length
|
19865 | });
|
19866 | }
|
19867 | labelsAreNumeric = labelsAreNumeric && result.labelsAreNumeric;
|
19868 | }
|
19869 | }
|
19870 | var referenceLineLabels = this.getReferenceLineLabels(axes, plotArea);
|
19871 | if (_.isEmpty(referenceLineLabels) || labelDataPointGroups.unshift({
|
19872 | labelDataPoints: referenceLineLabels,
|
19873 | maxNumberOfLabels: referenceLineLabels.length
|
19874 | }), this.renderDataLabels(labelDataPointGroups, labelsAreNumeric, plotArea, suppressAnimations, visuals.ComboChart.isComboChart(this.type)),
|
19875 | this.interactivityService) {
|
19876 | var behaviorOptions = {
|
19877 | layerOptions: layerBehaviorOptions,
|
19878 | clearCatcher: this.clearCatcher
|
19879 | };
|
19880 | this.interactivityService.bind(dataPoints, this.behavior, behaviorOptions);
|
19881 | }
|
19882 | }, CartesianChart.getPreferredPlotArea = function(categoryCount, categoryThickness, viewport, isScrollable, isScalar, margin, noOuterPadding) {
|
19883 | margin || (margin = {
|
19884 | top: 0,
|
19885 | right: 0,
|
19886 | bottom: 0,
|
19887 | left: 0
|
19888 | });
|
19889 | var plotArea = {
|
19890 | height: viewport.height - margin.top - margin.bottom,
|
19891 | width: viewport.width - margin.left - margin.right
|
19892 | };
|
19893 | if (!isScalar && isScrollable) {
|
19894 | var preferredCategorySpan = CartesianChart.getPreferredCategorySpan(categoryCount, categoryThickness, noOuterPadding);
|
19895 | plotArea.width = Math.max(preferredCategorySpan, plotArea.width);
|
19896 | }
|
19897 | return plotArea;
|
19898 | }, CartesianChart.getPreferredCategorySpan = function(categoryCount, categoryThickness, noOuterPadding) {
|
19899 | var span = categoryThickness * categoryCount;
|
19900 | return noOuterPadding ? span : span + categoryThickness * CartesianChart.OuterPaddingRatio * 2;
|
19901 | }, CartesianChart.getLayout = function(data, options) {
|
19902 | 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;
|
19903 | if (!isScalar && !willScroll) {
|
19904 | var oneOuterPadding = (availableWidth - categoryThickness * visibleCategoryCount) / 2;
|
19905 | outerPaddingRatio = oneOuterPadding / categoryThickness;
|
19906 | }
|
19907 | return !isScalar && isScrollable && (visibleCategoryCount = categoryCount), {
|
19908 | categoryCount: visibleCategoryCount,
|
19909 | categoryThickness: categoryThickness,
|
19910 | outerPaddingRatio: outerPaddingRatio,
|
19911 | isScalar: isScalar
|
19912 | };
|
19913 | }, CartesianChart.getCategoryThickness = function(seriesList, numCategories, plotLength, domain, isScalar, trimOrdinalDataOnOverflow) {
|
19914 | var thickness;
|
19915 | if (2 > numCategories) thickness = plotLength * (1 - CartesianChart.OuterPaddingRatio); else if (isScalar && domain && domain.length > 1) {
|
19916 | var minInterval = CartesianChart.getMinInterval(seriesList), domainSpan = domain[domain.length - 1] - domain[0], ratio = minInterval / (domainSpan + minInterval * CartesianChart.OuterPaddingRatio * 2);
|
19917 | thickness = plotLength * ratio, thickness = Math.max(thickness, CartesianChart.MinScalarRectThickness);
|
19918 | } else thickness = plotLength / (numCategories + 2 * CartesianChart.OuterPaddingRatio),
|
19919 | trimOrdinalDataOnOverflow && (thickness = Math.max(thickness, CartesianChart.MinOrdinalRectThickness));
|
19920 | var maxRectThickness = plotLength / (3 + 2 * CartesianChart.OuterPaddingRatio);
|
19921 | return thickness = Math.min(thickness, maxRectThickness), !isScalar && numCategories >= 3 && trimOrdinalDataOnOverflow ? Math.max(thickness, CartesianChart.MinOrdinalRectThickness) : thickness;
|
19922 | }, CartesianChart.getMinInterval = function(seriesList) {
|
19923 | var minInterval = Number.MAX_VALUE;
|
19924 | if (seriesList.length > 0) for (var series0data = seriesList[0].data.filter(function(d) {
|
19925 | return !d.highlight;
|
19926 | }), i = 0, ilen = series0data.length - 1; ilen > i; i++) minInterval = Math.min(minInterval, Math.abs(series0data[i + 1].categoryValue - series0data[i].categoryValue));
|
19927 | return minInterval;
|
19928 | }, CartesianChart.MinOrdinalRectThickness = 20, CartesianChart.MinScalarRectThickness = 2,
|
19929 | CartesianChart.OuterPaddingRatio = .4, CartesianChart.InnerPaddingRatio = .2, CartesianChart.TickLabelPadding = 2,
|
19930 | CartesianChart.ClassName = "cartesianChart", CartesianChart.PlayAxisBottomMargin = 80,
|
19931 | CartesianChart.FontSize = 11, CartesianChart.FontSizeString = jsCommon.PixelConverter.toString(CartesianChart.FontSize),
|
19932 | CartesianChart.AxisTextProperties = {
|
19933 | fontFamily: "wf_segoe-ui_normal",
|
19934 | fontSize: CartesianChart.FontSizeString
|
19935 | }, CartesianChart;
|
19936 | }();
|
19937 | visuals.CartesianChart = CartesianChart;
|
19938 | var SvgBrush = function() {
|
19939 | function SvgBrush(brushWidth) {
|
19940 | this.brush = d3.svg.brush(), this.brushWidth = brushWidth;
|
19941 | }
|
19942 | return SvgBrush.prototype.init = function(element) {
|
19943 | this.element = element;
|
19944 | }, SvgBrush.prototype.remove = function() {
|
19945 | this.element.selectAll(SvgBrush.Brush.selector).remove(), this.brushGraphicsContext = void 0;
|
19946 | }, SvgBrush.prototype.getExtent = function() {
|
19947 | return this.brush.extent();
|
19948 | }, SvgBrush.prototype.setExtent = function(extent) {
|
19949 | this.brush.extent(extent);
|
19950 | }, SvgBrush.prototype.setScale = function(scale) {
|
19951 | this.isHorizontal ? this.brush.x(scale) : this.brush.y(scale);
|
19952 | }, SvgBrush.prototype.setOrientation = function(isHorizontal) {
|
19953 | this.isHorizontal = isHorizontal;
|
19954 | }, SvgBrush.prototype.renderBrush = function(extentLength, brushX, brushY, scrollCallback) {
|
19955 | var _this = this;
|
19956 | this.brushGraphicsContext || (this.brushGraphicsContext = this.element.append("g").classed(SvgBrush.Brush["class"], !0)),
|
19957 | this.scrollCallback = scrollCallback, this.brush.on("brushstart", function() {
|
19958 | return _this.brushStartExtent = _this.brush.extent();
|
19959 | }).on("brush", function() {
|
19960 | window.requestAnimationFrame(scrollCallback);
|
19961 | }).on("brushend", function() {
|
19962 | _this.resizeExtent(extentLength), _this.updateExtentPosition(extentLength), _this.brushStartExtent = null;
|
19963 | });
|
19964 | var brushContext = this.brushGraphicsContext.attr({
|
19965 | transform: visuals.SVGUtil.translate(brushX, brushY),
|
19966 | "drag-resize-disabled": "true"
|
19967 | }).call(this.brush);
|
19968 | brushContext.selectAll(".resize").remove(), this.isHorizontal ? brushContext.selectAll("rect").attr("height", this.brushWidth) : brushContext.selectAll("rect").attr("width", this.brushWidth);
|
19969 | }, SvgBrush.prototype.scroll = function(scrollBarLength) {
|
19970 | this.updateExtentPosition(scrollBarLength), this.scrollCallback();
|
19971 | }, SvgBrush.prototype.updateExtentPosition = function(scrollBarLength) {
|
19972 | var extent = this.brush.extent(), newStartPos = extent[0], halfScrollBarLen = scrollBarLength / 2;
|
19973 | if (extent[0] === extent[1] && (newStartPos -= halfScrollBarLen), extent[1] - extent[0] > scrollBarLength) {
|
19974 | var halfDragLength = (extent[1] - extent[0]) / 2;
|
19975 | newStartPos = extent[0] < this.brushStartExtent[0] ? extent[0] + halfDragLength - halfScrollBarLen : extent[1] - halfDragLength - halfScrollBarLen;
|
19976 | }
|
19977 | this.isHorizontal ? this.brushGraphicsContext.select(".extent").attr("x", newStartPos) : this.brushGraphicsContext.select(".extent").attr("y", newStartPos);
|
19978 | }, SvgBrush.prototype.resizeExtent = function(extentLength) {
|
19979 | this.isHorizontal ? this.brushGraphicsContext.select(".extent").attr("width", extentLength) : this.brushGraphicsContext.select(".extent").attr("height", extentLength);
|
19980 | }, SvgBrush.Brush = createClassAndSelector("brush"), SvgBrush;
|
19981 | }(), ScrollableAxes = function() {
|
19982 | function ScrollableAxes(axes, svgBrush) {
|
19983 | this.axes = axes, this.brush = svgBrush;
|
19984 | }
|
19985 | return ScrollableAxes.prototype.filterDataToViewport = function(mainAxisScale, layers, axes, scrollScale, extent, visibleCategoryCount) {
|
19986 | if (scrollScale) {
|
19987 | var selected = void 0, data_1 = [], startIndex = visuals.AxisHelper.lookupOrdinalIndex(scrollScale, extent[0]), endIndex = startIndex + visibleCategoryCount, domain = scrollScale.domain();
|
19988 | if (selected = domain.slice(startIndex, endIndex), selected && selected.length > 0) {
|
19989 | for (var i = 0; i < layers.length; i++) data_1[i] = layers[i].setFilteredData(selected[0], selected[selected.length - 1] + 1);
|
19990 | mainAxisScale.domain(selected);
|
19991 | var axisPropsToUpdate = void 0;
|
19992 | axisPropsToUpdate = this.axes.isXScrollBarVisible ? axes.x : axes.y1, axisPropsToUpdate.axis.scale(mainAxisScale),
|
19993 | axisPropsToUpdate.scale(mainAxisScale), axisPropsToUpdate.axis.ticks(selected.length),
|
19994 | axisPropsToUpdate.axis.tickValues(selected);
|
19995 | var tickFormat_1 = axisPropsToUpdate.axis.tickFormat();
|
19996 | axisPropsToUpdate.values = _.map(selected, function(d) {
|
19997 | return tickFormat_1(d);
|
19998 | });
|
19999 | }
|
20000 | }
|
20001 | }, ScrollableAxes.prototype.render = function(axesLayout, layers, suppressAnimations, renderDelegate) {
|
20002 | var _this = this, plotArea = axesLayout.plotArea;
|
20003 | if (!(plotArea.width < 1 || plotArea.height < 1)) {
|
20004 | this.axisScale = null;
|
20005 | var brushX, brushY, scrollbarLength, numVisibleCategories, categoryThickness, newAxisLength;
|
20006 | if (this.axes.isXScrollBarVisible) {
|
20007 | this.axisScale = axesLayout.axes.x.scale, brushX = axesLayout.margin.left, brushY = axesLayout.viewport.height,
|
20008 | categoryThickness = axesLayout.axes.x.categoryThickness;
|
20009 | var outerPadding = axesLayout.axes.x.outerPadding;
|
20010 | numVisibleCategories = powerbi.Double.floorWithPrecision((plotArea.width - 2 * outerPadding) / categoryThickness),
|
20011 | scrollbarLength = (numVisibleCategories + 1) * categoryThickness, newAxisLength = plotArea.width;
|
20012 | } else {
|
20013 | if (!this.axes.isYScrollBarVisible) return this.brush.remove(), void renderDelegate(layers, axesLayout, suppressAnimations);
|
20014 | this.axisScale = axesLayout.axes.y1.scale, brushX = axesLayout.viewport.width, brushY = axesLayout.margin.top,
|
20015 | categoryThickness = axesLayout.axes.y1.categoryThickness;
|
20016 | var outerPadding = axesLayout.axes.y1.outerPadding;
|
20017 | numVisibleCategories = powerbi.Double.floorWithPrecision((plotArea.height - 2 * outerPadding) / categoryThickness),
|
20018 | scrollbarLength = (numVisibleCategories + 1) * categoryThickness, newAxisLength = plotArea.height;
|
20019 | }
|
20020 | if (!(1 > numVisibleCategories)) {
|
20021 | this.scrollScale = this.axisScale.copy(), this.scrollScale.rangeBands([ 0, scrollbarLength ]),
|
20022 | this.brushMinExtent = this.scrollScale(numVisibleCategories - 1), this.axisScale.rangeBands([ 0, newAxisLength ], CartesianChart.InnerPaddingRatio, CartesianChart.OuterPaddingRatio),
|
20023 | this.brush.setOrientation(this.axes.isXScrollBarVisible), this.brush.setScale(this.scrollScale),
|
20024 | this.brush.setExtent([ 0, this.brushMinExtent ]);
|
20025 | var renderOnScroll = function(extent, suppressAnimations) {
|
20026 | _this.filterDataToViewport(_this.axisScale, layers, axesLayout.axes, _this.scrollScale, extent, numVisibleCategories),
|
20027 | renderDelegate(layers, axesLayout, suppressAnimations);
|
20028 | }, scrollCallback = function() {
|
20029 | return _this.onBrushed(scrollbarLength, renderOnScroll);
|
20030 | };
|
20031 | this.brush.renderBrush(this.brushMinExtent, brushX, brushY, scrollCallback), renderOnScroll(this.brush.getExtent(), suppressAnimations);
|
20032 | }
|
20033 | }
|
20034 | }, ScrollableAxes.prototype.scrollDelta = function(delta) {
|
20035 | if (this.axisScale && !_.isEmpty(this.axisScale.domain())) {
|
20036 | var currentStartIndex = this.axisScale.domain()[0], newStartIndex = currentStartIndex + Math.round(delta / CartesianChart.MinOrdinalRectThickness);
|
20037 | this.scrollTo(newStartIndex);
|
20038 | }
|
20039 | }, ScrollableAxes.prototype.scrollTo = function(startIndex) {
|
20040 | var lastIndex = _.last(this.scrollScale.domain());
|
20041 | startIndex = Math.max(0, Math.min(startIndex, lastIndex));
|
20042 | var extent = this.brush.getExtent(), extentLength = extent[1] - extent[0], halfCategoryThickness = (this.scrollScale(1) - this.scrollScale(0)) / 2;
|
20043 | extent[0] = this.scrollScale(startIndex) + halfCategoryThickness, extent[1] = extent[0] + extentLength + halfCategoryThickness,
|
20044 | this.brush.setExtent(extent);
|
20045 | var scrollbarLength = this.scrollScale.rangeExtent()[1];
|
20046 | ScrollableAxes.clampBrushExtent(this.brush, scrollbarLength, this.brushMinExtent),
|
20047 | this.brush.scroll(scrollbarLength);
|
20048 | }, ScrollableAxes.prototype.onBrushed = function(scrollbarLength, render) {
|
20049 | var brush = this.brush;
|
20050 | ScrollableAxes.clampBrushExtent(this.brush, scrollbarLength, this.brushMinExtent);
|
20051 | var extent = brush.getExtent();
|
20052 | render(extent, !0);
|
20053 | }, ScrollableAxes.clampBrushExtent = function(brush, scrollbarLength, minExtent) {
|
20054 | var extent = brush.getExtent(), width = extent[1] - extent[0];
|
20055 | if (!(width === minExtent && extent[1] <= scrollbarLength && extent[0] >= 0)) {
|
20056 | if (width > minExtent) {
|
20057 | var padding = (width - minExtent) / 2;
|
20058 | extent[0] += padding, extent[1] -= padding;
|
20059 | } else if (minExtent > width) {
|
20060 | var padding = (minExtent - width) / 2;
|
20061 | extent[0] -= padding, extent[1] += padding;
|
20062 | }
|
20063 | extent[0] < 0 ? (extent[0] = 0, extent[1] = minExtent) : extent[0] > scrollbarLength - minExtent && (extent[0] = scrollbarLength - minExtent,
|
20064 | extent[1] = scrollbarLength), brush.setExtent(extent);
|
20065 | }
|
20066 | }, ScrollableAxes.ScrollbarWidth = 10, ScrollableAxes;
|
20067 | }(), SvgCartesianAxes = function() {
|
20068 | function SvgCartesianAxes(axes) {
|
20069 | this.axes = axes;
|
20070 | }
|
20071 | return SvgCartesianAxes.prototype.getScrollableRegion = function() {
|
20072 | return this.axisGraphicsContextScrollable;
|
20073 | }, SvgCartesianAxes.prototype.getLabelsRegion = function() {
|
20074 | return this.labelRegion;
|
20075 | }, SvgCartesianAxes.prototype.getLabelBackground = function() {
|
20076 | return this.labelBackgroundRegion;
|
20077 | }, SvgCartesianAxes.prototype.getXAxis = function() {
|
20078 | return this.xAxisGraphicsContext;
|
20079 | }, SvgCartesianAxes.prototype.getY1Axis = function() {
|
20080 | return this.y1AxisGraphicsContext;
|
20081 | }, SvgCartesianAxes.prototype.getY2Axis = function() {
|
20082 | return this.y2AxisGraphicsContext;
|
20083 | }, SvgCartesianAxes.prototype.update = function(categoryAxisProperties, valueAxisProperties) {
|
20084 | this.categoryAxisProperties = categoryAxisProperties, this.valueAxisProperties = valueAxisProperties;
|
20085 | }, SvgCartesianAxes.prototype.init = function(svg) {
|
20086 | var axisGraphicsContext = this.axisGraphicsContext = svg.append("g").classed(SvgCartesianAxes.AxisGraphicsContext["class"], !0);
|
20087 | this.svgScrollable = svg.append("svg").classed("svgScrollable", !0).style("overflow", "hidden");
|
20088 | var axisGraphicsContextScrollable = this.axisGraphicsContextScrollable = this.svgScrollable.append("g").classed(SvgCartesianAxes.AxisGraphicsContext["class"], !0);
|
20089 | this.labelBackgroundRegion = this.svgScrollable.append("g").classed(visuals.NewDataLabelUtils.labelBackgroundGraphicsContextClass["class"], !0),
|
20090 | this.labelRegion = this.svgScrollable.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0);
|
20091 | var showLinesOnX = this.axes.showLinesOnX, showLinesOnY = this.axes.showLinesOnY, scrollX = showLinesOnY, scrollY = !scrollX;
|
20092 | scrollY ? (this.y1AxisGraphicsContext = axisGraphicsContextScrollable.append("g").attr("class", "y axis"),
|
20093 | this.y2AxisGraphicsContext = axisGraphicsContextScrollable.append("g").attr("class", "y axis")) : (this.y1AxisGraphicsContext = axisGraphicsContext.append("g").attr("class", "y axis"),
|
20094 | this.y2AxisGraphicsContext = axisGraphicsContext.append("g").attr("class", "y axis")),
|
20095 | scrollX ? this.xAxisGraphicsContext = axisGraphicsContextScrollable.append("g").attr("class", "x axis") : this.xAxisGraphicsContext = axisGraphicsContext.append("g").attr("class", "x axis"),
|
20096 | this.xAxisGraphicsContext.classed("showLinesOnAxis", showLinesOnX), this.y1AxisGraphicsContext.classed("showLinesOnAxis", showLinesOnY),
|
20097 | this.y2AxisGraphicsContext.classed("showLinesOnAxis", showLinesOnY), this.xAxisGraphicsContext.classed("hideLinesOnAxis", !showLinesOnX),
|
20098 | this.y1AxisGraphicsContext.classed("hideLinesOnAxis", !showLinesOnY), this.y2AxisGraphicsContext.classed("hideLinesOnAxis", !showLinesOnY);
|
20099 | }, SvgCartesianAxes.updateAnimatedTickTooltips = function(axisSelection, values) {
|
20100 | axisSelection.each("end", function() {
|
20101 | d3.select(this).selectAll("text").append("title").text(function(d, i) {
|
20102 | return values[i];
|
20103 | });
|
20104 | });
|
20105 | }, SvgCartesianAxes.updateTickTooltips = function(axisSelection, values) {
|
20106 | axisSelection.selectAll("text").append("title").text(function(d, i) {
|
20107 | return values[i];
|
20108 | });
|
20109 | }, SvgCartesianAxes.prototype.renderAxes = function(axesLayout, duration, easing) {
|
20110 | void 0 === easing && (easing = "cubic-in-out");
|
20111 | 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;
|
20112 | if (this.axes.shouldRenderAxis(axes.x)) {
|
20113 | xLabelColor = axes.x.isCategoryAxis ? this.categoryAxisProperties && this.categoryAxisProperties.labelColor ? this.categoryAxisProperties.labelColor : null : this.valueAxisProperties && this.valueAxisProperties.labelColor ? this.valueAxisProperties.labelColor : null,
|
20114 | axes.x.axis.orient("bottom"), !axes.x.willLabelsFit && visuals.AxisHelper.isOrdinalScale(axes.x.scale) && axes.x.axis.tickPadding(SvgCartesianAxes.TickPaddingRotatedX);
|
20115 | var xAxisGraphicsElement = this.xAxisGraphicsContext;
|
20116 | duration ? xAxisGraphicsElement.transition().duration(duration).ease(easing).call(axes.x.axis).call(SvgCartesianAxes.updateAnimatedTickTooltips, axes.x.values) : xAxisGraphicsElement.call(axes.x.axis),
|
20117 | xAxisGraphicsElement.call(SvgCartesianAxes.darkenZeroLine).call(SvgCartesianAxes.setAxisLabelColor, xLabelColor);
|
20118 | var xAxisTextNodes = xAxisGraphicsElement.selectAll("text");
|
20119 | 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),
|
20120 | duration || SvgCartesianAxes.updateTickTooltips(xAxisGraphicsElement, axes.x.values);
|
20121 | } else this.xAxisGraphicsContext.selectAll("*").remove();
|
20122 | if (this.axes.shouldRenderAxis(axes.y1)) {
|
20123 | yLabelColor = axes.y1.isCategoryAxis ? this.categoryAxisProperties && this.categoryAxisProperties.labelColor ? this.categoryAxisProperties.labelColor : null : this.valueAxisProperties && this.valueAxisProperties.labelColor ? this.valueAxisProperties.labelColor : null;
|
20124 | var showY1OnRight = this.axes.shouldShowY1OnRight(), y1TickPadding = showY1OnRight ? axesLayout.tickPadding.right : axesLayout.tickPadding.left;
|
20125 | axes.y1.axis.tickSize(-plotArea.width).tickPadding(y1TickPadding).orient(this.axes.getYAxisOrientation().toLowerCase());
|
20126 | var y1AxisGraphicsElement = this.y1AxisGraphicsContext;
|
20127 | if (duration ? y1AxisGraphicsElement.transition().duration(duration).ease(easing).call(axes.y1.axis).call(SvgCartesianAxes.updateAnimatedTickTooltips, axes.y1.values) : y1AxisGraphicsElement.call(axes.y1.axis),
|
20128 | y1AxisGraphicsElement.call(SvgCartesianAxes.darkenZeroLine).call(SvgCartesianAxes.setAxisLabelColor, yLabelColor),
|
20129 | tickLabelMargins.yLeft >= leftRightMarginLimit && y1AxisGraphicsElement.selectAll("text").call(visuals.AxisHelper.LabelLayoutStrategy.clip, leftRightMarginLimit - y1TickPadding, powerbi.TextMeasurementService.svgEllipsis),
|
20130 | duration || SvgCartesianAxes.updateTickTooltips(y1AxisGraphicsElement, axes.y1.values),
|
20131 | !axes.y2 || this.valueAxisProperties && null != this.valueAxisProperties.secShow && !this.valueAxisProperties.secShow) this.y2AxisGraphicsContext.selectAll("*").remove(); else {
|
20132 | y2LabelColor = this.valueAxisProperties && this.valueAxisProperties.secLabelColor ? this.valueAxisProperties.secLabelColor : null;
|
20133 | var y2TickPadding = showY1OnRight ? axesLayout.tickPadding.left : axesLayout.tickPadding.right;
|
20134 | axes.y2.axis.tickSize(SvgCartesianAxes.Y2TickSize).tickPadding(y2TickPadding).orient(showY1OnRight ? visuals.yAxisPosition.left.toLowerCase() : visuals.yAxisPosition.right.toLowerCase());
|
20135 | var y2AxisGraphicsElement = this.y2AxisGraphicsContext;
|
20136 | duration ? y2AxisGraphicsElement.transition().duration(duration).ease(easing).call(axes.y2.axis).call(SvgCartesianAxes.updateAnimatedTickTooltips, axes.y2.values) : y2AxisGraphicsElement.call(axes.y2.axis),
|
20137 | y2AxisGraphicsElement.call(SvgCartesianAxes.darkenZeroLine).call(SvgCartesianAxes.setAxisLabelColor, y2LabelColor),
|
20138 | tickLabelMargins.yRight >= leftRightMarginLimit && y2AxisGraphicsElement.selectAll("text").call(visuals.AxisHelper.LabelLayoutStrategy.clip, leftRightMarginLimit - y2TickPadding, powerbi.TextMeasurementService.svgEllipsis),
|
20139 | duration || SvgCartesianAxes.updateTickTooltips(y2AxisGraphicsElement, axes.y2.values);
|
20140 | }
|
20141 | } else this.y1AxisGraphicsContext.selectAll("*").remove(), this.y2AxisGraphicsContext.selectAll("*").remove();
|
20142 | var axisLabels = axesLayout.axisLabels, chartHasAxisLabels = null != axisLabels.x || null != axisLabels.y || null != axisLabels.y2;
|
20143 | if (chartHasAxisLabels) {
|
20144 | 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 = {
|
20145 | axisLabels: axisLabels,
|
20146 | viewport: viewport,
|
20147 | margin: margin,
|
20148 | hideXAxisTitle: hideXAxisTitle,
|
20149 | hideYAxisTitle: hideYAxisTitle,
|
20150 | hideY2AxisTitle: hideY2AxisTitle,
|
20151 | xLabelColor: xLabelColor,
|
20152 | yLabelColor: yLabelColor,
|
20153 | y2LabelColor: y2LabelColor,
|
20154 | fontSize: SvgCartesianAxes.AxisLabelFontSize
|
20155 | };
|
20156 | this.renderAxesLabels(renderAxisOptions);
|
20157 | } else this.axisGraphicsContext.selectAll(".xAxisLabel").remove(), this.axisGraphicsContext.selectAll(".yAxisLabel").remove();
|
20158 | this.translateAxes(viewport, margin);
|
20159 | }, SvgCartesianAxes.prototype.renderAxesLabels = function(options) {
|
20160 | this.axisGraphicsContext.selectAll(".xAxisLabel").remove(), this.axisGraphicsContext.selectAll(".yAxisLabel").remove();
|
20161 | var margin = options.margin, width = options.viewport.width - (margin.left + margin.right), height = options.viewport.height, fontSize = options.fontSize, heightOffset = fontSize, showOnRight = this.axes.shouldShowY1OnRight();
|
20162 | if (!options.hideXAxisTitle) {
|
20163 | var xAxisLabel = this.axisGraphicsContext.append("text").style("text-anchor", "middle").text(options.axisLabels.x).call(function(text) {
|
20164 | text.each(function() {
|
20165 | var text = d3.select(this);
|
20166 | text.attr({
|
20167 | "class": "xAxisLabel",
|
20168 | transform: visuals.SVGUtil.translate(width / 2, height - heightOffset)
|
20169 | });
|
20170 | });
|
20171 | });
|
20172 | xAxisLabel.style("fill", options.xLabelColor ? options.xLabelColor.solid.color : null),
|
20173 | xAxisLabel.call(visuals.AxisHelper.LabelLayoutStrategy.clip, width, powerbi.TextMeasurementService.svgEllipsis).call(visuals.tooltipUtils.tooltipUpdate, [ options.axisLabels.x ]);
|
20174 | }
|
20175 | if (!options.hideYAxisTitle) {
|
20176 | var yAxisLabel = this.axisGraphicsContext.append("text").style("text-anchor", "middle").text(options.axisLabels.y).call(function(text) {
|
20177 | text.each(function() {
|
20178 | var text = d3.select(this);
|
20179 | text.attr({
|
20180 | "class": "yAxisLabel",
|
20181 | transform: "rotate(-90)",
|
20182 | y: showOnRight ? width + margin.right - fontSize : -margin.left,
|
20183 | x: -((height - margin.top - margin.bottom) / 2),
|
20184 | dy: "1em"
|
20185 | });
|
20186 | });
|
20187 | });
|
20188 | yAxisLabel.style("fill", options.yLabelColor ? options.yLabelColor.solid.color : null),
|
20189 | yAxisLabel.call(visuals.AxisHelper.LabelLayoutStrategy.clip, height - (margin.bottom + margin.top), powerbi.TextMeasurementService.svgEllipsis).call(visuals.tooltipUtils.tooltipUpdate, [ options.axisLabels.y ]);
|
20190 | }
|
20191 | if (!options.hideY2AxisTitle && options.axisLabels.y2) {
|
20192 | var y2AxisLabel = this.axisGraphicsContext.append("text").style("text-anchor", "middle").text(options.axisLabels.y2).call(function(text) {
|
20193 | text.each(function() {
|
20194 | var text = d3.select(this);
|
20195 | text.attr({
|
20196 | "class": "yAxisLabel",
|
20197 | transform: "rotate(-90)",
|
20198 | y: showOnRight ? -margin.left : width + margin.right - fontSize,
|
20199 | x: -((height - margin.top - margin.bottom) / 2),
|
20200 | dy: "1em"
|
20201 | });
|
20202 | });
|
20203 | });
|
20204 | y2AxisLabel.style("fill", options.y2LabelColor ? options.y2LabelColor.solid.color : null),
|
20205 | y2AxisLabel.call(visuals.AxisHelper.LabelLayoutStrategy.clip, height - (margin.bottom + margin.top), powerbi.TextMeasurementService.svgEllipsis).call(visuals.tooltipUtils.tooltipUpdate, [ options.axisLabels.y2 ]);
|
20206 | }
|
20207 | }, SvgCartesianAxes.prototype.translateAxes = function(viewport, margin) {
|
20208 | var width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom), showY1OnRight = this.axes.shouldShowY1OnRight();
|
20209 | this.xAxisGraphicsContext.attr("transform", visuals.SVGUtil.translate(0, height)),
|
20210 | this.y1AxisGraphicsContext.attr("transform", visuals.SVGUtil.translate(showY1OnRight ? width : 0, 0)),
|
20211 | this.y2AxisGraphicsContext.attr("transform", visuals.SVGUtil.translate(showY1OnRight ? 0 : width, 0)),
|
20212 | this.svgScrollable.attr({
|
20213 | x: 0,
|
20214 | width: viewport.width,
|
20215 | height: viewport.height
|
20216 | }), this.axisGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20217 | this.axisGraphicsContextScrollable.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20218 | this.labelRegion.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20219 | this.labelBackgroundRegion.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
20220 | this.axes.isXScrollBarVisible ? (this.svgScrollable.attr({
|
20221 | x: margin.left
|
20222 | }), this.axisGraphicsContextScrollable.attr("transform", visuals.SVGUtil.translate(0, margin.top)),
|
20223 | this.labelRegion.attr("transform", visuals.SVGUtil.translate(0, margin.top)), this.labelBackgroundRegion.attr("transform", visuals.SVGUtil.translate(0, margin.top)),
|
20224 | this.svgScrollable.attr("width", width)) : this.axes.isYScrollBarVisible && this.svgScrollable.attr("height", height + margin.top);
|
20225 | }, SvgCartesianAxes.darkenZeroLine = function(g) {
|
20226 | g.selectAll("g.tick line").classed("zero-line", !1);
|
20227 | var zeroTick = g.selectAll("g.tick").filter(function(data) {
|
20228 | return 0 === data;
|
20229 | }).node();
|
20230 | zeroTick && d3.select(zeroTick).select("line").classed("zero-line", !0);
|
20231 | }, SvgCartesianAxes.setAxisLabelColor = function(g, fill) {
|
20232 | g.selectAll("g.tick text").style("fill", fill ? fill.solid.color : null);
|
20233 | }, SvgCartesianAxes.AxisPadding = {
|
20234 | left: 10,
|
20235 | right: 10,
|
20236 | top: 0,
|
20237 | bottom: 13
|
20238 | }, SvgCartesianAxes.AxisGraphicsContext = createClassAndSelector("axisGraphicsContext"),
|
20239 | SvgCartesianAxes.TickPaddingRotatedX = 5, SvgCartesianAxes.AxisLabelFontSize = 11,
|
20240 | SvgCartesianAxes.Y2TickSize = -6, SvgCartesianAxes;
|
20241 | }();
|
20242 | visuals.SvgCartesianAxes = SvgCartesianAxes;
|
20243 | var CartesianAxes = function() {
|
20244 | function CartesianAxes(isScrollable, scrollbarWidth, trimOrdinalDataOnOverflow) {
|
20245 | this.scrollbarWidth = scrollbarWidth, this.isScrollable = isScrollable, this.maxMarginFactor = CartesianAxes.MaxMarginFactor,
|
20246 | this.yAxisOrientation = visuals.yAxisPosition.left, this.trimOrdinalDataOnOverflow = trimOrdinalDataOnOverflow;
|
20247 | }
|
20248 | return CartesianAxes.prototype.shouldShowY1OnRight = function() {
|
20249 | return this.yAxisOrientation === visuals.yAxisPosition.right;
|
20250 | }, CartesianAxes.prototype.isYAxisCategorical = function() {
|
20251 | return this.layout && this.layout.axes.y1.isCategoryAxis;
|
20252 | }, CartesianAxes.prototype.hasCategoryAxis = function() {
|
20253 | var axes = this.layout && this.layout.axes;
|
20254 | return axes ? this.isYAxisCategorical() ? axes.y1 && null != axes.y1.axis : axes.x && null != axes.x.axis : !1;
|
20255 | }, CartesianAxes.prototype.hasY2Axis = function() {
|
20256 | return this.layout && null != this.layout.axes.y2;
|
20257 | }, CartesianAxes.prototype.getYAxisOrientation = function() {
|
20258 | return this.yAxisOrientation;
|
20259 | }, CartesianAxes.prototype.setAxisLinesVisibility = function(axisLinesVisibility) {
|
20260 | this.showLinesOnX = EnumExtensions.hasFlag(axisLinesVisibility, 3) || EnumExtensions.hasFlag(axisLinesVisibility, 1),
|
20261 | this.showLinesOnY = EnumExtensions.hasFlag(axisLinesVisibility, 3) || EnumExtensions.hasFlag(axisLinesVisibility, 2);
|
20262 | }, CartesianAxes.prototype.setMaxMarginFactor = function(factor) {
|
20263 | this.maxMarginFactor = factor;
|
20264 | }, CartesianAxes.prototype.update = function(dataViews) {
|
20265 | if (dataViews && dataViews.length > 0) {
|
20266 | var dataViewMetadata = dataViews[0].metadata;
|
20267 | this.categoryAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataViewMetadata),
|
20268 | this.valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataViewMetadata);
|
20269 | }
|
20270 | var axisPosition = this.valueAxisProperties.position;
|
20271 | this.yAxisOrientation = axisPosition ? axisPosition.toString() : visuals.yAxisPosition.left;
|
20272 | }, CartesianAxes.prototype.addWarnings = function(warnings) {
|
20273 | var axes = this.layout && this.layout.axes;
|
20274 | (axes && axes.x && axes.x.hasDisallowedZeroInDomain || axes.y1 && axes.y1.hasDisallowedZeroInDomain || axes.y2 && axes.y2.hasDisallowedZeroInDomain) && warnings.unshift(new visuals.ZeroValueWarning());
|
20275 | }, CartesianAxes.prototype.calculateAxes = function(layers, viewport, margin, playAxisControlLayout, textProperties, scrollbarVisible, existingAxisProperties, hideAxisTitles, ensureXDomain, ensureYDomain) {
|
20276 | var mergeResult, visualOptions = {
|
20277 | viewport: viewport,
|
20278 | margin: margin,
|
20279 | forcedXDomain: [ this.categoryAxisProperties ? this.categoryAxisProperties.start : null, this.categoryAxisProperties ? this.categoryAxisProperties.end : null ],
|
20280 | forceMerge: this.valueAxisProperties && this.valueAxisProperties.secShow === !1,
|
20281 | showCategoryAxisLabel: !1,
|
20282 | showValueAxisLabel: !1,
|
20283 | trimOrdinalDataOnOverflow: this.trimOrdinalDataOnOverflow,
|
20284 | categoryAxisScaleType: this.categoryAxisProperties && null != this.categoryAxisProperties.axisScale ? this.categoryAxisProperties.axisScale : DEFAULT_AXIS_SCALE_TYPE,
|
20285 | valueAxisScaleType: this.valueAxisProperties && null != this.valueAxisProperties.axisScale ? this.valueAxisProperties.axisScale : DEFAULT_AXIS_SCALE_TYPE,
|
20286 | categoryAxisDisplayUnits: this.categoryAxisProperties && null != this.categoryAxisProperties.labelDisplayUnits ? this.categoryAxisProperties.labelDisplayUnits : 0,
|
20287 | valueAxisDisplayUnits: this.valueAxisProperties && null != this.valueAxisProperties.labelDisplayUnits ? this.valueAxisProperties.labelDisplayUnits : 0,
|
20288 | categoryAxisPrecision: this.categoryAxisProperties ? visuals.CartesianHelper.getPrecision(this.categoryAxisProperties.labelPrecision) : null,
|
20289 | valueAxisPrecision: this.valueAxisProperties ? visuals.CartesianHelper.getPrecision(this.valueAxisProperties.labelPrecision) : null,
|
20290 | playAxisControlLayout: playAxisControlLayout,
|
20291 | ensureXDomain: ensureXDomain,
|
20292 | ensureYDomain: ensureYDomain
|
20293 | }, skipMerge = this.valueAxisProperties && this.valueAxisProperties.secShow === !0, yAxisWillMerge = !1;
|
20294 | hasMultipleYAxes(layers) && !skipMerge && (mergeResult = tryMergeYDomains(layers, visualOptions),
|
20295 | yAxisWillMerge = mergeResult.merged, yAxisWillMerge ? visualOptions.forcedYDomain = mergeResult.domain : visualOptions.forcedTickCount = mergeResult.tickCount),
|
20296 | this.valueAxisProperties && (visualOptions.forcedYDomain = visuals.AxisHelper.applyCustomizedDomain([ this.valueAxisProperties.start, this.valueAxisProperties.end ], visualOptions.forcedYDomain));
|
20297 | for (var result, layerNumber = 0, len = layers.length; len > layerNumber; layerNumber++) {
|
20298 | var currentlayer = layers[layerNumber];
|
20299 | 1 !== layerNumber || yAxisWillMerge || (visualOptions.forcedYDomain = this.valueAxisProperties ? [ this.valueAxisProperties.secStart, this.valueAxisProperties.secEnd ] : null,
|
20300 | visualOptions.valueAxisScaleType = this.valueAxisProperties && null != this.valueAxisProperties.secAxisScale ? this.valueAxisProperties.secAxisScale : DEFAULT_AXIS_SCALE_TYPE,
|
20301 | visualOptions.valueAxisDisplayUnits = this.valueAxisProperties && null != this.valueAxisProperties.secLabelDisplayUnits ? this.valueAxisProperties.secLabelDisplayUnits : 0,
|
20302 | visualOptions.valueAxisPrecision = this.valueAxisProperties ? visuals.CartesianHelper.getPrecision(this.valueAxisProperties.secLabelPrecision) : null),
|
20303 | visualOptions.showCategoryAxisLabel = !!this.categoryAxisProperties && !!this.categoryAxisProperties.showAxisTitle,
|
20304 | visualOptions.showValueAxisLabel = shouldShowYAxisLabel(layerNumber, this.valueAxisProperties, yAxisWillMerge);
|
20305 | var axes = currentlayer.calculateAxesProperties(visualOptions);
|
20306 | if (0 === layerNumber) result = {
|
20307 | x: axes[0],
|
20308 | y1: axes[1]
|
20309 | }; else if (axes && !result.y2) if (result.x.usingDefaultDomain || _.isEmpty(result.x.dataDomain)) {
|
20310 | visualOptions.showValueAxisLabel = !!this.valueAxisProperties && !!this.valueAxisProperties.showAxisTitle;
|
20311 | var axes_1 = currentlayer.calculateAxesProperties(visualOptions);
|
20312 | result.x = axes_1[0], result.y1 = axes_1[1];
|
20313 | } else currentlayer.overrideXScale(result.x), yAxisWillMerge || axes[1].usingDefaultDomain || (result.y2 = axes[1]);
|
20314 | if (existingAxisProperties && existingAxisProperties.x) result.x.willLabelsFit = existingAxisProperties.x.willLabelsFit,
|
20315 | result.x.willLabelsWordBreak = existingAxisProperties.x.willLabelsWordBreak; else {
|
20316 | var width = viewport.width - (margin.left + margin.right);
|
20317 | result.x.willLabelsFit = visuals.AxisHelper.LabelLayoutStrategy.willLabelsFit(result.x, width, powerbi.TextMeasurementService.measureSvgTextWidth, textProperties),
|
20318 | 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);
|
20319 | }
|
20320 | }
|
20321 | return hideAxisTitles && (result.x.axisLabel = null, result.y1.axisLabel = null,
|
20322 | result.y2 && (result.y2.axisLabel = null)), this.addUnitTypeToAxisLabels(result),
|
20323 | result;
|
20324 | }, CartesianAxes.prototype.negotiateAxes = function(layers, parentViewport, padding, playAxisControlLayout, hideAxisLabels, textProperties, interactivityRightMargin, ensureXDomain, ensureYDomain) {
|
20325 | 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 = {
|
20326 | left: leftRightMarginLimit,
|
20327 | right: leftRightMarginLimit,
|
20328 | top: 0,
|
20329 | bottom: bottomMarginLimit
|
20330 | }, 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 = {
|
20331 | width: viewport.width - (margin.left + margin.right),
|
20332 | height: viewport.height - (margin.top + margin.bottom)
|
20333 | }, isScalar = !1;
|
20334 | _.isEmpty(layers) || layers[0].getVisualCategoryAxisIsScalar && (isScalar = layers[0].getVisualCategoryAxisIsScalar());
|
20335 | var tickLabelMargins = void 0;
|
20336 | tickLabelMargins = visuals.AxisHelper.getTickLabelMargins(plotArea, marginLimits.left, powerbi.TextMeasurementService.measureSvgTextWidth, powerbi.TextMeasurementService.estimateSvgTextHeight, axes, marginLimits.bottom, textProperties, !1, showY1OnRight, renderXAxis, renderY1Axis, renderY2Axis),
|
20337 | margin = this.updateAxisMargins(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, isScalar ? 0 : interactivityRightMargin);
|
20338 | 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;
|
20339 | axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, !1, null, hideAxisLabels, ensureXDomain, ensureYDomain),
|
20340 | plotArea.width = viewport.width - (margin.left + margin.right), plotArea.height = viewport.height - (margin.top + margin.bottom);
|
20341 | 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);
|
20342 | if (this.isXScrollBarVisible = !1, this.isYScrollBarVisible = !1, !allDone) {
|
20343 | tickLabelMargins = visuals.AxisHelper.getTickLabelMargins(plotArea, marginLimits.left, powerbi.TextMeasurementService.measureSvgTextWidth, powerbi.TextMeasurementService.estimateSvgTextHeight, axes, marginLimits.bottom, textProperties, rotateXTickLabels90, showY1OnRight, renderXAxis, renderY1Axis, renderY2Axis),
|
20344 | margin = this.updateAxisMargins(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, isScalar ? 0 : interactivityRightMargin),
|
20345 | axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, rotateXTickLabels90, axes, hideAxisLabels, ensureXDomain, ensureYDomain),
|
20346 | plotArea.width = viewport.width - (margin.left + margin.right), plotArea.height = viewport.height - (margin.top + margin.bottom),
|
20347 | preferredPlotArea = this.getPreferredPlotArea(axes, layers, isScalar);
|
20348 | var willScroll = !this.willAllCategoriesFitInPlotArea(plotArea, preferredPlotArea);
|
20349 | willScroll && (this.showLinesOnY && (this.isXScrollBarVisible = !0, plotArea.height -= this.scrollbarWidth,
|
20350 | viewport.height -= this.scrollbarWidth), this.showLinesOnX && (this.isYScrollBarVisible = !0,
|
20351 | plotArea.width -= this.scrollbarWidth, viewport.width -= this.scrollbarWidth), axes = this.calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, !0, axes, hideAxisLabels, ensureXDomain, ensureYDomain));
|
20352 | }
|
20353 | var axisLabels = hideAxisLabels ? {
|
20354 | x: null,
|
20355 | y: null,
|
20356 | y2: null
|
20357 | } : {
|
20358 | x: axes.x.axisLabel,
|
20359 | y: axes.y1.axisLabel,
|
20360 | y2: axes.y2 ? axes.y2.axisLabel : null
|
20361 | };
|
20362 | return this.layout = {
|
20363 | axes: axes,
|
20364 | axisLabels: axisLabels,
|
20365 | margin: margin,
|
20366 | marginLimits: marginLimits,
|
20367 | viewport: viewport,
|
20368 | plotArea: plotArea,
|
20369 | preferredPlotArea: preferredPlotArea,
|
20370 | tickLabelMargins: tickLabelMargins,
|
20371 | tickPadding: padding,
|
20372 | rotateXTickLabels90: rotateXTickLabels90
|
20373 | }, this.layout;
|
20374 | }, CartesianAxes.prototype.getPreferredPlotArea = function(axes, layers, isScalar) {
|
20375 | var preferredPlotArea;
|
20376 | if (!isScalar && this.isScrollable && !_.isEmpty(layers) && layers[0].getPreferredPlotArea) {
|
20377 | var categoryThickness = this.showLinesOnY ? axes.x.categoryThickness : axes.y1.categoryThickness, categoryCount = this.showLinesOnY ? axes.x.dataDomain.length : axes.y1.dataDomain.length;
|
20378 | preferredPlotArea = layers[0].getPreferredPlotArea(isScalar, categoryCount, categoryThickness);
|
20379 | }
|
20380 | return preferredPlotArea;
|
20381 | }, CartesianAxes.prototype.willAllCategoriesFitInPlotArea = function(plotArea, preferredPlotArea) {
|
20382 | return this.showLinesOnY && preferredPlotArea && powerbi.Double.greaterWithPrecision(preferredPlotArea.width, plotArea.width) ? !1 : !(this.showLinesOnX && preferredPlotArea && powerbi.Double.greaterWithPrecision(preferredPlotArea.height, plotArea.height));
|
20383 | }, CartesianAxes.prototype.updateAxisMargins = function(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, interactivityRightMargin) {
|
20384 | var maxY1Padding = showY1OnRight ? tickLabelMargins.yRight : tickLabelMargins.yLeft, maxY2Padding = showY1OnRight ? tickLabelMargins.yLeft : tickLabelMargins.yRight, maxXAxisBottom = tickLabelMargins.xMax;
|
20385 | maxY1Padding += padding.left, (renderY2Axis && !showY1OnRight || showY1OnRight && renderY1Axis) && (maxY2Padding += padding.right),
|
20386 | maxXAxisBottom += padding.bottom;
|
20387 | var axisLabels = {
|
20388 | x: axes.x.axisLabel,
|
20389 | y: axes.y1.axisLabel,
|
20390 | y2: axes.y2 ? axes.y2.axisLabel : null
|
20391 | };
|
20392 | null != axisLabels.x && (maxXAxisBottom += CartesianAxes.XAxisLabelPadding), null != axisLabels.y && (maxY1Padding += CartesianAxes.YAxisLabelPadding),
|
20393 | null != axisLabels.y2 && (maxY2Padding += CartesianAxes.YAxisLabelPadding);
|
20394 | var margin = powerbi.Prototype.inherit(CartesianAxes.MinimumMargin);
|
20395 | return margin.left = showY1OnRight ? maxY2Padding : maxY1Padding, margin.right = showY1OnRight ? maxY1Padding : maxY2Padding,
|
20396 | margin.right += interactivityRightMargin, margin.bottom = maxXAxisBottom, margin;
|
20397 | }, CartesianAxes.prototype.isLogScaleAllowed = function(axisType) {
|
20398 | var axes = this.layout && this.layout.axes;
|
20399 | if (!axes) return !1;
|
20400 | switch (axisType) {
|
20401 | case 0:
|
20402 | return axes.x.isLogScaleAllowed;
|
20403 |
|
20404 | case 1:
|
20405 | return axes.y1.isLogScaleAllowed;
|
20406 |
|
20407 | case 2:
|
20408 | return axes.y2 && axes.y2.isLogScaleAllowed;
|
20409 | }
|
20410 | }, CartesianAxes.prototype.axesHaveTicks = function(viewport) {
|
20411 | if (!this.layout) return !1;
|
20412 | var margin = this.layout.margin, width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom);
|
20413 | return 0 !== visuals.AxisHelper.getRecommendedNumberOfTicksForXAxis(width) || 0 !== visuals.AxisHelper.getRecommendedNumberOfTicksForYAxis(height);
|
20414 | }, CartesianAxes.prototype.shouldRenderAxisTitle = function(axisProperties, defaultValue, secondary) {
|
20415 | var propertyName = secondary ? "secShowAxisTitle" : "showAxisTitle";
|
20416 | return !!this.getAxisProperty(axisProperties, propertyName, defaultValue);
|
20417 | }, CartesianAxes.prototype.shouldRenderAxis = function(axisProperties, secondary) {
|
20418 | if (void 0 === secondary && (secondary = !1), !axisProperties) return !1;
|
20419 | var propertyName = secondary ? "secShow" : "show";
|
20420 | return this.getAxisProperty(axisProperties, propertyName, !0) && axisProperties.values && axisProperties.values.length > 0;
|
20421 | }, CartesianAxes.prototype.getAxisProperty = function(axisProperties, propertyName, defaultValue) {
|
20422 | if (!axisProperties) return defaultValue;
|
20423 | var properties = axisProperties.isCategoryAxis ? this.categoryAxisProperties : this.valueAxisProperties;
|
20424 | return properties && null != properties[propertyName] ? properties[propertyName] : defaultValue;
|
20425 | }, CartesianAxes.prototype.addUnitTypeToAxisLabels = function(axes) {
|
20426 | var unitType = CartesianAxes.getUnitType(axes.x.formatter);
|
20427 | if (axes.x.isCategoryAxis ? this.categoryAxisHasUnitType = null != unitType : this.valueAxisHasUnitType = null != unitType,
|
20428 | 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)),
|
20429 | unitType = CartesianAxes.getUnitType(axes.y1.formatter), axes.y1.isCategoryAxis ? this.categoryAxisHasUnitType = null != unitType : this.valueAxisHasUnitType = null != unitType,
|
20430 | 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)),
|
20431 | axes.y2) {
|
20432 | var unitType_1 = CartesianAxes.getUnitType(axes.y2.formatter);
|
20433 | this.secondaryValueAxisHasUnitType = null != unitType_1, axes.y2.axisLabel && unitType_1 && (axes.y2.axisLabel = visuals.AxisHelper.createAxisLabel(this.valueAxisProperties, axes.y2.axisLabel, unitType_1, !0));
|
20434 | }
|
20435 | }, CartesianAxes.getUnitType = function(formatter) {
|
20436 | return formatter && formatter.displayUnit && formatter.displayUnit.value > 1 ? formatter.displayUnit.title : void 0;
|
20437 | }, CartesianAxes.YAxisLabelPadding = 20, CartesianAxes.XAxisLabelPadding = 18, CartesianAxes.MaxMarginFactor = .25,
|
20438 | CartesianAxes.MinimumMargin = {
|
20439 | left: 1,
|
20440 | right: 1,
|
20441 | top: 8,
|
20442 | bottom: 25
|
20443 | }, CartesianAxes;
|
20444 | }();
|
20445 | visuals.CartesianAxes = CartesianAxes;
|
20446 | var CartesianLayerFactory;
|
20447 | !function(CartesianLayerFactory) {
|
20448 | function createLayers(type, objects, interactivityService, animator, isScrollable, tooltipsEnabled, lineChartLabelDensityEnabled) {
|
20449 | void 0 === isScrollable && (isScrollable = !1);
|
20450 | var layers = [], cartesianOptions = {
|
20451 | isScrollable: isScrollable,
|
20452 | animator: animator,
|
20453 | interactivityService: interactivityService,
|
20454 | tooltipsEnabled: tooltipsEnabled,
|
20455 | lineChartLabelDensityEnabled: lineChartLabelDensityEnabled
|
20456 | };
|
20457 | switch (type) {
|
20458 | case 1:
|
20459 | layers.push(createLineChartLayer(2, !1, cartesianOptions));
|
20460 | break;
|
20461 |
|
20462 | case 0:
|
20463 | layers.push(createLineChartLayer(1, !1, cartesianOptions));
|
20464 | break;
|
20465 |
|
20466 | case 2:
|
20467 | layers.push(createLineChartLayer(16, !1, cartesianOptions));
|
20468 | break;
|
20469 |
|
20470 | case 9:
|
20471 | layers.push(createScatterChartLayer(cartesianOptions));
|
20472 | break;
|
20473 |
|
20474 | case 12:
|
20475 | layers.push(createWaterfallChartLayer(cartesianOptions));
|
20476 | break;
|
20477 |
|
20478 | case 11:
|
20479 | layers.push(createDataDotChartLayer(cartesianOptions));
|
20480 | break;
|
20481 |
|
20482 | case 4:
|
20483 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedColumn, cartesianOptions));
|
20484 | break;
|
20485 |
|
20486 | case 3:
|
20487 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredColumn, cartesianOptions));
|
20488 | break;
|
20489 |
|
20490 | case 8:
|
20491 | layers.push(createColumnChartLayer(visuals.ColumnChartType.hundredPercentStackedColumn, cartesianOptions));
|
20492 | break;
|
20493 |
|
20494 | case 6:
|
20495 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedBar, cartesianOptions));
|
20496 | break;
|
20497 |
|
20498 | case 5:
|
20499 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredBar, cartesianOptions));
|
20500 | break;
|
20501 |
|
20502 | case 7:
|
20503 | layers.push(createColumnChartLayer(visuals.ColumnChartType.hundredPercentStackedBar, cartesianOptions));
|
20504 | break;
|
20505 |
|
20506 | case 10:
|
20507 | var columnType = getComboColumnType();
|
20508 | layers.push(createColumnChartLayer(columnType, cartesianOptions)), layers.push(createLineChartLayer(1, !0, cartesianOptions));
|
20509 | break;
|
20510 |
|
20511 | case 13:
|
20512 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredColumn, cartesianOptions)),
|
20513 | layers.push(createLineChartLayer(1, !0, cartesianOptions));
|
20514 | break;
|
20515 |
|
20516 | case 14:
|
20517 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedColumn, cartesianOptions)),
|
20518 | layers.push(createLineChartLayer(1, !0, cartesianOptions));
|
20519 | break;
|
20520 |
|
20521 | case 15:
|
20522 | layers.push(createColumnChartLayer(visuals.ColumnChartType.clusteredColumn, cartesianOptions)),
|
20523 | layers.push(createDataDotChartLayer(cartesianOptions));
|
20524 | break;
|
20525 |
|
20526 | case 16:
|
20527 | layers.push(createColumnChartLayer(visuals.ColumnChartType.stackedColumn, cartesianOptions)),
|
20528 | layers.push(createDataDotChartLayer(cartesianOptions));
|
20529 | }
|
20530 | return layers;
|
20531 | }
|
20532 | function createLineChartLayer(type, inComboChart, defaultOptions, isTrendLayer) {
|
20533 | var options = {
|
20534 | animator: defaultOptions.animator,
|
20535 | interactivityService: defaultOptions.interactivityService,
|
20536 | isScrollable: defaultOptions.isScrollable,
|
20537 | tooltipsEnabled: !isTrendLayer && defaultOptions.tooltipsEnabled,
|
20538 | chartType: type,
|
20539 | lineChartLabelDensityEnabled: defaultOptions.lineChartLabelDensityEnabled,
|
20540 | isTrendLayer: isTrendLayer
|
20541 | };
|
20542 | return inComboChart && (options.chartType = 8 | options.chartType), new visuals.LineChart(options);
|
20543 | }
|
20544 | function createScatterChartLayer(defaultOptions) {
|
20545 | return defaultOptions.isScrollable = !1, new visuals.ScatterChart(defaultOptions);
|
20546 | }
|
20547 | function createWaterfallChartLayer(defaultOptions) {
|
20548 | return new visuals.WaterfallChart(defaultOptions);
|
20549 | }
|
20550 | function createDataDotChartLayer(defaultOptions) {
|
20551 | return new visuals.DataDotChart(defaultOptions);
|
20552 | }
|
20553 | function createColumnChartLayer(type, defaultOptions) {
|
20554 | var options = {
|
20555 | animator: defaultOptions.animator,
|
20556 | interactivityService: defaultOptions.interactivityService,
|
20557 | isScrollable: defaultOptions.isScrollable,
|
20558 | tooltipsEnabled: defaultOptions.tooltipsEnabled,
|
20559 | chartType: type
|
20560 | };
|
20561 | return new visuals.ColumnChart(options);
|
20562 | }
|
20563 | function getComboColumnType(objects) {
|
20564 | var columnType = visuals.ColumnChartType.clusteredColumn;
|
20565 | if (objects) {
|
20566 | var comboChartTypes = objects.general;
|
20567 | if (comboChartTypes) {
|
20568 | switch (comboChartTypes.visualType1) {
|
20569 | case "Column":
|
20570 | columnType = visuals.ColumnChartType.clusteredColumn;
|
20571 | break;
|
20572 |
|
20573 | case "ColumnStacked":
|
20574 | columnType = visuals.ColumnChartType.stackedColumn;
|
20575 | }
|
20576 | comboChartTypes.visualType2;
|
20577 | }
|
20578 | }
|
20579 | return columnType;
|
20580 | }
|
20581 | CartesianLayerFactory.createLayers = createLayers;
|
20582 | }(CartesianLayerFactory || (CartesianLayerFactory = {}));
|
20583 | var SharedColorPalette = function() {
|
20584 | function SharedColorPalette(palette) {
|
20585 | this.palette = palette, this.clearPreferredScale();
|
20586 | }
|
20587 | return SharedColorPalette.prototype.getColorScaleByKey = function(scaleKey) {
|
20588 | return this.setPreferredScale(scaleKey), this.preferredScale;
|
20589 | }, SharedColorPalette.prototype.getNewColorScale = function() {
|
20590 | return this.preferredScale;
|
20591 | }, SharedColorPalette.prototype.getColorByIndex = function(index) {
|
20592 | return this.palette.getColorByIndex(index);
|
20593 | }, SharedColorPalette.prototype.getSentimentColors = function() {
|
20594 | return this.palette.getSentimentColors();
|
20595 | }, SharedColorPalette.prototype.getBasePickerColors = function() {
|
20596 | return this.palette.getBasePickerColors();
|
20597 | }, SharedColorPalette.prototype.clearPreferredScale = function() {
|
20598 | this.preferredScale = this.palette.getNewColorScale(), this.rotated = !1;
|
20599 | }, SharedColorPalette.prototype.rotateScale = function() {
|
20600 | this.preferredScale = this.preferredScale.clone(), this.preferredScale.clearAndRotateScale(),
|
20601 | this.rotated = !0;
|
20602 | }, SharedColorPalette.prototype.setPreferredScale = function(scaleKey) {
|
20603 | this.rotated || (this.preferredScale = this.palette.getColorScaleByKey(scaleKey));
|
20604 | }, SharedColorPalette;
|
20605 | }();
|
20606 | visuals.SharedColorPalette = SharedColorPalette;
|
20607 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
20608 | }(powerbi || (powerbi = {}));
|
20609 |
|
20610 | var powerbi;
|
20611 |
|
20612 | !function(powerbi) {
|
20613 | var visuals;
|
20614 | !function(visuals) {
|
20615 | var EnumExtensions = jsCommon.EnumExtensions, DataRoleHelper = powerbi.data.DataRoleHelper, flagBar = 2, flagColumn = 4, flagClustered = 8, flagStacked = 16, flagStacked100 = 32 | flagStacked;
|
20616 | !function(ColumnChartType) {
|
20617 | ColumnChartType[ColumnChartType.clusteredBar = flagBar | flagClustered] = "clusteredBar",
|
20618 | ColumnChartType[ColumnChartType.clusteredColumn = flagColumn | flagClustered] = "clusteredColumn",
|
20619 | ColumnChartType[ColumnChartType.hundredPercentStackedBar = flagBar | flagStacked100] = "hundredPercentStackedBar",
|
20620 | ColumnChartType[ColumnChartType.hundredPercentStackedColumn = flagColumn | flagStacked100] = "hundredPercentStackedColumn",
|
20621 | ColumnChartType[ColumnChartType.stackedBar = flagBar | flagStacked] = "stackedBar",
|
20622 | ColumnChartType[ColumnChartType.stackedColumn = flagColumn | flagStacked] = "stackedColumn";
|
20623 | }(visuals.ColumnChartType || (visuals.ColumnChartType = {}));
|
20624 | var ColumnChartType = visuals.ColumnChartType, RoleNames = {
|
20625 | category: "Category",
|
20626 | series: "Series",
|
20627 | y: "Y"
|
20628 | }, ColumnChart = function() {
|
20629 | function ColumnChart(options) {
|
20630 | var chartType = options.chartType;
|
20631 | this.chartType = chartType, this.categoryAxisType = null, this.animator = options.animator,
|
20632 | this.isScrollable = options.isScrollable, this.tooltipsEnabled = options.tooltipsEnabled,
|
20633 | this.interactivityService = options.interactivityService;
|
20634 | }
|
20635 | return ColumnChart.customizeQuery = function(options) {
|
20636 | var dataViewMapping = options.dataViewMappings[0];
|
20637 | if (dataViewMapping && dataViewMapping.categorical && dataViewMapping.categorical.categories && (dataViewMapping.categorical.dataVolume = 4,
|
20638 | visuals.CartesianChart.detectScalarMapping(dataViewMapping))) {
|
20639 | var dataViewCategories = dataViewMapping.categorical.categories;
|
20640 | dataViewCategories.dataReductionAlgorithm = {
|
20641 | sample: {}
|
20642 | };
|
20643 | }
|
20644 | }, ColumnChart.getSortableRoles = function(options) {
|
20645 | var dataViewMapping = options.dataViewMappings[0];
|
20646 | if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories) return null;
|
20647 | var dataViewCategories = dataViewMapping.categorical.categories, categoryItems = dataViewCategories["for"]["in"].items;
|
20648 | if (!_.isEmpty(categoryItems)) {
|
20649 | var categoryType = categoryItems[0].type, objects = void 0;
|
20650 | if (dataViewMapping.metadata && (objects = dataViewMapping.metadata.objects), !visuals.CartesianChart.getIsScalar(objects, visuals.columnChartProps.categoryAxis.axisType, categoryType)) return [ "Category", "Y" ];
|
20651 | }
|
20652 | return null;
|
20653 | }, ColumnChart.prototype.updateVisualMetadata = function(x, y, margin) {
|
20654 | this.xAxisProperties = x, this.yAxisProperties = y, this.margin = margin;
|
20655 | }, ColumnChart.prototype.init = function(options) {
|
20656 | this.svg = options.svg, this.svg.classed(ColumnChart.ColumnChartClassName, !0),
|
20657 | this.unclippedGraphicsContext = this.svg.append("g").classed("columnChartUnclippedGraphicsContext", !0),
|
20658 | this.mainGraphicsContext = this.unclippedGraphicsContext.append("svg").classed("columnChartMainGraphicsContext", !0),
|
20659 | this.style = options.style, this.currentViewport = options.viewport, this.hostService = options.host,
|
20660 | this.interactivity = options.interactivity, this.colors = this.style.colorPalette.dataColors,
|
20661 | this.cartesianVisualHost = options.cartesianHost, this.options = options, this.isComboChart = visuals.ComboChart.isComboChart(options.chartType),
|
20662 | this.element = options.element;
|
20663 | }, ColumnChart.prototype.getCategoryLayout = function(numCategoryValues, options) {
|
20664 | var availableWidth;
|
20665 | availableWidth = ColumnChart.isBar(this.chartType) ? this.currentViewport.height - (this.margin.top + this.margin.bottom) : this.currentViewport.width - (this.margin.left + this.margin.right);
|
20666 | 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);
|
20667 | return visuals.CartesianChart.getLayout(this.data, {
|
20668 | availableWidth: availableWidth,
|
20669 | categoryCount: numCategoryValues,
|
20670 | domain: domain,
|
20671 | isScalar: isScalar,
|
20672 | isScrollable: this.isScrollable,
|
20673 | trimOrdinalDataOnOverflow: options.trimOrdinalDataOnOverflow
|
20674 | });
|
20675 | }, ColumnChart.converter = function(dataView, colors, is100PercentStacked, isScalar, dataViewMetadata, chartType, interactivityService, tooltipsEnabled) {
|
20676 | void 0 === is100PercentStacked && (is100PercentStacked = !1), void 0 === isScalar && (isScalar = !1),
|
20677 | void 0 === dataViewMetadata && (dataViewMetadata = null), void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
20678 | var xAxisCardProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataViewMetadata), valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataViewMetadata);
|
20679 | isScalar = visuals.CartesianHelper.isScalar(isScalar, xAxisCardProperties);
|
20680 | 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;
|
20681 | if (dataViewMetadata && dataViewMetadata.objects) {
|
20682 | var objects = dataViewMetadata.objects;
|
20683 | defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.columnChartProps.dataPoint.defaultColor),
|
20684 | showAllDataPoints = powerbi.DataViewObjects.getValue(objects, visuals.columnChartProps.dataPoint.showAllDataPoints),
|
20685 | defaultLegendLabelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.columnChartProps.legend.labelColor, visuals.LegendData.DefaultLegendLabelFillColor);
|
20686 | var labelsObj = objects.labels;
|
20687 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, labelSettings);
|
20688 | }
|
20689 | 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), columnSeries = result.series, valuesMetadata = [], j = 0, jlen = legend.length; jlen > j; j++) valuesMetadata.push(seriesSources[j]);
|
20690 | var labels = visuals.converterHelper.createAxesLabels(xAxisCardProperties, valueAxisProperties, categoryMetadata, valuesMetadata);
|
20691 | if (!ColumnChart.isColumn(chartType)) {
|
20692 | var temp = labels.xAxisLabel;
|
20693 | labels.xAxisLabel = labels.yAxisLabel, labels.yAxisLabel = temp;
|
20694 | }
|
20695 | if (interactivityService) {
|
20696 | for (var _i = 0, columnSeries_1 = columnSeries; _i < columnSeries_1.length; _i++) {
|
20697 | var series = columnSeries_1[_i];
|
20698 | interactivityService.applySelectionStateToData(series.data);
|
20699 | }
|
20700 | interactivityService.applySelectionStateToData(legendAndSeriesInfo.legend.dataPoints);
|
20701 | }
|
20702 | return {
|
20703 | categories: categories,
|
20704 | categoryFormatter: categoryFormatter,
|
20705 | series: columnSeries,
|
20706 | valuesMetadata: valuesMetadata,
|
20707 | legendData: legendAndSeriesInfo.legend,
|
20708 | hasHighlights: result.hasHighlights,
|
20709 | categoryMetadata: categoryMetadata,
|
20710 | scalarCategoryAxis: isScalar,
|
20711 | labelSettings: labelSettings,
|
20712 | axesLabels: {
|
20713 | x: labels.xAxisLabel,
|
20714 | y: labels.yAxisLabel
|
20715 | },
|
20716 | hasDynamicSeries: result.hasDynamicSeries,
|
20717 | isMultiMeasure: result.isMultiMeasure,
|
20718 | defaultDataPointColor: defaultDataPointColor,
|
20719 | showAllDataPoints: showAllDataPoints
|
20720 | };
|
20721 | }, ColumnChart.canSupportOverflow = function(chartType, seriesCount) {
|
20722 | return !ColumnChart.isStacked(chartType) || 1 === seriesCount;
|
20723 | }, ColumnChart.createDataPoints = function(dataView, categories, categoryIdentities, legend, seriesObjectsList, converterStrategy, defaultLabelSettings, is100PercentStacked, isScalar, isCategoryAlsoSeries, categoryObjectsList, defaultDataPointColor, chartType, categoryMetadata, tooltipsEnabled) {
|
20724 | void 0 === is100PercentStacked && (is100PercentStacked = !1), void 0 === isScalar && (isScalar = !1);
|
20725 | var dataViewCat = dataView.categorical, grouped = dataViewCat && dataViewCat.values ? dataViewCat.values.grouped() : void 0, categoryCount = categories.length, seriesCount = legend.length, columnSeries = [];
|
20726 | if (1 > seriesCount || 1 > categoryCount) return {
|
20727 | series: columnSeries,
|
20728 | hasHighlights: !1,
|
20729 | hasDynamicSeries: !1,
|
20730 | isMultiMeasure: !1
|
20731 | };
|
20732 | var dvCategories = dataViewCat.categories;
|
20733 | categoryMetadata = _.isEmpty(dvCategories) ? null : dvCategories[0].source;
|
20734 | 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++) {
|
20735 | for (var seriesValues = [], seriesHighlightValues = [], categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
20736 | var value = converterStrategy.getValueBySeriesAndCategory(seriesIndex, categoryIndex);
|
20737 | if (seriesValues[categoryIndex] = value, hasHighlights) {
|
20738 | var highlightValue = converterStrategy.getHighlightBySeriesAndCategory(seriesIndex, categoryIndex);
|
20739 | seriesHighlightValues[categoryIndex] = highlightValue, value >= 0 && highlightValue >= 0 && value >= highlightValue || 0 >= value && 0 >= highlightValue && highlightValue >= value || (highlightsOverflow = !0);
|
20740 | }
|
20741 | }
|
20742 | rawValues.push(seriesValues), hasHighlights && rawHighlightValues.push(seriesHighlightValues);
|
20743 | }
|
20744 | highlightsOverflow && !ColumnChart.canSupportOverflow(chartType, seriesCount) && (highlightsOverflow = !1,
|
20745 | hasHighlights = !1, rawValues = rawHighlightValues);
|
20746 | for (var dataPointObjects = categoryObjectsList, formatStringProp = visuals.columnChartProps.general.formatString, seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
20747 | var seriesDataPoints = [], legendItem = legend[seriesIndex], seriesLabelSettings = void 0;
|
20748 | if (!hasDynamicSeries) {
|
20749 | var labelsSeriesGroup = !_.isEmpty(grouped) && grouped[0].values ? grouped[0].values[seriesIndex] : null, labelObjects = labelsSeriesGroup && labelsSeriesGroup.source && labelsSeriesGroup.source.objects ? labelsSeriesGroup.source.objects.labels : null;
|
20750 | labelObjects && (seriesLabelSettings = powerbi.Prototype.inherit(defaultLabelSettings),
|
20751 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelObjects, seriesLabelSettings));
|
20752 | }
|
20753 | columnSeries.push({
|
20754 | displayName: legendItem.label,
|
20755 | key: "series" + seriesIndex,
|
20756 | index: seriesIndex,
|
20757 | data: seriesDataPoints,
|
20758 | identity: legendItem.identity,
|
20759 | color: legendItem.color,
|
20760 | labelSettings: seriesLabelSettings
|
20761 | }), seriesCount > 1 && (dataPointObjects = seriesObjectsList[seriesIndex]);
|
20762 | for (var valueColumnMetadata = dataViewCat.values[seriesIndex].source, 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++) {
|
20763 | 0 === seriesIndex && (baseValuesPos.push(0), baseValuesNeg.push(0));
|
20764 | var value = visuals.AxisHelper.normalizeNonFiniteNumber(rawValues[seriesIndex][categoryIndex]);
|
20765 | if (!(null == value && seriesIndex > 0)) {
|
20766 | var originalValue = value, categoryValue = categories[categoryIndex];
|
20767 | if ((!isDateTime || null == categoryValue || categoryValue instanceof Date) && (isDateTime && categoryValue && (categoryValue = categoryValue.getTime()),
|
20768 | !isScalar || null != categoryValue && !isNaN(categoryValue))) {
|
20769 | var multipliers = void 0;
|
20770 | is100PercentStacked && (multipliers = visuals.StackedUtil.getStackedMultiplier(dataViewCat, categoryIndex, seriesCount, categoryCount, converterStrategy));
|
20771 | var unadjustedValue = value, isNegative = 0 > value;
|
20772 | multipliers && (value *= isNegative ? multipliers.neg : multipliers.pos);
|
20773 | var valueAbsolute = Math.abs(value), position = void 0;
|
20774 | isNegative ? (position = baseValuesNeg[categoryIndex], isNaN(valueAbsolute) || (baseValuesNeg[categoryIndex] -= valueAbsolute)) : (isNaN(valueAbsolute) || (baseValuesPos[categoryIndex] += valueAbsolute),
|
20775 | position = baseValuesPos[categoryIndex]);
|
20776 | 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 = categories[categoryIndex], color = ColumnChart.getDataPointColor(legendItem, categoryIndex, dataPointObjects), gradientColumnForTooltip = 0 === gradientMeasureIndex ? null : gradientValueColumn, tooltipInfo = void 0;
|
20777 | if (tooltipsEnabled) {
|
20778 | if (tooltipInfo = [], category && tooltipInfo.push({
|
20779 | displayName: category.source.displayName,
|
20780 | value: visuals.converterHelper.formatFromMetadataColumn(rawCategoryValue, category.source, formatStringProp)
|
20781 | }), hasDynamicSeries && (category && category.source === dataViewCat.values.source || tooltipInfo.push({
|
20782 | displayName: dataViewCat.values.source.displayName,
|
20783 | value: visuals.converterHelper.formatFromMetadataColumn(grouped[seriesIndex].name, dataViewCat.values.source, formatStringProp)
|
20784 | })), null != originalValue) {
|
20785 | var valueString = void 0, formattedOriginalValue = visuals.converterHelper.formatFromMetadataColumn(originalValue, valueColumnMetadata, formatStringProp);
|
20786 | if (is100PercentStacked) {
|
20787 | var originalPct = visuals.valueFormatter.format(valueAbsolute, pctFormatString);
|
20788 | valueString = formattedOriginalValue + " (" + originalPct + ")";
|
20789 | } else valueString = formattedOriginalValue;
|
20790 | tooltipInfo.push({
|
20791 | displayName: valueColumnMetadata.displayName,
|
20792 | value: valueString
|
20793 | });
|
20794 | }
|
20795 | gradientColumnForTooltip && null != gradientColumnForTooltip.values[categoryIndex] && tooltipInfo.push({
|
20796 | displayName: gradientColumnForTooltip.source.displayName,
|
20797 | value: visuals.converterHelper.formatFromMetadataColumn(gradientColumnForTooltip.values[categoryIndex], gradientColumnForTooltip.source, formatStringProp)
|
20798 | });
|
20799 | }
|
20800 | var series = columnSeries[seriesIndex], dataPointLabelSettings = series.labelSettings ? series.labelSettings : defaultLabelSettings, labelColor = dataPointLabelSettings.labelColor, lastValue = void 0;
|
20801 | ColumnChart.isStacked(chartType) && (lastValue = this.getStackedLabelColor(isNegative, seriesIndex, seriesCount, categoryIndex, rawValues),
|
20802 | labelColor = lastValue || seriesIndex === seriesCount - 1 && !isNegative ? labelColor : visuals.dataLabelUtils.defaultInsideLabelColor);
|
20803 | var dataPoint = {
|
20804 | categoryValue: categoryValue,
|
20805 | value: value,
|
20806 | position: position,
|
20807 | valueAbsolute: valueAbsolute,
|
20808 | valueOriginal: unadjustedValue,
|
20809 | seriesIndex: seriesIndex,
|
20810 | labelSettings: dataPointLabelSettings,
|
20811 | categoryIndex: categoryIndex,
|
20812 | color: color,
|
20813 | selected: !1,
|
20814 | originalValue: value,
|
20815 | originalPosition: position,
|
20816 | originalValueAbsolute: valueAbsolute,
|
20817 | identity: identity,
|
20818 | key: identity.getKey(),
|
20819 | tooltipInfo: tooltipInfo,
|
20820 | labelFill: labelColor,
|
20821 | labelFormatString: valueColumnMetadata.format,
|
20822 | lastSeries: lastValue,
|
20823 | chartType: chartType
|
20824 | };
|
20825 | if (seriesDataPoints.push(dataPoint), hasHighlights) {
|
20826 | var valueHighlight = rawHighlightValues[seriesIndex][categoryIndex], unadjustedValueHighlight = valueHighlight, highlightedTooltip = !0;
|
20827 | null === valueHighlight && (valueHighlight = 0, highlightedTooltip = !1), is100PercentStacked && (valueHighlight *= multipliers.pos);
|
20828 | var absoluteValueHighlight = Math.abs(valueHighlight), highlightPosition = position;
|
20829 | valueHighlight > 0 ? highlightPosition -= valueAbsolute - absoluteValueHighlight : 0 === valueHighlight && value > 0 && (highlightPosition -= valueAbsolute);
|
20830 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlightedValueAndPct = void 0, highlightedValueFormat = void 0;
|
20831 | if (highlightedTooltip && null != unadjustedValueHighlight && null != valueHighlight) {
|
20832 | var highlightedPct = visuals.valueFormatter.format(valueHighlight, pctFormatString);
|
20833 | highlightedValueFormat = visuals.converterHelper.formatFromMetadataColumn(unadjustedValueHighlight, valueColumnMetadata, formatStringProp),
|
20834 | highlightedValueAndPct = highlightedValueFormat + " (" + highlightedPct + ")";
|
20835 | }
|
20836 | if (tooltipsEnabled) {
|
20837 | var highlightValue = void 0;
|
20838 | highlightValue = is100PercentStacked ? highlightedValueAndPct : highlightedValueFormat,
|
20839 | null != highlightValue && tooltipInfo.push({
|
20840 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
20841 | value: highlightValue
|
20842 | });
|
20843 | }
|
20844 | highlightedTooltip && (dataPoint.tooltipInfo = tooltipInfo);
|
20845 | var highlightDataPoint = {
|
20846 | categoryValue: categoryValue,
|
20847 | value: valueHighlight,
|
20848 | position: highlightPosition,
|
20849 | valueAbsolute: absoluteValueHighlight,
|
20850 | valueOriginal: unadjustedValueHighlight,
|
20851 | seriesIndex: seriesIndex,
|
20852 | labelSettings: dataPointLabelSettings,
|
20853 | categoryIndex: categoryIndex,
|
20854 | color: color,
|
20855 | selected: !1,
|
20856 | highlight: !0,
|
20857 | originalValue: value,
|
20858 | originalPosition: position,
|
20859 | originalValueAbsolute: valueAbsolute,
|
20860 | drawThinner: highlightsOverflow,
|
20861 | identity: highlightIdentity,
|
20862 | key: highlightIdentity.getKey(),
|
20863 | tooltipInfo: tooltipInfo,
|
20864 | labelFormatString: valueColumnMetadata.format,
|
20865 | labelFill: labelColor,
|
20866 | lastSeries: lastValue,
|
20867 | chartType: chartType
|
20868 | };
|
20869 | seriesDataPoints.push(highlightDataPoint);
|
20870 | }
|
20871 | }
|
20872 | }
|
20873 | }
|
20874 | }
|
20875 | return {
|
20876 | series: columnSeries,
|
20877 | hasHighlights: hasHighlights,
|
20878 | hasDynamicSeries: hasDynamicSeries,
|
20879 | isMultiMeasure: isMultiMeasure
|
20880 | };
|
20881 | }, ColumnChart.getDataPointColor = function(legendItem, categoryIndex, dataPointObjects) {
|
20882 | if (dataPointObjects) {
|
20883 | var colorOverride = powerbi.DataViewObjects.getFillColor(dataPointObjects[categoryIndex], visuals.columnChartProps.dataPoint.fill);
|
20884 | if (colorOverride) return colorOverride;
|
20885 | }
|
20886 | return legendItem.color;
|
20887 | }, ColumnChart.getStackedLabelColor = function(isNegative, seriesIndex, seriesCount, categoryIndex, rawValues) {
|
20888 | for (var lastValue = !(isNegative && seriesIndex === seriesCount - 1 && 1 !== seriesCount), i = seriesIndex + 1; seriesCount > i; i++) {
|
20889 | var nextValues = visuals.AxisHelper.normalizeNonFiniteNumber(rawValues[i][categoryIndex]);
|
20890 | if (null !== nextValues && ((!isNegative || isNegative && 0 === seriesIndex) && nextValues > 0 || isNegative && 0 !== seriesIndex)) {
|
20891 | lastValue = !1;
|
20892 | break;
|
20893 | }
|
20894 | }
|
20895 | return lastValue;
|
20896 | }, ColumnChart.sliceSeries = function(series, endIndex, startIndex) {
|
20897 | void 0 === startIndex && (startIndex = 0);
|
20898 | var newSeries = [];
|
20899 | if (series && series.length > 0) for (var i = 0, len = series.length; len > i; i++) {
|
20900 | var iNewSeries = newSeries[i] = powerbi.Prototype.inherit(series[i]);
|
20901 | iNewSeries.data = series[i].data.filter(function(d) {
|
20902 | return d.categoryIndex >= startIndex && d.categoryIndex < endIndex;
|
20903 | });
|
20904 | }
|
20905 | return newSeries;
|
20906 | }, ColumnChart.getInteractiveColumnChartDomElement = function(element) {
|
20907 | return element.children("svg").get(0);
|
20908 | }, ColumnChart.prototype.setData = function(dataViews) {
|
20909 | var is100PctStacked = ColumnChart.isStacked100(this.chartType);
|
20910 | if (this.data = {
|
20911 | categories: [],
|
20912 | categoryFormatter: null,
|
20913 | series: [],
|
20914 | valuesMetadata: [],
|
20915 | legendData: null,
|
20916 | hasHighlights: !1,
|
20917 | categoryMetadata: null,
|
20918 | scalarCategoryAxis: !1,
|
20919 | labelSettings: visuals.dataLabelUtils.getDefaultColumnLabelSettings(is100PctStacked || ColumnChart.isStacked(this.chartType)),
|
20920 | axesLabels: {
|
20921 | x: null,
|
20922 | y: null
|
20923 | },
|
20924 | hasDynamicSeries: !1,
|
20925 | defaultDataPointColor: null,
|
20926 | isMultiMeasure: !1
|
20927 | }, dataViews.length > 0) {
|
20928 | var dataView = this.dataView = dataViews[0];
|
20929 | if (dataView && dataView.categorical) {
|
20930 | var dvCategories = dataView.categorical.categories, categoryMetadata = dvCategories && dvCategories.length > 0 ? dvCategories[0].source : null, categoryType = visuals.AxisHelper.getCategoryValueType(categoryMetadata);
|
20931 | 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);
|
20932 | }
|
20933 | }
|
20934 | this.setChartStrategy();
|
20935 | }, ColumnChart.prototype.setChartStrategy = function() {
|
20936 | switch (this.chartType) {
|
20937 | case ColumnChartType.clusteredBar:
|
20938 | this.columnChart = new visuals.ClusteredBarChartStrategy();
|
20939 | break;
|
20940 |
|
20941 | case ColumnChartType.clusteredColumn:
|
20942 | this.columnChart = new visuals.ClusteredColumnChartStrategy();
|
20943 | break;
|
20944 |
|
20945 | case ColumnChartType.stackedBar:
|
20946 | case ColumnChartType.hundredPercentStackedBar:
|
20947 | this.columnChart = new visuals.StackedBarChartStrategy();
|
20948 | break;
|
20949 |
|
20950 | case ColumnChartType.stackedColumn:
|
20951 | case ColumnChartType.hundredPercentStackedColumn:
|
20952 | default:
|
20953 | this.columnChart = new visuals.StackedColumnChartStrategy();
|
20954 | }
|
20955 | if (ColumnChart.isStacked(this.chartType) && 1 === this.data.series.length) switch (this.chartType) {
|
20956 | case ColumnChartType.stackedBar:
|
20957 | this.columnChart = new visuals.ClusteredBarChartStrategy();
|
20958 | break;
|
20959 |
|
20960 | case ColumnChartType.stackedColumn:
|
20961 | this.columnChart = new visuals.ClusteredColumnChartStrategy();
|
20962 | }
|
20963 | }, ColumnChart.prototype.calculateLegend = function() {
|
20964 | if (this.interactivity && this.interactivity.isInteractiveLegend) return this.createInteractiveLegendDataPoints(0);
|
20965 | var legendData = this.data ? this.data.legendData : null, legendDataPoints = legendData ? legendData.dataPoints : [];
|
20966 | return _.isEmpty(legendDataPoints) ? null : legendData;
|
20967 | }, ColumnChart.prototype.hasLegend = function() {
|
20968 | return this.data && (this.data.hasDynamicSeries || this.data.series && this.data.series.length > 1);
|
20969 | }, ColumnChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
20970 | switch (options.objectName) {
|
20971 | case "dataPoint":
|
20972 | this.dataView && !visuals.GradientUtils.hasGradientRole(this.dataView.categorical) && this.enumerateDataPoints(enumeration);
|
20973 | break;
|
20974 |
|
20975 | case "labels":
|
20976 | this.enumerateDataLabels(enumeration);
|
20977 | }
|
20978 | }, ColumnChart.prototype.enumerateDataLabels = function(enumeration) {
|
20979 | var data = this.data, labelSettings = this.data.labelSettings, seriesCount = data.series.length, showLabelPerSeries = !data.hasDynamicSeries && (seriesCount > 1 || !data.categoryMetadata);
|
20980 | if (visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings, null, showLabelPerSeries)),
|
20981 | 0 !== seriesCount && showLabelPerSeries && labelSettings.showLabelPerSeries) for (var i = 0; seriesCount > i; i++) {
|
20982 | var series = data.series[i], labelSettings_1 = series.labelSettings ? series.labelSettings : this.data.labelSettings;
|
20983 | enumeration.pushContainer({
|
20984 | displayName: series.displayName
|
20985 | }), visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings_1, series)),
|
20986 | enumeration.popContainer();
|
20987 | }
|
20988 | }, ColumnChart.prototype.getLabelSettingsOptions = function(enumeration, labelSettings, series, showAll) {
|
20989 | return {
|
20990 | enumeration: enumeration,
|
20991 | dataLabelsSettings: labelSettings,
|
20992 | show: !0,
|
20993 | displayUnits: !ColumnChart.isStacked100(this.chartType),
|
20994 | precision: !0,
|
20995 | selector: series && series.identity ? series.identity.getSelector() : null,
|
20996 | showAll: showAll,
|
20997 | fontSize: !0
|
20998 | };
|
20999 | }, ColumnChart.prototype.enumerateDataPoints = function(enumeration) {
|
21000 | var data = this.data;
|
21001 | if (data) {
|
21002 | var seriesCount = data.series.length;
|
21003 | if (0 !== seriesCount) if (data.hasDynamicSeries || seriesCount > 1 || !data.categoryMetadata) for (var i = 0; seriesCount > i; i++) {
|
21004 | var series = data.series[i];
|
21005 | enumeration.pushInstance({
|
21006 | objectName: "dataPoint",
|
21007 | displayName: series.displayName,
|
21008 | selector: visuals.ColorHelper.normalizeSelector(series.identity.getSelector()),
|
21009 | properties: {
|
21010 | fill: {
|
21011 | solid: {
|
21012 | color: series.color
|
21013 | }
|
21014 | }
|
21015 | }
|
21016 | });
|
21017 | } else {
|
21018 | var singleSeriesData = data.series[0].data, categoryFormatter = data.categoryFormatter;
|
21019 | if (enumeration.pushInstance({
|
21020 | objectName: "dataPoint",
|
21021 | selector: null,
|
21022 | properties: {
|
21023 | defaultColor: {
|
21024 | solid: {
|
21025 | color: data.defaultDataPointColor || this.colors.getColorByIndex(0).value
|
21026 | }
|
21027 | }
|
21028 | }
|
21029 | }).pushInstance({
|
21030 | objectName: "dataPoint",
|
21031 | selector: null,
|
21032 | properties: {
|
21033 | showAllDataPoints: !!data.showAllDataPoints
|
21034 | }
|
21035 | }), data.showAllDataPoints) for (var i = 0; i < singleSeriesData.length; i++) {
|
21036 | var singleSeriesDataPoints = singleSeriesData[i], categoryValue = data.categories[i];
|
21037 | enumeration.pushInstance({
|
21038 | objectName: "dataPoint",
|
21039 | displayName: categoryFormatter ? categoryFormatter.format(categoryValue) : categoryValue,
|
21040 | selector: visuals.ColorHelper.normalizeSelector(singleSeriesDataPoints.identity.getSelector(), !0),
|
21041 | properties: {
|
21042 | fill: {
|
21043 | solid: {
|
21044 | color: singleSeriesDataPoints.color
|
21045 | }
|
21046 | }
|
21047 | }
|
21048 | });
|
21049 | }
|
21050 | }
|
21051 | }
|
21052 | }, ColumnChart.prototype.calculateAxesProperties = function(options) {
|
21053 | var data = this.data;
|
21054 | this.currentViewport = options.viewport;
|
21055 | var margin = this.margin = options.margin, origCatgSize = data && data.categories ? data.categories.length : 0, chartLayout = data ? this.getCategoryLayout(origCatgSize, options) : {
|
21056 | categoryCount: 0,
|
21057 | categoryThickness: visuals.CartesianChart.MinOrdinalRectThickness,
|
21058 | outerPaddingRatio: visuals.CartesianChart.OuterPaddingRatio,
|
21059 | isScalar: !1
|
21060 | };
|
21061 | if (this.categoryAxisType = chartLayout.isScalar ? visuals.axisType.scalar : null,
|
21062 | data && !chartLayout.isScalar && !this.isScrollable && options.trimOrdinalDataOnOverflow) {
|
21063 | var catgSize = Math.min(origCatgSize, chartLayout.categoryCount);
|
21064 | catgSize !== origCatgSize && (data = powerbi.Prototype.inherit(data), data.series = ColumnChart.sliceSeries(data.series, catgSize),
|
21065 | data.categories = data.categories.slice(0, catgSize));
|
21066 | }
|
21067 | this.columnChart.setData(data);
|
21068 | var preferredPlotArea = this.getPreferredPlotArea(chartLayout.isScalar, chartLayout.categoryCount, chartLayout.categoryThickness), is100Pct = ColumnChart.isStacked100(this.chartType), chartContext = {
|
21069 | height: preferredPlotArea.height,
|
21070 | width: preferredPlotArea.width,
|
21071 | duration: 0,
|
21072 | hostService: this.hostService,
|
21073 | unclippedGraphicsContext: this.unclippedGraphicsContext,
|
21074 | mainGraphicsContext: this.mainGraphicsContext,
|
21075 | margin: this.margin,
|
21076 | layout: chartLayout,
|
21077 | animator: this.animator,
|
21078 | interactivityService: this.interactivityService,
|
21079 | viewportHeight: this.currentViewport.height - (margin.top + margin.bottom),
|
21080 | viewportWidth: this.currentViewport.width - (margin.left + margin.right),
|
21081 | is100Pct: is100Pct,
|
21082 | isComboChart: this.isComboChart
|
21083 | };
|
21084 | this.ApplyInteractivity(chartContext), this.columnChart.setupVisualProps(chartContext);
|
21085 | var ensureXDomain, ensureYDomain, isBarChart = ColumnChart.isBar(this.chartType);
|
21086 | if (isBarChart) {
|
21087 | var temp = options.forcedXDomain;
|
21088 | options.forcedXDomain = options.forcedYDomain, options.forcedYDomain = temp, ensureXDomain = options.ensureYDomain;
|
21089 | } else ensureYDomain = options.ensureYDomain;
|
21090 | 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),
|
21091 | 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),
|
21092 | options.showCategoryAxisLabel && this.xAxisProperties.isCategoryAxis || options.showValueAxisLabel && !this.xAxisProperties.isCategoryAxis ? this.xAxisProperties.axisLabel = data.axesLabels.x : this.xAxisProperties.axisLabel = null,
|
21093 | options.showValueAxisLabel && !this.yAxisProperties.isCategoryAxis || options.showCategoryAxisLabel && this.yAxisProperties.isCategoryAxis ? this.yAxisProperties.axisLabel = data.axesLabels.y : this.yAxisProperties.axisLabel = null,
|
21094 | [ this.xAxisProperties, this.yAxisProperties ];
|
21095 | }, ColumnChart.prototype.getPreferredPlotArea = function(isScalar, categoryCount, categoryThickness) {
|
21096 | var plotArea = {
|
21097 | height: this.currentViewport.height - this.margin.top - this.margin.bottom,
|
21098 | width: this.currentViewport.width - this.margin.left - this.margin.right
|
21099 | };
|
21100 | if (this.isScrollable && !isScalar) {
|
21101 | var preferredCategorySpan = visuals.CartesianChart.getPreferredCategorySpan(categoryCount, categoryThickness);
|
21102 | ColumnChart.isBar(this.chartType) ? plotArea.height = Math.max(preferredCategorySpan, plotArea.height) : plotArea.width = Math.max(preferredCategorySpan, plotArea.width);
|
21103 | }
|
21104 | return plotArea;
|
21105 | }, ColumnChart.prototype.ApplyInteractivity = function(chartContext) {
|
21106 | var _this = this, interactivity = this.interactivity;
|
21107 | if (interactivity && (interactivity.dragDataPoint && (chartContext.onDragStart = function(datum) {
|
21108 | datum.identity && _this.hostService.onDragStart({
|
21109 | event: d3.event,
|
21110 | data: {
|
21111 | data: datum.identity.getSelector()
|
21112 | }
|
21113 | });
|
21114 | }), interactivity.isInteractiveLegend)) {
|
21115 | var dragMove = function() {
|
21116 | var mousePoint = d3.mouse(_this.mainGraphicsContext[0][0]), x = mousePoint[0], y = mousePoint[1], index = _this.columnChart.getClosestColumnIndex(x, y);
|
21117 | _this.selectColumn(index);
|
21118 | }, ColumnChartSvg = ColumnChart.getInteractiveColumnChartDomElement(this.element);
|
21119 | this.svg.on("click", dragMove), d3.select(ColumnChartSvg).on("click", dragMove).style("touch-action", "none");
|
21120 | var drag = d3.behavior.drag().origin(Object).on("drag", dragMove);
|
21121 | this.svg.call(drag), d3.select(ColumnChartSvg).call(drag);
|
21122 | }
|
21123 | }, ColumnChart.prototype.selectColumn = function(indexOfColumnSelected, force) {
|
21124 | if (void 0 === force && (force = !1), force || this.lastInteractiveSelectedColumnIndex !== indexOfColumnSelected) {
|
21125 | var legendData = this.createInteractiveLegendDataPoints(indexOfColumnSelected), legendDataPoints = legendData.dataPoints;
|
21126 | this.cartesianVisualHost.updateLegend(legendData), legendDataPoints.length > 0 && this.columnChart.selectColumn(indexOfColumnSelected, this.lastInteractiveSelectedColumnIndex),
|
21127 | this.lastInteractiveSelectedColumnIndex = indexOfColumnSelected;
|
21128 | }
|
21129 | }, ColumnChart.prototype.createInteractiveLegendDataPoints = function(columnIndex) {
|
21130 | var data = this.data;
|
21131 | if (!data || _.isEmpty(data.series)) return {
|
21132 | dataPoints: []
|
21133 | };
|
21134 | 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++) {
|
21135 | var measure = converterStrategy.getValueBySeriesAndCategory(i, columnIndex), valueMetadata = data.valuesMetadata[i], formattedLabel = visuals.converterHelper.getFormattedLegendLabel(valueMetadata, this.dataView.categorical.values, formatStringProp), dataPointColor = void 0;
|
21136 | if (1 === allSeries.length) {
|
21137 | var series = allSeries[0];
|
21138 | dataPointColor = series.data.length > columnIndex && series.data[columnIndex].color;
|
21139 | } else dataPointColor = dataPoints.length > i && dataPoints[i].color;
|
21140 | legendDataPoints.push({
|
21141 | color: dataPointColor,
|
21142 | icon: visuals.LegendIcon.Box,
|
21143 | label: formattedLabel,
|
21144 | category: data.categoryFormatter ? data.categoryFormatter.format(category) : category,
|
21145 | measure: visuals.valueFormatter.format(measure, visuals.valueFormatter.getFormatString(valueMetadata, formatStringProp)),
|
21146 | identity: visuals.SelectionId.createNull(),
|
21147 | selected: !1
|
21148 | });
|
21149 | }
|
21150 | return {
|
21151 | dataPoints: legendDataPoints
|
21152 | };
|
21153 | }, ColumnChart.prototype.overrideXScale = function(xProperties) {
|
21154 | this.xAxisProperties = xProperties;
|
21155 | }, ColumnChart.prototype.render = function(suppressAnimations) {
|
21156 | 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);
|
21157 | this.mainGraphicsContext.attr("height", height).attr("width", width), this.tooltipsEnabled && visuals.TooltipManager.addTooltip(columnChartDrawInfo.eventGroup, function(tooltipEvent) {
|
21158 | return tooltipEvent.data.tooltipInfo;
|
21159 | });
|
21160 | var allDataPoints = [], behaviorOptions = void 0;
|
21161 | if (this.interactivityService) {
|
21162 | for (var i = 0, ilen = data.series.length; ilen > i; i++) allDataPoints = allDataPoints.concat(data.series[i].data);
|
21163 | behaviorOptions = {
|
21164 | datapoints: allDataPoints,
|
21165 | eventGroup: columnChartDrawInfo.eventGroup,
|
21166 | bars: columnChartDrawInfo.shapesSelection,
|
21167 | hasHighlights: data.hasHighlights,
|
21168 | mainGraphicsContext: this.mainGraphicsContext,
|
21169 | viewport: columnChartDrawInfo.viewport,
|
21170 | axisOptions: columnChartDrawInfo.axisOptions,
|
21171 | showLabel: data.labelSettings.show
|
21172 | };
|
21173 | }
|
21174 | return this.interactivity && this.interactivity.isInteractiveLegend && this.data.series.length > 0 && this.selectColumn(visuals.CartesianHelper.findMaxCategoryIndex(this.data.series), !0),
|
21175 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), {
|
21176 | dataPoints: allDataPoints,
|
21177 | behaviorOptions: behaviorOptions,
|
21178 | labelDataPoints: columnChartDrawInfo.labelDataPoints,
|
21179 | labelsAreNumeric: !0
|
21180 | };
|
21181 | }, ColumnChart.prototype.onClearSelection = function() {
|
21182 | this.interactivityService && this.interactivityService.clearSelection();
|
21183 | }, ColumnChart.prototype.getVisualCategoryAxisIsScalar = function() {
|
21184 | return this.data ? this.data.scalarCategoryAxis : !1;
|
21185 | }, ColumnChart.prototype.getSupportedCategoryAxisType = function() {
|
21186 | var metaDataColumn = this.data ? this.data.categoryMetadata : void 0, valueType = visuals.AxisHelper.getCategoryValueType(metaDataColumn), isOrdinal = visuals.AxisHelper.isOrdinal(valueType);
|
21187 | return isOrdinal ? visuals.axisType.categorical : visuals.axisType.both;
|
21188 | }, ColumnChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
21189 | var data = powerbi.Prototype.inherit(this.data);
|
21190 | return data.series = ColumnChart.sliceSeries(data.series, endIndex, startIndex),
|
21191 | data.categories = data.categories.slice(startIndex, endIndex), this.columnChart.setData(data),
|
21192 | data;
|
21193 | }, ColumnChart.getLabelFill = function(labelColor, isInside, isCombo) {
|
21194 | return labelColor ? labelColor : isInside && !isCombo ? visuals.NewDataLabelUtils.defaultInsideLabelColor : visuals.NewDataLabelUtils.defaultLabelColor;
|
21195 | }, ColumnChart.prototype.supportsTrendLine = function() {
|
21196 | var isScalar = this.data ? this.data.scalarCategoryAxis : !1;
|
21197 | return this.chartType === ColumnChartType.clusteredColumn && isScalar;
|
21198 | }, ColumnChart.isBar = function(chartType) {
|
21199 | return EnumExtensions.hasFlag(chartType, flagBar);
|
21200 | }, ColumnChart.isColumn = function(chartType) {
|
21201 | return EnumExtensions.hasFlag(chartType, flagColumn);
|
21202 | }, ColumnChart.isClustered = function(chartType) {
|
21203 | return EnumExtensions.hasFlag(chartType, flagClustered);
|
21204 | }, ColumnChart.isStacked = function(chartType) {
|
21205 | return EnumExtensions.hasFlag(chartType, flagStacked);
|
21206 | }, ColumnChart.isStacked100 = function(chartType) {
|
21207 | return EnumExtensions.hasFlag(chartType, flagStacked100);
|
21208 | }, ColumnChart.ColumnChartClassName = "columnChart", ColumnChart.clusteredValidLabelPositions = [ 16, 4, 1, 2 ],
|
21209 | ColumnChart.stackedValidLabelPositions = [ 1, 4, 2 ], ColumnChart.SeriesClasses = jsCommon.CssConstants.createClassAndSelector("series"),
|
21210 | ColumnChart;
|
21211 | }();
|
21212 | visuals.ColumnChart = ColumnChart;
|
21213 | var ColumnChartConverterHelper = function() {
|
21214 | function ColumnChartConverterHelper(dataView) {
|
21215 | this.dataView = dataView && dataView.categorical, this.reader = powerbi.data.createIDataViewCategoricalReader(dataView);
|
21216 | }
|
21217 | return ColumnChartConverterHelper.prototype.getLegend = function(colors, defaultLegendLabelColor, defaultColor) {
|
21218 | var legend = [], seriesSources = [], seriesObjects = [], grouped = !1, colorHelper = new visuals.ColorHelper(colors, visuals.columnChartProps.dataPoint.fill, defaultColor), legendTitle = void 0;
|
21219 | if (this.dataView && this.dataView.values) {
|
21220 | 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++) {
|
21221 | var series = values[valueIndex], source = series.source;
|
21222 | if (!DataRoleHelper.hasRole(source, "Gradient") || DataRoleHelper.hasRole(source, "Y")) {
|
21223 | seriesSources.push(source), seriesObjects.push(series.objects);
|
21224 | 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);
|
21225 | legend.push({
|
21226 | icon: visuals.LegendIcon.Box,
|
21227 | color: color,
|
21228 | label: label,
|
21229 | identity: selectionId,
|
21230 | selected: !1
|
21231 | }), series.identity && void 0 !== source.groupName && (grouped = !0);
|
21232 | }
|
21233 | }
|
21234 | var dvValues = this.dataView.values;
|
21235 | legendTitle = dvValues && dvValues.source ? dvValues.source.displayName : "";
|
21236 | }
|
21237 | var legendData = {
|
21238 | title: legendTitle,
|
21239 | dataPoints: legend,
|
21240 | grouped: grouped,
|
21241 | labelColor: defaultLegendLabelColor
|
21242 | };
|
21243 | return {
|
21244 | legend: legendData,
|
21245 | seriesSources: seriesSources,
|
21246 | seriesObjects: seriesObjects
|
21247 | };
|
21248 | }, ColumnChartConverterHelper.prototype.getValueBySeriesAndCategory = function(series, category) {
|
21249 | if (this.reader.hasDynamicSeries()) {
|
21250 | var grouped = this.dataView.values.grouped();
|
21251 | return grouped[series].values[0].values[category];
|
21252 | }
|
21253 | return this.reader.getValue("Y", category, series);
|
21254 | }, ColumnChartConverterHelper.prototype.getMeasureNameByIndex = function(index) {
|
21255 | return this.dataView.values[index].source.queryName;
|
21256 | }, ColumnChartConverterHelper.prototype.hasHighlightValues = function(series) {
|
21257 | var column = this.dataView && this.dataView.values ? this.dataView.values[series] : void 0;
|
21258 | return column && !!column.highlights;
|
21259 | }, ColumnChartConverterHelper.prototype.getHighlightBySeriesAndCategory = function(series, category) {
|
21260 | return this.dataView.values[series].highlights[category];
|
21261 | }, ColumnChartConverterHelper;
|
21262 | }();
|
21263 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
21264 | }(powerbi || (powerbi = {}));
|
21265 |
|
21266 | var powerbi;
|
21267 |
|
21268 | !function(powerbi) {
|
21269 | var visuals;
|
21270 | !function(visuals) {
|
21271 | var PixelConverter = jsCommon.PixelConverter, ClusteredColumnChartStrategy = function() {
|
21272 | function ClusteredColumnChartStrategy() {}
|
21273 | return ClusteredColumnChartStrategy.prototype.setupVisualProps = function(columnChartProps) {
|
21274 | this.graphicsContext = columnChartProps, this.margin = columnChartProps.margin,
|
21275 | this.width = this.graphicsContext.width, this.height = this.graphicsContext.height,
|
21276 | this.categoryLayout = columnChartProps.layout, this.animator = columnChartProps.animator,
|
21277 | this.interactivityService = columnChartProps.interactivityService, this.viewportHeight = columnChartProps.viewportHeight,
|
21278 | this.viewportWidth = columnChartProps.viewportWidth, this.isComboChart = columnChartProps.isComboChart;
|
21279 | }, ClusteredColumnChartStrategy.prototype.setData = function(data) {
|
21280 | this.data = data;
|
21281 | }, ClusteredColumnChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
21282 | var forcedXMin, forcedXMax, width = this.width;
|
21283 | forcedXDomain && 2 === forcedXDomain.length && (forcedXMin = forcedXDomain[0], forcedXMax = forcedXDomain[1]);
|
21284 | 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;
|
21285 | return this.seriesOffsetScale = d3.scale.ordinal().domain(this.data.series.map(function(s) {
|
21286 | return s.index;
|
21287 | })).rangeBands([ 0, seriesLength * columnWidth ]), props;
|
21288 | }, ClusteredColumnChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain) {
|
21289 | 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);
|
21290 | return this.yProps = visuals.AxisHelper.createAxis({
|
21291 | pixelSpan: height,
|
21292 | dataDomain: combinedDomain,
|
21293 | metaDataColumn: this.data.valuesMetadata[0],
|
21294 | formatString: visuals.valueFormatter.getFormatString(this.data.valuesMetadata[0], visuals.columnChartProps.general.formatString),
|
21295 | outerPadding: 0,
|
21296 | isScalar: !0,
|
21297 | isVertical: !0,
|
21298 | forcedTickCount: forcedTickCount,
|
21299 | useTickIntervalForDisplayUnits: !0,
|
21300 | isCategoryAxis: !1,
|
21301 | scaleType: axisScaleType,
|
21302 | axisDisplayUnits: axisDisplayUnits,
|
21303 | axisPrecision: axisPrecision,
|
21304 | shouldClamp: shouldClamp
|
21305 | }), this.yProps;
|
21306 | }, ClusteredColumnChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21307 | var data = this.data;
|
21308 | this.columnsCenters = null;
|
21309 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio), columnWidth = categoryWidth / data.series.length, axisOptions = {
|
21310 | columnWidth: columnWidth,
|
21311 | categoryWidth: categoryWidth,
|
21312 | xScale: this.xProps.scale,
|
21313 | yScale: this.yProps.scale,
|
21314 | seriesOffsetScale: this.seriesOffsetScale,
|
21315 | isScalar: this.categoryLayout.isScalar,
|
21316 | margin: this.margin
|
21317 | }, clusteredColumnLayout = this.layout = ClusteredColumnChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21318 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21319 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21320 | return this.animator && useAnimation && (result = this.animator.animate({
|
21321 | viewModel: data,
|
21322 | series: series,
|
21323 | layout: clusteredColumnLayout,
|
21324 | itemCS: ClusteredColumnChartStrategy.classes.item,
|
21325 | interactivityService: this.interactivityService,
|
21326 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21327 | viewPort: {
|
21328 | height: this.height,
|
21329 | width: this.width
|
21330 | }
|
21331 | }), 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())),
|
21332 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21333 | {
|
21334 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21335 | shapesSelection: shapes,
|
21336 | viewport: {
|
21337 | height: this.height,
|
21338 | width: this.width
|
21339 | },
|
21340 | axisOptions: axisOptions,
|
21341 | labelDataPoints: labelDataPoints
|
21342 | };
|
21343 | }, ClusteredColumnChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastSelectedColumnIndex) {
|
21344 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, ClusteredColumnChartStrategy.classes.item.selector, selectedColumnIndex, lastSelectedColumnIndex),
|
21345 | this.moveHandle(selectedColumnIndex);
|
21346 | }, ClusteredColumnChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21347 | return visuals.ColumnUtil.getClosestColumnIndex(x, this.getColumnsCenters());
|
21348 | }, ClusteredColumnChartStrategy.prototype.getColumnsCenters = function() {
|
21349 | var _this = this;
|
21350 | if (!this.columnsCenters) {
|
21351 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21352 | if (this.data.series.length > 0) {
|
21353 | var xScaleOffset_1 = 0;
|
21354 | this.categoryLayout.isScalar || (xScaleOffset_1 = categoryWidth / 2);
|
21355 | var firstSeries = this.data.series[0];
|
21356 | this.columnsCenters = firstSeries.data.map(function(d) {
|
21357 | return _this.xProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + xScaleOffset_1;
|
21358 | });
|
21359 | }
|
21360 | }
|
21361 | return this.columnsCenters;
|
21362 | }, ClusteredColumnChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21363 | var columnCenters = this.getColumnsCenters(), x = columnCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21364 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21365 | this.columnSelectionLineHandle) {
|
21366 | var handle = this.columnSelectionLineHandle;
|
21367 | handle.select("line").attr({
|
21368 | x1: x,
|
21369 | x2: x
|
21370 | }), handle.select("circle").attr({
|
21371 | cx: x
|
21372 | });
|
21373 | } else {
|
21374 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21375 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21376 | x1: x,
|
21377 | x2: x,
|
21378 | y1: 0,
|
21379 | y2: this.height
|
21380 | }), handle.append("circle").attr({
|
21381 | cx: x,
|
21382 | cy: this.height,
|
21383 | r: "6px"
|
21384 | }).classed("drag-handle", !0);
|
21385 | }
|
21386 | }, ClusteredColumnChartStrategy.getLayout = function(data, axisOptions) {
|
21387 | 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;
|
21388 | return isScalar && (xScaleOffset = axisOptions.categoryWidth / 2), {
|
21389 | shapeLayout: {
|
21390 | width: function(d) {
|
21391 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21392 | },
|
21393 | x: function(d) {
|
21394 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - xScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21395 | },
|
21396 | y: function(d) {
|
21397 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, Math.max(0, d.value), 0);
|
21398 | },
|
21399 | height: function(d) {
|
21400 | return Math.abs(visuals.AxisHelper.diffScaled(yScale, 0, d.value));
|
21401 | }
|
21402 | },
|
21403 | shapeLayoutWithoutHighlights: {
|
21404 | width: function(d) {
|
21405 | return columnWidth;
|
21406 | },
|
21407 | x: function(d) {
|
21408 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - xScaleOffset;
|
21409 | },
|
21410 | y: function(d) {
|
21411 | return scaledY0 + visuals.AxisHelper.diffScaled(yScale, Math.max(0, d.originalValue), 0);
|
21412 | },
|
21413 | height: function(d) {
|
21414 | return Math.abs(visuals.AxisHelper.diffScaled(yScale, 0, d.originalValue));
|
21415 | }
|
21416 | },
|
21417 | zeroShapeLayout: {
|
21418 | width: function(d) {
|
21419 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21420 | },
|
21421 | x: function(d) {
|
21422 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - xScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21423 | },
|
21424 | y: function(d) {
|
21425 | return scaledY0;
|
21426 | },
|
21427 | height: function(d) {
|
21428 | return 0;
|
21429 | }
|
21430 | }
|
21431 | };
|
21432 | }, ClusteredColumnChartStrategy.prototype.createLabelDataPoints = function() {
|
21433 | 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++) {
|
21434 | var currentSeries = series_2[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21435 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21436 | var dataPoint = _b[_a];
|
21437 | if ((!data.hasHighlights || dataPoint.highlight) && null != dataPoint.value) {
|
21438 | var parentRect = {
|
21439 | left: shapeLayout.x(dataPoint),
|
21440 | top: shapeLayout.y(dataPoint),
|
21441 | width: shapeLayout.width(dataPoint),
|
21442 | height: shapeLayout.height(dataPoint)
|
21443 | }, formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21444 | text: text,
|
21445 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21446 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21447 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21448 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
21449 | labelDataPoints.push({
|
21450 | isPreferred: !0,
|
21451 | text: text,
|
21452 | textSize: {
|
21453 | width: textWidth,
|
21454 | height: textHeight
|
21455 | },
|
21456 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21457 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21458 | parentType: 1,
|
21459 | parentShape: {
|
21460 | rect: parentRect,
|
21461 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
21462 | validPositions: visuals.ColumnChart.clusteredValidLabelPositions
|
21463 | },
|
21464 | identity: dataPoint.identity,
|
21465 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21466 | });
|
21467 | }
|
21468 | }
|
21469 | }
|
21470 | return labelDataPoints;
|
21471 | }, ClusteredColumnChartStrategy.classes = {
|
21472 | item: {
|
21473 | "class": "column",
|
21474 | selector: ".column"
|
21475 | }
|
21476 | }, ClusteredColumnChartStrategy;
|
21477 | }();
|
21478 | visuals.ClusteredColumnChartStrategy = ClusteredColumnChartStrategy;
|
21479 | var ClusteredBarChartStrategy = function() {
|
21480 | function ClusteredBarChartStrategy() {}
|
21481 | return ClusteredBarChartStrategy.prototype.setupVisualProps = function(barChartProps) {
|
21482 | this.graphicsContext = barChartProps, this.margin = barChartProps.margin, this.width = this.graphicsContext.width,
|
21483 | this.height = this.graphicsContext.height, this.categoryLayout = barChartProps.layout,
|
21484 | this.animator = barChartProps.animator, this.interactivityService = barChartProps.interactivityService,
|
21485 | this.viewportHeight = barChartProps.viewportHeight, this.viewportWidth = barChartProps.viewportWidth,
|
21486 | this.isComboChart = barChartProps.isComboChart;
|
21487 | }, ClusteredBarChartStrategy.prototype.setData = function(data) {
|
21488 | this.data = data;
|
21489 | }, ClusteredBarChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain) {
|
21490 | var forcedYMin, forcedYMax, height = this.height;
|
21491 | forcedYDomain && 2 === forcedYDomain.length && (forcedYMin = forcedYDomain[0], forcedYMax = forcedYDomain[1]);
|
21492 | 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;
|
21493 | return this.seriesOffsetScale = d3.scale.ordinal().domain(this.data.series.map(function(s) {
|
21494 | return s.index;
|
21495 | })).rangeBands([ 0, seriesLength * columnWidth ]), props;
|
21496 | }, ClusteredBarChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
21497 | 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);
|
21498 | return this.xProps = visuals.AxisHelper.createAxis({
|
21499 | pixelSpan: width,
|
21500 | dataDomain: combinedDomain,
|
21501 | metaDataColumn: this.data.valuesMetadata[0],
|
21502 | formatString: visuals.valueFormatter.getFormatString(this.data.valuesMetadata[0], visuals.columnChartProps.general.formatString),
|
21503 | outerPadding: 0,
|
21504 | isScalar: !0,
|
21505 | isVertical: !1,
|
21506 | forcedTickCount: forcedTickCount,
|
21507 | useTickIntervalForDisplayUnits: !0,
|
21508 | isCategoryAxis: !1,
|
21509 | scaleType: axisScaleType,
|
21510 | axisDisplayUnits: axisDisplayUnits,
|
21511 | axisPrecision: axisPrecision,
|
21512 | shouldClamp: shouldClamp
|
21513 | }), this.xProps.axis.tickSize(-this.viewportHeight, 0), this.xProps;
|
21514 | }, ClusteredBarChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21515 | var data = this.data;
|
21516 | this.barsCenters = null;
|
21517 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio), columnWidth = categoryWidth / data.series.length, axisOptions = {
|
21518 | columnWidth: columnWidth,
|
21519 | categoryWidth: categoryWidth,
|
21520 | xScale: this.xProps.scale,
|
21521 | yScale: this.yProps.scale,
|
21522 | seriesOffsetScale: this.seriesOffsetScale,
|
21523 | isScalar: this.categoryLayout.isScalar,
|
21524 | margin: this.margin
|
21525 | }, clusteredBarLayout = this.layout = ClusteredBarChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21526 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21527 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21528 | return this.animator && useAnimation && (result = this.animator.animate({
|
21529 | viewModel: data,
|
21530 | series: series,
|
21531 | layout: clusteredBarLayout,
|
21532 | itemCS: ClusteredBarChartStrategy.classes.item,
|
21533 | interactivityService: this.interactivityService,
|
21534 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21535 | viewPort: {
|
21536 | height: this.height,
|
21537 | width: this.width
|
21538 | }
|
21539 | }), 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())),
|
21540 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21541 | {
|
21542 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21543 | shapesSelection: shapes,
|
21544 | viewport: {
|
21545 | height: this.height,
|
21546 | width: this.width
|
21547 | },
|
21548 | axisOptions: axisOptions,
|
21549 | labelDataPoints: labelDataPoints
|
21550 | };
|
21551 | }, ClusteredBarChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastSelectedColumnIndex) {
|
21552 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, ClusteredBarChartStrategy.classes.item.selector, selectedColumnIndex, lastSelectedColumnIndex),
|
21553 | this.moveHandle(selectedColumnIndex);
|
21554 | }, ClusteredBarChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21555 | return visuals.ColumnUtil.getClosestColumnIndex(y, this.getBarsCenters());
|
21556 | }, ClusteredBarChartStrategy.prototype.getBarsCenters = function() {
|
21557 | var _this = this;
|
21558 | if (!this.barsCenters) {
|
21559 | var barWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21560 | if (this.data.series.length > 0) {
|
21561 | var yScaleOffset_1 = 0;
|
21562 | this.categoryLayout.isScalar || (yScaleOffset_1 = barWidth / 2);
|
21563 | var firstSeries = this.data.series[0];
|
21564 | this.barsCenters = firstSeries.data.map(function(d) {
|
21565 | return _this.yProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + yScaleOffset_1;
|
21566 | });
|
21567 | }
|
21568 | }
|
21569 | return this.barsCenters;
|
21570 | }, ClusteredBarChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21571 | var barCenters = this.getBarsCenters(), y = barCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21572 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21573 | this.columnSelectionLineHandle) {
|
21574 | var handle = this.columnSelectionLineHandle;
|
21575 | handle.select("line").attr({
|
21576 | y1: y,
|
21577 | y2: y
|
21578 | }), handle.select("circle").attr({
|
21579 | cy: y
|
21580 | });
|
21581 | } else {
|
21582 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21583 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21584 | x1: 0,
|
21585 | x2: this.width,
|
21586 | y1: y,
|
21587 | y2: y
|
21588 | }), handle.append("circle").attr({
|
21589 | cx: 0,
|
21590 | cy: y,
|
21591 | r: "6px"
|
21592 | }).classed("drag-handle", !0);
|
21593 | }
|
21594 | }, ClusteredBarChartStrategy.getLayout = function(data, axisOptions) {
|
21595 | 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;
|
21596 | return isScalar && (yScaleOffset = axisOptions.categoryWidth / 2), {
|
21597 | shapeLayout: {
|
21598 | width: function(d) {
|
21599 | return Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.value));
|
21600 | },
|
21601 | x: function(d) {
|
21602 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.min(0, d.value), 0);
|
21603 | },
|
21604 | y: function(d) {
|
21605 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - yScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21606 | },
|
21607 | height: function(d) {
|
21608 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21609 | }
|
21610 | },
|
21611 | shapeLayoutWithoutHighlights: {
|
21612 | width: function(d) {
|
21613 | return Math.abs(visuals.AxisHelper.diffScaled(xScale, 0, d.originalValue));
|
21614 | },
|
21615 | x: function(d) {
|
21616 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.min(0, d.originalValue), 0);
|
21617 | },
|
21618 | y: function(d) {
|
21619 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - yScaleOffset;
|
21620 | },
|
21621 | height: function(d) {
|
21622 | return columnWidth;
|
21623 | }
|
21624 | },
|
21625 | zeroShapeLayout: {
|
21626 | width: function(d) {
|
21627 | return 0;
|
21628 | },
|
21629 | x: function(d) {
|
21630 | return scaledX0 + visuals.AxisHelper.diffScaled(xScale, Math.min(0, d.value), 0);
|
21631 | },
|
21632 | y: function(d) {
|
21633 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) + seriesOffsetScale(d.seriesIndex) - yScaleOffset + (d.drawThinner ? quarterColumnWidth : 0);
|
21634 | },
|
21635 | height: function(d) {
|
21636 | return d.drawThinner ? halfColumnWidth : columnWidth;
|
21637 | }
|
21638 | }
|
21639 | };
|
21640 | }, ClusteredBarChartStrategy.prototype.createLabelDataPoints = function() {
|
21641 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_3 = series; _i < series_3.length; _i++) {
|
21642 | var currentSeries = series_3[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21643 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21644 | var dataPoint = _b[_a];
|
21645 | if (!(this.interactivityService && this.interactivityService.hasSelection() && !dataPoint.selected || data.hasHighlights && !dataPoint.highlight || null == dataPoint.value)) {
|
21646 | var formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21647 | text: text,
|
21648 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21649 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21650 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21651 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0), parentRect = {
|
21652 | left: shapeLayout.x(dataPoint),
|
21653 | top: shapeLayout.y(dataPoint),
|
21654 | width: shapeLayout.width(dataPoint),
|
21655 | height: shapeLayout.height(dataPoint)
|
21656 | };
|
21657 | labelDataPoints.push({
|
21658 | isPreferred: !0,
|
21659 | text: text,
|
21660 | textSize: {
|
21661 | width: textWidth,
|
21662 | height: textHeight
|
21663 | },
|
21664 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21665 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21666 | parentType: 1,
|
21667 | parentShape: {
|
21668 | rect: parentRect,
|
21669 | orientation: dataPoint.value >= 0 ? 3 : 4,
|
21670 | validPositions: visuals.ColumnChart.clusteredValidLabelPositions
|
21671 | },
|
21672 | identity: dataPoint.identity,
|
21673 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21674 | });
|
21675 | }
|
21676 | }
|
21677 | }
|
21678 | return labelDataPoints;
|
21679 | }, ClusteredBarChartStrategy.classes = {
|
21680 | item: {
|
21681 | "class": "bar",
|
21682 | selector: ".bar"
|
21683 | }
|
21684 | }, ClusteredBarChartStrategy;
|
21685 | }();
|
21686 | visuals.ClusteredBarChartStrategy = ClusteredBarChartStrategy;
|
21687 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
21688 | }(powerbi || (powerbi = {}));
|
21689 |
|
21690 | var powerbi;
|
21691 |
|
21692 | !function(powerbi) {
|
21693 | var visuals;
|
21694 | !function(visuals) {
|
21695 | var PixelConverter = jsCommon.PixelConverter, StackedColumnChartStrategy = function() {
|
21696 | function StackedColumnChartStrategy() {}
|
21697 | return StackedColumnChartStrategy.prototype.setupVisualProps = function(columnChartProps) {
|
21698 | this.graphicsContext = columnChartProps, this.margin = columnChartProps.margin,
|
21699 | this.width = this.graphicsContext.width, this.height = this.graphicsContext.height,
|
21700 | this.categoryLayout = columnChartProps.layout, this.animator = columnChartProps.animator,
|
21701 | this.interactivityService = columnChartProps.interactivityService, this.viewportHeight = columnChartProps.viewportHeight,
|
21702 | this.viewportWidth = columnChartProps.viewportWidth, this.isComboChart = columnChartProps.isComboChart;
|
21703 | }, StackedColumnChartStrategy.prototype.setData = function(data) {
|
21704 | this.data = data;
|
21705 | }, StackedColumnChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, xReferenceLineValue) {
|
21706 | var forcedXMin, forcedXMax, width = this.width;
|
21707 | forcedXDomain && 2 === forcedXDomain.length && (forcedXMin = forcedXDomain[0], forcedXMax = forcedXDomain[1]);
|
21708 | var props = this.xProps = visuals.ColumnUtil.getCategoryAxis(this.data, width, this.categoryLayout, !1, forcedXMin, forcedXMax, axisScaleType, axisDisplayUnits, axisPrecision, xReferenceLineValue);
|
21709 | return props;
|
21710 | }, StackedColumnChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, y1ReferenceLineValue) {
|
21711 | 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);
|
21712 | return this.yProps = visuals.AxisHelper.createAxis({
|
21713 | pixelSpan: height,
|
21714 | dataDomain: combinedDomain,
|
21715 | metaDataColumn: metadataColumn,
|
21716 | formatString: formatString,
|
21717 | outerPadding: 0,
|
21718 | isScalar: !0,
|
21719 | isVertical: !0,
|
21720 | forcedTickCount: forcedTickCount,
|
21721 | useTickIntervalForDisplayUnits: !0,
|
21722 | isCategoryAxis: !1,
|
21723 | scaleType: axisScaleType,
|
21724 | axisDisplayUnits: axisDisplayUnits,
|
21725 | axisPrecision: axisPrecision,
|
21726 | is100Pct: is100Pct,
|
21727 | shouldClamp: shouldClamp
|
21728 | }), this.yProps;
|
21729 | }, StackedColumnChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21730 | var data = this.data;
|
21731 | this.columnsCenters = null;
|
21732 | var axisOptions = {
|
21733 | columnWidth: this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio),
|
21734 | xScale: this.xProps.scale,
|
21735 | yScale: this.yProps.scale,
|
21736 | isScalar: this.categoryLayout.isScalar,
|
21737 | margin: this.margin
|
21738 | }, stackedColumnLayout = this.layout = StackedColumnChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21739 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21740 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21741 | return this.animator && useAnimation && (result = this.animator.animate({
|
21742 | viewModel: data,
|
21743 | series: series,
|
21744 | layout: stackedColumnLayout,
|
21745 | itemCS: StackedColumnChartStrategy.classes.item,
|
21746 | interactivityService: this.interactivityService,
|
21747 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21748 | viewPort: {
|
21749 | height: this.height,
|
21750 | width: this.width
|
21751 | }
|
21752 | }), 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())),
|
21753 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21754 | {
|
21755 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21756 | shapesSelection: shapes,
|
21757 | viewport: {
|
21758 | height: this.height,
|
21759 | width: this.width
|
21760 | },
|
21761 | axisOptions: axisOptions,
|
21762 | labelDataPoints: labelDataPoints
|
21763 | };
|
21764 | }, StackedColumnChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastSelectedColumnIndex) {
|
21765 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, StackedColumnChartStrategy.classes.item.selector, selectedColumnIndex, lastSelectedColumnIndex),
|
21766 | this.moveHandle(selectedColumnIndex);
|
21767 | }, StackedColumnChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21768 | return visuals.ColumnUtil.getClosestColumnIndex(x, this.getColumnsCenters());
|
21769 | }, StackedColumnChartStrategy.prototype.getColumnsCenters = function() {
|
21770 | var _this = this;
|
21771 | if (!this.columnsCenters) {
|
21772 | var categoryWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21773 | if (this.data.series.length > 0) {
|
21774 | var xScaleOffset_2 = 0;
|
21775 | this.categoryLayout.isScalar || (xScaleOffset_2 = categoryWidth / 2);
|
21776 | var firstSeries = this.data.series[0];
|
21777 | this.columnsCenters = firstSeries.data.map(function(d) {
|
21778 | return _this.xProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + xScaleOffset_2;
|
21779 | });
|
21780 | }
|
21781 | }
|
21782 | return this.columnsCenters;
|
21783 | }, StackedColumnChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21784 | var columnCenters = this.getColumnsCenters(), x = columnCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21785 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21786 | this.columnSelectionLineHandle) {
|
21787 | var handle = this.columnSelectionLineHandle;
|
21788 | handle.select("line").attr({
|
21789 | x1: x,
|
21790 | x2: x
|
21791 | }), handle.select("circle").attr({
|
21792 | cx: x
|
21793 | });
|
21794 | } else {
|
21795 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
21796 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
21797 | x1: x,
|
21798 | x2: x,
|
21799 | y1: 0,
|
21800 | y2: this.height
|
21801 | }), handle.append("circle").attr({
|
21802 | cx: x,
|
21803 | cy: this.height,
|
21804 | r: "6px"
|
21805 | }).classed("drag-handle", !0);
|
21806 | }
|
21807 | }, StackedColumnChartStrategy.getLayout = function(data, axisOptions) {
|
21808 | var columnWidth = axisOptions.columnWidth, isScalar = axisOptions.isScalar, xScale = axisOptions.xScale, yScale = axisOptions.yScale, xScaleOffset = 0;
|
21809 | return isScalar && (xScaleOffset = columnWidth / 2), {
|
21810 | shapeLayout: {
|
21811 | width: function(d) {
|
21812 | return columnWidth;
|
21813 | },
|
21814 | x: function(d) {
|
21815 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) - xScaleOffset;
|
21816 | },
|
21817 | y: function(d) {
|
21818 | return yScale(d.position);
|
21819 | },
|
21820 | height: function(d) {
|
21821 | return yScale(d.position - d.valueAbsolute) - yScale(d.position);
|
21822 | }
|
21823 | },
|
21824 | shapeLayoutWithoutHighlights: {
|
21825 | width: function(d) {
|
21826 | return columnWidth;
|
21827 | },
|
21828 | x: function(d) {
|
21829 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) - xScaleOffset;
|
21830 | },
|
21831 | y: function(d) {
|
21832 | return yScale(d.originalPosition);
|
21833 | },
|
21834 | height: function(d) {
|
21835 | return yScale(d.originalPosition - d.originalValueAbsolute) - yScale(d.originalPosition);
|
21836 | }
|
21837 | },
|
21838 | zeroShapeLayout: {
|
21839 | width: function(d) {
|
21840 | return columnWidth;
|
21841 | },
|
21842 | x: function(d) {
|
21843 | return xScale(isScalar ? d.categoryValue : d.categoryIndex) - xScaleOffset;
|
21844 | },
|
21845 | y: function(d) {
|
21846 | return yScale(d.value >= 0 ? d.position - d.valueAbsolute : d.position);
|
21847 | },
|
21848 | height: function(d) {
|
21849 | return 0;
|
21850 | }
|
21851 | }
|
21852 | };
|
21853 | }, StackedColumnChartStrategy.prototype.createLabelDataPoints = function() {
|
21854 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_4 = series; _i < series_4.length; _i++) {
|
21855 | var currentSeries = series_4[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
21856 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
21857 | var dataPoint = _b[_a];
|
21858 | if ((!data.hasHighlights || dataPoint.highlight) && null != dataPoint.value) {
|
21859 | var parentRect = {
|
21860 | left: shapeLayout.x(dataPoint),
|
21861 | top: shapeLayout.y(dataPoint),
|
21862 | width: shapeLayout.width(dataPoint),
|
21863 | height: shapeLayout.height(dataPoint)
|
21864 | }, formatString = "";
|
21865 | formatString = this.graphicsContext.is100Pct ? visuals.NewDataLabelUtils.hundredPercentFormat : dataPoint.labelFormatString;
|
21866 | var formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
21867 | text: text,
|
21868 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
21869 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
21870 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
21871 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
21872 | labelDataPoints.push({
|
21873 | isPreferred: !0,
|
21874 | text: text,
|
21875 | textSize: {
|
21876 | width: textWidth,
|
21877 | height: textHeight
|
21878 | },
|
21879 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
21880 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
21881 | parentType: 1,
|
21882 | parentShape: {
|
21883 | rect: parentRect,
|
21884 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
21885 | validPositions: visuals.ColumnChart.stackedValidLabelPositions
|
21886 | },
|
21887 | identity: dataPoint.identity,
|
21888 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
21889 | });
|
21890 | }
|
21891 | }
|
21892 | }
|
21893 | return labelDataPoints;
|
21894 | }, StackedColumnChartStrategy.classes = {
|
21895 | item: {
|
21896 | "class": "column",
|
21897 | selector: ".column"
|
21898 | },
|
21899 | highlightItem: {
|
21900 | "class": "highlightColumn",
|
21901 | selector: ".highlightColumn"
|
21902 | }
|
21903 | }, StackedColumnChartStrategy;
|
21904 | }();
|
21905 | visuals.StackedColumnChartStrategy = StackedColumnChartStrategy;
|
21906 | var StackedBarChartStrategy = function() {
|
21907 | function StackedBarChartStrategy() {}
|
21908 | return StackedBarChartStrategy.prototype.setupVisualProps = function(barChartProps) {
|
21909 | this.graphicsContext = barChartProps, this.margin = barChartProps.margin, this.width = this.graphicsContext.width,
|
21910 | this.height = this.graphicsContext.height, this.categoryLayout = barChartProps.layout,
|
21911 | this.animator = barChartProps.animator, this.interactivityService = barChartProps.interactivityService,
|
21912 | this.viewportHeight = barChartProps.viewportHeight, this.viewportWidth = barChartProps.viewportWidth,
|
21913 | this.isComboChart = barChartProps.isComboChart;
|
21914 | }, StackedBarChartStrategy.prototype.setData = function(data) {
|
21915 | this.data = data;
|
21916 | }, StackedBarChartStrategy.prototype.setYScale = function(is100Pct, forcedTickCount, forcedYDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain) {
|
21917 | var forcedYMin, forcedYMax, height = this.height;
|
21918 | forcedYDomain && 2 === forcedYDomain.length && (forcedYMin = forcedYDomain[0], forcedYMax = forcedYDomain[1]);
|
21919 | var props = this.yProps = visuals.ColumnUtil.getCategoryAxis(this.data, height, this.categoryLayout, !0, forcedYMin, forcedYMax, axisScaleType, axisDisplayUnits, axisPrecision, ensureYDomain);
|
21920 | return props;
|
21921 | }, StackedBarChartStrategy.prototype.setXScale = function(is100Pct, forcedTickCount, forcedXDomain, axisScaleType, axisDisplayUnits, axisPrecision, ensureXDomain) {
|
21922 | 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);
|
21923 | return this.xProps = visuals.AxisHelper.createAxis({
|
21924 | pixelSpan: width,
|
21925 | dataDomain: combinedDomain,
|
21926 | metaDataColumn: metadataColumn,
|
21927 | formatString: formatString,
|
21928 | outerPadding: 0,
|
21929 | isScalar: !0,
|
21930 | isVertical: !1,
|
21931 | forcedTickCount: forcedTickCount,
|
21932 | useTickIntervalForDisplayUnits: !0,
|
21933 | isCategoryAxis: !1,
|
21934 | scaleType: axisScaleType,
|
21935 | axisDisplayUnits: axisDisplayUnits,
|
21936 | axisPrecision: axisPrecision,
|
21937 | is100Pct: is100Pct,
|
21938 | shouldClamp: shouldClamp
|
21939 | }), this.xProps.axis.tickSize(-this.viewportHeight, 0), this.xProps;
|
21940 | }, StackedBarChartStrategy.prototype.drawColumns = function(useAnimation) {
|
21941 | var data = this.data;
|
21942 | this.barsCenters = null;
|
21943 | var axisOptions = {
|
21944 | columnWidth: this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio),
|
21945 | xScale: this.xProps.scale,
|
21946 | yScale: this.yProps.scale,
|
21947 | isScalar: this.categoryLayout.isScalar,
|
21948 | margin: this.margin
|
21949 | }, stackedBarLayout = this.layout = StackedBarChartStrategy.getLayout(data, axisOptions), dataLabelSettings = data.labelSettings, labelDataPoints = [];
|
21950 | dataLabelSettings && dataLabelSettings.show && (labelDataPoints = this.createLabelDataPoints());
|
21951 | var result, shapes, series = visuals.ColumnUtil.drawSeries(data, this.graphicsContext.mainGraphicsContext, axisOptions);
|
21952 | return this.animator && useAnimation && (result = this.animator.animate({
|
21953 | viewModel: data,
|
21954 | series: series,
|
21955 | layout: stackedBarLayout,
|
21956 | itemCS: StackedBarChartStrategy.classes.item,
|
21957 | interactivityService: this.interactivityService,
|
21958 | mainGraphicsContext: this.graphicsContext.mainGraphicsContext,
|
21959 | viewPort: {
|
21960 | height: this.height,
|
21961 | width: this.width
|
21962 | }
|
21963 | }), 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())),
|
21964 | visuals.ColumnUtil.applyInteractivity(shapes, this.graphicsContext.onDragStart),
|
21965 | {
|
21966 | eventGroup: this.graphicsContext.mainGraphicsContext,
|
21967 | shapesSelection: shapes,
|
21968 | viewport: {
|
21969 | height: this.height,
|
21970 | width: this.width
|
21971 | },
|
21972 | axisOptions: axisOptions,
|
21973 | labelDataPoints: labelDataPoints
|
21974 | };
|
21975 | }, StackedBarChartStrategy.prototype.selectColumn = function(selectedColumnIndex, lastInteractiveSelectedColumnIndex) {
|
21976 | visuals.ColumnUtil.setChosenColumnOpacity(this.graphicsContext.mainGraphicsContext, StackedBarChartStrategy.classes.item.selector, selectedColumnIndex, lastInteractiveSelectedColumnIndex),
|
21977 | this.moveHandle(selectedColumnIndex);
|
21978 | }, StackedBarChartStrategy.prototype.getClosestColumnIndex = function(x, y) {
|
21979 | return visuals.ColumnUtil.getClosestColumnIndex(y, this.getBarsCenters());
|
21980 | }, StackedBarChartStrategy.prototype.getBarsCenters = function() {
|
21981 | var _this = this;
|
21982 | if (!this.barsCenters) {
|
21983 | var barWidth = this.categoryLayout.categoryThickness * (1 - visuals.CartesianChart.InnerPaddingRatio);
|
21984 | if (this.data.series.length > 0) {
|
21985 | var yScaleOffset_2 = 0;
|
21986 | this.categoryLayout.isScalar || (yScaleOffset_2 = barWidth / 2);
|
21987 | var firstSeries = this.data.series[0];
|
21988 | this.barsCenters = firstSeries.data.map(function(d) {
|
21989 | return _this.yProps.scale(_this.categoryLayout.isScalar ? d.categoryValue : d.categoryIndex) + yScaleOffset_2;
|
21990 | });
|
21991 | }
|
21992 | }
|
21993 | return this.barsCenters;
|
21994 | }, StackedBarChartStrategy.prototype.moveHandle = function(selectedColumnIndex) {
|
21995 | var barCenters = this.getBarsCenters(), y = barCenters[selectedColumnIndex], hoverLine = d3.select(".interactive-hover-line");
|
21996 | if (hoverLine.empty() || this.columnSelectionLineHandle || (this.columnSelectionLineHandle = d3.select(hoverLine.node().parentNode)),
|
21997 | this.columnSelectionLineHandle) {
|
21998 | var handle = this.columnSelectionLineHandle;
|
21999 | handle.select("line").attr({
|
22000 | y1: y,
|
22001 | y2: y
|
22002 | }), handle.select("circle").attr({
|
22003 | cy: y
|
22004 | });
|
22005 | } else {
|
22006 | var handle = this.columnSelectionLineHandle = this.graphicsContext.unclippedGraphicsContext.append("g");
|
22007 | handle.append("line").classed("interactive-hover-line", !0).attr({
|
22008 | x1: 0,
|
22009 | x2: this.width,
|
22010 | y1: y,
|
22011 | y2: y
|
22012 | }), handle.append("circle").classed("drag-handle", !0).attr({
|
22013 | cx: 0,
|
22014 | cy: y,
|
22015 | r: "6px"
|
22016 | });
|
22017 | }
|
22018 | }, StackedBarChartStrategy.getLayout = function(data, axisOptions) {
|
22019 | var columnWidth = axisOptions.columnWidth, isScalar = axisOptions.isScalar, xScale = axisOptions.xScale, yScale = axisOptions.yScale, yScaleOffset = 0;
|
22020 | return isScalar && (yScaleOffset = columnWidth / 2), {
|
22021 | shapeLayout: {
|
22022 | width: function(d) {
|
22023 | return xScale(d.position) - xScale(d.position - d.valueAbsolute);
|
22024 | },
|
22025 | x: function(d) {
|
22026 | return xScale(d.position - d.valueAbsolute);
|
22027 | },
|
22028 | y: function(d) {
|
22029 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) - yScaleOffset;
|
22030 | },
|
22031 | height: function(d) {
|
22032 | return columnWidth;
|
22033 | }
|
22034 | },
|
22035 | shapeLayoutWithoutHighlights: {
|
22036 | width: function(d) {
|
22037 | return xScale(d.originalPosition) - xScale(d.originalPosition - d.originalValueAbsolute);
|
22038 | },
|
22039 | x: function(d) {
|
22040 | return xScale(d.originalPosition - d.originalValueAbsolute);
|
22041 | },
|
22042 | y: function(d) {
|
22043 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) - yScaleOffset;
|
22044 | },
|
22045 | height: function(d) {
|
22046 | return columnWidth;
|
22047 | }
|
22048 | },
|
22049 | zeroShapeLayout: {
|
22050 | width: function(d) {
|
22051 | return 0;
|
22052 | },
|
22053 | x: function(d) {
|
22054 | return xScale(d.value >= 0 ? d.position - d.valueAbsolute : d.position);
|
22055 | },
|
22056 | y: function(d) {
|
22057 | return yScale(isScalar ? d.categoryValue : d.categoryIndex) - yScaleOffset;
|
22058 | },
|
22059 | height: function(d) {
|
22060 | return columnWidth;
|
22061 | }
|
22062 | }
|
22063 | };
|
22064 | }, StackedBarChartStrategy.prototype.createLabelDataPoints = function() {
|
22065 | for (var labelDataPoints = [], data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), shapeLayout = this.layout.shapeLayout, _i = 0, series_5 = series; _i < series_5.length; _i++) {
|
22066 | var currentSeries = series_5[_i], labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : data.labelSettings;
|
22067 | if (labelSettings.show) for (var axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yProps.formatter, labelSettings), _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
22068 | var dataPoint = _b[_a];
|
22069 | if (!(this.interactivityService && this.interactivityService.hasSelection() && !dataPoint.selected || data.hasHighlights && !dataPoint.highlight || null == dataPoint.value)) {
|
22070 | var formatString = void 0;
|
22071 | formatString = this.graphicsContext.is100Pct ? visuals.NewDataLabelUtils.hundredPercentFormat : dataPoint.labelFormatString;
|
22072 | var formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
22073 | text: text,
|
22074 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
22075 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
22076 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
22077 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0), parentRect = {
|
22078 | left: shapeLayout.x(dataPoint),
|
22079 | top: shapeLayout.y(dataPoint),
|
22080 | width: shapeLayout.width(dataPoint),
|
22081 | height: shapeLayout.height(dataPoint)
|
22082 | };
|
22083 | labelDataPoints.push({
|
22084 | isPreferred: !0,
|
22085 | text: text,
|
22086 | textSize: {
|
22087 | width: textWidth,
|
22088 | height: textHeight
|
22089 | },
|
22090 | outsideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !1, this.isComboChart),
|
22091 | insideFill: visuals.ColumnChart.getLabelFill(labelSettings.labelColor, !0, this.isComboChart),
|
22092 | parentType: 1,
|
22093 | parentShape: {
|
22094 | rect: parentRect,
|
22095 | orientation: dataPoint.value >= 0 ? 3 : 4,
|
22096 | validPositions: visuals.ColumnChart.stackedValidLabelPositions
|
22097 | },
|
22098 | identity: dataPoint.identity,
|
22099 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
22100 | });
|
22101 | }
|
22102 | }
|
22103 | }
|
22104 | return labelDataPoints;
|
22105 | }, StackedBarChartStrategy.classes = {
|
22106 | item: {
|
22107 | "class": "bar",
|
22108 | selector: ".bar"
|
22109 | },
|
22110 | highlightItem: {
|
22111 | "class": "highlightBar",
|
22112 | selector: ".highlightBar"
|
22113 | }
|
22114 | }, StackedBarChartStrategy;
|
22115 | }();
|
22116 | visuals.StackedBarChartStrategy = StackedBarChartStrategy;
|
22117 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22118 | }(powerbi || (powerbi = {}));
|
22119 |
|
22120 | var powerbi;
|
22121 |
|
22122 | !function(powerbi) {
|
22123 | var visuals;
|
22124 | !function(visuals) {
|
22125 | var samples;
|
22126 | !function(samples) {
|
22127 | var SelectionManager = visuals.utility.SelectionManager, HelloIVisual = function() {
|
22128 | function HelloIVisual() {}
|
22129 | return HelloIVisual.converter = function(dataView) {
|
22130 | var viewModel = {
|
22131 | size: HelloIVisual.getSize(dataView),
|
22132 | color: HelloIVisual.getFill(dataView).solid.color,
|
22133 | text: HelloIVisual.DefaultText,
|
22134 | toolTipInfo: [ {
|
22135 | displayName: "Test",
|
22136 | value: "1...2....3... can you see me? I am sending random strings to the tooltip"
|
22137 | } ],
|
22138 | selector: visuals.SelectionId.createNull()
|
22139 | }, table = dataView.table;
|
22140 | 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()),
|
22141 | viewModel) : viewModel;
|
22142 | }, HelloIVisual.prototype.init = function(options) {
|
22143 | this.root = d3.select(options.element.get(0)).append("svg").classed("hello", !0),
|
22144 | this.svgText = this.root.append("text").style("cursor", "pointer").style("stroke", "green").style("stroke-width", "0px").attr("text-anchor", "middle"),
|
22145 | this.selectiionManager = new SelectionManager({
|
22146 | hostServices: options.host
|
22147 | });
|
22148 | }, HelloIVisual.prototype.update = function(options) {
|
22149 | if (options.dataViews || options.dataViews[0]) {
|
22150 | var dataView = this.dataView = options.dataViews[0], viewport = options.viewport, viewModel = HelloIVisual.converter(dataView);
|
22151 | this.root.attr({
|
22152 | height: viewport.height,
|
22153 | width: viewport.width
|
22154 | });
|
22155 | var textProperties = {
|
22156 | fontFamily: "tahoma",
|
22157 | fontSize: viewModel.size + "px",
|
22158 | text: viewModel.text
|
22159 | }, textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties), selectionManager = this.selectiionManager;
|
22160 | this.svgText.style({
|
22161 | fill: viewModel.color,
|
22162 | "font-size": textProperties.fontSize,
|
22163 | "font-family": textProperties.fontFamily
|
22164 | }).attr({
|
22165 | y: viewport.height / 2 + textHeight / 3 + "px",
|
22166 | x: viewport.width / 2
|
22167 | }).text(viewModel.text).on("click", function() {
|
22168 | var _this = this;
|
22169 | selectionManager.select(viewModel.selector).then(function(ids) {
|
22170 | return d3.select(_this).style("stroke-width", ids.length > 0 ? "2px" : "0px");
|
22171 | });
|
22172 | }).data([ viewModel ]), visuals.TooltipManager.addTooltip(this.svgText, function(tooltipEvent) {
|
22173 | return tooltipEvent.data.toolTipInfo;
|
22174 | });
|
22175 | }
|
22176 | }, HelloIVisual.getFill = function(dataView) {
|
22177 | if (dataView) {
|
22178 | var objects = dataView.metadata.objects;
|
22179 | if (objects) {
|
22180 | var general = objects.general;
|
22181 | if (general) {
|
22182 | var fill = general.fill;
|
22183 | if (fill) return fill;
|
22184 | }
|
22185 | }
|
22186 | }
|
22187 | return {
|
22188 | solid: {
|
22189 | color: "red"
|
22190 | }
|
22191 | };
|
22192 | }, HelloIVisual.getSize = function(dataView) {
|
22193 | if (dataView) {
|
22194 | var objects = dataView.metadata.objects;
|
22195 | if (objects) {
|
22196 | var general = objects.general;
|
22197 | if (general) {
|
22198 | var size = general.size;
|
22199 | if (size) return size;
|
22200 | }
|
22201 | }
|
22202 | }
|
22203 | return 100;
|
22204 | }, HelloIVisual.prototype.enumerateObjectInstances = function(options) {
|
22205 | var instances = [], dataView = this.dataView;
|
22206 | switch (options.objectName) {
|
22207 | case "general":
|
22208 | var general = {
|
22209 | objectName: "general",
|
22210 | displayName: "General",
|
22211 | selector: null,
|
22212 | properties: {
|
22213 | fill: HelloIVisual.getFill(dataView),
|
22214 | size: HelloIVisual.getSize(dataView)
|
22215 | }
|
22216 | };
|
22217 | instances.push(general);
|
22218 | }
|
22219 | return instances;
|
22220 | }, HelloIVisual.prototype.destroy = function() {
|
22221 | this.root = null;
|
22222 | }, HelloIVisual.capabilities = {
|
22223 | dataRoles: [ {
|
22224 | displayName: "Values",
|
22225 | name: "Values",
|
22226 | kind: powerbi.VisualDataRoleKind.GroupingOrMeasure
|
22227 | } ],
|
22228 | dataViewMappings: [ {
|
22229 | table: {
|
22230 | rows: {
|
22231 | "for": {
|
22232 | "in": "Values"
|
22233 | },
|
22234 | dataReductionAlgorithm: {
|
22235 | window: {
|
22236 | count: 100
|
22237 | }
|
22238 | }
|
22239 | },
|
22240 | rowCount: {
|
22241 | preferred: {
|
22242 | min: 1
|
22243 | }
|
22244 | }
|
22245 | }
|
22246 | } ],
|
22247 | objects: {
|
22248 | general: {
|
22249 | displayName: powerbi.data.createDisplayNameGetter("Visual_General"),
|
22250 | properties: {
|
22251 | fill: {
|
22252 | type: {
|
22253 | fill: {
|
22254 | solid: {
|
22255 | color: !0
|
22256 | }
|
22257 | }
|
22258 | },
|
22259 | displayName: "Fill"
|
22260 | },
|
22261 | size: {
|
22262 | type: {
|
22263 | numeric: !0
|
22264 | },
|
22265 | displayName: "Size"
|
22266 | }
|
22267 | }
|
22268 | }
|
22269 | }
|
22270 | }, HelloIVisual.DefaultText = "Invalid DV", HelloIVisual;
|
22271 | }();
|
22272 | samples.HelloIVisual = HelloIVisual;
|
22273 | }(samples = visuals.samples || (visuals.samples = {}));
|
22274 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22275 | }(powerbi || (powerbi = {}));
|
22276 |
|
22277 | var powerbi;
|
22278 |
|
22279 | !function(powerbi) {
|
22280 | var visuals;
|
22281 | !function(visuals) {
|
22282 | var ComboChart;
|
22283 | !function(ComboChart) {
|
22284 | function enumerateDataPoints(enumeration, options, layers) {
|
22285 | if (layers) {
|
22286 | for (var columnChartLayerIndex, layersLength = layers.length, layerIndex = 0; layersLength > layerIndex; layerIndex++) {
|
22287 | var layer = layers[layerIndex];
|
22288 | if (layer.enumerateObjectInstances) {
|
22289 | if (layer instanceof visuals.ColumnChart) {
|
22290 | columnChartLayerIndex = layerIndex;
|
22291 | continue;
|
22292 | }
|
22293 | layer.enumerateObjectInstances(enumeration, options);
|
22294 | }
|
22295 | }
|
22296 | void 0 !== columnChartLayerIndex && layers[columnChartLayerIndex].enumerateObjectInstances(enumeration, options);
|
22297 | }
|
22298 | }
|
22299 | function customizeQuery(options) {
|
22300 | var columnMapping = !_.isEmpty(options.dataViewMappings) && options.dataViewMappings[0];
|
22301 | if (columnMapping) {
|
22302 | var columnValuesMapping = columnMapping.categorical && columnMapping.categorical.values, seriesSelect = columnValuesMapping.group && !_.isEmpty(columnValuesMapping.group.select) && columnValuesMapping.group.select[0];
|
22303 | _.isEmpty(seriesSelect["for"]["in"].items) && (columnValuesMapping.group.by.items = void 0);
|
22304 | }
|
22305 | columnMapping && columnMapping.categorical && (columnMapping.categorical.dataVolume = 4);
|
22306 | var lineMapping = options.dataViewMappings.length > 1 && options.dataViewMappings[1];
|
22307 | lineMapping && lineMapping.categorical && (lineMapping.categorical.dataVolume = 4);
|
22308 | }
|
22309 | function getSortableRoles(options) {
|
22310 | if (options && options.dataViewMappings.length > 0) {
|
22311 | var dataViewMapping = options.dataViewMappings[0];
|
22312 | if (!visuals.CartesianChart.detectScalarMapping(dataViewMapping)) return [ "Category", "Y", "Y2" ];
|
22313 | }
|
22314 | return null;
|
22315 | }
|
22316 | function isComboChart(chartType) {
|
22317 | return 10 === chartType || 13 === chartType || 14 === chartType || 15 === chartType || 16 === chartType;
|
22318 | }
|
22319 | ComboChart.capabilities = visuals.comboChartCapabilities, ComboChart.enumerateDataPoints = enumerateDataPoints,
|
22320 | ComboChart.customizeQuery = customizeQuery, ComboChart.getSortableRoles = getSortableRoles,
|
22321 | ComboChart.isComboChart = isComboChart;
|
22322 | }(ComboChart = visuals.ComboChart || (visuals.ComboChart = {}));
|
22323 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22324 | }(powerbi || (powerbi = {}));
|
22325 |
|
22326 | var powerbi;
|
22327 |
|
22328 | !function(powerbi) {
|
22329 | var visuals;
|
22330 | !function(visuals) {
|
22331 | var ArrayExtensions = jsCommon.ArrayExtensions, DataColorPalette = function() {
|
22332 | function DataColorPalette(colors, sentimentcolors) {
|
22333 | this.basePickerColors = [ {
|
22334 | value: "#FFFFFF"
|
22335 | }, {
|
22336 | value: "#000000"
|
22337 | }, {
|
22338 | value: "#00B8AA"
|
22339 | }, {
|
22340 | value: "#374649"
|
22341 | }, {
|
22342 | value: "#FD625E"
|
22343 | }, {
|
22344 | value: "#F2C811"
|
22345 | }, {
|
22346 | value: "#5F6B6D"
|
22347 | }, {
|
22348 | value: "#8AD4EB"
|
22349 | }, {
|
22350 | value: "#FE9666"
|
22351 | }, {
|
22352 | value: "#A66999"
|
22353 | } ], this.colors = colors || ThemeManager.getDefaultTheme(), this.sentimentColors = sentimentcolors || ThemeManager.defaultSentimentColors,
|
22354 | this.scales = {};
|
22355 | }
|
22356 | return DataColorPalette.prototype.getColorScaleByKey = function(key) {
|
22357 | var scale = this.scales[key];
|
22358 | return void 0 === scale && (scale = this.createScale(), this.scales[key] = scale),
|
22359 | scale;
|
22360 | }, DataColorPalette.prototype.getNewColorScale = function() {
|
22361 | return this.createScale();
|
22362 | }, DataColorPalette.prototype.getColorByIndex = function(index) {
|
22363 | return this.colors[index];
|
22364 | }, DataColorPalette.prototype.getSentimentColors = function() {
|
22365 | return this.sentimentColors;
|
22366 | }, DataColorPalette.prototype.getBasePickerColors = function() {
|
22367 | return this.basePickerColors;
|
22368 | }, DataColorPalette.prototype.getAllColors = function() {
|
22369 | return this.colors;
|
22370 | }, DataColorPalette.prototype.createScale = function() {
|
22371 | return D3ColorScale.createFromColors(this.colors);
|
22372 | }, DataColorPalette;
|
22373 | }();
|
22374 | visuals.DataColorPalette = DataColorPalette;
|
22375 | var D3ColorScale = function() {
|
22376 | function D3ColorScale(scale) {
|
22377 | this.scale = scale;
|
22378 | }
|
22379 | return D3ColorScale.prototype.getColor = function(key) {
|
22380 | return this.scale(key);
|
22381 | }, D3ColorScale.prototype.clearAndRotateScale = function() {
|
22382 | var offset = this.scale.domain().length, rotatedColors = ArrayExtensions.rotate(this.scale.range(), offset);
|
22383 | this.scale = d3.scale.ordinal().range(rotatedColors);
|
22384 | }, D3ColorScale.prototype.clone = function() {
|
22385 | return new D3ColorScale(this.scale.copy());
|
22386 | }, D3ColorScale.prototype.getDomain = function() {
|
22387 | return this.scale.domain();
|
22388 | }, D3ColorScale.createFromColors = function(colors) {
|
22389 | return new D3ColorScale(d3.scale.ordinal().range(colors));
|
22390 | }, D3ColorScale;
|
22391 | }();
|
22392 | visuals.D3ColorScale = D3ColorScale;
|
22393 | var ThemeManager = function() {
|
22394 | function ThemeManager() {}
|
22395 | return ThemeManager.getDefaultTheme = function() {
|
22396 | if (!ThemeManager.defaultTheme) {
|
22397 | ThemeManager.defaultTheme = [];
|
22398 | for (var baseColors = ThemeManager.defaultBaseColors, i = 0; i < ThemeManager.colorSectorCount; ++i) for (var j = 0, jlen = baseColors.length; jlen > j; ++j) ThemeManager.defaultTheme.push({
|
22399 | value: jsCommon.Color.rotate(baseColors[j].value, i / ThemeManager.colorSectorCount)
|
22400 | });
|
22401 | }
|
22402 | return ThemeManager.defaultTheme;
|
22403 | }, ThemeManager.colorSectorCount = 12, ThemeManager.defaultBaseColors = [ {
|
22404 | value: "#01B8AA"
|
22405 | }, {
|
22406 | value: "#374649"
|
22407 | }, {
|
22408 | value: "#FD625E"
|
22409 | }, {
|
22410 | value: "#F2C80F"
|
22411 | }, {
|
22412 | value: "#5F6B6D"
|
22413 | }, {
|
22414 | value: "#8AD4EB"
|
22415 | }, {
|
22416 | value: "#FE9666"
|
22417 | }, {
|
22418 | value: "#A66999"
|
22419 | }, {
|
22420 | value: "#3599B8"
|
22421 | }, {
|
22422 | value: "#DFBFBF"
|
22423 | }, {
|
22424 | value: "#4AC5BB"
|
22425 | }, {
|
22426 | value: "#5F6B6D"
|
22427 | }, {
|
22428 | value: "#FB8281"
|
22429 | }, {
|
22430 | value: "#F4D25A"
|
22431 | }, {
|
22432 | value: "#7F898A"
|
22433 | }, {
|
22434 | value: "#A4DDEE"
|
22435 | }, {
|
22436 | value: "#FDAB89"
|
22437 | }, {
|
22438 | value: "#B687AC"
|
22439 | }, {
|
22440 | value: "#28738A"
|
22441 | }, {
|
22442 | value: "#A78F8F"
|
22443 | }, {
|
22444 | value: "#168980"
|
22445 | }, {
|
22446 | value: "#293537"
|
22447 | }, {
|
22448 | value: "#BB4A4A"
|
22449 | }, {
|
22450 | value: "#B59525"
|
22451 | }, {
|
22452 | value: "#475052"
|
22453 | }, {
|
22454 | value: "#6A9FB0"
|
22455 | }, {
|
22456 | value: "#BD7150"
|
22457 | }, {
|
22458 | value: "#7B4F71"
|
22459 | }, {
|
22460 | value: "#1B4D5C"
|
22461 | }, {
|
22462 | value: "#706060"
|
22463 | }, {
|
22464 | value: "#0F5C55"
|
22465 | }, {
|
22466 | value: "#1C2325"
|
22467 | }, {
|
22468 | value: "#7D3231"
|
22469 | }, {
|
22470 | value: "#796419"
|
22471 | }, {
|
22472 | value: "#303637"
|
22473 | }, {
|
22474 | value: "#476A75"
|
22475 | }, {
|
22476 | value: "#7E4B36"
|
22477 | }, {
|
22478 | value: "#52354C"
|
22479 | }, {
|
22480 | value: "#0D262E"
|
22481 | }, {
|
22482 | value: "#544848"
|
22483 | } ], ThemeManager.defaultSentimentColors = [ {
|
22484 | value: "#C0433A"
|
22485 | }, {
|
22486 | value: "#E8D62E"
|
22487 | }, {
|
22488 | value: "#79C75B"
|
22489 | } ], ThemeManager;
|
22490 | }();
|
22491 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22492 | }(powerbi || (powerbi = {}));
|
22493 |
|
22494 | var powerbi;
|
22495 |
|
22496 | !function(powerbi) {
|
22497 | var visuals;
|
22498 | !function(visuals) {
|
22499 | var DataDotChart = function() {
|
22500 | function DataDotChart(options) {
|
22501 | this.isScrollable = options.isScrollable, this.interactivityService = options.interactivityService;
|
22502 | }
|
22503 | return DataDotChart.prototype.init = function(options) {
|
22504 | this.options = options, this.svg = options.svg, this.svg.classed(DataDotChart.ClassName, !0),
|
22505 | this.mainGraphicsG = this.svg.append("g").classed("dataDotChartMainGraphicsContext", !0),
|
22506 | this.mainGraphicsContext = this.mainGraphicsG.append("svg"), this.currentViewport = options.viewport,
|
22507 | this.hostService = options.host, this.cartesianVisualHost = options.cartesianHost,
|
22508 | this.style = options.style, this.colors = this.style.colorPalette.dataColors, this.interactivity = options.interactivity,
|
22509 | this.element = options.element;
|
22510 | }, DataDotChart.prototype.setData = function(dataViews) {
|
22511 | if (this.data = {
|
22512 | series: {
|
22513 | data: []
|
22514 | },
|
22515 | hasHighlights: !1,
|
22516 | hasDynamicSeries: !1
|
22517 | }, dataViews.length > 0) {
|
22518 | var dataView = dataViews[0];
|
22519 | if (dataView && dataView.categorical) {
|
22520 | var dataViewCategorical = this.dataViewCategorical = dataView.categorical, dvCategories = dataViewCategorical.categories, categoryType = powerbi.ValueType.fromDescriptor({
|
22521 | text: !0
|
22522 | });
|
22523 | dvCategories && dvCategories.length > 0 && dvCategories[0].source && dvCategories[0].source.type && (categoryType = dvCategories[0].source.type),
|
22524 | this.data = DataDotChart.converter(dataView, visuals.valueFormatter.format(null), this.interactivityService);
|
22525 | }
|
22526 | }
|
22527 | }, DataDotChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
22528 | var data = this.clippedData = powerbi.Prototype.inherit(this.data);
|
22529 | return data && data.series && data.series.data && (data.series = {
|
22530 | data: data.series.data.slice(startIndex, endIndex),
|
22531 | xCol: data.series.xCol,
|
22532 | yCol: data.series.yCol
|
22533 | }), data;
|
22534 | }, DataDotChart.prototype.calculateAxesProperties = function(options) {
|
22535 | var _this = this;
|
22536 | this.currentViewport = options.viewport, this.margin = options.margin;
|
22537 | 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;
|
22538 | data.hasHighlights && (categoryCount /= 2);
|
22539 | var xMetaDataColumn, yMetaDataColumn, width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom);
|
22540 | DataDotChart.hasDataPoint(series) && (xMetaDataColumn = series.xCol, yMetaDataColumn = series.yCol);
|
22541 | var layout = visuals.CartesianChart.getLayout(null, {
|
22542 | availableWidth: width,
|
22543 | categoryCount: categoryCount,
|
22544 | domain: null,
|
22545 | isScalar: !1,
|
22546 | isScrollable: this.isScrollable,
|
22547 | trimOrdinalDataOnOverflow: options.trimOrdinalDataOnOverflow
|
22548 | }), outerPadding = layout.categoryThickness * visuals.CartesianChart.OuterPaddingRatio;
|
22549 | this.isScrollable || (this.clippedData = DataDotChart.createClippedDataIfOverflowed(data, layout.categoryCount));
|
22550 | var yDomain = visuals.AxisHelper.createValueDomain(seriesArray, !0) || visuals.emptyDomain, combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, yDomain, options.ensureYDomain);
|
22551 | this.yAxisProperties = visuals.AxisHelper.createAxis({
|
22552 | pixelSpan: height,
|
22553 | dataDomain: combinedDomain,
|
22554 | metaDataColumn: yMetaDataColumn,
|
22555 | formatString: visuals.valueFormatter.getFormatString(yMetaDataColumn, DataDotChart.formatStringProp),
|
22556 | outerPadding: 0,
|
22557 | isScalar: !0,
|
22558 | isVertical: !0,
|
22559 | forcedTickCount: options.forcedTickCount,
|
22560 | useTickIntervalForDisplayUnits: !0,
|
22561 | isCategoryAxis: !1
|
22562 | });
|
22563 | var axisType = this.xAxisProperties ? this.xAxisProperties.axisType : powerbi.ValueType.fromDescriptor({
|
22564 | text: !0
|
22565 | }), xDomain = visuals.AxisHelper.createDomain(seriesArray, axisType, !1, options.forcedXDomain, options.ensureXDomain);
|
22566 | return this.xAxisProperties = visuals.AxisHelper.createAxis({
|
22567 | pixelSpan: width,
|
22568 | dataDomain: xDomain,
|
22569 | metaDataColumn: xMetaDataColumn,
|
22570 | formatString: visuals.valueFormatter.getFormatString(xMetaDataColumn, DataDotChart.formatStringProp),
|
22571 | outerPadding: outerPadding,
|
22572 | isScalar: !1,
|
22573 | isVertical: !1,
|
22574 | forcedTickCount: options.forcedTickCount,
|
22575 | useTickIntervalForDisplayUnits: !0,
|
22576 | categoryThickness: layout.categoryThickness,
|
22577 | getValueFn: function(index, type) {
|
22578 | return _this.lookupXValue(index, type);
|
22579 | },
|
22580 | isCategoryAxis: !0
|
22581 | }), [ this.xAxisProperties, this.yAxisProperties ];
|
22582 | }, DataDotChart.createClippedDataIfOverflowed = function(data, categoryCount) {
|
22583 | var requiredLength = data.hasHighlights ? Math.min(data.series.data.length, 2 * categoryCount) : Math.min(data.series.data.length, categoryCount);
|
22584 | if (requiredLength >= data.series.data.length) return data;
|
22585 | var clipped = powerbi.Prototype.inherit(data);
|
22586 | return clipped.series = powerbi.Prototype.inherit(data.series), clipped.series.data = clipped.series.data.slice(0, requiredLength),
|
22587 | clipped;
|
22588 | }, DataDotChart.hasDataPoint = function(series) {
|
22589 | return series && series.data && series.data.length > 0;
|
22590 | }, DataDotChart.prototype.lookupXValue = function(index, type) {
|
22591 | var data = this.data, isDateTime = visuals.AxisHelper.isDateTime(type);
|
22592 | if (isDateTime) return new Date(index);
|
22593 | if (data && data.series) {
|
22594 | var seriesData = data.series.data;
|
22595 | if (seriesData) {
|
22596 | var dataAtIndex = seriesData[index];
|
22597 | if (dataAtIndex) return dataAtIndex.categoryValue;
|
22598 | }
|
22599 | }
|
22600 | return index;
|
22601 | }, DataDotChart.prototype.overrideXScale = function(xProperties) {
|
22602 | this.xAxisProperties = xProperties;
|
22603 | }, DataDotChart.prototype.render = function(suppressAnimations) {
|
22604 | var _this = this;
|
22605 | if (this.clippedData) {
|
22606 | 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;
|
22607 | this.mainGraphicsContext.attr("width", width).attr("height", height);
|
22608 | var dots = this.mainGraphicsContext.selectAll(DataDotChart.DotClassSelector).data(dataPoints, function(d) {
|
22609 | return d.identity.getKey();
|
22610 | });
|
22611 | dots.enter().append("circle").classed(DataDotChart.DotClassName, !0), dots.style({
|
22612 | fill: dotColor.value
|
22613 | }).style("fill-opacity", function(d) {
|
22614 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
22615 | }).classed("null-value", function(d) {
|
22616 | return null === d.value;
|
22617 | }).attr({
|
22618 | r: function(d) {
|
22619 | return dotRadius;
|
22620 | },
|
22621 | cx: function(d) {
|
22622 | return xScale(d.categoryIndex) + dotRadius;
|
22623 | },
|
22624 | cy: function(d) {
|
22625 | return yScale(d.value);
|
22626 | }
|
22627 | }), dots.exit().remove();
|
22628 | var dotLabels = this.mainGraphicsContext.selectAll(DataDotChart.DotLabelClassSelector).data(dataPoints, function(d) {
|
22629 | return d.identity.getKey();
|
22630 | });
|
22631 | dotLabels.enter().append("text").classed(DataDotChart.DotLabelClassName, !0).attr({
|
22632 | "text-anchor": DataDotChart.DotLabelTextAnchor,
|
22633 | dy: DataDotChart.DotLabelVerticalOffset
|
22634 | }), dotLabels.classed("null-value", function(d) {
|
22635 | return null === d.value;
|
22636 | }).classed("overflowed", !1).attr({
|
22637 | x: function(d) {
|
22638 | return xScale(d.categoryIndex) + dotRadius;
|
22639 | },
|
22640 | y: function(d) {
|
22641 | return yScale(d.value);
|
22642 | }
|
22643 | }).text(function(d) {
|
22644 | return _this.yAxisProperties.formatter.format(d.value);
|
22645 | });
|
22646 | var overflowed = !1;
|
22647 | dotLabels.each(function() {
|
22648 | if (!overflowed && !$("<div>").addClass($(this).attr("class")).hasClass("null-value")) {
|
22649 | var width_1 = powerbi.TextMeasurementService.measureSvgTextElementWidth(this);
|
22650 | width_1 > dotWidth && (dotLabels.classed("overflowed", !0), overflowed = !0);
|
22651 | }
|
22652 | }), dotLabels.exit().remove();
|
22653 | var behaviorOptions = void 0;
|
22654 | return this.interactivityService && (behaviorOptions = {
|
22655 | dots: dots,
|
22656 | dotLabels: dotLabels,
|
22657 | datapoints: dataPoints
|
22658 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), {
|
22659 | dataPoints: dataPoints,
|
22660 | behaviorOptions: behaviorOptions,
|
22661 | labelDataPoints: [],
|
22662 | labelsAreNumeric: !0
|
22663 | };
|
22664 | }
|
22665 | }, DataDotChart.prototype.calculateLegend = function() {
|
22666 | return this.createLegendDataPoints(0);
|
22667 | }, DataDotChart.prototype.hasLegend = function() {
|
22668 | return this.data && this.data.hasDynamicSeries;
|
22669 | }, DataDotChart.prototype.createLegendDataPoints = function(columnIndex) {
|
22670 | var data = this.data;
|
22671 | if (!data) return null;
|
22672 | var category, series = data.series, seriesData = series.data, legendDataPoints = [], axisType = this.xAxisProperties ? this.xAxisProperties.axisType : powerbi.ValueType.fromDescriptor({
|
22673 | text: !0
|
22674 | });
|
22675 | if (data.series && data.series.data) {
|
22676 | var firstDataPoint = data.series.data[0];
|
22677 | category = firstDataPoint && this.lookupXValue(firstDataPoint.categoryValue, axisType);
|
22678 | }
|
22679 | if (series.yCol) {
|
22680 | 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);
|
22681 | legendDataPoints.push({
|
22682 | color: dotColor.value,
|
22683 | icon: visuals.LegendIcon.Line,
|
22684 | label: label,
|
22685 | category: visuals.valueFormatter.format(category, visuals.valueFormatter.getFormatString(series.xCol, formatStringProp)),
|
22686 | measure: visuals.valueFormatter.format(measure, visuals.valueFormatter.getFormatString(series.yCol, formatStringProp)),
|
22687 | identity: identity,
|
22688 | selected: !1
|
22689 | });
|
22690 | }
|
22691 | return {
|
22692 | dataPoints: legendDataPoints
|
22693 | };
|
22694 | }, DataDotChart.prototype.onClearSelection = function() {
|
22695 | this.interactivityService && this.interactivityService.clearSelection();
|
22696 | }, DataDotChart.converter = function(dataView, blankCategoryValue, interactivityService) {
|
22697 | var categorical = dataView.categorical, category = categorical.categories && categorical.categories.length > 0 ? categorical.categories[0] : {
|
22698 | source: void 0,
|
22699 | values: [ blankCategoryValue ],
|
22700 | identity: void 0
|
22701 | }, categoryType = visuals.AxisHelper.getCategoryValueType(category.source), isDateTime = visuals.AxisHelper.isDateTime(categoryType), categoryValues = category.values;
|
22702 | if (!_.isEmpty(categorical.values)) {
|
22703 | for (var measure = categorical.values[0], hasHighlights = !!measure.highlights, dataPoints = [], categoryIndex = 0, len = measure.values.length; len > categoryIndex; categoryIndex++) {
|
22704 | var identity = category.identity ? visuals.SelectionId.createWithIdAndMeasure(category.identity[categoryIndex], measure.source.queryName) : visuals.SelectionId.createWithMeasure(measure.source.queryName), categoryValue = categoryValues[categoryIndex];
|
22705 | if ((!isDateTime || null == categoryValue || categoryValue instanceof Date) && (dataPoints.push({
|
22706 | categoryValue: isDateTime && categoryValue ? categoryValue.getTime() : categoryValue,
|
22707 | value: measure.values[categoryIndex],
|
22708 | categoryIndex: categoryIndex,
|
22709 | seriesIndex: 0,
|
22710 | selected: !1,
|
22711 | identity: identity,
|
22712 | highlight: !1
|
22713 | }), hasHighlights)) {
|
22714 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlightValue = measure.highlights[categoryIndex];
|
22715 | dataPoints.push({
|
22716 | categoryValue: isDateTime && categoryValue ? categoryValue.getTime() : categoryValue,
|
22717 | value: highlightValue,
|
22718 | categoryIndex: categoryIndex,
|
22719 | seriesIndex: 0,
|
22720 | selected: !1,
|
22721 | identity: highlightIdentity,
|
22722 | highlight: !0
|
22723 | });
|
22724 | }
|
22725 | }
|
22726 | return interactivityService && interactivityService.applySelectionStateToData(dataPoints),
|
22727 | {
|
22728 | series: {
|
22729 | xCol: category.source,
|
22730 | yCol: measure.source,
|
22731 | data: dataPoints
|
22732 | },
|
22733 | hasHighlights: hasHighlights,
|
22734 | hasDynamicSeries: !0
|
22735 | };
|
22736 | }
|
22737 | return {
|
22738 | series: {
|
22739 | data: []
|
22740 | },
|
22741 | hasHighlights: !1,
|
22742 | hasDynamicSeries: !1
|
22743 | };
|
22744 | }, DataDotChart.formatStringProp = {
|
22745 | objectName: "general",
|
22746 | propertyName: "formatString"
|
22747 | }, DataDotChart.ClassName = "dataDotChart", DataDotChart.DotClassName = "dot", DataDotChart.DotClassSelector = ".dot",
|
22748 | DataDotChart.DotColorKey = "dataDot", DataDotChart.DotLabelClassName = "label",
|
22749 | DataDotChart.DotLabelClassSelector = ".label", DataDotChart.DotLabelVerticalOffset = "0.4em",
|
22750 | DataDotChart.DotLabelTextAnchor = "middle", DataDotChart;
|
22751 | }();
|
22752 | visuals.DataDotChart = DataDotChart;
|
22753 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
22754 | }(powerbi || (powerbi = {}));
|
22755 |
|
22756 | var powerbi;
|
22757 |
|
22758 | !function(powerbi) {
|
22759 | var visuals;
|
22760 | !function(visuals) {
|
22761 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, DataRoleHelper = powerbi.data.DataRoleHelper, FunnelChart = function() {
|
22762 | function FunnelChart(options) {
|
22763 | this.labelPositionObjects = [ visuals.labelPosition.outsideEnd, visuals.labelPosition.insideCenter ],
|
22764 | options && (this.tooltipsEnabled = options.tooltipsEnabled, options.funnelSmallViewPortProperties && (this.funnelSmallViewPortProperties = options.funnelSmallViewPortProperties),
|
22765 | options.animator && (this.animator = options.animator), options.behavior && (this.behavior = options.behavior));
|
22766 | }
|
22767 | return FunnelChart.isValidValueColumn = function(valueColumn) {
|
22768 | return DataRoleHelper.hasRole(valueColumn.source, "Y");
|
22769 | }, FunnelChart.getFirstValidValueColumn = function(values) {
|
22770 | for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
|
22771 | var valueColumn = values_1[_i];
|
22772 | if (FunnelChart.isValidValueColumn(valueColumn)) return valueColumn;
|
22773 | }
|
22774 | }, FunnelChart.converter = function(dataView, colors, hostServices, defaultDataPointColor, tooltipsEnabled) {
|
22775 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
22776 | var slices = [], formatStringProp = visuals.funnelChartProps.general.formatString, categorical = dataView.categorical, categories = categorical.categories || [], values = categorical.values, valueMetaData = [];
|
22777 | values && (valueMetaData = _.map(values, function(v) {
|
22778 | return v.source;
|
22779 | }));
|
22780 | var firstValue, firstHighlight, previousValue, previousHighlight, hasHighlights = values && values.length > 0 && values[0] && !!values[0].highlights, highlightsOverflow = !1, hasNegativeValues = !1, allValuesAreNegative = !1, categoryLabels = [], dataLabelsSettings = visuals.dataLabelUtils.getDefaultFunnelLabelSettings(), percentBarLabelSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0), colorHelper = new visuals.ColorHelper(colors, visuals.funnelChartProps.dataPoint.fill, defaultDataPointColor), gradientValueColumn = visuals.GradientUtils.getGradientValueColumn(categorical);
|
22781 | if (dataView && dataView.metadata && dataView.metadata.objects) {
|
22782 | var labelsObj = dataView.metadata.objects.labels;
|
22783 | labelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
22784 | var percentLabelsObj = dataView.metadata.objects.percentBarLabel;
|
22785 | percentLabelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(percentLabelsObj, percentBarLabelSettings);
|
22786 | }
|
22787 | var firstValueColumn = !_.isEmpty(values) && FunnelChart.getFirstValidValueColumn(values);
|
22788 | if (!firstValueColumn) return {
|
22789 | slices: slices,
|
22790 | categoryLabels: categoryLabels,
|
22791 | valuesMetadata: valueMetaData,
|
22792 | hasHighlights: hasHighlights,
|
22793 | highlightsOverflow: highlightsOverflow,
|
22794 | canShowDataLabels: !0,
|
22795 | dataLabelsSettings: dataLabelsSettings,
|
22796 | hasNegativeValues: hasNegativeValues,
|
22797 | allValuesAreNegative: allValuesAreNegative,
|
22798 | percentBarLabelSettings: percentBarLabelSettings
|
22799 | };
|
22800 | firstValue = firstValueColumn.values[0], hasHighlights && (firstHighlight = firstValueColumn.highlights[0]);
|
22801 | var pctFormatString = visuals.valueFormatter.getLocalizedString("Percentage");
|
22802 | if (1 === categories.length) for (var category = categories[0], categoryValues = category.values, i = 0, ilen = categoryValues.length; ilen > i; i++) {
|
22803 | var measureName = firstValueColumn.source.queryName, identity = visuals.SelectionIdBuilder.builder().withCategory(category, i).withMeasure(measureName).createSelectionId(), value = firstValueColumn.values[i], formattedCategoryValue = visuals.converterHelper.formatFromMetadataColumn(categoryValues[i], category.source, formatStringProp), tooltipInfo = void 0;
|
22804 | if (tooltipsEnabled) {
|
22805 | tooltipInfo = [], tooltipInfo.push({
|
22806 | displayName: category.source.displayName,
|
22807 | value: formattedCategoryValue
|
22808 | }), null != value && tooltipInfo.push({
|
22809 | displayName: firstValueColumn.source.displayName,
|
22810 | value: visuals.converterHelper.formatFromMetadataColumn(value, firstValueColumn.source, formatStringProp)
|
22811 | });
|
22812 | var highlightValue = void 0;
|
22813 | hasHighlights && (highlightValue = firstValueColumn.highlights[i], null != highlightValue && tooltipInfo.push({
|
22814 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
22815 | value: visuals.converterHelper.formatFromMetadataColumn(highlightValue, firstValueColumn.source, formatStringProp)
|
22816 | }));
|
22817 | var gradientColumnMetadata = gradientValueColumn ? gradientValueColumn.source : void 0;
|
22818 | gradientColumnMetadata && gradientColumnMetadata !== firstValueColumn.source && null != gradientValueColumn.values[i] && tooltipInfo.push({
|
22819 | displayName: gradientColumnMetadata.displayName,
|
22820 | value: visuals.converterHelper.formatFromMetadataColumn(gradientValueColumn.values[i], gradientColumnMetadata, formatStringProp)
|
22821 | }), 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);
|
22822 | }
|
22823 | var color = colorHelper.getColorForMeasure(category.objects && category.objects[i], "");
|
22824 | if (slices.push({
|
22825 | label: formattedCategoryValue,
|
22826 | value: value,
|
22827 | originalValue: value,
|
22828 | categoryOrMeasureIndex: i,
|
22829 | identity: identity,
|
22830 | selected: !1,
|
22831 | key: identity.getKey(),
|
22832 | tooltipInfo: tooltipInfo,
|
22833 | color: color,
|
22834 | labelFill: dataLabelsSettings.labelColor
|
22835 | }), hasHighlights) {
|
22836 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlightValue = firstValueColumn.highlights[i];
|
22837 | slices.push({
|
22838 | label: formattedCategoryValue,
|
22839 | value: value,
|
22840 | originalValue: value,
|
22841 | categoryOrMeasureIndex: i,
|
22842 | identity: highlightIdentity,
|
22843 | selected: !1,
|
22844 | key: highlightIdentity.getKey(),
|
22845 | highlight: !0,
|
22846 | highlightValue: highlightValue,
|
22847 | originalHighlightValue: highlightValue,
|
22848 | tooltipInfo: tooltipInfo,
|
22849 | color: color
|
22850 | }), previousHighlight = highlightValue;
|
22851 | }
|
22852 | previousValue = value;
|
22853 | } else if (valueMetaData.length > 0 && values && values.length > 0) for (var i = 0, len = values.length; len > i; i++) {
|
22854 | var valueColumn = values[i];
|
22855 | if (FunnelChart.isValidValueColumn(valueColumn)) {
|
22856 | var value = valueColumn.values[0], identity = visuals.SelectionId.createWithMeasure(valueColumn.source.queryName), tooltipInfo = void 0, color = colorHelper.getColorForMeasure(valueColumn.source.objects, "");
|
22857 | if (tooltipsEnabled) if (tooltipInfo = [], null != value && tooltipInfo.push({
|
22858 | displayName: valueColumn.source.displayName,
|
22859 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueColumn.source, formatStringProp)
|
22860 | }), hasHighlights) {
|
22861 | var highlightValue = valueColumn.highlights[0];
|
22862 | null != highlightValue && tooltipInfo.push({
|
22863 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
22864 | value: visuals.converterHelper.formatFromMetadataColumn(highlightValue, valueColumn.source, formatStringProp)
|
22865 | }), FunnelChart.addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, firstHighlight ? highlightValue / firstHighlight : null, previousHighlight ? highlightValue / previousHighlight : null, !0);
|
22866 | } else FunnelChart.addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, firstValue ? value / firstValue : null, previousValue ? value / previousValue : null);
|
22867 | if (slices.push({
|
22868 | label: valueMetaData[i].displayName,
|
22869 | value: value,
|
22870 | originalValue: value,
|
22871 | categoryOrMeasureIndex: i,
|
22872 | identity: identity,
|
22873 | selected: !1,
|
22874 | key: identity.getKey(),
|
22875 | tooltipInfo: tooltipInfo,
|
22876 | color: color,
|
22877 | labelFill: dataLabelsSettings.labelColor
|
22878 | }), hasHighlights) {
|
22879 | var highlightIdentity = visuals.SelectionId.createWithHighlight(identity), highlight = valueColumn.highlights[0];
|
22880 | slices.push({
|
22881 | label: valueMetaData[i].displayName,
|
22882 | value: value,
|
22883 | originalValue: value,
|
22884 | categoryOrMeasureIndex: i,
|
22885 | identity: highlightIdentity,
|
22886 | key: highlightIdentity.getKey(),
|
22887 | selected: !1,
|
22888 | highlight: !0,
|
22889 | originalHighlightValue: highlight,
|
22890 | highlightValue: highlight,
|
22891 | tooltipInfo: tooltipInfo,
|
22892 | color: color
|
22893 | }), previousHighlight = highlight;
|
22894 | }
|
22895 | previousValue = value;
|
22896 | }
|
22897 | }
|
22898 | for (var i = 0; i < slices.length; i += hasHighlights ? 2 : 1) {
|
22899 | var slice = slices[i];
|
22900 | categoryLabels.push(slice.label);
|
22901 | }
|
22902 | allValuesAreNegative = slices.length > 0 && _.every(slices, function(slice) {
|
22903 | return (slice.highlight ? slice.highlightValue <= 0 : !0) && slice.value < 0;
|
22904 | });
|
22905 | for (var _i = 0, slices_1 = slices; _i < slices_1.length; _i++) {
|
22906 | var slice = slices_1[_i];
|
22907 | if (allValuesAreNegative) slice.value = Math.abs(slice.value), slice.highlight && (slice.highlightValue = Math.abs(slice.highlightValue)); else {
|
22908 | var value = slice.value, isValueNegative = 0 > value;
|
22909 | isValueNegative && (slice.value = 0);
|
22910 | var isHighlightValueNegative = !1;
|
22911 | if (slice.highlight) {
|
22912 | var highlightValue = slice.highlightValue;
|
22913 | isHighlightValueNegative = 0 > highlightValue, slice.highlightValue = isHighlightValueNegative ? 0 : highlightValue;
|
22914 | }
|
22915 | hasNegativeValues || (hasNegativeValues = isValueNegative || isHighlightValueNegative);
|
22916 | }
|
22917 | slice.highlightValue > slice.value && (highlightsOverflow = !0);
|
22918 | }
|
22919 | return {
|
22920 | slices: slices,
|
22921 | categoryLabels: categoryLabels,
|
22922 | valuesMetadata: valueMetaData,
|
22923 | hasHighlights: hasHighlights,
|
22924 | highlightsOverflow: highlightsOverflow,
|
22925 | canShowDataLabels: !0,
|
22926 | dataLabelsSettings: dataLabelsSettings,
|
22927 | hasNegativeValues: hasNegativeValues,
|
22928 | allValuesAreNegative: allValuesAreNegative,
|
22929 | percentBarLabelSettings: percentBarLabelSettings
|
22930 | };
|
22931 | }, FunnelChart.prototype.enumerateObjectInstances = function(options) {
|
22932 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
22933 | switch (options.objectName) {
|
22934 | case "dataPoint":
|
22935 | var dataViewCat = this.dataViews && this.dataViews.length > 0 && this.dataViews[0] && this.dataViews[0].categorical, hasGradientRole = visuals.GradientUtils.hasGradientRole(dataViewCat);
|
22936 | hasGradientRole || this.enumerateDataPoints(enumeration);
|
22937 | break;
|
22938 |
|
22939 | case "labels":
|
22940 | var labelSettingsOptions = FunnelChart.getLabelSettingsOptions(enumeration, this.data.dataLabelsSettings, !0, this.labelPositionObjects);
|
22941 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingsOptions);
|
22942 | break;
|
22943 |
|
22944 | case "percentBarLabel":
|
22945 | var percentLabelSettingOptions = FunnelChart.getLabelSettingsOptions(enumeration, this.data.percentBarLabelSettings, !1);
|
22946 | visuals.dataLabelUtils.enumerateDataLabels(percentLabelSettingOptions);
|
22947 | }
|
22948 | return enumeration.complete();
|
22949 | }, FunnelChart.getLabelSettingsOptions = function(enumeration, labelSettings, isDataLabels, positionObject) {
|
22950 | return {
|
22951 | enumeration: enumeration,
|
22952 | dataLabelsSettings: labelSettings,
|
22953 | show: !0,
|
22954 | displayUnits: isDataLabels,
|
22955 | precision: isDataLabels,
|
22956 | position: isDataLabels,
|
22957 | positionObject: positionObject,
|
22958 | fontSize: !0
|
22959 | };
|
22960 | }, FunnelChart.prototype.enumerateDataPoints = function(enumeration) {
|
22961 | var data = this.data;
|
22962 | if (data) {
|
22963 | var slices = data.slices;
|
22964 | enumeration.pushInstance({
|
22965 | objectName: "dataPoint",
|
22966 | selector: null,
|
22967 | properties: {
|
22968 | defaultColor: {
|
22969 | solid: {
|
22970 | color: this.defaultDataPointColor || this.colors.getColorByIndex(0).value
|
22971 | }
|
22972 | }
|
22973 | }
|
22974 | });
|
22975 | for (var i = 0; i < slices.length; i++) {
|
22976 | var slice = slices[i];
|
22977 | if (!slice.highlight) {
|
22978 | var color = slice.color, selector = slice.identity.getSelector(), isSingleSeries = !!selector.data;
|
22979 | enumeration.pushInstance({
|
22980 | objectName: "dataPoint",
|
22981 | displayName: slice.label,
|
22982 | selector: visuals.ColorHelper.normalizeSelector(selector, isSingleSeries),
|
22983 | properties: {
|
22984 | fill: {
|
22985 | solid: {
|
22986 | color: color
|
22987 | }
|
22988 | }
|
22989 | }
|
22990 | });
|
22991 | }
|
22992 | }
|
22993 | }
|
22994 | }, FunnelChart.prototype.init = function(options) {
|
22995 | this.options = options;
|
22996 | var element = options.element, svg = this.svg = d3.select(element.get(0)).append("svg").classed(FunnelChart.VisualClassName, !0);
|
22997 | this.behavior && (this.clearCatcher = visuals.appendClearCatcher(this.svg)), this.currentViewport = options.viewport,
|
22998 | this.margin = {
|
22999 | left: 5,
|
23000 | right: 5,
|
23001 | top: 0,
|
23002 | bottom: 0
|
23003 | };
|
23004 | var style = options.style;
|
23005 | this.colors = style.colorPalette.dataColors, this.hostServices = options.host, this.behavior && (this.interactivityService = visuals.createInteractivityService(this.hostServices)),
|
23006 | this.percentGraphicsContext = svg.append("g").classed(FunnelChart.Selectors.percentBar.root["class"], !0),
|
23007 | this.funnelGraphicsContext = svg.append("g"), this.axisGraphicsContext = svg.append("g"),
|
23008 | this.updateViewportProperties();
|
23009 | }, FunnelChart.prototype.updateViewportProperties = function() {
|
23010 | var viewport = this.currentViewport;
|
23011 | this.svg.attr("width", viewport.width).attr("height", viewport.height);
|
23012 | }, FunnelChart.prototype.update = function(options) {
|
23013 | this.data = {
|
23014 | slices: [],
|
23015 | categoryLabels: [],
|
23016 | valuesMetadata: [],
|
23017 | hasHighlights: !1,
|
23018 | highlightsOverflow: !1,
|
23019 | canShowDataLabels: !0,
|
23020 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultFunnelLabelSettings(),
|
23021 | hasNegativeValues: !1,
|
23022 | allValuesAreNegative: !1,
|
23023 | percentBarLabelSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0)
|
23024 | };
|
23025 | var dataViews = this.dataViews = options.dataViews;
|
23026 | if (this.currentViewport = options.viewport, dataViews && dataViews.length > 0) {
|
23027 | var dataView = dataViews[0];
|
23028 | if (dataView.metadata && dataView.metadata.objects) {
|
23029 | var defaultColor = powerbi.DataViewObjects.getFillColor(dataView.metadata.objects, visuals.funnelChartProps.dataPoint.defaultColor);
|
23030 | defaultColor && (this.defaultDataPointColor = defaultColor);
|
23031 | }
|
23032 | dataView.categorical && (this.data = FunnelChart.converter(dataView, this.colors, this.hostServices, this.defaultDataPointColor, this.tooltipsEnabled),
|
23033 | this.interactivityService && this.interactivityService.applySelectionStateToData(this.data.slices));
|
23034 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
23035 | this.data.allValuesAreNegative ? warnings.unshift(new visuals.AllNegativeValuesWarning()) : this.data.hasNegativeValues && warnings.unshift(new visuals.NegativeValuesNotSupportedWarning()),
|
23036 | this.hostServices.setWarnings(warnings);
|
23037 | }
|
23038 | this.updateViewportProperties(), this.updateInternal(options.suppressAnimations);
|
23039 | }, FunnelChart.prototype.onDataChanged = function(options) {
|
23040 | this.update({
|
23041 | dataViews: options.dataViews,
|
23042 | suppressAnimations: options.suppressAnimations,
|
23043 | viewport: this.currentViewport
|
23044 | });
|
23045 | }, FunnelChart.prototype.onResizing = function(viewport) {
|
23046 | this.currentViewport = viewport, this.update({
|
23047 | dataViews: this.dataViews,
|
23048 | suppressAnimations: !0,
|
23049 | viewport: this.currentViewport
|
23050 | });
|
23051 | }, FunnelChart.prototype.getMaxLabelLength = function(labels, properties) {
|
23052 | for (var max = 0, textMeasurer = powerbi.TextMeasurementService.measureSvgTextWidth, i = 0, len = labels.length; len > i; i++) properties.text = labels[i],
|
23053 | max = Math.max(max, textMeasurer(properties));
|
23054 | return max + FunnelChart.LabelFunnelPadding;
|
23055 | }, FunnelChart.prototype.updateInternal = function(suppressAnimations) {
|
23056 | if (null != this.data) {
|
23057 | var data = this.data, slices = data.slices, slicesWithoutHighlights = slices.filter(function(d) {
|
23058 | return !d.highlight;
|
23059 | }), isHidingPercentBars = this.isHidingPercentBars(), axisOptions = this.setUpAxis(), margin = axisOptions.margin, funnelContext = this.funnelGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top));
|
23060 | this.percentGraphicsContext.attr("transform", visuals.SVGUtil.translate(margin.left, margin.top)),
|
23061 | this.svg.style("font-family", visuals.dataLabelUtils.StandardFontFamily);
|
23062 | var result, shapes, dataLabels, layout = FunnelChart.getLayout(data, axisOptions), labelLayout = visuals.dataLabelUtils.getFunnelChartLabelLayout(data, axisOptions, FunnelChart.InnerTextMinimumPadding, data.dataLabelsSettings, this.currentViewport);
|
23063 | if (this.animator && !suppressAnimations) {
|
23064 | var animationOptions = {
|
23065 | viewModel: data,
|
23066 | interactivityService: this.interactivityService,
|
23067 | layout: layout,
|
23068 | axisGraphicsContext: this.axisGraphicsContext,
|
23069 | shapeGraphicsContext: funnelContext,
|
23070 | percentGraphicsContext: this.percentGraphicsContext,
|
23071 | labelGraphicsContext: this.svg,
|
23072 | axisOptions: axisOptions,
|
23073 | slicesWithoutHighlights: slicesWithoutHighlights,
|
23074 | labelLayout: labelLayout,
|
23075 | isHidingPercentBars: isHidingPercentBars,
|
23076 | visualInitOptions: this.options
|
23077 | };
|
23078 | result = this.animator.animate(animationOptions), shapes = result.shapes, dataLabels = result.dataLabels;
|
23079 | }
|
23080 | if ((!this.animator || suppressAnimations || result.failed) && (FunnelChart.drawDefaultAxis(this.axisGraphicsContext, axisOptions, isHidingPercentBars),
|
23081 | shapes = FunnelChart.drawDefaultShapes(data, slices, funnelContext, layout, this.interactivityService && this.interactivityService.hasSelection()),
|
23082 | FunnelChart.drawPercentBars(data, this.percentGraphicsContext, layout, isHidingPercentBars),
|
23083 | data.dataLabelsSettings.show && data.canShowDataLabels ? dataLabels = visuals.dataLabelUtils.drawDefaultLabelsForFunnelChart(data.slices, this.svg, labelLayout) : visuals.dataLabelUtils.cleanDataLabels(this.svg)),
|
23084 | this.interactivityService) {
|
23085 | var interactors = FunnelChart.drawInteractorShapes(slices, funnelContext, layout), behaviorOptions = {
|
23086 | bars: shapes,
|
23087 | interactors: interactors,
|
23088 | clearCatcher: this.clearCatcher,
|
23089 | hasHighlights: data.hasHighlights
|
23090 | };
|
23091 | this.interactivityService.bind(slices, this.behavior, behaviorOptions), this.tooltipsEnabled && visuals.TooltipManager.addTooltip(interactors, function(tooltipEvent) {
|
23092 | return tooltipEvent.data.tooltipInfo;
|
23093 | });
|
23094 | }
|
23095 | this.tooltipsEnabled && visuals.TooltipManager.addTooltip(shapes, function(tooltipEvent) {
|
23096 | return tooltipEvent.data.tooltipInfo;
|
23097 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
23098 | }
|
23099 | }, FunnelChart.prototype.getUsableVerticalSpace = function() {
|
23100 | var categoryLabels = this.data.categoryLabels, margin = this.margin, verticalSpace = this.currentViewport.height - (margin.top + margin.bottom);
|
23101 | return verticalSpace - FunnelChart.MinBarThickness * categoryLabels.length;
|
23102 | }, FunnelChart.prototype.isHidingPercentBars = function() {
|
23103 | var data = this.data;
|
23104 | if (data.percentBarLabelSettings.show) {
|
23105 | var percentBarTextHeight = this.getPercentBarTextHeight(), verticalSpace = this.getUsableVerticalSpace() - 2 * FunnelChart.MinBarThickness * FunnelChart.PercentBarToBarRatio - 2 * percentBarTextHeight;
|
23106 | return 0 >= verticalSpace;
|
23107 | }
|
23108 | return !0;
|
23109 | }, FunnelChart.prototype.isSparklines = function() {
|
23110 | return this.getUsableVerticalSpace() <= 0;
|
23111 | }, FunnelChart.prototype.setUpAxis = function() {
|
23112 | var data = this.data, slices = data.slices, 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;
|
23113 | if (categoryLabels.length > 0 && isSparklines) categoryLabels = [], data.canShowDataLabels = !1; else if (this.showCategoryLabels()) {
|
23114 | var textProperties = FunnelChart.getTextProperties(), longestLabelLength = this.getMaxLabelLength(categoryLabels, textProperties), maxLabelLength = viewport.width * maxMarginFactor, labelLength = Math.min(longestLabelLength, maxLabelLength);
|
23115 | margin.left = labelLength + FunnelChart.YAxisPadding;
|
23116 | } else categoryLabels = [];
|
23117 | var horizontalRange = viewport.width - (margin.left + margin.right), barToSpaceRatio = FunnelChart.BarToSpaceRatio, maxScore = d3.max(slices.map(function(d) {
|
23118 | return d.value;
|
23119 | }));
|
23120 | if (data.hasHighlights) {
|
23121 | var maxHighlight = d3.max(slices.map(function(d) {
|
23122 | return d.highlightValue;
|
23123 | }));
|
23124 | maxScore = d3.max([ maxScore, maxHighlight ]);
|
23125 | }
|
23126 | var delta, minScore = 0, rangeStart = 0, rangeEnd = verticalRange;
|
23127 | delta = isHidingPercentBars ? verticalRange - categoryLabels.length * FunnelChart.MaxBarHeight : verticalRange - categoryLabels.length * FunnelChart.MaxBarHeight - 2 * FunnelChart.MaxBarHeight * FunnelChart.PercentBarToBarRatio,
|
23128 | categoryLabels.length > 0 && delta > 0 && (rangeStart = Math.ceil(delta / 2), rangeEnd = Math.ceil(verticalRange - delta / 2)),
|
23129 | isHidingPercentBars || (rangeStart += percentBarTextHeight, rangeEnd += percentBarTextHeight);
|
23130 | 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);
|
23131 | return {
|
23132 | margin: margin,
|
23133 | valueScale: valueScale,
|
23134 | categoryScale: categoryScale,
|
23135 | maxScore: maxScore,
|
23136 | maxWidth: horizontalRange,
|
23137 | rangeStart: rangeStart,
|
23138 | rangeEnd: rangeEnd,
|
23139 | barToSpaceRatio: barToSpaceRatio,
|
23140 | categoryLabels: categoryLabels
|
23141 | };
|
23142 | }, FunnelChart.prototype.getPercentBarTextHeight = function() {
|
23143 | var percentBarTextProperties = FunnelChart.getTextProperties(this.data.percentBarLabelSettings.fontSize);
|
23144 | return powerbi.TextMeasurementService.estimateSvgTextHeight(percentBarTextProperties);
|
23145 | }, FunnelChart.prototype.onClearSelection = function() {
|
23146 | this.interactivityService && this.interactivityService.clearSelection();
|
23147 | }, FunnelChart.getLayout = function(data, axisOptions) {
|
23148 | 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) {
|
23149 | return (horizontalDistance - Math.abs(valueScale(value) - valueScale(0))) / 2;
|
23150 | }, getMinimumShapeSize = function(value) {
|
23151 | return Math.max(FunnelChart.MinimumInteractorSize, Math.abs(valueScale(value) - valueScale(0)));
|
23152 | }, percentBarFontSize = PixelConverter.fromPoint(data.percentBarLabelSettings.fontSize), percentBarTextProperties = FunnelChart.getTextProperties(data.percentBarLabelSettings.fontSize), baselineDelta = powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(percentBarTextProperties), percentBarYOffset = powerbi.TextMeasurementService.estimateSvgTextHeight(percentBarTextProperties) - baselineDelta;
|
23153 | return {
|
23154 | percentBarLayout: {
|
23155 | mainLine: {
|
23156 | x2: function(d) {
|
23157 | return Math.abs(valueScale(d.value) - valueScale(0));
|
23158 | },
|
23159 | transform: function(d) {
|
23160 | var xOffset = valueScale(d.value) - emptyHorizontalSpace(d.value), yOffset = d.isTop ? categoryScale(0) - percentBarTickHeight : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight;
|
23161 | return visuals.SVGUtil.translate(xOffset, yOffset);
|
23162 | }
|
23163 | },
|
23164 | leftTick: {
|
23165 | y2: function(d) {
|
23166 | return percentBarTickHeight;
|
23167 | },
|
23168 | transform: function(d) {
|
23169 | var xOffset = valueScale(d.value) - emptyHorizontalSpace(d.value), yOffset = d.isTop ? categoryScale(0) - percentBarTickHeight - percentBarTickHeight / 2 : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight - percentBarTickHeight / 2;
|
23170 | return visuals.SVGUtil.translate(xOffset, yOffset);
|
23171 | }
|
23172 | },
|
23173 | rightTick: {
|
23174 | y2: function(d) {
|
23175 | return percentBarTickHeight;
|
23176 | },
|
23177 | transform: function(d) {
|
23178 | 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;
|
23179 | return visuals.SVGUtil.translate(xOffset, yOffset);
|
23180 | }
|
23181 | },
|
23182 | text: {
|
23183 | x: function(d) {
|
23184 | return Math.ceil(Math.abs(valueScale(maxScore) - valueScale(0)) / 2);
|
23185 | },
|
23186 | y: function(d) {
|
23187 | return d.isTop ? -percentBarTickHeight / 2 - baselineDelta : percentBarYOffset + percentBarTickHeight / 2;
|
23188 | },
|
23189 | style: function() {
|
23190 | return "font-size: " + percentBarFontSize + ";";
|
23191 | },
|
23192 | transform: function(d) {
|
23193 | var xOffset = d.isTop ? categoryScale(0) - percentBarTickHeight : categoryScale(lastCategoryIndex) + columnHeight + percentBarTickHeight;
|
23194 | return visuals.SVGUtil.translate(0, xOffset);
|
23195 | },
|
23196 | fill: data.percentBarLabelSettings.labelColor,
|
23197 | maxWidth: horizontalDistance
|
23198 | }
|
23199 | },
|
23200 | shapeLayout: {
|
23201 | height: function(d) {
|
23202 | return d.highlight && highlightsOverflow ? overFlowHighlightColumnWidth : columnHeight;
|
23203 | },
|
23204 | width: function(d) {
|
23205 | return Math.abs(valueScale(FunnelChart.getFunnelSliceValue(d)) - valueScale(0));
|
23206 | },
|
23207 | y: function(d) {
|
23208 | return categoryScale(d.categoryOrMeasureIndex) + (d.highlight && highlightsOverflow ? overFlowHighlightOffset : 0);
|
23209 | },
|
23210 | x: function(d) {
|
23211 | var value = FunnelChart.getFunnelSliceValue(d);
|
23212 | return valueScale(value) - emptyHorizontalSpace(value);
|
23213 | }
|
23214 | },
|
23215 | shapeLayoutWithoutHighlights: {
|
23216 | height: function(d) {
|
23217 | return columnHeight;
|
23218 | },
|
23219 | width: function(d) {
|
23220 | return Math.abs(valueScale(d.value) - valueScale(0));
|
23221 | },
|
23222 | y: function(d) {
|
23223 | return categoryScale(d.categoryOrMeasureIndex) + 0;
|
23224 | },
|
23225 | x: function(d) {
|
23226 | return valueScale(d.value) - emptyHorizontalSpace(d.value);
|
23227 | }
|
23228 | },
|
23229 | zeroShapeLayout: {
|
23230 | height: function(d) {
|
23231 | return d.highlight && highlightsOverflow ? overFlowHighlightColumnWidth : columnHeight;
|
23232 | },
|
23233 | width: function(d) {
|
23234 | return 0;
|
23235 | },
|
23236 | y: function(d) {
|
23237 | return categoryScale(d.categoryOrMeasureIndex) + (d.highlight && highlightsOverflow ? overFlowHighlightOffset : 0);
|
23238 | },
|
23239 | x: function(d) {
|
23240 | return valueScale((valueScale.domain()[0] + valueScale.domain()[1]) / 2);
|
23241 | }
|
23242 | },
|
23243 | interactorLayout: {
|
23244 | height: function(d) {
|
23245 | return d.highlight && highlightsOverflow ? overFlowHighlightColumnWidth : columnHeight;
|
23246 | },
|
23247 | width: function(d) {
|
23248 | return getMinimumShapeSize(FunnelChart.getFunnelSliceValue(d));
|
23249 | },
|
23250 | y: function(d) {
|
23251 | return categoryScale(d.categoryOrMeasureIndex) + (d.highlight && highlightsOverflow ? overFlowHighlightOffset : 0);
|
23252 | },
|
23253 | x: function(d) {
|
23254 | var size = getMinimumShapeSize(FunnelChart.getFunnelSliceValue(d));
|
23255 | return (horizontalDistance - size) / 2;
|
23256 | }
|
23257 | }
|
23258 | };
|
23259 | }, FunnelChart.drawDefaultAxis = function(graphicsContext, axisOptions, isHidingPercentBars) {
|
23260 | 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) {
|
23261 | return axisOptions.categoryLabels[i];
|
23262 | });
|
23263 | graphicsContext.attr("class", "axis hideLinesOnAxis").attr("transform", visuals.SVGUtil.translate(0, axisOptions.margin.top)).call(xAxis),
|
23264 | graphicsContext.selectAll(".tick").call(visuals.tooltipUtils.tooltipUpdate, axisOptions.categoryLabels);
|
23265 | var leftRightMarginLimit = axisOptions.margin.left - FunnelChart.LabelFunnelPadding;
|
23266 | graphicsContext.selectAll(".tick text").call(visuals.AxisHelper.LabelLayoutStrategy.clip, leftRightMarginLimit, powerbi.TextMeasurementService.svgEllipsis);
|
23267 | }, FunnelChart.drawDefaultShapes = function(data, slices, graphicsContext, layout, hasSelection) {
|
23268 | var hasHighlights = data.hasHighlights, columns = graphicsContext.selectAll(FunnelChart.Selectors.funnel.bars.selector).data(slices, function(d) {
|
23269 | return d.key;
|
23270 | });
|
23271 | return columns.enter().append("rect").attr("class", function(d) {
|
23272 | return d.highlight ? FunnelChart.FunnelBarHighlightClass : FunnelChart.Selectors.funnel.bars["class"];
|
23273 | }), columns.style("fill", function(d) {
|
23274 | return d.color;
|
23275 | }).style("fill-opacity", function(d) {
|
23276 | return function(d) {
|
23277 | return visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, hasHighlights);
|
23278 | };
|
23279 | }).attr(layout.shapeLayout), columns.exit().remove(), columns;
|
23280 | }, FunnelChart.getFunnelSliceValue = function(slice, asOriginal) {
|
23281 | return void 0 === asOriginal && (asOriginal = !1), asOriginal ? slice.highlight ? slice.originalHighlightValue : slice.originalValue : slice.highlight ? slice.highlightValue : slice.value;
|
23282 | }, FunnelChart.drawInteractorShapes = function(slices, graphicsContext, layout) {
|
23283 | var interactorsData = slices.filter(function(d) {
|
23284 | return !d.highlight && layout.interactorLayout.width(d) === FunnelChart.MinimumInteractorSize;
|
23285 | }), columns = graphicsContext.selectAll(FunnelChart.Selectors.funnel.interactors.selector).data(interactorsData, function(d) {
|
23286 | return d.key;
|
23287 | });
|
23288 | return columns.enter().append("rect").attr("class", FunnelChart.Selectors.funnel.interactors["class"]),
|
23289 | columns.style("fill-opacity", 0).attr(layout.interactorLayout), columns.exit().remove(),
|
23290 | columns;
|
23291 | }, FunnelChart.drawPercentBarComponents = function(graphicsContext, data, layout, percentLabelSettings) {
|
23292 | var mainLine = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.mainLine.selector).data(data);
|
23293 | mainLine.exit().remove(), mainLine.enter().append("line").classed(FunnelChart.Selectors.percentBar.mainLine["class"], !0),
|
23294 | mainLine.attr(layout.percentBarLayout.mainLine);
|
23295 | var leftTick = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.leftTick.selector).data(data);
|
23296 | leftTick.exit().remove(), leftTick.enter().append("line").classed(FunnelChart.Selectors.percentBar.leftTick["class"], !0),
|
23297 | leftTick.attr(layout.percentBarLayout.leftTick);
|
23298 | var rightTick = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.rightTick.selector).data(data);
|
23299 | rightTick.exit().remove(), rightTick.enter().append("line").classed(FunnelChart.Selectors.percentBar.rightTick["class"], !0),
|
23300 | rightTick.attr(layout.percentBarLayout.rightTick);
|
23301 | var text = graphicsContext.selectAll(FunnelChart.Selectors.percentBar.text.selector).data(data), localizedString = visuals.valueFormatter.getLocalizedString("Percentage1");
|
23302 | text.exit().remove(), text.enter().append("text").classed(FunnelChart.Selectors.percentBar.text["class"], !0),
|
23303 | text.attr(layout.percentBarLayout.text).text(function(fp) {
|
23304 | return visuals.dataLabelUtils.getLabelFormattedText({
|
23305 | label: fp.percent,
|
23306 | format: localizedString,
|
23307 | fontSize: percentLabelSettings.fontSize,
|
23308 | maxWidth: layout.percentBarLayout.text.maxWidth
|
23309 | });
|
23310 | }).append("title").text(function(d) {
|
23311 | return powerbi.formattingService.formatValue(d.percent, localizedString);
|
23312 | });
|
23313 | }, FunnelChart.drawPercentBars = function(data, graphicsContext, layout, isHidingPercentBars) {
|
23314 | if (isHidingPercentBars || !data.slices || (data.hasHighlights ? data.slices.length / 2 : data.slices.length) < 2) return void FunnelChart.drawPercentBarComponents(graphicsContext, [], layout, data.percentBarLabelSettings);
|
23315 | var slices = [ data.slices[data.hasHighlights ? 1 : 0], data.slices[data.slices.length - 1] ], baseline = FunnelChart.getFunnelSliceValue(slices[0]);
|
23316 | if (0 >= baseline) return void FunnelChart.drawPercentBarComponents(graphicsContext, [], layout, data.percentBarLabelSettings);
|
23317 | var percentData = [ {
|
23318 | value: FunnelChart.getFunnelSliceValue(slices[0]),
|
23319 | percent: 1,
|
23320 | isTop: !0
|
23321 | }, {
|
23322 | value: FunnelChart.getFunnelSliceValue(slices[1]),
|
23323 | percent: FunnelChart.getFunnelSliceValue(slices[1]) / baseline,
|
23324 | isTop: !1
|
23325 | } ];
|
23326 | FunnelChart.drawPercentBarComponents(graphicsContext, percentData, layout, data.percentBarLabelSettings);
|
23327 | }, FunnelChart.prototype.showCategoryLabels = function() {
|
23328 | return !(this.funnelSmallViewPortProperties && this.funnelSmallViewPortProperties.hideFunnelCategoryLabelsOnSmallViewPort && this.currentViewport.height < this.funnelSmallViewPortProperties.minHeightFunnelCategoryLabelsVisible);
|
23329 | }, FunnelChart.addFunnelPercentsToTooltip = function(pctFormatString, tooltipInfo, hostServices, percentOfFirst, percentOfPrevious, highlight) {
|
23330 | null != percentOfFirst && tooltipInfo.push({
|
23331 | displayName: hostServices.getLocalizedString("Funnel_PercentOfFirst" + (highlight ? "_Highlight" : "")),
|
23332 | value: visuals.valueFormatter.format(percentOfFirst, pctFormatString)
|
23333 | }), null != percentOfPrevious && tooltipInfo.push({
|
23334 | displayName: hostServices.getLocalizedString("Funnel_PercentOfPrevious" + (highlight ? "_Highlight" : "")),
|
23335 | value: visuals.valueFormatter.format(percentOfPrevious, pctFormatString)
|
23336 | });
|
23337 | }, FunnelChart.getTextProperties = function(fontSize) {
|
23338 | return {
|
23339 | fontSize: PixelConverter.fromPoint(fontSize || visuals.dataLabelUtils.DefaultFontSizeInPt),
|
23340 | fontFamily: FunnelChart.DefaultFontFamily
|
23341 | };
|
23342 | }, FunnelChart.DefaultBarOpacity = 1, FunnelChart.DimmedBarOpacity = .4, FunnelChart.PercentBarToBarRatio = .75,
|
23343 | FunnelChart.TickPadding = 0, FunnelChart.InnerTickSize = 0, FunnelChart.MinimumInteractorSize = 15,
|
23344 | FunnelChart.InnerTextClassName = "labelSeries", FunnelChart.Selectors = {
|
23345 | funnel: {
|
23346 | bars: createClassAndSelector("funnelBar"),
|
23347 | highlights: createClassAndSelector("highlight"),
|
23348 | interactors: createClassAndSelector("funnelBarInteractor")
|
23349 | },
|
23350 | percentBar: {
|
23351 | root: createClassAndSelector("percentBars"),
|
23352 | mainLine: createClassAndSelector("mainLine"),
|
23353 | leftTick: createClassAndSelector("leftTick"),
|
23354 | rightTick: createClassAndSelector("rightTick"),
|
23355 | text: createClassAndSelector("value")
|
23356 | }
|
23357 | }, FunnelChart.FunnelBarHighlightClass = [ FunnelChart.Selectors.funnel.bars["class"], FunnelChart.Selectors.funnel.highlights["class"] ].join(" "),
|
23358 | FunnelChart.YAxisPadding = 10, FunnelChart.VisualClassName = "funnelChart", FunnelChart.DefaultFontFamily = "wf_standard-font",
|
23359 | FunnelChart.BarToSpaceRatio = .1, FunnelChart.MaxBarHeight = 40, FunnelChart.MinBarThickness = 12,
|
23360 | FunnelChart.LabelFunnelPadding = 6, FunnelChart.InnerTextMinimumPadding = 10, FunnelChart.OverflowingHighlightWidthRatio = .5,
|
23361 | FunnelChart.MaxMarginFactor = .25, FunnelChart;
|
23362 | }();
|
23363 | visuals.FunnelChart = FunnelChart;
|
23364 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
23365 | }(powerbi || (powerbi = {}));
|
23366 |
|
23367 | var powerbi;
|
23368 |
|
23369 | !function(powerbi) {
|
23370 | var visuals;
|
23371 | !function(visuals) {
|
23372 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, DataRoleHelper = powerbi.data.DataRoleHelper, Gauge = function() {
|
23373 | function Gauge(options) {
|
23374 | this.lastAngle = -Math.PI / 2, options && (options.gaugeSmallViewPortProperties && (this.gaugeSmallViewPortProperties = options.gaugeSmallViewPortProperties),
|
23375 | this.animator = options.animator, this.tooltipsEnabled = options.tooltipsEnabled);
|
23376 | }
|
23377 | return Gauge.prototype.enumerateObjectInstances = function(options) {
|
23378 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
23379 | switch (options.objectName) {
|
23380 | case "axis":
|
23381 | this.enumerateAxis(enumeration);
|
23382 | break;
|
23383 |
|
23384 | case "labels":
|
23385 | var labelSettings = this.data ? this.data.dataLabelsSettings : visuals.dataLabelUtils.getDefaultGaugeLabelSettings();
|
23386 | visuals.dataLabelUtils.enumerateDataLabels(this.getDataLabelSettingsOptions(enumeration, labelSettings));
|
23387 | break;
|
23388 |
|
23389 | case "calloutValue":
|
23390 | var labelSettings = this.data ? this.data.calloutValueLabelsSettings : visuals.dataLabelUtils.getDefaultGaugeLabelSettings();
|
23391 | visuals.dataLabelUtils.enumerateDataLabels(this.getDataLabelSettingsOptions(enumeration, labelSettings));
|
23392 | break;
|
23393 |
|
23394 | case "dataPoint":
|
23395 | this.enumerateDataPoint(enumeration);
|
23396 | }
|
23397 | return enumeration.complete();
|
23398 | }, Gauge.prototype.getDataLabelSettingsOptions = function(enumeration, labelSettings) {
|
23399 | return {
|
23400 | dataLabelsSettings: labelSettings,
|
23401 | show: !0,
|
23402 | precision: !0,
|
23403 | displayUnits: !0,
|
23404 | fontSize: !0,
|
23405 | enumeration: enumeration
|
23406 | };
|
23407 | }, Gauge.prototype.enumerateAxis = function(enumeration) {
|
23408 | var dataView = this.dataViews[0];
|
23409 | if (dataView && dataView.metadata) {
|
23410 | var properties = Gauge.getGaugeObjectsProperties(dataView);
|
23411 | enumeration.pushInstance({
|
23412 | selector: null,
|
23413 | objectName: "axis",
|
23414 | properties: properties
|
23415 | });
|
23416 | }
|
23417 | }, Gauge.prototype.enumerateDataPoint = function(enumeration) {
|
23418 | var dataPointSettings = this.data ? this.data.dataPointSettings : Gauge.DefaultDataPointSettings, properties = {};
|
23419 | properties.fill = {
|
23420 | solid: {
|
23421 | color: dataPointSettings.fillColor
|
23422 | }
|
23423 | }, null != dataPointSettings.targetColor && (properties.target = {
|
23424 | solid: {
|
23425 | color: dataPointSettings.targetColor
|
23426 | }
|
23427 | }), enumeration.pushInstance({
|
23428 | selector: null,
|
23429 | objectName: visuals.gaugeProps.dataPoint.target.objectName,
|
23430 | properties: properties
|
23431 | });
|
23432 | }, Gauge.getGaugeObjectsProperties = function(dataView) {
|
23433 | var properties = {}, objects = dataView.metadata.objects, hasAxisObject = !!objects && !!objects.axis;
|
23434 | return DataRoleHelper.hasRoleInDataView(dataView, visuals.gaugeRoleNames.minValue) || (properties.min = hasAxisObject ? objects.axis.min : void 0),
|
23435 | DataRoleHelper.hasRoleInDataView(dataView, visuals.gaugeRoleNames.maxValue) || (properties.max = hasAxisObject ? objects.axis.max : void 0),
|
23436 | DataRoleHelper.hasRoleInDataView(dataView, visuals.gaugeRoleNames.targetValue) || (properties.target = hasAxisObject ? objects.axis.target : void 0),
|
23437 | properties;
|
23438 | }, Gauge.prototype.init = function(options) {
|
23439 | this.element = options.element, this.currentViewport = options.viewport, this.style = options.style,
|
23440 | this.options = options, this.settings = Gauge.DefaultStyleProperties, this.targetSettings = Gauge.DefaultTargetSettings,
|
23441 | this.setMargins(), this.color = d3.scale.ordinal().range(this.style.colorPalette.dataColors.getSentimentColors().map(function(color) {
|
23442 | return color.value;
|
23443 | })), this.hostService = options.host;
|
23444 | var svg = this.svg = d3.select(this.element.get(0)).append("svg");
|
23445 | svg.classed(Gauge.VisualClassName, !0);
|
23446 | var mainGraphicsContext = this.mainGraphicsContext = svg.append("g");
|
23447 | mainGraphicsContext.attr("class", Gauge.MainGaugeGroupClassName), this.initKpiBands();
|
23448 | 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);
|
23449 | this.backgroundArcPath = mainGraphicsContext.append("path").classed("backgroundArc", !0).attr("d", backgroundArc),
|
23450 | this.foregroundArcPath = mainGraphicsContext.append("path").datum({
|
23451 | endAngle: -Math.PI / 2
|
23452 | }).classed("foregroundArc", !0).attr("d", foregroundArc);
|
23453 | var g = this.animatedNumberGrapicsContext = svg.append("g");
|
23454 | this.animatedNumber = new visuals.AnimatedNumber(g), this.animatedNumber.init(options);
|
23455 | var gaugeDrawingOptions = this.gaugeVisualProperties = this.getGaugeVisualProperties(), animatedNumberProperties = this.getAnimatedNumberProperties(gaugeDrawingOptions.radius, gaugeDrawingOptions.innerRadiusFactor, gaugeDrawingOptions.top, gaugeDrawingOptions.left);
|
23456 | this.animatedNumberGrapicsContext.attr("transform", animatedNumberProperties.transformString),
|
23457 | this.animatedNumber.onResizing(animatedNumberProperties.viewport);
|
23458 | }, Gauge.prototype.update = function(options) {
|
23459 | this.currentViewport = options.viewport;
|
23460 | var dataViews = this.dataViews = options.dataViews;
|
23461 | if (dataViews && dataViews[0]) {
|
23462 | this.data = Gauge.converter(dataViews[0], this.tooltipsEnabled), this.targetSettings = this.data.targetSettings,
|
23463 | dataViews[0] && (dataViews[0].single = {
|
23464 | value: this.data.total
|
23465 | }), this.showTargetLabel = null != this.targetSettings.target && (this.currentViewport.width > Gauge.MinWidthForTargetLabel || !this.showMinMaxLabelsOnBottom()) && this.showSideNumbersLabelText() && this.data.dataLabelsSettings.show,
|
23466 | this.setMargins(), this.gaugeVisualProperties = this.getGaugeVisualProperties(),
|
23467 | this.drawViewPort(this.gaugeVisualProperties), this.updateInternal(options.suppressAnimations),
|
23468 | this.updateCalloutValue(options.suppressAnimations);
|
23469 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
23470 | this.hostService.setWarnings(warnings);
|
23471 | }
|
23472 | }, Gauge.prototype.updateCalloutValue = function(suppressAnimations) {
|
23473 | if (this.data.calloutValueLabelsSettings.show) {
|
23474 | var animatedNumberProperties = this.getAnimatedNumberProperties(this.gaugeVisualProperties.radius, this.gaugeVisualProperties.innerRadiusFactor, this.gaugeVisualProperties.top, this.gaugeVisualProperties.left);
|
23475 | this.animatedNumberGrapicsContext.attr("transform", animatedNumberProperties.transformString),
|
23476 | this.animatedNumber.setTextColor(this.data.calloutValueLabelsSettings.labelColor);
|
23477 | var calloutValue = this.data ? this.data.total : null, formatter = this.getFormatter(this.data.calloutValueLabelsSettings, calloutValue);
|
23478 | this.animatedNumber.setFormatter(formatter), this.animatedNumber.update({
|
23479 | viewport: animatedNumberProperties.viewport,
|
23480 | dataViews: this.dataViews,
|
23481 | suppressAnimations: suppressAnimations
|
23482 | }), this.animatedNumberGrapicsContext.selectAll("title").remove(), this.animatedNumberGrapicsContext.append("title").text([ formatter.format(calloutValue) ]);
|
23483 | } else this.animatedNumber.clear(), this.animatedNumberGrapicsContext.selectAll("title").remove();
|
23484 | }, Gauge.prototype.onDataChanged = function(options) {
|
23485 | this.update({
|
23486 | dataViews: options.dataViews,
|
23487 | suppressAnimations: options.suppressAnimations,
|
23488 | viewport: this.currentViewport
|
23489 | });
|
23490 | }, Gauge.prototype.onResizing = function(viewport) {
|
23491 | this.update({
|
23492 | dataViews: this.dataViews,
|
23493 | suppressAnimations: !0,
|
23494 | viewMode: 0,
|
23495 | viewport: viewport
|
23496 | });
|
23497 | }, Gauge.getValidSettings = function(targetData) {
|
23498 | var maxVal = targetData.max === Gauge.MAX_VALUE ? Gauge.DEFAULT_MAX : targetData.max, minVal = targetData.min === Gauge.MIN_VALUE ? Gauge.DEFAULT_MIN : targetData.min, targetVal = targetData.target;
|
23499 | return {
|
23500 | min: minVal,
|
23501 | max: maxVal,
|
23502 | target: targetVal
|
23503 | };
|
23504 | }, Gauge.getGaugeData = function(dataView) {
|
23505 | var settings = {
|
23506 | max: Gauge.MAX_VALUE,
|
23507 | min: Gauge.MIN_VALUE,
|
23508 | target: void 0,
|
23509 | total: 0,
|
23510 | tooltipItems: []
|
23511 | };
|
23512 | if (dataView && dataView.categorical && dataView.categorical.values && dataView.metadata && dataView.metadata.columns) {
|
23513 | for (var values = dataView.categorical.values, metadataColumns = dataView.metadata.columns, i = 0; i < values.length; i++) {
|
23514 | var col = metadataColumns[i], value = values[i].values[0] || 0;
|
23515 | col && col.roles && (col.roles[visuals.gaugeRoleNames.y] ? (settings.total = value,
|
23516 | value && settings.tooltipItems.push({
|
23517 | displayName: values[i].source.displayName,
|
23518 | value: visuals.converterHelper.formatFromMetadataColumn(value, values[i].source, Gauge.formatStringProp)
|
23519 | })) : col.roles[visuals.gaugeRoleNames.minValue] ? settings.min = value : col.roles[visuals.gaugeRoleNames.maxValue] ? settings.max = value : col.roles[visuals.gaugeRoleNames.targetValue] && (settings.target = value,
|
23520 | value && settings.tooltipItems.push({
|
23521 | displayName: values[i].source.displayName,
|
23522 | value: visuals.converterHelper.formatFromMetadataColumn(value, values[i].source, Gauge.formatStringProp)
|
23523 | })));
|
23524 | }
|
23525 | var gaugeObjectsSettings = Gauge.getGaugeObjectsProperties(dataView);
|
23526 | gaugeObjectsSettings && !$.isEmptyObject(gaugeObjectsSettings) && Gauge.overrideGaugeSettings(settings, gaugeObjectsSettings);
|
23527 | } else settings.tooltipItems = void 0;
|
23528 | return settings;
|
23529 | }, Gauge.overrideGaugeSettings = function(settings, gaugeObjectsSettings) {
|
23530 | $.isNumeric(gaugeObjectsSettings.min) && (settings.min = gaugeObjectsSettings.min),
|
23531 | $.isNumeric(gaugeObjectsSettings.max) && (settings.max = gaugeObjectsSettings.max),
|
23532 | $.isNumeric(gaugeObjectsSettings.target) && (settings.target = gaugeObjectsSettings.target);
|
23533 | }, Gauge.converter = function(dataView, tooltipsEnabled) {
|
23534 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
23535 | var gaugeData = Gauge.getGaugeData(dataView), total = gaugeData.total, formatString = null, hasPercent = !1;
|
23536 | dataView.metadata && !_.isEmpty(dataView.metadata.columns) && (formatString = visuals.valueFormatter.getFormatString(dataView.metadata.columns[0], Gauge.formatStringProp, !0),
|
23537 | null != formatString && (hasPercent = visuals.valueFormatter.getFormatMetadata(formatString).hasPercent)),
|
23538 | total > 0 && gaugeData.max === Gauge.MAX_VALUE && (gaugeData.max = hasPercent ? Gauge.DEFAULT_MAX : 2 * total);
|
23539 | var settings = Gauge.getValidSettings(gaugeData), adjustedTotal = Math.max(total, settings.min);
|
23540 | adjustedTotal = Math.min(adjustedTotal, settings.max);
|
23541 | var tooltipInfo, percent = settings.min !== settings.max ? (adjustedTotal - settings.min) / (settings.max - settings.min) : 0;
|
23542 | return tooltipsEnabled && dataView && null != gaugeData.tooltipItems && (tooltipInfo = gaugeData.tooltipItems),
|
23543 | {
|
23544 | percent: percent,
|
23545 | adjustedTotal: adjustedTotal,
|
23546 | total: total,
|
23547 | metadataColumn: Gauge.getMetaDataColumn(dataView),
|
23548 | targetSettings: settings,
|
23549 | tooltipInfo: tooltipInfo,
|
23550 | dataLabelsSettings: Gauge.convertDataLabelSettings(dataView, "labels"),
|
23551 | calloutValueLabelsSettings: Gauge.convertDataLabelSettings(dataView, "calloutValue"),
|
23552 | dataPointSettings: Gauge.convertDataPointSettings(dataView, settings)
|
23553 | };
|
23554 | }, Gauge.convertDataLabelSettings = function(dataview, objectName) {
|
23555 | var dataViewMetadata = dataview.metadata, dataLabelsSettings = visuals.dataLabelUtils.getDefaultGaugeLabelSettings();
|
23556 | if (dataViewMetadata) {
|
23557 | var objects = dataViewMetadata.objects;
|
23558 | if (objects) {
|
23559 | var labelsObj = objects[objectName];
|
23560 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
23561 | }
|
23562 | }
|
23563 | return dataLabelsSettings;
|
23564 | }, Gauge.convertDataPointSettings = function(dataView, targetSettings) {
|
23565 | var targetColor, fillColor = Gauge.DefaultDataPointSettings.fillColor;
|
23566 | if (dataView && dataView.metadata && dataView.metadata.objects) {
|
23567 | var objects = dataView.metadata.objects;
|
23568 | fillColor = powerbi.DataViewObjects.getFillColor(objects, visuals.gaugeProps.dataPoint.fill, Gauge.DefaultDataPointSettings.fillColor),
|
23569 | targetSettings && null != targetSettings.target && (targetColor = powerbi.DataViewObjects.getFillColor(objects, visuals.gaugeProps.dataPoint.target, Gauge.DefaultDataPointSettings.targetColor));
|
23570 | } else targetSettings && null != targetSettings.target && (targetColor = Gauge.DefaultDataPointSettings.targetColor);
|
23571 | return {
|
23572 | fillColor: fillColor,
|
23573 | targetColor: targetColor
|
23574 | };
|
23575 | }, Gauge.getMetaDataColumn = function(dataView) {
|
23576 | if (dataView && dataView.metadata && dataView.metadata.columns) for (var i = 0, ilen = dataView.metadata.columns.length; ilen > i; i++) {
|
23577 | var column = dataView.metadata.columns[i];
|
23578 | if (column.isMeasure) return column;
|
23579 | }
|
23580 | return null;
|
23581 | }, Gauge.prototype.initKpiBands = function() {
|
23582 | if (this.settings.kpiBands.show) for (var kpiArcs = this.kpiArcs = [], kpiArcPaths = this.kpiArcPaths = [], mainGraphicsContext = this.mainGraphicsContext, i = 0; 3 > i; i++) {
|
23583 | var arc = d3.svg.arc().innerRadius(0).outerRadius(0).startAngle(0).endAngle(0);
|
23584 | kpiArcs.push(arc);
|
23585 | var arcPath = mainGraphicsContext.append("path").attr("d", arc);
|
23586 | kpiArcPaths.push(arcPath);
|
23587 | }
|
23588 | }, Gauge.prototype.updateKpiBands = function(radius, innerRadiusFactor, tString, kpiAngleAttr) {
|
23589 | 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),
|
23590 | this.kpiArcPaths[i].attr("fill", kpiAngleAttr[i].fill).attr("d", this.kpiArcs[i]).attr("transform", tString);
|
23591 | }, Gauge.prototype.removeTargetElements = function() {
|
23592 | this.targetLine && (this.targetLine.remove(), this.targetText.remove(), this.targetConnector.remove(),
|
23593 | this.targetLine = this.targetConnector = this.targetText = null);
|
23594 | }, Gauge.prototype.getTargetRatio = function() {
|
23595 | var targetSettings = this.targetSettings, range = targetSettings.max - targetSettings.min;
|
23596 | return 0 !== range ? (targetSettings.target - targetSettings.min) / range : 0;
|
23597 | }, Gauge.prototype.updateTargetLine = function(radius, innerRadius, left, top) {
|
23598 | this.targetLine || (this.targetLine = this.mainGraphicsContext.append("line"));
|
23599 | 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);
|
23600 | this.targetLine.attr({
|
23601 | x1: inX,
|
23602 | y1: inY,
|
23603 | x2: outX,
|
23604 | y2: outY
|
23605 | });
|
23606 | }, Gauge.prototype.getAnimatedNumberProperties = function(radius, innerRadiusFactor, top, left) {
|
23607 | 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;
|
23608 | innerY *= scale, innerX *= scale;
|
23609 | var animatedNumberWidth = 2 * innerRCos, properties = {
|
23610 | transformString: visuals.SVGUtil.translate(innerX, innerY),
|
23611 | viewport: {
|
23612 | height: innerRSin,
|
23613 | width: animatedNumberWidth
|
23614 | }
|
23615 | };
|
23616 | return properties;
|
23617 | }, Gauge.prototype.getGaugeVisualProperties = function() {
|
23618 | 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 = {
|
23619 | radius: radius,
|
23620 | innerRadiusOfArc: innerRadiusOfArc,
|
23621 | left: left,
|
23622 | top: top,
|
23623 | height: height,
|
23624 | width: width,
|
23625 | margin: margin,
|
23626 | transformString: tString,
|
23627 | innerRadiusFactor: innerRadiusFactor
|
23628 | };
|
23629 | return gaugeData;
|
23630 | }, Gauge.prototype.drawViewPort = function(drawOptions) {
|
23631 | var separation = this.settings.kpiBands.separationRadians, innerRadiusFactor = Gauge.InnerRadiusFactor, backgroudArc = this.backgroundArc, color = this.color, attrs = [ {
|
23632 | fill: color(0),
|
23633 | start: -Math.PI / 2,
|
23634 | end: -Math.PI / 2 + Math.PI / 4 - separation
|
23635 | }, {
|
23636 | fill: color(1),
|
23637 | start: -Math.PI / 2 + 1 * Math.PI / 4 + separation,
|
23638 | end: -Math.PI / 2 + 3 * Math.PI / 4 - separation
|
23639 | }, {
|
23640 | fill: color(2),
|
23641 | start: -Math.PI / 2 + 3 * Math.PI / 4 + separation,
|
23642 | end: Math.PI / 2
|
23643 | } ], radius = drawOptions.radius, transformString = drawOptions.transformString;
|
23644 | this.updateKpiBands(radius, innerRadiusFactor, transformString, attrs), backgroudArc.innerRadius(radius * innerRadiusFactor).outerRadius(radius).startAngle(-Math.PI / 2).endAngle(Math.PI / 2),
|
23645 | this.backgroundArcPath.attr("d", backgroudArc).attr("transform", transformString);
|
23646 | var foregroundArc = this.foregroundArc;
|
23647 | foregroundArc.innerRadius(radius * innerRadiusFactor).outerRadius(radius).startAngle(-Math.PI / 2),
|
23648 | this.foregroundArcPath.datum({
|
23649 | endAngle: this.lastAngle
|
23650 | }).attr("transform", transformString).attr("d", foregroundArc);
|
23651 | var innerRadiusOfArc = drawOptions.innerRadiusOfArc, left = drawOptions.left, top = drawOptions.top, margin = drawOptions.margin, height = drawOptions.height, targetSettings = this.targetSettings;
|
23652 | this.settings.targetLine.show && null != targetSettings.target ? targetSettings.min > targetSettings.target || targetSettings.max < targetSettings.target ? this.removeTargetElements() : (this.updateTargetLine(radius, innerRadiusOfArc, left, top),
|
23653 | this.appendTargetTextAlongArc(radius, height, drawOptions.width, margin)) : this.removeTargetElements(),
|
23654 | this.svg.attr("height", this.currentViewport.height).attr("width", this.currentViewport.width);
|
23655 | }, Gauge.prototype.createTicks = function() {
|
23656 | for (var settings = this.settings, targetSettings = this.targetSettings, total = targetSettings.max - targetSettings.min, numberOfLabels = settings.labels.count, step = total / numberOfLabels, arr = [], formatter = this.getFormatter(this.data.dataLabelsSettings, targetSettings.max), i = 0; numberOfLabels + 1 > i; i++) arr.push(formatter.format(targetSettings.min + i * step));
|
23657 | return arr;
|
23658 | }, Gauge.prototype.updateInternal = function(suppressAnimations) {
|
23659 | 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 * data.percent, ticks = this.createTicks();
|
23660 | this.foregroundArcPath.transition().ease(this.settings.transition.ease).duration(duration).call(this.arcTween, [ lastAngle, this.foregroundArc ]),
|
23661 | this.appendTextAlongArc(ticks, radius, height, width, margin), this.updateVisualConfigurations(),
|
23662 | this.updateVisualStyles(), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.foregroundArcPath, function(tooltipEvent) {
|
23663 | return data.tooltipInfo;
|
23664 | }), visuals.TooltipManager.addTooltip(this.backgroundArcPath, function(tooltipEvent) {
|
23665 | return data.tooltipInfo;
|
23666 | }));
|
23667 | }, Gauge.prototype.updateVisualStyles = function() {
|
23668 | var fillColor = this.data.dataLabelsSettings.labelColor || this.style.labelText.color.value;
|
23669 | this.mainGraphicsContext.selectAll("text").style({
|
23670 | fill: fillColor
|
23671 | });
|
23672 | }, Gauge.prototype.updateVisualConfigurations = function() {
|
23673 | var configOptions = this.settings, dataPointSettings = this.data.dataPointSettings;
|
23674 | this.mainGraphicsContext.select("line").attr({
|
23675 | stroke: dataPointSettings.targetColor,
|
23676 | "stroke-width": configOptions.targetLine.thickness
|
23677 | }), this.backgroundArcPath.style("fill", configOptions.arcColors.background), this.foregroundArcPath.style("fill", dataPointSettings.fillColor);
|
23678 | }, Gauge.prototype.appendTextAlongArc = function(ticks, radius, height, width, margin) {
|
23679 | 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, count = 0; total > count; count++) {
|
23680 | var textProperties = {
|
23681 | text: ticks[count],
|
23682 | fontFamily: visuals.dataLabelUtils.LabelTextProperties.fontFamily,
|
23683 | fontSize: visuals.dataLabelUtils.LabelTextProperties.fontSize,
|
23684 | fontWeight: visuals.dataLabelUtils.LabelTextProperties.fontWeight
|
23685 | };
|
23686 | if (Math.floor(total / 2) !== count && this.showSideNumbersLabelText()) {
|
23687 | var x = margin.left + width / 2 - radius * Math.cos(Math.PI * count / divisor), y = top - radius * Math.sin(Math.PI * count / divisor), anchor = void 0, onRight = 2 * count > total, onBottom = !1;
|
23688 | !showMinMaxLabelsOnBottom || 0 !== count && count !== total - 1 ? (anchor = onRight ? "start" : "end",
|
23689 | x += padding * (onRight ? 1 : -1)) : (onBottom = !0, y += padding / 2, anchor = onRight ? "end" : "start",
|
23690 | textProperties.text = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, radius));
|
23691 | var text = this.mainGraphicsContext.append("text").attr({
|
23692 | x: x,
|
23693 | y: y,
|
23694 | dy: onBottom ? fontSize : 0,
|
23695 | "class": Gauge.LabelText["class"]
|
23696 | }).style({
|
23697 | "text-anchor": anchor,
|
23698 | "font-size": fontSize
|
23699 | }).text(textProperties.text).append("title").text(textProperties.text);
|
23700 | onBottom || this.truncateTextIfNeeded(text, x, onRight);
|
23701 | }
|
23702 | }
|
23703 | }, Gauge.prototype.truncateTextIfNeeded = function(text, positionX, onRight) {
|
23704 | var availableSpace = onRight ? this.currentViewport.width - positionX : positionX;
|
23705 | text.call(visuals.AxisHelper.LabelLayoutStrategy.clip, availableSpace, powerbi.TextMeasurementService.svgEllipsis);
|
23706 | }, Gauge.prototype.getFormatter = function(dataLabelSettings, value2) {
|
23707 | var realValue2 = 0 === dataLabelSettings.displayUnits ? value2 : null, formatString = visuals.valueFormatter.getFormatString(this.data.metadataColumn, Gauge.formatStringProp), precision = visuals.dataLabelUtils.getLabelPrecision(dataLabelSettings.precision, formatString), valueFormatterOptions = visuals.dataLabelUtils.getOptionsForLabelFormatter(dataLabelSettings, formatString, realValue2, precision);
|
23708 | return valueFormatterOptions.formatSingleValues = !(dataLabelSettings.displayUnits > 0),
|
23709 | visuals.valueFormatter.create(valueFormatterOptions);
|
23710 | }, Gauge.prototype.appendTargetTextAlongArc = function(radius, height, width, margin) {
|
23711 | 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, 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);
|
23712 | this.targetText || (this.targetText = this.mainGraphicsContext.append("text").classed(Gauge.TargetText["class"], !0)),
|
23713 | this.targetText.attr({
|
23714 | x: targetX,
|
23715 | y: targetY
|
23716 | }).style({
|
23717 | "text-anchor": anchor,
|
23718 | display: this.showTargetLabel ? "" : "none",
|
23719 | "font-size": this.style.labelText.fontSize
|
23720 | }).text(formatter.format(target)), this.truncateTextIfNeeded(this.targetText, targetX, flag),
|
23721 | this.targetText.call(visuals.tooltipUtils.tooltipUpdate, [ formatter.format(target) ]),
|
23722 | this.targetConnector || (this.targetConnector = this.mainGraphicsContext.append("line").classed(Gauge.TargetConnector["class"], !0)),
|
23723 | tRatio === finalRatio ? this.targetConnector.style("display", "none") : this.targetConnector.attr({
|
23724 | x1: margin.left + width / 2 - radius * Math.cos(Math.PI * tRatio),
|
23725 | y1: top - radius * Math.sin(Math.PI * tRatio),
|
23726 | x2: targetX,
|
23727 | y2: targetY
|
23728 | }).style({
|
23729 | "stroke-width": this.settings.targetLine.thickness,
|
23730 | stroke: this.settings.targetLine.color,
|
23731 | display: ""
|
23732 | });
|
23733 | }, Gauge.prototype.arcTween = function(transition, arr) {
|
23734 | transition.attrTween("d", function(d) {
|
23735 | var interpolate = d3.interpolate(d.endAngle, arr[0]);
|
23736 | return function(t) {
|
23737 | return d.endAngle = interpolate(t), arr[1](d);
|
23738 | };
|
23739 | });
|
23740 | }, Gauge.prototype.showMinMaxLabelsOnBottom = function() {
|
23741 | if (this.currentViewport.height > this.currentViewport.width) return !0;
|
23742 | if (this.data && this.gaugeVisualProperties) {
|
23743 | 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()));
|
23744 | textProperties.fontSize = PixelConverter.fromPoint(this.data.dataLabelsSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt);
|
23745 | for (var width = void 0, _i = 0, _a = [ ticks[0], ticks[ticks.length - 1] ]; _i < _a.length; _i++) {
|
23746 | var tickValue = _a[_i];
|
23747 | if (textProperties.text = tickValue, width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
23748 | width > maxLabelWidth) return !0;
|
23749 | }
|
23750 | }
|
23751 | return !1;
|
23752 | }, Gauge.prototype.setMargins = function() {
|
23753 | if (this.gaugeSmallViewPortProperties && this.gaugeSmallViewPortProperties.smallGaugeMarginsOnSmallViewPort && this.currentViewport.height < this.gaugeSmallViewPortProperties.MinHeightGaugeSideNumbersVisible) {
|
23754 | var margins = this.gaugeSmallViewPortProperties.GaugeMarginsOnSmallViewPort;
|
23755 | return void (this.margin = {
|
23756 | top: margins,
|
23757 | bottom: margins,
|
23758 | left: margins,
|
23759 | right: margins
|
23760 | });
|
23761 | }
|
23762 | if (this.margin = {
|
23763 | top: Gauge.DefaultTopBottomMargin,
|
23764 | bottom: Gauge.DefaultTopBottomMargin,
|
23765 | left: Gauge.DefaultLeftRightMargin,
|
23766 | right: Gauge.DefaultLeftRightMargin
|
23767 | }, !this.showSideNumbersLabelText() || this.showMinMaxLabelsOnBottom()) {
|
23768 | var targetSettings = this.targetSettings;
|
23769 | if (this.showTargetLabel) {
|
23770 | var tRatio = (targetSettings.target - targetSettings.min) / (targetSettings.max - targetSettings.min);
|
23771 | tRatio > .5 ? this.margin.left = Gauge.ReducedLeftRightMargin : this.margin.right = Gauge.ReducedLeftRightMargin;
|
23772 | } else this.margin.left = this.margin.right = Gauge.ReducedLeftRightMargin;
|
23773 | }
|
23774 | var fontSize = 0;
|
23775 | 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)),
|
23776 | 0 !== fontSize && (this.margin.bottom += fontSize, this.margin.left += fontSize,
|
23777 | this.margin.right += fontSize);
|
23778 | }, Gauge.prototype.showSideNumbersLabelText = function() {
|
23779 | return !(this.gaugeSmallViewPortProperties && this.gaugeSmallViewPortProperties.hideGaugeSideNumbersOnSmallViewPort && this.currentViewport.height < this.gaugeSmallViewPortProperties.MinHeightGaugeSideNumbersVisible);
|
23780 | }, Gauge.MIN_VALUE = -(1 / 0), Gauge.MAX_VALUE = +(1 / 0), Gauge.MinDistanceFromBottom = 10,
|
23781 | Gauge.MinWidthForTargetLabel = 150, Gauge.DefaultTopBottomMargin = 20, Gauge.DefaultLeftRightMargin = 45,
|
23782 | Gauge.ReducedLeftRightMargin = 15, Gauge.DEFAULT_MAX = 1, Gauge.DEFAULT_MIN = 0,
|
23783 | Gauge.VisualClassName = "gauge", Gauge.DefaultStyleProperties = {
|
23784 | transition: {
|
23785 | ease: "bounce"
|
23786 | },
|
23787 | arcColors: {
|
23788 | background: "#e9e9e9",
|
23789 | foreground: "#00B8AA"
|
23790 | },
|
23791 | targetLine: {
|
23792 | show: !0,
|
23793 | color: "#666666",
|
23794 | thickness: 2
|
23795 | },
|
23796 | labels: {
|
23797 | count: 2,
|
23798 | padding: 5,
|
23799 | fontSize: visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
23800 | },
|
23801 | kpiBands: {
|
23802 | show: !1,
|
23803 | separationRadians: Math.PI / 128,
|
23804 | thickness: 5
|
23805 | }
|
23806 | }, Gauge.DefaultTargetSettings = {
|
23807 | min: 0,
|
23808 | max: 1,
|
23809 | target: void 0
|
23810 | }, Gauge.DefaultDataPointSettings = {
|
23811 | fillColor: Gauge.DefaultStyleProperties.arcColors.foreground,
|
23812 | targetColor: Gauge.DefaultStyleProperties.targetLine.color
|
23813 | }, Gauge.InnerRadiusFactor = .7, Gauge.KpiBandDistanceFromMainArc = 2, Gauge.MainGaugeGroupClassName = "mainGroup",
|
23814 | Gauge.LabelText = createClassAndSelector("labelText"), Gauge.TargetConnector = createClassAndSelector("targetConnector"),
|
23815 | Gauge.TargetText = createClassAndSelector("targetText"), Gauge.formatStringProp = {
|
23816 | objectName: "general",
|
23817 | propertyName: "formatString"
|
23818 | }, Gauge;
|
23819 | }();
|
23820 | visuals.Gauge = Gauge;
|
23821 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
23822 | }(powerbi || (powerbi = {}));
|
23823 |
|
23824 | var powerbi;
|
23825 |
|
23826 | !function(powerbi) {
|
23827 | var visuals;
|
23828 | !function(visuals) {
|
23829 | var Utility = jsCommon.Utility, ImageVisual = function() {
|
23830 | function ImageVisual() {
|
23831 | this.scalingType = visuals.imageScalingType.normal;
|
23832 | }
|
23833 | return ImageVisual.prototype.init = function(options) {
|
23834 | this.element = options.element;
|
23835 | }, ImageVisual.prototype.enumerateObjectInstances = function(options) {
|
23836 | switch (options.objectName) {
|
23837 | case "imageScaling":
|
23838 | return this.enumerateImageScaling();
|
23839 | }
|
23840 | return null;
|
23841 | }, ImageVisual.prototype.enumerateImageScaling = function() {
|
23842 | return [ {
|
23843 | selector: null,
|
23844 | objectName: "imageScaling",
|
23845 | properties: {
|
23846 | imageScalingType: this.scalingType
|
23847 | }
|
23848 | } ];
|
23849 | }, ImageVisual.prototype.update = function(options) {
|
23850 | var dataViews = options.dataViews;
|
23851 | if (dataViews && 0 !== dataViews.length) {
|
23852 | var objects = dataViews[0].metadata.objects;
|
23853 | if (objects && objects.general) {
|
23854 | var div = this.imageBackgroundElement;
|
23855 | div || (div = $("<div class='imageBackground' />"), this.imageBackgroundElement = div,
|
23856 | this.imageBackgroundElement.appendTo(this.element));
|
23857 | var viewport = options.viewport;
|
23858 | div.css("height", viewport.height), objects.imageScaling ? this.scalingType = objects.imageScaling.imageScalingType.toString() : this.scalingType = visuals.imageScalingType.normal;
|
23859 | var imageUrl = objects.general.imageUrl;
|
23860 | Utility.isLocalUrl(imageUrl) && div.css("backgroundImage", "url(" + imageUrl + ")"),
|
23861 | 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");
|
23862 | }
|
23863 | }
|
23864 | }, ImageVisual;
|
23865 | }();
|
23866 | visuals.ImageVisual = ImageVisual;
|
23867 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
23868 | }(powerbi || (powerbi = {}));
|
23869 |
|
23870 | var powerbi;
|
23871 |
|
23872 | !function(powerbi) {
|
23873 | var visuals;
|
23874 | !function(visuals) {
|
23875 | function GetStatus(actual, goals, directionType) {
|
23876 | if (!goals || 0 === goals.length) return KPIStatusWithHistory.status.NOGOAL;
|
23877 | var maxGoal, minGoal;
|
23878 | if (2 === goals.length) {
|
23879 | if (maxGoal = Math.max.apply(Math, goals), minGoal = Math.min.apply(Math, goals),
|
23880 | actual >= minGoal && maxGoal >= actual) return KPIStatusWithHistory.status.IN_BETWEEN;
|
23881 | } else maxGoal = goals[0], minGoal = goals[0];
|
23882 | switch (directionType) {
|
23883 | case visuals.kpiDirection.positive:
|
23884 | if (minGoal > actual) return KPIStatusWithHistory.status.DROP;
|
23885 | break;
|
23886 |
|
23887 | case visuals.kpiDirection.negative:
|
23888 | if (actual > maxGoal) return KPIStatusWithHistory.status.DROP;
|
23889 | }
|
23890 | return KPIStatusWithHistory.status.INCREASE;
|
23891 | }
|
23892 | function getDistanceFromGoalInPercentageString(actual, goals, directionType) {
|
23893 | if (!goals || 1 !== goals.length || 0 === goals[0]) return "";
|
23894 | var distance, sign = "+", goal = goals[0];
|
23895 | switch (distance = Math.abs(actual - goal), directionType) {
|
23896 | case visuals.kpiDirection.positive:
|
23897 | goal > actual && (sign = "-");
|
23898 | break;
|
23899 |
|
23900 | case visuals.kpiDirection.negative:
|
23901 | actual > goal && (sign = "-");
|
23902 | }
|
23903 | var percent = Number((100 * distance / goal).toFixed(2));
|
23904 | return "(" + sign + percent + "%)";
|
23905 | }
|
23906 | function GetTextColorClassByStatus(status) {
|
23907 | switch (status) {
|
23908 | case KPIStatusWithHistory.status.NOGOAL:
|
23909 | return KPIStatusWithHistory.kpiTextGreyClass;
|
23910 |
|
23911 | case KPIStatusWithHistory.status.INCREASE:
|
23912 | return KPIStatusWithHistory.kpiGreenClass;
|
23913 |
|
23914 | case KPIStatusWithHistory.status.IN_BETWEEN:
|
23915 | return KPIStatusWithHistory.kpiYellowClass;
|
23916 |
|
23917 | case KPIStatusWithHistory.status.DROP:
|
23918 | return KPIStatusWithHistory.kpiRedClass;
|
23919 | }
|
23920 | }
|
23921 | function GetGraphColorClassByStatus(status) {
|
23922 | switch (status) {
|
23923 | case KPIStatusWithHistory.status.NOGOAL:
|
23924 | return KPIStatusWithHistory.kpiGraphGreyClass;
|
23925 |
|
23926 | case KPIStatusWithHistory.status.INCREASE:
|
23927 | return KPIStatusWithHistory.kpiGreenClass;
|
23928 |
|
23929 | case KPIStatusWithHistory.status.IN_BETWEEN:
|
23930 | return KPIStatusWithHistory.kpiYellowClass;
|
23931 |
|
23932 | case KPIStatusWithHistory.status.DROP:
|
23933 | return KPIStatusWithHistory.kpiRedClass;
|
23934 | }
|
23935 | }
|
23936 | var DataRoleHelper = powerbi.data.DataRoleHelper, KPIStatusWithHistory = function() {
|
23937 | function KPIStatusWithHistory() {}
|
23938 | return KPIStatusWithHistory.prototype.init = function(options) {
|
23939 | KPIStatusWithHistory.getLocalizedString = options.host.getLocalizedString, this.rootElement = d3.select(options.element.get(0)).append("div").attr("text-align", "center").classed("kpiVisual", !0),
|
23940 | this.svg = this.rootElement.append("svg");
|
23941 | var mainGroupElement = this.mainGroupElement = this.svg.append("g");
|
23942 | this.areaFill = mainGroupElement.append("path"), this.textContainer = this.rootElement.append("div").classed("textContainer", !0),
|
23943 | this.indicatorTextContainer = this.textContainer.append("div").classed("indicatorText", !0),
|
23944 | this.absoluteGoalDistanceText = this.textContainer.append("div").classed("goalText", !0),
|
23945 | this.kpiActualText = this.indicatorTextContainer.append("div").attr("id", "indicatorText"),
|
23946 | this.initIcons(), this.host = options.host;
|
23947 | }, KPIStatusWithHistory.prototype.update = function(options) {
|
23948 | if (options.dataViews && options.dataViews[0]) {
|
23949 | var dataView = this.dataView = options.dataViews[0], viewport = options.viewport;
|
23950 | 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"),
|
23951 | void this.textContainer.attr("style", "display:none");
|
23952 | this.svg.attr("visibility", "visible");
|
23953 | var kpiViewModel = KPIStatusWithHistory.converter(dataView, viewport, KPIStatusWithHistory.getProp_KPIDirection(dataView));
|
23954 | this.render(kpiViewModel, viewport);
|
23955 | }
|
23956 | }, KPIStatusWithHistory.prototype.initIcons = function() {
|
23957 | this.successMarkIcon = this.indicatorTextContainer.append("div").classed("powervisuals-glyph checkmark kpi-visual-green", !0),
|
23958 | this.betweenIcon = this.indicatorTextContainer.append("div").classed("powervisuals-glyph circle-small kpi-visual-yellow", !0),
|
23959 | this.exclamationMarkIcon = this.indicatorTextContainer.append("div").classed("powervisuals-glyph exclamation kpi-visual-red", !0),
|
23960 | this.successMarkIcon.attr("style", "display:none"), this.betweenIcon.attr("style", "display:none"),
|
23961 | this.exclamationMarkIcon.attr("style", "display:none");
|
23962 | }, KPIStatusWithHistory.prototype.render = function(kpiViewModel, viewport) {
|
23963 | if (this.setShowDataMissingWarning(!(kpiViewModel.indicatorExists && kpiViewModel.trendExists)),
|
23964 | 0 === kpiViewModel.dataPoints.length || !kpiViewModel.indicatorExists || !kpiViewModel.trendExists) return this.areaFill.attr("visibility", "hidden"),
|
23965 | this.svg.attr("visibility", "hidden"), void this.textContainer.attr("style", "display:none");
|
23966 | this.svg.attr({
|
23967 | height: viewport.height,
|
23968 | width: viewport.width
|
23969 | });
|
23970 | var status = KPIStatusWithHistory.status.NOGOAL;
|
23971 | kpiViewModel.targetExists && kpiViewModel.indicatorExists && kpiViewModel.trendExists && (status = GetStatus(kpiViewModel.actual, kpiViewModel.goals, kpiViewModel.directionType));
|
23972 | var actualText = kpiViewModel.formattedValue, calculatedHeight = KPIStatusWithHistory.indicatorTextSizeInPx;
|
23973 | this.textContainer.attr("style", "width:" + viewport.width + "px;top:" + (viewport.height - calculatedHeight) / 2 + "px"),
|
23974 | this.kpiActualText.classed(KPIStatusWithHistory.allColorClasses, !1).classed(GetTextColorClassByStatus(status), !0).attr("text-anchor", "middle").text(actualText);
|
23975 | var icon = null;
|
23976 | switch (status) {
|
23977 | case KPIStatusWithHistory.status.INCREASE:
|
23978 | icon = this.successMarkIcon, this.exclamationMarkIcon.attr("style", "display:none"),
|
23979 | this.betweenIcon.attr("style", "display:none");
|
23980 | break;
|
23981 |
|
23982 | case KPIStatusWithHistory.status.IN_BETWEEN:
|
23983 | icon = this.betweenIcon, this.exclamationMarkIcon.attr("style", "display:none"),
|
23984 | this.successMarkIcon.attr("style", "display:none");
|
23985 | break;
|
23986 |
|
23987 | case KPIStatusWithHistory.status.DROP:
|
23988 | icon = this.exclamationMarkIcon, this.successMarkIcon.attr("style", "display:none"),
|
23989 | this.betweenIcon.attr("style", "display:none");
|
23990 | break;
|
23991 |
|
23992 | default:
|
23993 | this.exclamationMarkIcon.attr("style", "display:none"), this.successMarkIcon.attr("style", "display:none"),
|
23994 | this.betweenIcon.attr("style", "display:none");
|
23995 | }
|
23996 | icon && icon.attr("style", "font-size:12px");
|
23997 | var shownGoalString = kpiViewModel.showGoal ? kpiViewModel.formattedGoalString + " " : "", shownDistanceFromGoalString = kpiViewModel.showDistanceFromGoal ? getDistanceFromGoalInPercentageString(kpiViewModel.actual, kpiViewModel.goals, kpiViewModel.directionType) : "";
|
23998 | if (this.absoluteGoalDistanceText.attr("text-anchor", "middle").text(shownGoalString + shownDistanceFromGoalString),
|
23999 | kpiViewModel.showTrendLine && kpiViewModel.historyExists) {
|
24000 | var area = d3.svg.area().x(function(d) {
|
24001 | return d.x;
|
24002 | }).y0(viewport.height).y1(function(d) {
|
24003 | return d.y;
|
24004 | });
|
24005 | 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);
|
24006 | } else this.areaFill.attr("visibility", "hidden");
|
24007 | }, KPIStatusWithHistory.prototype.setShowDataMissingWarning = function(show) {
|
24008 | this.host.setWarnings(show ? [ new visuals.VisualKPIDataMissingWarning() ] : []);
|
24009 | }, KPIStatusWithHistory.getDefaultFormatSettings = function() {
|
24010 | return {
|
24011 | labelSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, visuals.Card.DefaultStyle.value.color),
|
24012 | textSize: 27,
|
24013 | wordWrap: !1
|
24014 | };
|
24015 | }, KPIStatusWithHistory.getFormatString = function(column) {
|
24016 | return visuals.valueFormatter.getFormatString(column, visuals.AnimatedText.formatStringProp);
|
24017 | }, KPIStatusWithHistory.getProp_Show_KPIGoal = function(dataView) {
|
24018 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.showKPIGoal, !0) : !0;
|
24019 | }, KPIStatusWithHistory.getProp_Show_KPITrendLine = function(dataView) {
|
24020 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.showKPITrendLine, !0) : !0;
|
24021 | }, KPIStatusWithHistory.getProp_Show_KPIDistance = function(dataView) {
|
24022 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.showKPIDistance, !0) : !0;
|
24023 | }, KPIStatusWithHistory.getProp_KPIDirection = function(dataView) {
|
24024 | return dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.directionTypeStringProp, visuals.kpiDirection.positive) : visuals.kpiDirection.positive;
|
24025 | }, KPIStatusWithHistory.getProp_Indicator_DisplayUnits = function(dataView) {
|
24026 | return KPIStatusWithHistory.initDefaultLabelSettings(), dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.indicatorDisplayUnitsProp, KPIStatusWithHistory.defaultLabelSettings.displayUnits) : KPIStatusWithHistory.defaultLabelSettings.displayUnits;
|
24027 | }, KPIStatusWithHistory.getProp_Indicator_Precision = function(dataView) {
|
24028 | return KPIStatusWithHistory.initDefaultLabelSettings(), dataView && dataView.metadata ? powerbi.DataViewObjects.getValue(dataView.metadata.objects, KPIStatusWithHistory.indicatorPrecisionProp, KPIStatusWithHistory.defaultLabelSettings.precision) : KPIStatusWithHistory.defaultLabelSettings.precision;
|
24029 | }, KPIStatusWithHistory.initDefaultLabelSettings = function() {
|
24030 | KPIStatusWithHistory.defaultCardFormatSetting || (KPIStatusWithHistory.defaultCardFormatSetting = KPIStatusWithHistory.getDefaultFormatSettings(),
|
24031 | KPIStatusWithHistory.defaultLabelSettings = KPIStatusWithHistory.defaultCardFormatSetting.labelSettings);
|
24032 | }, KPIStatusWithHistory.getFormattedValue = function(metaDataColumn, theValue, precision, displayUnits, displayUnitSystemType) {
|
24033 | void 0 === displayUnitSystemType && (displayUnitSystemType = powerbi.DisplayUnitSystemType.WholeUnits);
|
24034 | var isDefaultDisplayUnit = 0 === displayUnits, formatter = visuals.valueFormatter.create({
|
24035 | format: KPIStatusWithHistory.getFormatString(metaDataColumn),
|
24036 | value: displayUnits,
|
24037 | precision: precision,
|
24038 | displayUnitSystemType: displayUnitSystemType,
|
24039 | formatSingleValues: !!isDefaultDisplayUnit,
|
24040 | allowFormatBeautification: !0,
|
24041 | columnType: metaDataColumn ? metaDataColumn.type : void 0
|
24042 | });
|
24043 | return formatter.format(theValue);
|
24044 | }, KPIStatusWithHistory.getFormattedGoalString = function(metaDataColumn, goals, precision, displayUnits) {
|
24045 | if (!goals || 0 === goals.length) return "";
|
24046 | var goalsString = KPIStatusWithHistory.getLocalizedString("Visual_KPI_Goal_Title") + ": " + KPIStatusWithHistory.getFormattedValue(metaDataColumn, goals[0], precision, displayUnits);
|
24047 | return 2 === goals.length && (goalsString += ", " + KPIStatusWithHistory.getFormattedValue(metaDataColumn, goals[1], precision, displayUnits)),
|
24048 | goalsString;
|
24049 | }, KPIStatusWithHistory.converter = function(dataView, viewPort, directionType) {
|
24050 | var dataPoints = [], catDv = dataView.categorical, indicatorMetadataColumn = null, goalMetadataColumn = null, formattedGoalString = "", formattedValue = "", targetExists = !1, indicatorExists = !1, trendExists = !1, historyExists = !0;
|
24051 | dataView.categorical.categories || (historyExists = !1);
|
24052 | for (var values = catDv.values, columns = dataView.metadata.columns, _i = 0, columns_2 = columns; _i < columns_2.length; _i++) {
|
24053 | var column = columns_2[_i];
|
24054 | DataRoleHelper.hasRole(column, "Indicator") && (indicatorExists = !0, indicatorMetadataColumn = column),
|
24055 | DataRoleHelper.hasRole(column, "TrendLine") && (trendExists = !0), DataRoleHelper.hasRole(column, "Goal") && (targetExists = !0,
|
24056 | goalMetadataColumn = column);
|
24057 | }
|
24058 | if (!(indicatorExists && trendExists && values && 0 !== values.length && values[0].values && dataView.categorical.values)) return {
|
24059 | dataPoints: dataPoints,
|
24060 | directionType: directionType,
|
24061 | actual: 0,
|
24062 | goals: [],
|
24063 | formattedGoalString: formattedGoalString,
|
24064 | targetExists: targetExists,
|
24065 | historyExists: historyExists,
|
24066 | indicatorExists: indicatorExists,
|
24067 | trendExists: trendExists,
|
24068 | formattedValue: formattedValue,
|
24069 | showGoal: !1,
|
24070 | showDistanceFromGoal: !1,
|
24071 | showTrendLine: !1
|
24072 | };
|
24073 | var category, categoryValues;
|
24074 | historyExists && (category = catDv.categories[0], categoryValues = category.values);
|
24075 | 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++) {
|
24076 | actualValue = indicatorColumns[0].values[i];
|
24077 | for (var goals_1 = [], goalCnt = 0; goalCnt < goalColumns.length; goalCnt++) goals_1.push(goalColumns[goalCnt].values[i]);
|
24078 | historyGoalData.push(goals_1), historyActualData.push(actualValue);
|
24079 | }
|
24080 | 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++) {
|
24081 | var yPos = areaMaxHight * (historyActualData[i] - minActualData) / (maxActualData - minActualData), selectorId = null;
|
24082 | historyExists && (selectorId = visuals.SelectionId.createWithId(category.identity[i]).getSelector()),
|
24083 | dataPoints.push({
|
24084 | x: i * viewPort.width / (historyActualData.length - 1),
|
24085 | y: viewPort.height - yPos,
|
24086 | actual: historyActualData[i],
|
24087 | goals: historyGoalData[i]
|
24088 | });
|
24089 | }
|
24090 | var actual, goals;
|
24091 | dataPoints.length > 0 && (actual = dataPoints[dataPoints.length - 1].actual, goals = dataPoints[dataPoints.length - 1].goals),
|
24092 | 1 === dataPoints.length && (historyExists = !1), formattedValue = KPIStatusWithHistory.getFormattedValue(indicatorMetadataColumn, actual, precision, displayUnits, powerbi.DisplayUnitSystemType.DataLabels),
|
24093 | formattedGoalString = KPIStatusWithHistory.getFormattedGoalString(goalMetadataColumn, goals, precision, displayUnits);
|
24094 | var showGoal = KPIStatusWithHistory.getProp_Show_KPIGoal(dataView), showDistanceFromGoal = KPIStatusWithHistory.getProp_Show_KPIDistance(dataView), showTrendLine = KPIStatusWithHistory.getProp_Show_KPITrendLine(dataView);
|
24095 | return {
|
24096 | dataPoints: dataPoints,
|
24097 | directionType: directionType,
|
24098 | actual: actual,
|
24099 | goals: goals,
|
24100 | formattedGoalString: formattedGoalString,
|
24101 | targetExists: targetExists,
|
24102 | historyExists: historyExists,
|
24103 | indicatorExists: indicatorExists,
|
24104 | trendExists: trendExists,
|
24105 | formattedValue: formattedValue,
|
24106 | showGoal: showGoal,
|
24107 | showDistanceFromGoal: showDistanceFromGoal,
|
24108 | showTrendLine: showTrendLine
|
24109 | };
|
24110 | }, KPIStatusWithHistory.getColumnsByRole = function(values, roleString) {
|
24111 | for (var retval = [], i = 0; i < values.length; i++) DataRoleHelper.hasRole(values[i].source, roleString) && retval.push(values[i]);
|
24112 | return retval;
|
24113 | }, KPIStatusWithHistory.prototype.enumerateObjectInstances = function(options) {
|
24114 | var instances = [], dataView = this.dataView;
|
24115 | switch (options.objectName) {
|
24116 | case "indicator":
|
24117 | instances.push({
|
24118 | selector: null,
|
24119 | objectName: "indicator",
|
24120 | properties: {
|
24121 | indicatorDisplayUnits: KPIStatusWithHistory.getProp_Indicator_DisplayUnits(dataView),
|
24122 | indicatorPrecision: KPIStatusWithHistory.getProp_Indicator_Precision(dataView)
|
24123 | }
|
24124 | });
|
24125 |
|
24126 | case "trendline":
|
24127 | instances.push({
|
24128 | selector: null,
|
24129 | objectName: "trendline",
|
24130 | properties: {
|
24131 | show: KPIStatusWithHistory.getProp_Show_KPITrendLine(dataView)
|
24132 | }
|
24133 | });
|
24134 |
|
24135 | case "goals":
|
24136 | instances.push({
|
24137 | selector: null,
|
24138 | objectName: "goals",
|
24139 | properties: {
|
24140 | showGoal: KPIStatusWithHistory.getProp_Show_KPIGoal(dataView),
|
24141 | showDistance: KPIStatusWithHistory.getProp_Show_KPIDistance(dataView)
|
24142 | }
|
24143 | });
|
24144 |
|
24145 | case "status":
|
24146 | instances.push({
|
24147 | selector: null,
|
24148 | objectName: "status",
|
24149 | properties: {
|
24150 | direction: KPIStatusWithHistory.getProp_KPIDirection(dataView)
|
24151 | }
|
24152 | });
|
24153 | }
|
24154 | return instances;
|
24155 | }, KPIStatusWithHistory.prototype.destroy = function() {
|
24156 | this.svg = null;
|
24157 | }, KPIStatusWithHistory.directionTypeStringProp = {
|
24158 | objectName: "status",
|
24159 | propertyName: "direction"
|
24160 | }, KPIStatusWithHistory.showKPIGoal = {
|
24161 | objectName: "goals",
|
24162 | propertyName: "showGoal"
|
24163 | }, KPIStatusWithHistory.showKPIDistance = {
|
24164 | objectName: "goals",
|
24165 | propertyName: "showDistance"
|
24166 | }, KPIStatusWithHistory.showKPITrendLine = {
|
24167 | objectName: "trendline",
|
24168 | propertyName: "show"
|
24169 | }, KPIStatusWithHistory.indicatorDisplayUnitsProp = {
|
24170 | objectName: "indicator",
|
24171 | propertyName: "indicatorDisplayUnits"
|
24172 | }, KPIStatusWithHistory.indicatorPrecisionProp = {
|
24173 | objectName: "indicator",
|
24174 | propertyName: "indicatorPrecision"
|
24175 | }, KPIStatusWithHistory.status = {
|
24176 | INCREASE: "increase",
|
24177 | DROP: "drop",
|
24178 | IN_BETWEEN: "in-between",
|
24179 | NOGOAL: "no-goal"
|
24180 | }, KPIStatusWithHistory.statusBandingType = {
|
24181 | Below: "BELOW",
|
24182 | Above: "ABOVE"
|
24183 | }, KPIStatusWithHistory.actualTextConsts = {
|
24184 | VERTICAL_OFFSET_FROM_HALF_HEIGHT: 20,
|
24185 | FONT_WIDTH_FACTOR: 14,
|
24186 | RIGHT_MARGIN: 10
|
24187 | }, KPIStatusWithHistory.kpiRedClass = "kpi-visual-red", KPIStatusWithHistory.kpiYellowClass = "kpi-visual-yellow",
|
24188 | KPIStatusWithHistory.kpiGreenClass = "kpi-visual-green", KPIStatusWithHistory.kpiTextGreyClass = "kpi-visual-text-grey",
|
24189 | KPIStatusWithHistory.kpiGraphGreyClass = "kpi-visual-graph-grey", KPIStatusWithHistory.allColorClasses = KPIStatusWithHistory.kpiRedClass + " " + KPIStatusWithHistory.kpiYellowClass + " " + KPIStatusWithHistory.kpiGreenClass + " " + KPIStatusWithHistory.kpiTextGreyClass + " " + KPIStatusWithHistory.kpiGraphGreyClass,
|
24190 | KPIStatusWithHistory.trendAreaFilePercentage = 1, KPIStatusWithHistory.estimatedIconHeightInPx = 9,
|
24191 | KPIStatusWithHistory.indicatorTextSizeInPx = 60, KPIStatusWithHistory;
|
24192 | }();
|
24193 | visuals.KPIStatusWithHistory = KPIStatusWithHistory;
|
24194 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
24195 | }(powerbi || (powerbi = {}));
|
24196 |
|
24197 | var powerbi;
|
24198 |
|
24199 | !function(powerbi) {
|
24200 | var visuals;
|
24201 | !function(visuals) {
|
24202 | var EnumExtensions = jsCommon.EnumExtensions, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, LineChart = function() {
|
24203 | function LineChart(options) {
|
24204 | var _this = this;
|
24205 | this.deferDragMoveOperation = jsCommon.DeferUtility.deferUntilNextFrame(function() {
|
24206 | if (_this.lastDragMoveXPosition) {
|
24207 | var index = _this.findIndex(_this.lastDragMoveXPosition - _this.margin.left);
|
24208 | _this.selectColumn(index), _this.lastDragMoveXPosition = void 0;
|
24209 | }
|
24210 | }), this.isScrollable = options.isScrollable ? options.isScrollable : !1, this.tooltipsEnabled = options.tooltipsEnabled,
|
24211 | this.lineType = options.chartType ? options.chartType : 1, this.interactivityService = options.interactivityService,
|
24212 | this.animator = options.animator, this.lineChartLabelDensityEnabled = options.lineChartLabelDensityEnabled,
|
24213 | this.lineClassAndSelector = LineChart.LineClassSelector;
|
24214 | }
|
24215 | return LineChart.customizeQuery = function(options) {
|
24216 | var dataViewMapping = options.dataViewMappings[0];
|
24217 | if (dataViewMapping && dataViewMapping.categorical && dataViewMapping.categorical.categories && (dataViewMapping.categorical.dataVolume = 4,
|
24218 | visuals.CartesianChart.detectScalarMapping(dataViewMapping))) {
|
24219 | var dataViewCategories = dataViewMapping.categorical.categories;
|
24220 | dataViewCategories.dataReductionAlgorithm = {
|
24221 | sample: {}
|
24222 | };
|
24223 | }
|
24224 | }, LineChart.getSortableRoles = function(options) {
|
24225 | var dataViewMapping = options.dataViewMappings[0];
|
24226 | if (!dataViewMapping || !dataViewMapping.categorical || !dataViewMapping.categorical.categories) return null;
|
24227 | var dataViewCategories = dataViewMapping.categorical.categories, categoryItems = dataViewCategories["for"]["in"].items;
|
24228 | if (!_.isEmpty(categoryItems)) {
|
24229 | var categoryType = categoryItems[0].type, objects = void 0;
|
24230 | if (dataViewMapping.metadata && (objects = dataViewMapping.metadata.objects), !visuals.CartesianChart.getIsScalar(objects, visuals.lineChartProps.categoryAxis.axisType, categoryType)) return [ "Category", "Y" ];
|
24231 | }
|
24232 | return null;
|
24233 | }, LineChart.converter = function(dataView, blankCategoryValue, colors, isScalar, interactivityService, shouldCalculateStacked, isComboChart, tooltipsEnabled) {
|
24234 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
24235 | var reader = powerbi.data.createIDataViewCategoricalReader(dataView), valueRoleName = isComboChart ? "Y2" : "Y", categorical = dataView.categorical, category = categorical.categories && categorical.categories.length > 0 ? categorical.categories[0] : {
|
24236 | source: void 0,
|
24237 | values: [ blankCategoryValue ],
|
24238 | identity: void 0
|
24239 | }, xAxisCardProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata);
|
24240 | isScalar = visuals.CartesianHelper.isScalar(isScalar, xAxisCardProperties), categorical = visuals.ColumnUtil.applyUserMinMax(isScalar, categorical, xAxisCardProperties);
|
24241 | var defaultSeriesColor, formatStringProp = visuals.lineChartProps.general.formatString, categoryType = visuals.AxisHelper.getCategoryValueType(category.source, isScalar), isDateTime = visuals.AxisHelper.isDateTime(categoryType), categoryValues = category.values, categoryData = [], series = [], seriesLen = categorical.values ? categorical.values.length : 0, hasDynamicSeries = !(!categorical.values || !categorical.values.source), values = categorical.values, defaultLabelSettings = visuals.dataLabelUtils.getDefaultLineChartLabelSettings(isComboChart);
|
24242 | if (dataView.metadata && dataView.metadata.objects) {
|
24243 | var objects = dataView.metadata.objects;
|
24244 | defaultSeriesColor = isComboChart ? void 0 : powerbi.DataViewObjects.getFillColor(objects, visuals.lineChartProps.dataPoint.defaultColor);
|
24245 | var labelsObj = objects.labels;
|
24246 | visuals.dataLabelUtils.updateLineChartLabelSettingsFromLabelsObject(labelsObj, defaultLabelSettings);
|
24247 | }
|
24248 | var grouped, colorHelper = new visuals.ColorHelper(colors, visuals.lineChartProps.dataPoint.fill, defaultSeriesColor);
|
24249 | dataView.categorical.values && (grouped = dataView.categorical.values.grouped());
|
24250 | var stackedValues;
|
24251 | shouldCalculateStacked && (stackedValues = categorical.values && categorical.values.length > 0 ? _.times(categorical.values[0].values.length, function() {
|
24252 | return 0;
|
24253 | }) : []);
|
24254 | for (var seriesIndex = 0; seriesLen > seriesIndex; seriesIndex++) {
|
24255 | 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;
|
24256 | if (!hasDynamicSeries) {
|
24257 | 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;
|
24258 | labelObjects && (seriesLabelSettings = powerbi.Prototype.inherit(defaultLabelSettings),
|
24259 | visuals.dataLabelUtils.updateLineChartLabelSettingsFromLabelsObject(labelObjects, seriesLabelSettings));
|
24260 | }
|
24261 | for (var dataPointLabelSettings = seriesLabelSettings ? seriesLabelSettings : defaultLabelSettings, useHighlightValues = column.highlights && column.highlights.length > 0, categoryCount = reader.hasCategories() ? reader.getCategoryCount() : 1, categoryIndex = 0; categoryCount > categoryIndex; categoryIndex++) {
|
24262 | var categoryValue = categoryValues[categoryIndex], value = visuals.AxisHelper.normalizeNonFiniteNumber(useHighlightValues ? reader.getHighlight(valueRoleName, categoryIndex, seriesIndex) : reader.getValue(valueRoleName, categoryIndex, seriesIndex));
|
24263 | if ((!isScalar || null != categoryValue && null != value) && (!isDateTime || null == categoryValue || categoryValue instanceof Date)) {
|
24264 | var categorical_1 = dataView.categorical, tooltipInfo = void 0;
|
24265 | tooltipsEnabled && (tooltipInfo = [], category.source && tooltipInfo.push({
|
24266 | displayName: category.source.displayName,
|
24267 | value: visuals.converterHelper.formatFromMetadataColumn(categoryValue, category.source, formatStringProp)
|
24268 | }), hasDynamicSeries && (category.source && category.source === categorical_1.values.source || tooltipInfo.push({
|
24269 | displayName: categorical_1.values.source.displayName,
|
24270 | value: visuals.converterHelper.formatFromMetadataColumn(grouped[seriesIndex].name, categorical_1.values.source, formatStringProp)
|
24271 | })), null != value && tooltipInfo.push({
|
24272 | displayName: valuesMetadata.displayName,
|
24273 | value: visuals.converterHelper.formatFromMetadataColumn(value, valuesMetadata, formatStringProp)
|
24274 | }));
|
24275 | var categoryKey = category && !_.isEmpty(category.identity) && category.identity[categoryIndex] ? category.identity[categoryIndex].key : categoryIndex, dataPoint = {
|
24276 | categoryValue: isDateTime && categoryValue ? categoryValue.getTime() : categoryValue,
|
24277 | value: value,
|
24278 | categoryIndex: categoryIndex,
|
24279 | seriesIndex: seriesIndex,
|
24280 | tooltipInfo: tooltipInfo,
|
24281 | selected: !1,
|
24282 | identity: identity,
|
24283 | key: JSON.stringify({
|
24284 | series: key,
|
24285 | category: categoryKey
|
24286 | }),
|
24287 | labelFill: dataPointLabelSettings.labelColor,
|
24288 | labelFormatString: valuesMetadata.format,
|
24289 | labelSettings: dataPointLabelSettings
|
24290 | };
|
24291 | shouldCalculateStacked && (stackedValues[categoryIndex] += value, dataPoint.stackedValue = stackedValues[categoryIndex]),
|
24292 | category.objects && category.objects[categoryIndex] && (dataPoint.pointColor = powerbi.DataViewObjects.getFillColor(category.objects[categoryIndex], visuals.lineChartProps.dataPoint.fill)),
|
24293 | dataPoints.push(dataPoint), categoryData[categoryIndex] || (categoryData[categoryIndex] = dataPoint);
|
24294 | }
|
24295 | }
|
24296 | interactivityService && interactivityService.applySelectionStateToData(dataPoints),
|
24297 | dataPoints.length > 0 && series.push({
|
24298 | displayName: valuesMetadata.displayName,
|
24299 | key: key,
|
24300 | lineIndex: seriesIndex,
|
24301 | color: color,
|
24302 | xCol: category.source,
|
24303 | yCol: column.source,
|
24304 | data: dataPoints,
|
24305 | identity: identity,
|
24306 | selected: !1,
|
24307 | labelSettings: seriesLabelSettings
|
24308 | });
|
24309 | }
|
24310 | xAxisCardProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata);
|
24311 | var valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataView.metadata), valuesMetadataArray = [];
|
24312 | if (values) for (var i = 0; i < values.length; i++) values[i] && values[i].source && values[i].source.displayName && valuesMetadataArray.push({
|
24313 | displayName: values[i].source.displayName
|
24314 | });
|
24315 | var axesLabels = visuals.converterHelper.createAxesLabels(xAxisCardProperties, valueAxisProperties, category.source, valuesMetadataArray);
|
24316 | return interactivityService && interactivityService.applySelectionStateToData(series),
|
24317 | {
|
24318 | series: series,
|
24319 | isScalar: isScalar,
|
24320 | dataLabelsSettings: defaultLabelSettings,
|
24321 | axesLabels: {
|
24322 | x: axesLabels.xAxisLabel,
|
24323 | y: axesLabels.yAxisLabel
|
24324 | },
|
24325 | hasDynamicSeries: hasDynamicSeries,
|
24326 | categoryMetadata: category.source,
|
24327 | categories: categoryValues,
|
24328 | categoryData: categoryData
|
24329 | };
|
24330 | }, LineChart.getInteractiveLineChartDomElement = function(element) {
|
24331 | return element.children("svg").get(0);
|
24332 | }, LineChart.getColor = function(colorHelper, hasDynamicSeries, values, grouped, seriesIndex, groupedIdentity) {
|
24333 | var objects;
|
24334 | return hasDynamicSeries ? grouped && grouped[seriesIndex] && (objects = grouped[seriesIndex].objects) : values[seriesIndex] && (objects = values[seriesIndex].source.objects),
|
24335 | hasDynamicSeries && groupedIdentity ? colorHelper.getColorForSeriesValue(objects, values.identityFields, groupedIdentity.name) : colorHelper.getColorForMeasure(objects, values[seriesIndex].source.queryName);
|
24336 | }, LineChart.createStackedValueDomain = function(data) {
|
24337 | if (0 === data.length) return null;
|
24338 | var minY = d3.min(data, function(kv) {
|
24339 | return d3.min(kv.data, function(d) {
|
24340 | return d.stackedValue;
|
24341 | });
|
24342 | }), maxY = d3.max(data, function(kv) {
|
24343 | return d3.max(kv.data, function(d) {
|
24344 | return d.stackedValue;
|
24345 | });
|
24346 | });
|
24347 | return [ minY, maxY ];
|
24348 | }, LineChart.prototype.init = function(options) {
|
24349 | var _this = this;
|
24350 | this.options = options, this.element = options.element, this.cartesainSVG = options.svg,
|
24351 | this.host = options.host, this.currentViewport = options.viewport, this.colors = options.style.colorPalette.dataColors,
|
24352 | this.isInteractiveChart = options.interactivity && options.interactivity.isInteractiveLegend,
|
24353 | this.cartesianVisualHost = options.cartesianHost, this.scaleDetector = new visuals.SVGScaleDetector(this.cartesainSVG);
|
24354 | var chartType = options.chartType;
|
24355 | this.isComboChart = 10 === chartType || 13 === chartType || 14 === chartType;
|
24356 | var svg = options.svg;
|
24357 | svg.classed(LineChart.ClassName, !0);
|
24358 | var graphicsContextParent = this.mainGraphicsSVG = svg.append("svg").classed("lineChartSVG", !0);
|
24359 | this.isComboChart || this.isInteractiveChart || (this.overlayRect = graphicsContextParent.append(LineChart.RectOverlayName).style("opacity", visuals.SVGUtil.AlmostZero)),
|
24360 | this.mainGraphicsContext = graphicsContextParent.append("g").classed(LineChart.MainGraphicsContextClassName, !0),
|
24361 | 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);
|
24362 | var hoverLine = this.hoverLine = this.hoverLineContext.select(LineChart.LineElementName);
|
24363 | if (this.isInteractiveChart && hoverLine.classed("interactive", !0), hoverLine.style("opacity", visuals.SVGUtil.AlmostZero),
|
24364 | this.selectionCircles = [], this.xAxisProperties = {
|
24365 | axis: null,
|
24366 | scale: null,
|
24367 | isScalar: null,
|
24368 | axisType: null,
|
24369 | formatter: null,
|
24370 | graphicsContext: null,
|
24371 | values: null,
|
24372 | axisLabel: null,
|
24373 | isCategoryAxis: !0
|
24374 | }, this.isInteractiveChart) {
|
24375 | var rootSvg_1 = LineChart.getInteractiveLineChartDomElement(this.element), dragMove = function() {
|
24376 | _this.lastDragMoveXPosition = d3.mouse(rootSvg_1)[0], _this.deferDragMoveOperation();
|
24377 | }, drag = d3.behavior.drag().origin(Object).on("drag", dragMove);
|
24378 | d3.select(rootSvg_1).style("touch-action", "none").call(drag).on("click", dragMove);
|
24379 | }
|
24380 | this.shouldAdjustMouseCoordsOnPathsForStroke = !jsCommon.BrowserUtils.isChrome();
|
24381 | }, LineChart.prototype.setData = function(dataViews) {
|
24382 | if (this.data = {
|
24383 | series: [],
|
24384 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLineChartLabelSettings(this.isComboChart),
|
24385 | axesLabels: {
|
24386 | x: null,
|
24387 | y: null
|
24388 | },
|
24389 | hasDynamicSeries: !1,
|
24390 | categories: [],
|
24391 | categoryMetadata: void 0,
|
24392 | categoryData: []
|
24393 | }, dataViews.length > 0) {
|
24394 | var dataView = dataViews[0];
|
24395 | if (dataView && dataView.categorical) {
|
24396 | var dataViewCat = this.dataViewCat = dataView.categorical, dvCategories = dataViewCat.categories, categoryType = powerbi.ValueType.fromDescriptor({
|
24397 | text: !0
|
24398 | });
|
24399 | dvCategories && dvCategories.length > 0 && dvCategories[0].source && dvCategories[0].source.type && (categoryType = dvCategories[0].source.type);
|
24400 | 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), this.interactivityService, EnumExtensions.hasFlag(this.lineType, 16), this.isComboChart);
|
24401 | this.data = convertedData;
|
24402 | }
|
24403 | }
|
24404 | }, LineChart.prototype.calculateLegend = function() {
|
24405 | return this.createLegendDataPoints(0);
|
24406 | }, LineChart.prototype.hasLegend = function() {
|
24407 | return this.data && (this.data.hasDynamicSeries || this.data.series && this.data.series.length > 1);
|
24408 | }, LineChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
24409 | var catgSize = endIndex - startIndex, data = this.clippedData = powerbi.Prototype.inherit(this.data);
|
24410 | return data.series = LineChart.sliceSeries(data.series, catgSize, startIndex), data.categories = data.categories.slice(startIndex, endIndex),
|
24411 | data;
|
24412 | }, LineChart.prototype.calculateAxesProperties = function(options) {
|
24413 | var _this = this, data = this.data, viewport = options.viewport, margin = options.margin;
|
24414 | this.currentViewport = viewport, this.margin = margin;
|
24415 | 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);
|
24416 | if (this.clippedData = void 0, data && !isScalar && !this.isScrollable && trimOrdinalDataOnOverflow) {
|
24417 | var categoryCount = this.getCategoryCount(origCatgSize), catgSize = Math.min(origCatgSize, categoryCount);
|
24418 | catgSize !== origCatgSize && (data = this.clippedData = powerbi.Prototype.inherit(data),
|
24419 | this.clippedData.series = LineChart.sliceSeries(data.series, catgSize));
|
24420 | }
|
24421 | var xMetaDataColumn, yMetaDataColumn;
|
24422 | data.series && data.series.length > 0 && (xMetaDataColumn = data.series[0].xCol,
|
24423 | yMetaDataColumn = data.series[0].yCol);
|
24424 | 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);
|
24425 | this.yAxisProperties = visuals.AxisHelper.createAxis({
|
24426 | pixelSpan: preferredPlotArea.height,
|
24427 | dataDomain: combinedDomain,
|
24428 | metaDataColumn: yMetaDataColumn,
|
24429 | formatString: visuals.valueFormatter.getFormatString(yMetaDataColumn, visuals.lineChartProps.general.formatString),
|
24430 | outerPadding: 0,
|
24431 | isScalar: !0,
|
24432 | isVertical: !0,
|
24433 | forcedTickCount: options.forcedTickCount,
|
24434 | useTickIntervalForDisplayUnits: !0,
|
24435 | isCategoryAxis: !1,
|
24436 | scaleType: options.valueAxisScaleType,
|
24437 | axisDisplayUnits: options.valueAxisDisplayUnits,
|
24438 | axisPrecision: options.valueAxisPrecision,
|
24439 | shouldClamp: !1
|
24440 | });
|
24441 | var metaDataColumn = this.data ? this.data.categoryMetadata : void 0, categoryDataType = visuals.AxisHelper.getCategoryValueType(metaDataColumn), xDomain = visuals.AxisHelper.createDomain(data.series, categoryDataType, this.data.isScalar, options.forcedXDomain, options.ensureXDomain), hasZeroValueInXDomain = options.categoryAxisScaleType === visuals.axisScale.log && !visuals.AxisHelper.isLogScalePossible(xDomain);
|
24442 | return this.xAxisProperties = visuals.AxisHelper.createAxis({
|
24443 | pixelSpan: preferredPlotArea.width,
|
24444 | dataDomain: xDomain,
|
24445 | metaDataColumn: xMetaDataColumn,
|
24446 | formatString: visuals.valueFormatter.getFormatString(xMetaDataColumn, visuals.lineChartProps.general.formatString),
|
24447 | outerPadding: this.data.isScalar ? LineChart.ScalarOuterPadding : 0,
|
24448 | isScalar: this.data.isScalar,
|
24449 | isVertical: !1,
|
24450 | forcedTickCount: options.forcedTickCount,
|
24451 | useTickIntervalForDisplayUnits: !0,
|
24452 | getValueFn: function(index, type) {
|
24453 | return visuals.CartesianHelper.lookupXValue(_this.data, index, type, _this.data.isScalar);
|
24454 | },
|
24455 | categoryThickness: visuals.CartesianChart.getCategoryThickness(data.series, origCatgSize, this.getAvailableWidth(), xDomain, isScalar, trimOrdinalDataOnOverflow),
|
24456 | isCategoryAxis: !0,
|
24457 | scaleType: options.categoryAxisScaleType,
|
24458 | axisDisplayUnits: options.categoryAxisDisplayUnits,
|
24459 | axisPrecision: options.categoryAxisPrecision
|
24460 | }), this.xAxisProperties.axisLabel = options.showCategoryAxisLabel ? data.axesLabels.x : null,
|
24461 | this.yAxisProperties.axisLabel = options.showValueAxisLabel ? data.axesLabels.y : null,
|
24462 | this.xAxisProperties.hasDisallowedZeroInDomain = hasZeroValueInXDomain, this.yAxisProperties.hasDisallowedZeroInDomain = hasZeroValueInYDomain,
|
24463 | [ this.xAxisProperties, this.yAxisProperties ];
|
24464 | }, LineChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
24465 | switch (options.objectName) {
|
24466 | case "dataPoint":
|
24467 | this.enumerateDataPoints(enumeration);
|
24468 | break;
|
24469 |
|
24470 | case "labels":
|
24471 | this.enumerateDataLabels(enumeration);
|
24472 | }
|
24473 | }, LineChart.prototype.enumerateDataPoints = function(enumeration) {
|
24474 | var data = this.data;
|
24475 | 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++) {
|
24476 | var selector = visuals.ColorHelper.normalizeSelector(singleSeriesData[i].identity.getSelector()), label = visuals.converterHelper.getFormattedLegendLabel(singleSeriesData[i].yCol, this.dataViewCat.values, formatStringProp);
|
24477 | enumeration.pushInstance({
|
24478 | objectName: "dataPoint",
|
24479 | displayName: label,
|
24480 | selector: selector,
|
24481 | properties: {
|
24482 | fill: {
|
24483 | solid: {
|
24484 | color: data.defaultSeriesColor || singleSeriesData[i].color
|
24485 | }
|
24486 | }
|
24487 | }
|
24488 | });
|
24489 | }
|
24490 | }, LineChart.prototype.enumerateDataLabels = function(enumeration) {
|
24491 | var data = this.data, labelSettings = this.data.dataLabelsSettings, seriesCount = data.series.length, showLabelPerSeries = this.showLabelPerSeries();
|
24492 | if (visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings, null, showLabelPerSeries)),
|
24493 | 0 !== seriesCount && showLabelPerSeries && labelSettings.showLabelPerSeries) for (var i = 0; seriesCount > i; i++) {
|
24494 | var series = data.series[i], labelSettings_2 = series.labelSettings ? series.labelSettings : this.data.dataLabelsSettings;
|
24495 | enumeration.pushContainer({
|
24496 | displayName: series.displayName
|
24497 | }), visuals.dataLabelUtils.enumerateDataLabels(this.getLabelSettingsOptions(enumeration, labelSettings_2, series)),
|
24498 | enumeration.popContainer();
|
24499 | }
|
24500 | }, LineChart.prototype.supportsTrendLine = function() {
|
24501 | var isScalar = this.data ? this.data.isScalar : !1;
|
24502 | return !EnumExtensions.hasFlag(this.lineType, 16) && isScalar;
|
24503 | }, LineChart.prototype.getLabelSettingsOptions = function(enumeration, labelSettings, series, showAll) {
|
24504 | return {
|
24505 | enumeration: enumeration,
|
24506 | dataLabelsSettings: labelSettings,
|
24507 | show: !0,
|
24508 | displayUnits: !0,
|
24509 | precision: !0,
|
24510 | selector: series && series.identity ? series.identity.getSelector() : null,
|
24511 | showAll: showAll,
|
24512 | fontSize: !0,
|
24513 | labelDensity: this.lineChartLabelDensityEnabled
|
24514 | };
|
24515 | }, LineChart.prototype.overrideXScale = function(xProperties) {
|
24516 | this.xAxisProperties = xProperties;
|
24517 | }, LineChart.prototype.onClearSelection = function() {
|
24518 | this.interactivityService && this.interactivityService.clearSelection();
|
24519 | }, LineChart.prototype.render = function(suppressAnimations) {
|
24520 | var duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
24521 | this.data.categoryData.length !== this.previousCategoryCount && (duration = 0),
|
24522 | this.previousCategoryCount = this.data.categoryData.length;
|
24523 | var result;
|
24524 | return result = this.isInteractiveChart ? this.renderOld(duration) : this.renderNew(duration),
|
24525 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), result;
|
24526 | }, LineChart.prototype.renderNew = function(duration) {
|
24527 | var _this = this, data = this.clippedData ? this.clippedData : this.data;
|
24528 | if (data) {
|
24529 | var dataPointCount = data.categories.length * data.series.length;
|
24530 | dataPointCount > visuals.AnimatorCommon.MaxDataPointsToAnimate && (duration = 0);
|
24531 | 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) {
|
24532 | return xScale(_this.getXValue(d)) + horizontalOffset;
|
24533 | };
|
24534 | isStackedArea ? (y0Position = function(d) {
|
24535 | return yScale(d.stackedValue - d.value);
|
24536 | }, yPosition = function(d) {
|
24537 | return yScale(d.stackedValue);
|
24538 | }) : (y0Position = yScale(0), yPosition = function(d) {
|
24539 | return yScale(d.value);
|
24540 | });
|
24541 | var area;
|
24542 | renderAreas && (area = d3.svg.area().x(xPosition).y0(y0Position).y1(yPosition).defined(function(d) {
|
24543 | return null !== d.value;
|
24544 | }));
|
24545 | var line = d3.svg.line().x(xPosition).y(yPosition).defined(function(d) {
|
24546 | return null !== d.value;
|
24547 | });
|
24548 | EnumExtensions.hasFlag(this.lineType, 4) && (line.interpolate("basis"), area && area.interpolate("basis")),
|
24549 | this.mainGraphicsSVG.attr("height", height).attr("width", width);
|
24550 | var areas = void 0;
|
24551 | renderAreas && (areas = this.mainGraphicsContext.selectAll(LineChart.CategoryAreaSelector.selector).data(data.series, function(d) {
|
24552 | return d.identity.getKey();
|
24553 | }), areas.enter().append(LineChart.PathElementName).classed(LineChart.CategoryAreaSelector["class"], !0),
|
24554 | areas.style("fill", function(d) {
|
24555 | return d.color;
|
24556 | }).style("fill-opacity", function(d) {
|
24557 | return hasSelection && !d.selected ? LineChart.DimmedAreaFillOpacity : LineChart.AreaFillOpacity;
|
24558 | }).transition().ease("linear").duration(duration).attr("d", function(d) {
|
24559 | return area(d.data);
|
24560 | }), areas.exit().remove());
|
24561 | var lines = this.mainGraphicsContext.selectAll(this.lineClassAndSelector.selector).data(data.series, function(d) {
|
24562 | return d.identity.getKey();
|
24563 | });
|
24564 | lines.enter().append(LineChart.PathElementName).classed(this.lineClassAndSelector["class"], !0),
|
24565 | lines.style("stroke", function(d) {
|
24566 | return d.color;
|
24567 | }).style("stroke-opacity", function(d) {
|
24568 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
24569 | }).transition().ease("linear").duration(duration).attr("d", function(d) {
|
24570 | return line(d.data);
|
24571 | }), lines.exit().remove();
|
24572 | var interactivityLines;
|
24573 | this.interactivityService && (interactivityLines = this.mainGraphicsContext.selectAll(".interactivity-line").data(data.series, function(d) {
|
24574 | return d.identity.getKey();
|
24575 | }), interactivityLines.enter().append(LineChart.PathElementName).classed("interactivity-line", !0).style("stroke-width", LineChart.interactivityStrokeWidth),
|
24576 | interactivityLines.attr("d", function(d) {
|
24577 | return line(d.data);
|
24578 | }), interactivityLines.exit().remove());
|
24579 | var dotGroups = this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector).data(data.series, function(d) {
|
24580 | return d.identity.getKey();
|
24581 | });
|
24582 | dotGroups.enter().append("g").classed(LineChart.CategorySelector["class"], !0),
|
24583 | dotGroups.exit().remove();
|
24584 | var dots = dotGroups.selectAll(LineChart.CategoryValuePoint.selector).data(function(series) {
|
24585 | return series.data.filter(function(value, i) {
|
24586 | return _this.shouldDrawCircle(series, i);
|
24587 | });
|
24588 | }, function(d) {
|
24589 | return d.key;
|
24590 | });
|
24591 | dots.enter().append(LineChart.CircleElementName).classed(LineChart.CategoryValuePoint["class"], !0),
|
24592 | dots.style("fill", function() {
|
24593 | var lineSeries = d3.select(this.parentNode).datum();
|
24594 | return lineSeries.color;
|
24595 | }).style("fill-opacity", function() {
|
24596 | var lineSeries = d3.select(this.parentNode).datum();
|
24597 | return visuals.ColumnUtil.getFillOpacity(lineSeries.selected, !1, hasSelection, !1);
|
24598 | }).transition().duration(duration).attr({
|
24599 | cx: function(d, i) {
|
24600 | return xScale(_this.getXValue(d)) + horizontalOffset;
|
24601 | },
|
24602 | cy: function(d, i) {
|
24603 | return yScale(isStackedArea ? d.stackedValue : d.value);
|
24604 | },
|
24605 | r: LineChart.CircleRadius
|
24606 | }), dots.exit().remove();
|
24607 | var explicitDots;
|
24608 | this.isComboChart || (explicitDots = dotGroups.selectAll(LineChart.CategoryPointSelector.selector).data(function(series) {
|
24609 | return _.filter(series.data, function(value) {
|
24610 | return null != value.pointColor;
|
24611 | });
|
24612 | }, function(d) {
|
24613 | return d.key;
|
24614 | }), explicitDots.enter().append(LineChart.CircleElementName).classed(LineChart.CategoryPointSelector["class"], !0),
|
24615 | explicitDots.style("fill", function(d) {
|
24616 | return d.pointColor;
|
24617 | }).transition().duration(duration).attr({
|
24618 | cx: function(d) {
|
24619 | return xScale(_this.getXValue(d));
|
24620 | },
|
24621 | cy: function(d) {
|
24622 | return yScale(isStackedArea ? d.stackedValue : d.value);
|
24623 | },
|
24624 | r: LineChart.PointRadius
|
24625 | }), explicitDots.exit().remove());
|
24626 | var labelDataPointsGroups;
|
24627 | if (data.dataLabelsSettings.show && (labelDataPointsGroups = this.createLabelDataPoints()),
|
24628 | this.tooltipsEnabled) if (this.isComboChart) {
|
24629 | var seriesTooltipApplier = function(tooltipEvent) {
|
24630 | var pointX = tooltipEvent.elementCoordinates[0];
|
24631 | return _this.getTooltipInfoForCombo(tooltipEvent, pointX);
|
24632 | };
|
24633 | interactivityLines && visuals.TooltipManager.addTooltip(interactivityLines, seriesTooltipApplier, !0),
|
24634 | visuals.TooltipManager.addTooltip(dots, function(tooltipEvent) {
|
24635 | return tooltipEvent.data.tooltipInfo;
|
24636 | }, !0), explicitDots && visuals.TooltipManager.addTooltip(explicitDots, function(tooltipEvent) {
|
24637 | return tooltipEvent.data.tooltipInfo;
|
24638 | }, !0);
|
24639 | } else {
|
24640 | this.overlayRect.attr({
|
24641 | x: 0,
|
24642 | width: width,
|
24643 | height: height
|
24644 | });
|
24645 | var seriesTooltipApplier = function(tooltipEvent) {
|
24646 | var pointX = tooltipEvent.elementCoordinates[0], index = _this.getCategoryIndexFromTooltipEvent(tooltipEvent, pointX), categoryData = _this.selectColumnForTooltip(index);
|
24647 | return _this.getSeriesTooltipInfo(categoryData);
|
24648 | }, clearHoverLine = function() {
|
24649 | _this.hoverLine.style("opacity", visuals.SVGUtil.AlmostZero), _this.hoverLineContext.selectAll(LineChart.HoverLineCircleDot.selector).remove();
|
24650 | };
|
24651 | visuals.TooltipManager.addTooltip(this.mainGraphicsSVG, seriesTooltipApplier, !0, clearHoverLine);
|
24652 | }
|
24653 | var dataPointsToBind = void 0, behaviorOptions = void 0;
|
24654 | if (this.interactivityService) {
|
24655 | dataPointsToBind = data.series.slice();
|
24656 | for (var i = 0, ilen = data.series.length; ilen > i; i++) dataPointsToBind = dataPointsToBind.concat(data.series[i].data);
|
24657 | behaviorOptions = {
|
24658 | lines: lines,
|
24659 | interactivityLines: interactivityLines,
|
24660 | dots: dots,
|
24661 | areas: areas,
|
24662 | tooltipOverlay: this.overlayRect
|
24663 | };
|
24664 | }
|
24665 | return {
|
24666 | dataPoints: dataPointsToBind,
|
24667 | behaviorOptions: behaviorOptions,
|
24668 | labelDataPoints: [],
|
24669 | labelsAreNumeric: !0,
|
24670 | labelDataPointGroups: labelDataPointsGroups
|
24671 | };
|
24672 | }
|
24673 | }, LineChart.prototype.renderOld = function(duration) {
|
24674 | var _this = this, data = this.clippedData ? this.clippedData : this.data;
|
24675 | if (data) {
|
24676 | 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();
|
24677 | EnumExtensions.hasFlag(this.lineType, 2) && (area = d3.svg.area().x(function(d) {
|
24678 | return xScale(_this.getXValue(d));
|
24679 | }).y0(height).y1(function(d) {
|
24680 | return yScale(d.value);
|
24681 | }).defined(function(d) {
|
24682 | return null !== d.value;
|
24683 | }));
|
24684 | var line = d3.svg.line().x(function(d) {
|
24685 | return xScale(_this.getXValue(d));
|
24686 | }).y(function(d) {
|
24687 | return yScale(d.value);
|
24688 | }).defined(function(d) {
|
24689 | return null !== d.value;
|
24690 | });
|
24691 | EnumExtensions.hasFlag(this.lineType, 4) && (line.interpolate("basis"), area && area.interpolate("basis"));
|
24692 | var firstCategoryOffset = this.getXOfFirstCategory();
|
24693 | if (this.mainGraphicsContext.attr("transform", visuals.SVGUtil.translate(firstCategoryOffset, 0)),
|
24694 | this.mainGraphicsSVG.attr("height", this.getAvailableHeight()).attr("width", this.getAvailableWidth()),
|
24695 | this.hoverLineContext.attr("transform", visuals.SVGUtil.translate(firstCategoryOffset, 0)),
|
24696 | EnumExtensions.hasFlag(this.lineType, 2)) {
|
24697 | var catAreaSelect = this.mainGraphicsContext.selectAll(LineChart.CategoryAreaSelector.selector).data(data.series, function(d) {
|
24698 | return d.identity.getKey();
|
24699 | }), catAreaEnter = catAreaSelect.enter().append("g").classed(LineChart.CategoryAreaSelector["class"], !0);
|
24700 | catAreaEnter.append(LineChart.PathElementName);
|
24701 | var catAreaUpdate = this.mainGraphicsContext.selectAll(LineChart.CategoryAreaSelector.selector);
|
24702 | catAreaUpdate.select(LineChart.PathElementName).transition().ease("linear").duration(duration).attr("d", function(d) {
|
24703 | return area(d.data);
|
24704 | }).style("fill", function(d) {
|
24705 | return d.color;
|
24706 | }).style("fill-opacity", function(d) {
|
24707 | return hasSelection && !d.selected ? LineChart.DimmedAreaFillOpacity : LineChart.AreaFillOpacity;
|
24708 | }), catAreaSelect.exit().remove();
|
24709 | }
|
24710 | var catSelect = this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector).data(data.series, function(d) {
|
24711 | return d.identity.getKey();
|
24712 | }), catEnter = catSelect.enter().append("g").classed(LineChart.CategorySelector["class"], !0);
|
24713 | if (catEnter.append(LineChart.PathElementName), catEnter.selectAll(LineChart.CategoryValuePoint.selector).data(function(d) {
|
24714 | return d.data;
|
24715 | }).enter().append(LineChart.CircleElementName).classed(LineChart.CategoryValuePoint["class"], !0),
|
24716 | catSelect.exit().remove(), this.isInteractiveChart && !this.dragHandle) {
|
24717 | var handleTop = this.getAvailableHeight();
|
24718 | this.dragHandle = this.hoverLineContext.append("circle").attr("cx", 0).attr("cy", handleTop).attr("r", "6px").classed("drag-handle", !0);
|
24719 | }
|
24720 | for (var linesCount = catSelect.data().length; this.selectionCircles.length < linesCount; ) {
|
24721 | var addedCircle = this.hoverLineContext.append(LineChart.CircleElementName).classed(LineChart.CircleClassName, !0).attr("r", LineChart.CircleRadius).style("opacity", 0);
|
24722 | this.selectionCircles.push(addedCircle);
|
24723 | }
|
24724 | for (;this.selectionCircles.length > linesCount; ) this.selectionCircles.pop().remove();
|
24725 | var catUpdate = this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector), lineSelection = catUpdate.select(LineChart.PathElementName).classed(this.lineClassAndSelector["class"], !0).style("stroke", function(d) {
|
24726 | return d.color;
|
24727 | }).style("stroke-opacity", function(d) {
|
24728 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
24729 | });
|
24730 | lineSelection.transition().ease("linear").duration(duration).attr("d", function(d) {
|
24731 | return line(d.data);
|
24732 | });
|
24733 | var that = this, updateSelection = catUpdate.selectAll(LineChart.CategoryValuePoint.selector), transitions = updateSelection.style("fill", function() {
|
24734 | var lineSeries = d3.select(this.parentNode).datum();
|
24735 | return lineSeries.color;
|
24736 | }).style("fill-opacity", function() {
|
24737 | var lineSeries = d3.select(this.parentNode).datum();
|
24738 | return visuals.ColumnUtil.getFillOpacity(lineSeries.selected, !1, hasSelection, !1);
|
24739 | }).transition().duration(duration).attr({
|
24740 | cx: function(d, i) {
|
24741 | var lineSeries = d3.select(this.parentNode).datum(), circleIndex = that.shouldDrawCircle(lineSeries, i);
|
24742 | return circleIndex ? xScale(that.getXValue(d)) : 0;
|
24743 | },
|
24744 | cy: function(d, i) {
|
24745 | var lineSeries = d3.select(this.parentNode).datum(), circleIndex = that.shouldDrawCircle(lineSeries, i);
|
24746 | return circleIndex ? yScale(d.value) : 0;
|
24747 | },
|
24748 | r: function(d, i) {
|
24749 | var lineSeries = d3.select(this.parentNode).datum(), circleIndex = that.shouldDrawCircle(lineSeries, i);
|
24750 | return circleIndex ? LineChart.CircleRadius : 0;
|
24751 | }
|
24752 | });
|
24753 | if (this.isInteractiveChart && this.hasDataPoint(data.series)) {
|
24754 | var selectionSize_1 = updateSelection.size(), endedTransitionCount_1 = 0;
|
24755 | transitions.each("end", function() {
|
24756 | endedTransitionCount_1++, endedTransitionCount_1 === selectionSize_1 && _this.selectColumn(visuals.CartesianHelper.findMaxCategoryIndex(data.series), !0);
|
24757 | });
|
24758 | }
|
24759 | var dataPoints = null;
|
24760 | if (data.dataLabelsSettings.show) {
|
24761 | dataPoints = [];
|
24762 | for (var i = 0, ilen = data.series.length; ilen > i; i++) Array.prototype.push.apply(dataPoints, data.series[i].data);
|
24763 | }
|
24764 | catSelect.exit().remove();
|
24765 | var labelDataPointsGroups;
|
24766 | return data.dataLabelsSettings.show && (labelDataPointsGroups = this.createLabelDataPoints()),
|
24767 | null == dataPoints ? null : {
|
24768 | dataPoints: dataPoints,
|
24769 | behaviorOptions: null,
|
24770 | labelDataPoints: null,
|
24771 | labelsAreNumeric: null,
|
24772 | labelDataPointGroups: labelDataPointsGroups
|
24773 | };
|
24774 | }
|
24775 | }, LineChart.prototype.getSeriesTooltipInfo = function(pointData) {
|
24776 | for (var tooltipinfo = [], maxNumberOfItems = 10, count = 0, _i = 0, pointData_1 = pointData; _i < pointData_1.length; _i++) {
|
24777 | var point = pointData_1[_i];
|
24778 | if (count >= maxNumberOfItems) break;
|
24779 | null != point.value && (tooltipinfo.push({
|
24780 | header: point.category,
|
24781 | color: point.color,
|
24782 | displayName: point.label,
|
24783 | value: point.measure
|
24784 | }), count++);
|
24785 | }
|
24786 | return 0 === tooltipinfo.length ? null : tooltipinfo;
|
24787 | }, LineChart.prototype.getTooltipInfoForCombo = function(tooltipEvent, pointX) {
|
24788 | var dataPoint, categoryIndex = this.getCategoryIndexFromTooltipEvent(tooltipEvent, pointX), seriesData = tooltipEvent.data;
|
24789 | return seriesData && seriesData.data && seriesData.data.length && (dataPoint = _.find(seriesData.data, function(dp) {
|
24790 | return dp.categoryIndex === categoryIndex;
|
24791 | })), dataPoint ? dataPoint.tooltipInfo : void 0;
|
24792 | }, LineChart.prototype.getCategoryIndexFromTooltipEvent = function(tooltipEvent, pointX) {
|
24793 | if (tooltipEvent.data && null != tooltipEvent.data.categoryIndex) return tooltipEvent.data.categoryIndex;
|
24794 | var seriesData = tooltipEvent.data, offsetX = 0;
|
24795 | if (seriesData && !_.isEmpty(seriesData.data) && this.xAxisProperties) {
|
24796 | pointX = this.adjustPathXCoordinate(pointX);
|
24797 | var firstPathPoint = _.find(seriesData.data, function(dataPoint, index, dataPoints) {
|
24798 | var nextDataPoint = dataPoints[index + 1];
|
24799 | return null != dataPoint.value && nextDataPoint && null != nextDataPoint.value;
|
24800 | });
|
24801 | offsetX = this.xAxisProperties.scale(this.getXValue(firstPathPoint)) + this.getXOfFirstCategory();
|
24802 | }
|
24803 | return this.findIndex(pointX, offsetX);
|
24804 | }, LineChart.prototype.getVisualCategoryAxisIsScalar = function() {
|
24805 | return this.data ? this.data.isScalar : !1;
|
24806 | }, LineChart.prototype.getSupportedCategoryAxisType = function() {
|
24807 | var dvCategories = this.dataViewCat ? this.dataViewCat.categories : void 0, categoryType = powerbi.ValueType.fromDescriptor({
|
24808 | text: !0
|
24809 | });
|
24810 | dvCategories && dvCategories.length > 0 && dvCategories[0].source && dvCategories[0].source.type && (categoryType = dvCategories[0].source.type);
|
24811 | var isOrdinal = visuals.AxisHelper.isOrdinal(categoryType);
|
24812 | return isOrdinal ? visuals.axisType.categorical : visuals.axisType.both;
|
24813 | }, LineChart.prototype.getPreferredPlotArea = function(isScalar, categoryCount, categoryThickness) {
|
24814 | return visuals.CartesianChart.getPreferredPlotArea(categoryCount, categoryThickness, this.currentViewport, this.isScrollable, isScalar, this.margin, !0);
|
24815 | }, LineChart.prototype.getCategoryCount = function(origCatgSize) {
|
24816 | var availableWidth = this.getAvailableWidth(), categoryThickness = visuals.CartesianChart.MinOrdinalRectThickness;
|
24817 | return Math.min(Math.round((availableWidth - categoryThickness * visuals.CartesianChart.OuterPaddingRatio * 2) / categoryThickness), origCatgSize);
|
24818 | }, LineChart.prototype.getAvailableWidth = function() {
|
24819 | return this.currentViewport.width - (this.margin.left + this.margin.right);
|
24820 | }, LineChart.prototype.getAvailableHeight = function() {
|
24821 | return this.currentViewport.height - (this.margin.top + this.margin.bottom);
|
24822 | }, LineChart.sliceSeries = function(series, newLength, startIndex) {
|
24823 | void 0 === startIndex && (startIndex = 0);
|
24824 | var newSeries = [];
|
24825 | if (series && series.length > 0) for (var i = 0, len = series.length; len > i; i++) newSeries[i] = powerbi.Prototype.inherit(series[i]),
|
24826 | newSeries[i].data = series[i].data.slice(startIndex, startIndex + newLength);
|
24827 | return newSeries;
|
24828 | }, LineChart.prototype.getXOfFirstCategory = function() {
|
24829 | if (!this.data.isScalar) {
|
24830 | var xScale = this.xAxisProperties.scale;
|
24831 | if (xScale.rangeBand) return xScale.rangeBand() / 2;
|
24832 | }
|
24833 | return 0;
|
24834 | }, LineChart.prototype.hasDataPoint = function(series) {
|
24835 | if (0 === series.length) return !1;
|
24836 | for (var i = 0, len = series.length; len > i; i++) if (series[i].data.length > 0) return !0;
|
24837 | return !1;
|
24838 | }, LineChart.prototype.getXValue = function(d) {
|
24839 | return this.data.isScalar ? d.categoryValue : d.categoryIndex;
|
24840 | }, LineChart.prototype.shouldDrawCircle = function(d, i) {
|
24841 | var dataLength = d.data.length, isLastPoint = i === dataLength - 1, isFirstPoint = 0 === i;
|
24842 | 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;
|
24843 | }, LineChart.prototype.selectColumnForTooltip = function(columnIndex, force) {
|
24844 | void 0 === force && (force = !1);
|
24845 | var x = this.getChartX(columnIndex) + this.getXOfFirstCategory(), dataPoints = this.createTooltipDataPoints(columnIndex);
|
24846 | return dataPoints.length > 0 && this.setHoverLineForTooltip(x), this.setDotsForTooltip(x, dataPoints),
|
24847 | dataPoints;
|
24848 | }, LineChart.prototype.setHoverLineForTooltip = function(chartX) {
|
24849 | chartX = chartX || 0, this.hoverLine.attr("x1", chartX).attr("x2", chartX).attr("y1", 0).attr("y2", this.getAvailableHeight()).style("opacity", 1);
|
24850 | }, LineChart.prototype.setDotsForTooltip = function(chartX, dataPoints) {
|
24851 | var _this = this, isStackedArea = EnumExtensions.hasFlag(this.lineType, 16), dotYPosition = isStackedArea ? function(d) {
|
24852 | return _this.yAxisProperties.scale(d.stackedValue);
|
24853 | } : function(d) {
|
24854 | return _this.yAxisProperties.scale(d.value);
|
24855 | }, tooltipDots = this.hoverLineContext.selectAll(LineChart.HoverLineCircleDot.selector).data(dataPoints);
|
24856 | tooltipDots.enter().append(LineChart.CircleElementName).classed(LineChart.HoverLineCircleDot["class"], !0),
|
24857 | tooltipDots.filter(function(d) {
|
24858 | return d.value;
|
24859 | }).attr("fill", function(d) {
|
24860 | return d.color;
|
24861 | }).attr("r", 3).attr("cx", chartX).attr("cy", dotYPosition), tooltipDots.exit().remove();
|
24862 | }, LineChart.prototype.selectColumn = function(columnIndex, force) {
|
24863 | if (void 0 === force && (force = !1), force || this.lastInteractiveSelectedColumnIndex !== columnIndex) {
|
24864 | this.lastInteractiveSelectedColumnIndex = columnIndex;
|
24865 | var x = this.getChartX(columnIndex);
|
24866 | this.setHoverLine(x, columnIndex);
|
24867 | var legendItems = this.createLegendDataPoints(columnIndex);
|
24868 | legendItems && this.options.cartesianHost.updateLegend(legendItems);
|
24869 | }
|
24870 | }, LineChart.prototype.setHoverLine = function(chartX, columnIndex) {
|
24871 | this.hoverLine.attr("x1", chartX).attr("x2", chartX).attr("y1", 0).attr("y2", this.getAvailableHeight()).style("opacity", 1);
|
24872 | var that = this;
|
24873 | this.mainGraphicsContext.selectAll(LineChart.CategorySelector.selector).selectAll(LineChart.PathElementName).each(function(series) {
|
24874 | var _this = this, color = series.color, circleToChange = that.selectionCircles[series.lineIndex];
|
24875 | circleToChange.attr({
|
24876 | cx: chartX,
|
24877 | cy: function() {
|
24878 | var pathElement = d3.select(_this).node(), pos = that.getPosition(chartX, pathElement);
|
24879 | return pos.y;
|
24880 | }
|
24881 | }).style({
|
24882 | opacity: function() {
|
24883 | return _.some(series.data, function(value) {
|
24884 | return value.categoryIndex === columnIndex;
|
24885 | }) ? 1 : 0;
|
24886 | },
|
24887 | fill: color
|
24888 | }), that.dragHandle && that.dragHandle.attr("cx", chartX);
|
24889 | });
|
24890 | }, LineChart.prototype.getChartX = function(columnIndex) {
|
24891 | var x = 0;
|
24892 | 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));
|
24893 | var rangeEnd = powerbi.visuals.AxisHelper.extent(this.xAxisProperties.scale)[1];
|
24894 | return x = Math.min(x, rangeEnd), isNaN(x) ? 0 : x;
|
24895 | }, LineChart.prototype.findIndex = function(pointX, offsetX) {
|
24896 | var xScale = this.scaleDetector.getScale().x;
|
24897 | powerbi.Double.equalWithPrecision(xScale, 1, 1e-5) || (pointX /= xScale), offsetX && (pointX += offsetX);
|
24898 | var index = powerbi.visuals.AxisHelper.invertScale(this.xAxisProperties.scale, pointX);
|
24899 | return this.data.isScalar && (index = visuals.AxisHelper.findClosestXAxisIndex(index, this.data.categoryData)),
|
24900 | index;
|
24901 | }, LineChart.prototype.getPosition = function(x, pathElement) {
|
24902 | for (var pos, target, pathLength = pathElement.getTotalLength(), beginning = 0, end = pathLength; ;) {
|
24903 | if (target = Math.floor((beginning + end) / 2), pos = pathElement.getPointAtLength(target),
|
24904 | visuals.SVGUtil.ensureValidSVGPoint(pos), (target === end || target === beginning) && pos.x !== x) break;
|
24905 | if (pos.x > x) end = target; else {
|
24906 | if (!(pos.x < x)) break;
|
24907 | beginning = target;
|
24908 | }
|
24909 | }
|
24910 | return pos;
|
24911 | }, LineChart.prototype.createTooltipDataPoints = function(columnIndex) {
|
24912 | var data = this.data;
|
24913 | if (!data || 0 === data.series.length || !data.categoryData) return [];
|
24914 | var category, dataPoints = [], categoryDataPoint = data.categoryData[columnIndex];
|
24915 | this.data.isScalar ? categoryDataPoint && (category = visuals.AxisHelper.isDateTime(this.xAxisProperties.axisType) ? visuals.CartesianHelper.lookupXValue(this.data, categoryDataPoint.categoryValue, this.xAxisProperties.axisType, this.data.isScalar) : categoryDataPoint.categoryValue) : category = visuals.CartesianHelper.lookupXValue(this.data, columnIndex, this.xAxisProperties.axisType, this.data.isScalar);
|
24916 | for (var formatStringProp = visuals.lineChartProps.general.formatString, _i = 0, _a = data.series; _i < _a.length; _i++) {
|
24917 | var series = _a[_i], lineData = series.data, lineDataPoint = void 0;
|
24918 | this.data.isScalar ? categoryDataPoint && (lineDataPoint = lineData.filter(function(data) {
|
24919 | return data.categoryValue === categoryDataPoint.categoryValue;
|
24920 | })[0]) : lineDataPoint = lineData[columnIndex];
|
24921 | var value = lineDataPoint && lineDataPoint.value;
|
24922 | if (null != value) {
|
24923 | var label = visuals.converterHelper.getFormattedLegendLabel(series.yCol, this.dataViewCat.values, formatStringProp);
|
24924 | dataPoints.push({
|
24925 | color: series.color,
|
24926 | label: label,
|
24927 | category: visuals.valueFormatter.format(category, visuals.valueFormatter.getFormatString(series.xCol, formatStringProp)),
|
24928 | measure: visuals.valueFormatter.format(value, visuals.valueFormatter.getFormatString(series.yCol, formatStringProp)),
|
24929 | value: value,
|
24930 | stackedValue: lineDataPoint.stackedValue
|
24931 | });
|
24932 | }
|
24933 | }
|
24934 | return dataPoints;
|
24935 | }, LineChart.prototype.createLegendDataPoints = function(columnIndex) {
|
24936 | var data = this.data;
|
24937 | if (data && data.series && !(data.series.length < 1)) {
|
24938 | var category, legendDataPoints = [], categoryDataPoint = data.categoryData[columnIndex];
|
24939 | this.isInteractiveChart && categoryDataPoint && (this.data.isScalar ? (category = categoryDataPoint.categoryValue,
|
24940 | visuals.AxisHelper.isDateTime(this.xAxisProperties.axisType) && (category = new Date(category))) : category = visuals.CartesianHelper.lookupXValue(this.data, columnIndex, this.xAxisProperties.axisType, this.data.isScalar));
|
24941 | for (var formatStringProp = visuals.lineChartProps.general.formatString, seriesYCol = null, i = 0, len = data.series.length; len > i; i++) {
|
24942 | var series = data.series[i], lineData = series.data, measure = void 0;
|
24943 | if (this.isInteractiveChart) {
|
24944 | var lineDataPoint = void 0;
|
24945 | if (this.data.isScalar) {
|
24946 | if (categoryDataPoint) for (var targetCategoryValue = categoryDataPoint.categoryValue, i_1 = 0; i_1 < lineData.length; i_1++) if (lineData[i_1].categoryValue === targetCategoryValue) {
|
24947 | lineDataPoint = lineData[i_1];
|
24948 | break;
|
24949 | }
|
24950 | } else lineDataPoint = lineData[columnIndex];
|
24951 | measure = lineDataPoint && lineDataPoint.value;
|
24952 | }
|
24953 | var label = visuals.converterHelper.getFormattedLegendLabel(series.yCol, this.dataViewCat.values, formatStringProp);
|
24954 | seriesYCol = series.yCol, legendDataPoints.push({
|
24955 | color: series.color,
|
24956 | icon: visuals.LegendIcon.Line,
|
24957 | label: label,
|
24958 | category: visuals.valueFormatter.format(category, visuals.valueFormatter.getFormatString(series.xCol, formatStringProp)),
|
24959 | measure: visuals.valueFormatter.format(measure, visuals.valueFormatter.getFormatString(series.yCol, formatStringProp)),
|
24960 | identity: series.identity,
|
24961 | selected: series.selected
|
24962 | });
|
24963 | }
|
24964 | var dvValues = this.dataViewCat ? this.dataViewCat.values : null, title = dvValues && dvValues.source ? dvValues.source.displayName : "";
|
24965 | return {
|
24966 | title: title,
|
24967 | dataPoints: legendDataPoints
|
24968 | };
|
24969 | }
|
24970 | }, LineChart.prototype.createLabelDataPoints = function() {
|
24971 | var labelSettings, axisFormatter, seriesLabelDataPoints, seriesDataPointsCandidates, seriesIndex, seriesCount, _this = this, xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, lineshift = this.getXOfFirstCategory(), data = this.data, series = data.series, formattersCache = visuals.NewDataLabelUtils.createColumnFormatterCacheManager(), dataLabelsSettings = data.dataLabelsSettings, isStackedArea = EnumExtensions.hasFlag(this.lineType, 16), labelDataPointsGroups = [];
|
24972 | for (seriesIndex = 0, seriesCount = series.length; seriesCount > seriesIndex; seriesIndex++) {
|
24973 | var currentSeries = series[seriesIndex];
|
24974 | if (labelSettings = currentSeries.labelSettings ? currentSeries.labelSettings : dataLabelsSettings,
|
24975 | labelSettings.show) {
|
24976 | axisFormatter = visuals.NewDataLabelUtils.getDisplayUnitValueFromAxisFormatter(this.yAxisProperties.formatter, labelSettings);
|
24977 | var dataPoints = currentSeries.data;
|
24978 | seriesLabelDataPoints = [], seriesDataPointsCandidates = [];
|
24979 | var createLabelDataPoint = function(dataPoint) {
|
24980 | if (null == dataPoint.value) return null;
|
24981 | var formatString = "";
|
24982 | formatString = dataPoint.labelFormatString;
|
24983 | var parentShape, formatter = formattersCache.getOrCreate(formatString, labelSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
24984 | text: text,
|
24985 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
24986 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
24987 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
24988 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties) + visuals.NewDataLabelUtils.LabelDensityPadding, textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0), isParentRect = !1;
|
24989 | if (isStackedArea) {
|
24990 | var bottomPos = Math.max(dataPoint.stackedValue - dataPoint.value, yScale.domain()[0]), areaWidth = _this.currentViewport.width;
|
24991 | parentShape = {
|
24992 | rect: {
|
24993 | left: xScale(_this.getXValue(dataPoint)) - areaWidth / 2,
|
24994 | top: yScale(Math.max(dataPoint.stackedValue, dataPoint.stackedValue - dataPoint.value)),
|
24995 | width: areaWidth,
|
24996 | height: Math.abs(yScale(dataPoint.stackedValue) - yScale(bottomPos))
|
24997 | },
|
24998 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
24999 | validPositions: LineChart.validStackedLabelPositions
|
25000 | }, isParentRect = !0;
|
25001 | } else parentShape = {
|
25002 | point: {
|
25003 | x: xScale(_this.getXValue(dataPoint)) + lineshift,
|
25004 | y: yScale(dataPoint.value)
|
25005 | },
|
25006 | radius: 0,
|
25007 | validPositions: _this.lineChartLabelDensityEnabled ? LineChart.validLabelPositions : [ 1 ]
|
25008 | };
|
25009 | var labelDataPoint = {
|
25010 | isPreferred: !1,
|
25011 | text: text,
|
25012 | textSize: {
|
25013 | width: textWidth,
|
25014 | height: textHeight
|
25015 | },
|
25016 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor,
|
25017 | insideFill: labelSettings.labelColor && isStackedArea ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25018 | parentType: isParentRect ? 1 : 0,
|
25019 | parentShape: parentShape,
|
25020 | fontSize: labelSettings.fontSize,
|
25021 | identity: dataPoint.identity,
|
25022 | key: dataPoint.key
|
25023 | };
|
25024 | return labelDataPoint;
|
25025 | };
|
25026 | if (!_.isEmpty(dataPoints)) {
|
25027 | var categoryCount = dataPoints.length, lastDataPoint = dataPoints[categoryCount - 1], lastLabelDataPoint = createLabelDataPoint(lastDataPoint, seriesIndex);
|
25028 | lastLabelDataPoint && seriesLabelDataPoints.push(lastLabelDataPoint);
|
25029 | for (var categoryIndex = 0; categoryCount - 1 > categoryIndex; categoryIndex++) {
|
25030 | var labelDataPoint = createLabelDataPoint(dataPoints[categoryIndex], seriesIndex);
|
25031 | labelDataPoint && seriesLabelDataPoints.push(labelDataPoint);
|
25032 | }
|
25033 | }
|
25034 | var maxLabelsToRender = dataPoints.length;
|
25035 | labelDataPointsGroups[seriesIndex] = {
|
25036 | labelDataPoints: seriesLabelDataPoints,
|
25037 | maxNumberOfLabels: maxLabelsToRender
|
25038 | };
|
25039 | }
|
25040 | }
|
25041 | return labelDataPointsGroups;
|
25042 | }, LineChart.prototype.adjustPathXCoordinate = function(x) {
|
25043 | if (this.shouldAdjustMouseCoordsOnPathsForStroke) {
|
25044 | var xScale = this.scaleDetector.getScale().x;
|
25045 | x -= powerbi.Double.equalWithPrecision(xScale, 1, 1e-5) ? LineChart.pathXAdjustment : LineChart.pathXAdjustment * xScale;
|
25046 | }
|
25047 | return x;
|
25048 | }, LineChart.prototype.showLabelPerSeries = function() {
|
25049 | var data = this.data;
|
25050 | return !data.hasDynamicSeries && (data.series.length > 1 || !data.categoryMetadata);
|
25051 | }, LineChart.ClassName = "lineChart", LineChart.MainGraphicsContextClassName = "mainGraphicsContext",
|
25052 | LineChart.CategorySelector = createClassAndSelector("cat"), LineChart.CategoryValuePoint = createClassAndSelector("dot"),
|
25053 | LineChart.CategoryPointSelector = createClassAndSelector("point"), LineChart.CategoryAreaSelector = createClassAndSelector("catArea"),
|
25054 | LineChart.HoverLineCircleDot = createClassAndSelector("circle-item"), LineChart.LineClassSelector = createClassAndSelector("line"),
|
25055 | LineChart.PointRadius = 5, LineChart.CircleRadius = 4, LineChart.PathElementName = "path",
|
25056 | LineChart.CircleElementName = "circle", LineChart.CircleClassName = "selection-circle",
|
25057 | LineChart.LineElementName = "line", LineChart.RectOverlayName = "rect", LineChart.ScalarOuterPadding = 10,
|
25058 | LineChart.interactivityStrokeWidth = 10, LineChart.pathXAdjustment = 5, LineChart.AreaFillOpacity = .4,
|
25059 | LineChart.DimmedAreaFillOpacity = .2, LineChart.validLabelPositions = [ 1, 2, 8, 4, 64, 128, 16, 32 ],
|
25060 | LineChart.validStackedLabelPositions = [ 1, 4, 2 ], LineChart;
|
25061 | }();
|
25062 | visuals.LineChart = LineChart;
|
25063 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
25064 | }(powerbi || (powerbi = {}));
|
25065 |
|
25066 | var powerbi;
|
25067 |
|
25068 | !function(powerbi) {
|
25069 | var visuals;
|
25070 | !function(visuals) {
|
25071 | var Color = jsCommon.Color, PixelConverter = jsCommon.PixelConverter, Polygon = visuals.shapes.Polygon, DataRoleHelper = powerbi.data.DataRoleHelper;
|
25072 | visuals.MaxLevelOfDetail = 23, visuals.MinLevelOfDetail = 1, visuals.DefaultFillOpacity = .5,
|
25073 | visuals.DefaultBackgroundColor = "#000000", visuals.LeaderLineColor = "#000000";
|
25074 | var MapBubbleDataPointRenderer = function() {
|
25075 | function MapBubbleDataPointRenderer(tooltipsEnabled) {
|
25076 | this.tooltipsEnabled = tooltipsEnabled;
|
25077 | }
|
25078 | return MapBubbleDataPointRenderer.prototype.init = function(mapControl, mapDiv, addClearCatcher) {
|
25079 | this.mapControl = mapControl, this.root = mapDiv;
|
25080 | var root = d3.select(mapDiv[0]);
|
25081 | root.attr("drag-resize-disabled", "true");
|
25082 | var svg = this.svg = root.append("svg").style("position", "absolute").style("pointer-events", "none");
|
25083 | if (addClearCatcher) {
|
25084 | var clearSvg = this.clearSvg = d3.select(this.mapControl.getRootElement()).append("svg").style("position", "absolute");
|
25085 | this.clearCatcher = visuals.appendClearCatcher(clearSvg);
|
25086 | }
|
25087 | this.bubbleGraphicsContext = svg.append("g").classed("mapBubbles", !0), this.sliceGraphicsContext = svg.append("g").classed("mapSlices", !0),
|
25088 | this.labelBackgroundGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelBackgroundGraphicsContextClass["class"], !0),
|
25089 | this.labelGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0),
|
25090 | this.sliceLayout = d3.layout.pie().sort(null).value(function(d) {
|
25091 | return d.value;
|
25092 | }), this.arc = d3.svg.arc(), this.clearMaxDataPointRadius(), this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings();
|
25093 | }, MapBubbleDataPointRenderer.prototype.setData = function(data) {
|
25094 | this.mapData = data;
|
25095 | }, MapBubbleDataPointRenderer.prototype.clearDataPoints = function() {
|
25096 | this.mapData = {
|
25097 | dataPoints: [],
|
25098 | geocodingCategory: null,
|
25099 | hasDynamicSeries: !1,
|
25100 | hasSize: !1
|
25101 | };
|
25102 | }, MapBubbleDataPointRenderer.prototype.getDataPointCount = function() {
|
25103 | return this.mapData ? _.filter(this.mapData.dataPoints, function(value) {
|
25104 | return !!value.location;
|
25105 | }).length : 0;
|
25106 | }, MapBubbleDataPointRenderer.prototype.getDataPointPadding = function() {
|
25107 | return 2 * this.maxDataPointRadius;
|
25108 | }, MapBubbleDataPointRenderer.prototype.clearMaxDataPointRadius = function() {
|
25109 | this.maxDataPointRadius = 0;
|
25110 | }, MapBubbleDataPointRenderer.prototype.setMaxDataPointRadius = function(dataPointRadius) {
|
25111 | this.maxDataPointRadius = Math.max(dataPointRadius, this.maxDataPointRadius);
|
25112 | }, MapBubbleDataPointRenderer.prototype.getDefaultMap = function(geocodingCategory, dataPointCount) {
|
25113 | this.clearDataPoints();
|
25114 | }, MapBubbleDataPointRenderer.prototype.converter = function(viewport, dataView, labelSettings, interactivityService, tooltipsEnabled) {
|
25115 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
25116 | var mapControl = this.mapControl, widthOverTwo = viewport.width / 2, heightOverTwo = viewport.height / 2, strokeWidth = 1;
|
25117 | this.dataLabelsSettings = labelSettings;
|
25118 | var radiusScale = Math.min(viewport.width, viewport.height) / 384;
|
25119 | this.clearMaxDataPointRadius();
|
25120 | var grouped, dataValuesSource, bubbleData = [], sliceData = [], categorical = dataView ? dataView.categorical : null, sizeIndex = -1;
|
25121 | categorical && categorical.values && (grouped = categorical.values.grouped(), sizeIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Size"),
|
25122 | dataValuesSource = categorical.values.source);
|
25123 | for (var dataPoints = this.mapData ? this.mapData.dataPoints : [], hasSize = this.mapData.hasSize, categoryIndex = 0, categoryCount = dataPoints.length; categoryCount > categoryIndex; categoryIndex++) {
|
25124 | var dataPoint = dataPoints[categoryIndex], categoryValue = dataPoint.categoryValue, location_2 = dataPoint.location;
|
25125 | if (location_2) {
|
25126 | var xy = mapControl.tryLocationToPixel(new Microsoft.Maps.Location(location_2.latitude, location_2.longitude)), x = xy.x + widthOverTwo, y = xy.y + heightOverTwo, radius = dataPoint.radius * radiusScale;
|
25127 | this.setMaxDataPointRadius(radius);
|
25128 | var subDataPoints = dataPoint.subDataPoints, seriesCount = subDataPoints.length;
|
25129 | if (1 === seriesCount) {
|
25130 | var subDataPoint = subDataPoints[0];
|
25131 | bubbleData.push({
|
25132 | x: x,
|
25133 | y: y,
|
25134 | labeltext: categoryValue,
|
25135 | radius: radius,
|
25136 | fill: subDataPoint.fill,
|
25137 | stroke: subDataPoint.stroke,
|
25138 | strokeWidth: strokeWidth,
|
25139 | tooltipInfo: subDataPoint.tooltipInfo,
|
25140 | identity: subDataPoint.identity,
|
25141 | selected: !1,
|
25142 | labelFill: labelSettings.labelColor
|
25143 | });
|
25144 | } else {
|
25145 | for (var slices = [], seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
25146 | var subDataPoint = subDataPoints[seriesIndex], value = hasSize ? subDataPoint.value : 1;
|
25147 | slices.push({
|
25148 | x: x,
|
25149 | y: y,
|
25150 | labeltext: categoryValue,
|
25151 | radius: radius,
|
25152 | fill: subDataPoint.fill,
|
25153 | stroke: subDataPoint.stroke,
|
25154 | strokeWidth: strokeWidth,
|
25155 | value: value,
|
25156 | tooltipInfo: subDataPoint.tooltipInfo,
|
25157 | identity: subDataPoint.identity,
|
25158 | selected: !1,
|
25159 | labelFill: labelSettings.labelColor
|
25160 | });
|
25161 | }
|
25162 | interactivityService && interactivityService.applySelectionStateToData(slices),
|
25163 | sliceData.push(slices);
|
25164 | }
|
25165 | }
|
25166 | }
|
25167 | return interactivityService && interactivityService.applySelectionStateToData(bubbleData),
|
25168 | {
|
25169 | bubbleData: bubbleData,
|
25170 | sliceData: sliceData
|
25171 | };
|
25172 | }, MapBubbleDataPointRenderer.prototype.updateInternal = function(data, viewport, dataChanged, interactivityService, redrawDataLabels) {
|
25173 | Map.removeTransform3d(this.root), this.mapRendererData = data, this.svg && this.svg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px"),
|
25174 | this.clearSvg && this.clearSvg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px");
|
25175 | var arc = this.arc, hasSelection = interactivityService && interactivityService.hasSelection(), bubbles = this.bubbleGraphicsContext.selectAll(".bubble").data(data.bubbleData, function(d) {
|
25176 | return d.identity.getKey();
|
25177 | });
|
25178 | bubbles.enter().append("circle").classed("bubble", !0), bubbles.attr("cx", function(d) {
|
25179 | return d.x;
|
25180 | }).attr("cy", function(d) {
|
25181 | return d.y;
|
25182 | }).attr("r", function(d) {
|
25183 | return d.radius;
|
25184 | }).style("fill", function(d) {
|
25185 | return d.fill;
|
25186 | }).style("stroke", function(d) {
|
25187 | return d.stroke;
|
25188 | }).style("fill-opacity", function(d) {
|
25189 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
25190 | }).style("strokeWidth", function(d) {
|
25191 | return d.strokeWidth;
|
25192 | }).style("stroke-opacity", function(d) {
|
25193 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
25194 | }).style("cursor", "default"), bubbles.exit().remove(), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.bubbleGraphicsContext, function(tooltipEvent) {
|
25195 | return tooltipEvent.data.tooltipInfo;
|
25196 | }), bubbles.style("pointer-events", "all"));
|
25197 | var sliceData = data.sliceData, sliceContainers = this.sliceGraphicsContext.selectAll(".sliceContainer").data(sliceData);
|
25198 | sliceContainers.enter().append("g").classed("sliceContainer", !0), sliceContainers.exit().remove();
|
25199 | var sliceLayout = this.sliceLayout, slices = sliceContainers.selectAll(".slice").data(function(d) {
|
25200 | return sliceLayout(d);
|
25201 | }, function(d) {
|
25202 | return d.data.identity.getKey();
|
25203 | });
|
25204 | slices.enter().append("path").classed("slice", !0), slices.style("fill", function(t) {
|
25205 | return t.data.fill;
|
25206 | }).style("fill-opacity", function(d) {
|
25207 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
25208 | }).style("stroke", function(t) {
|
25209 | return t.data.stroke;
|
25210 | }).style("strokeWidth", function(t) {
|
25211 | return t.data.strokeWidth;
|
25212 | }).style("stroke-opacity", function(d) {
|
25213 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, !1);
|
25214 | }).style("cursor", "default").attr("transform", function(t) {
|
25215 | return visuals.SVGUtil.translate(t.data.x, t.data.y);
|
25216 | }).attr("d", function(t) {
|
25217 | return arc.innerRadius(0).outerRadius(function(t) {
|
25218 | return t.data.radius;
|
25219 | })(t);
|
25220 | }), slices.exit().remove(), this.updateInternalDataLabels(viewport, redrawDataLabels),
|
25221 | this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.sliceGraphicsContext, function(tooltipEvent) {
|
25222 | return tooltipEvent.data.data.tooltipInfo;
|
25223 | }), slices.style("pointer-events", "all"));
|
25224 | for (var allData = data.bubbleData.slice(), i = 0, ilen = sliceData.length; ilen > i; i++) allData.push.apply(allData, sliceData[i]);
|
25225 | var behaviorOptions = {
|
25226 | bubbleEventGroup: this.bubbleGraphicsContext,
|
25227 | sliceEventGroup: this.sliceGraphicsContext,
|
25228 | bubbles: bubbles,
|
25229 | slices: slices,
|
25230 | clearCatcher: this.clearCatcher,
|
25231 | dataPoints: allData
|
25232 | };
|
25233 | return behaviorOptions;
|
25234 | }, MapBubbleDataPointRenderer.prototype.updateInternalDataLabels = function(viewport, redrawDataLabels) {
|
25235 | var labelSettings = this.dataLabelsSettings, dataLabels = [];
|
25236 | if (labelSettings && (labelSettings.show || labelSettings.showCategory)) {
|
25237 | var labelDataPoints = this.createLabelDataPoints(), labelLayout = new powerbi.LabelLayout({
|
25238 | maximumOffset: visuals.NewDataLabelUtils.maxLabelOffset,
|
25239 | startingOffset: visuals.NewDataLabelUtils.startingLabelOffset
|
25240 | }), labelDataPointsGroup = {
|
25241 | labelDataPoints: labelDataPoints,
|
25242 | maxNumberOfLabels: labelDataPoints.length
|
25243 | };
|
25244 | dataLabels = labelLayout.layout([ labelDataPointsGroup ], {
|
25245 | width: viewport.width,
|
25246 | height: viewport.height
|
25247 | });
|
25248 | }
|
25249 | visuals.NewDataLabelUtils.drawLabelBackground(this.labelGraphicsContext, dataLabels, powerbi.visuals.DefaultBackgroundColor, powerbi.visuals.DefaultFillOpacity),
|
25250 | visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, dataLabels, !1);
|
25251 | }, MapBubbleDataPointRenderer.prototype.createLabelDataPoints = function() {
|
25252 | var data = this.mapRendererData, labelDataPoints = [], dataPoints = data.bubbleData;
|
25253 | dataPoints = dataPoints.concat(_.map(data.sliceData, function(value) {
|
25254 | return value[0];
|
25255 | }));
|
25256 | for (var labelSettings = this.dataLabelsSettings, _i = 0, dataPoints_4 = dataPoints; _i < dataPoints_4.length; _i++) {
|
25257 | var dataPoint = dataPoints_4[_i], text = dataPoint.labeltext, properties = {
|
25258 | text: text,
|
25259 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
25260 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize),
|
25261 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
25262 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
25263 | labelDataPoints.push({
|
25264 | isPreferred: !0,
|
25265 | text: text,
|
25266 | textSize: {
|
25267 | width: textWidth,
|
25268 | height: textHeight
|
25269 | },
|
25270 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25271 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25272 | parentType: 0,
|
25273 | parentShape: {
|
25274 | point: {
|
25275 | x: dataPoint.x,
|
25276 | y: dataPoint.y
|
25277 | },
|
25278 | radius: dataPoint.radius,
|
25279 | validPositions: MapBubbleDataPointRenderer.validLabelPositions
|
25280 | },
|
25281 | fontSize: labelSettings.fontSize,
|
25282 | identity: void 0,
|
25283 | hasBackground: !0
|
25284 | });
|
25285 | }
|
25286 | return labelDataPoints;
|
25287 | }, MapBubbleDataPointRenderer.validLabelPositions = [ 1, 2, 4, 8 ], MapBubbleDataPointRenderer;
|
25288 | }();
|
25289 | visuals.MapBubbleDataPointRenderer = MapBubbleDataPointRenderer;
|
25290 | var MapShapeDataPointRenderer = function() {
|
25291 | function MapShapeDataPointRenderer(fillMapDataLabelsEnabled, tooltipsEnabled) {
|
25292 | this.filledMapDataLabelsEnabled = fillMapDataLabelsEnabled, this.tooltipsEnabled = tooltipsEnabled;
|
25293 | }
|
25294 | return MapShapeDataPointRenderer.getFilledMapParams = function(category, dataCount) {
|
25295 | switch (category) {
|
25296 | case visuals.MapUtil.CategoryTypes.Continent:
|
25297 | case visuals.MapUtil.CategoryTypes.CountryRegion:
|
25298 | return 10 > dataCount ? {
|
25299 | level: 1,
|
25300 | maxPolygons: 50,
|
25301 | strokeWidth: 0
|
25302 | } : 30 > dataCount ? {
|
25303 | level: 1,
|
25304 | maxPolygons: 20,
|
25305 | strokeWidth: 0
|
25306 | } : {
|
25307 | level: 1,
|
25308 | maxPolygons: 5,
|
25309 | strokeWidth: 0
|
25310 | };
|
25311 |
|
25312 | default:
|
25313 | return 100 > dataCount ? {
|
25314 | level: 1,
|
25315 | maxPolygons: 5,
|
25316 | strokeWidth: 6
|
25317 | } : 200 > dataCount ? {
|
25318 | level: 0,
|
25319 | maxPolygons: 5,
|
25320 | strokeWidth: 6
|
25321 | } : {
|
25322 | level: 0,
|
25323 | maxPolygons: 5,
|
25324 | strokeWidth: 0
|
25325 | };
|
25326 | }
|
25327 | }, MapShapeDataPointRenderer.buildPaths = function(locations) {
|
25328 | for (var paths = [], i = 0; i < locations.length; i++) {
|
25329 | var location_3 = locations[i], polygon = location_3.geographic;
|
25330 | polygon.length > 2 && paths.push(location_3);
|
25331 | }
|
25332 | return paths;
|
25333 | }, MapShapeDataPointRenderer.prototype.init = function(mapControl, mapDiv, addClearCatcher) {
|
25334 | this.mapControl = mapControl, this.polygonInfo = new visuals.MapPolygonInfo(), this.root = mapDiv;
|
25335 | var root = d3.select(mapDiv[0]);
|
25336 | root.attr("drag-resize-disabled", "true");
|
25337 | var svg = this.svg = root.append("svg").style("position", "absolute").style("pointer-events", "none");
|
25338 | if (addClearCatcher) {
|
25339 | var clearSvg = this.clearSvg = d3.select(this.mapControl.getRootElement()).append("svg").style("position", "absolute");
|
25340 | this.clearCatcher = visuals.appendClearCatcher(clearSvg);
|
25341 | }
|
25342 | this.shapeGraphicsContext = svg.append("g").classed("mapShapes", !0), this.labelBackgroundGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelBackgroundGraphicsContextClass["class"], !0),
|
25343 | this.labelGraphicsContext = svg.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0),
|
25344 | this.clearMaxShapeDimension(), this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings();
|
25345 | }, MapShapeDataPointRenderer.prototype.setData = function(data) {
|
25346 | this.mapData = data;
|
25347 | }, MapShapeDataPointRenderer.prototype.clearDataPoints = function() {
|
25348 | this.mapData = {
|
25349 | dataPoints: [],
|
25350 | geocodingCategory: null,
|
25351 | hasDynamicSeries: !1,
|
25352 | hasSize: !1
|
25353 | };
|
25354 | }, MapShapeDataPointRenderer.prototype.getDataPointCount = function() {
|
25355 | return this.mapData ? _.filter(this.mapData.dataPoints, function(value) {
|
25356 | return !!value.paths;
|
25357 | }).length : 0;
|
25358 | }, MapShapeDataPointRenderer.prototype.converter = function(viewport, dataView, labelSettings, interactivityService) {
|
25359 | this.clearMaxShapeDimension(), this.dataLabelsSettings = labelSettings;
|
25360 | for (var strokeWidth = 1, shapeData = [], dataPoints = this.mapData ? this.mapData.dataPoints : [], categoryIndex = 0, categoryCount = dataPoints.length; categoryCount > categoryIndex; categoryIndex++) {
|
25361 | var categorical = dataView ? dataView.categorical : null, dataPoint = dataPoints[categoryIndex], subDataPoint = dataPoint.subDataPoints[0], paths = dataPoint.paths, grouped = void 0, sizeIndex = -1, dataValuesSource = void 0;
|
25362 | if (categorical && categorical.values && (grouped = categorical.values.grouped(),
|
25363 | sizeIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Size"), dataValuesSource = categorical.values.source),
|
25364 | 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++) {
|
25365 | 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;
|
25366 | this.setMaxShapeDimension(path.absoluteBounds.width, path.absoluteBounds.height);
|
25367 | var formatter = formattersCache.getOrCreate(labelFormatString, labelSettings);
|
25368 | shapeData.push({
|
25369 | absolutePointArray: path.absolute,
|
25370 | path: path.absoluteString,
|
25371 | fill: subDataPoint.fill,
|
25372 | stroke: subDataPoint.stroke,
|
25373 | strokeWidth: strokeWidth,
|
25374 | tooltipInfo: subDataPoint.tooltipInfo,
|
25375 | identity: identity,
|
25376 | selected: !1,
|
25377 | key: JSON.stringify({
|
25378 | id: idKey,
|
25379 | pIdx: pathIndex
|
25380 | }),
|
25381 | displayLabel: pathIndex === mainShapeIndex,
|
25382 | labeltext: categoryValue,
|
25383 | catagoryLabeltext: null != value ? visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(value)) : void 0,
|
25384 | labelFormatString: labelFormatString
|
25385 | });
|
25386 | }
|
25387 | }
|
25388 | return interactivityService && interactivityService.applySelectionStateToData(shapeData),
|
25389 | {
|
25390 | shapeData: shapeData
|
25391 | };
|
25392 | }, MapShapeDataPointRenderer.prototype.updateInternal = function(data, viewport, dataChanged, interactivityService, redrawDataLabels) {
|
25393 | Map.removeTransform3d(this.root), this.mapRendererData = data, this.svg && this.svg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px"),
|
25394 | this.clearSvg && this.clearSvg.style("width", viewport.width.toString() + "px").style("height", viewport.height.toString() + "px"),
|
25395 | this.polygonInfo.reCalc(this.mapControl, viewport.width, viewport.height), this.shapeGraphicsContext.attr("transform", this.polygonInfo.transformToString(this.polygonInfo.transform));
|
25396 | var hasSelection = interactivityService && interactivityService.hasSelection(), shapes = this.shapeGraphicsContext.selectAll("polygon").data(data.shapeData, function(d) {
|
25397 | return d.key;
|
25398 | });
|
25399 | shapes.enter().append("polygon").classed("shape", !0).attr("points", function(d) {
|
25400 | return d.path;
|
25401 | }), shapes.style("fill", function(d) {
|
25402 | return d.fill;
|
25403 | }).style("fill-opacity", function(d) {
|
25404 | return visuals.ColumnUtil.getFillOpacity(d.selected, !1, hasSelection, !1);
|
25405 | }).style("cursor", "default"), dataChanged && shapes.attr("points", function(d) {
|
25406 | return d.path;
|
25407 | }), shapes.exit().remove(), this.updateInternalDataLabels(viewport, redrawDataLabels),
|
25408 | this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(this.shapeGraphicsContext, function(tooltipEvent) {
|
25409 | return tooltipEvent.data.tooltipInfo;
|
25410 | }), shapes.style("pointer-events", "all"));
|
25411 | var behaviorOptions = {
|
25412 | shapeEventGroup: this.shapeGraphicsContext,
|
25413 | shapes: shapes,
|
25414 | clearCatcher: this.clearCatcher,
|
25415 | dataPoints: data.shapeData
|
25416 | };
|
25417 | return behaviorOptions;
|
25418 | }, MapShapeDataPointRenderer.prototype.getDataPointPadding = function() {
|
25419 | return 12;
|
25420 | }, MapShapeDataPointRenderer.getIndexOfLargestShape = function(paths) {
|
25421 | for (var largestShapeIndex = 0, largestShapeArea = 0, pathIndex = 0, pathCount = paths.length; pathCount > pathIndex; pathIndex++) {
|
25422 | var path = paths[pathIndex], polygon = new Polygon(path.absolute), currentShapeArea = Math.abs(Polygon.calculateAbsolutePolygonArea(polygon.polygonPoints));
|
25423 | currentShapeArea > largestShapeArea && (largestShapeIndex = pathIndex, largestShapeArea = currentShapeArea);
|
25424 | }
|
25425 | return largestShapeIndex;
|
25426 | }, MapShapeDataPointRenderer.prototype.updateInternalDataLabels = function(viewport, redrawDataLabels) {
|
25427 | var labels, labelSettings = this.dataLabelsSettings;
|
25428 | if (labelSettings && (labelSettings.show || labelSettings.showCategory)) {
|
25429 | var labelDataPoints = this.createLabelDataPoints();
|
25430 | void 0 === this.labelLayout && (this.labelLayout = new powerbi.FilledMapLabelLayout()),
|
25431 | labels = this.labelLayout.layout(labelDataPoints, {
|
25432 | width: viewport.width,
|
25433 | height: viewport.height
|
25434 | }, this.polygonInfo.transform, redrawDataLabels);
|
25435 | }
|
25436 | this.drawLabelStems(this.labelGraphicsContext, labels, labelSettings.show, labelSettings.showCategory),
|
25437 | visuals.NewDataLabelUtils.drawLabelBackground(this.labelGraphicsContext, labels, powerbi.visuals.DefaultBackgroundColor, powerbi.visuals.DefaultFillOpacity),
|
25438 | visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, labels, !1, labelSettings.show && labelSettings.showCategory);
|
25439 | }, MapShapeDataPointRenderer.prototype.clearMaxShapeDimension = function() {
|
25440 | this.maxShapeDimension = 0;
|
25441 | }, MapShapeDataPointRenderer.prototype.setMaxShapeDimension = function(width, height) {
|
25442 | this.maxShapeDimension = Math.max(width, this.maxShapeDimension), this.maxShapeDimension = Math.max(height, this.maxShapeDimension);
|
25443 | }, MapShapeDataPointRenderer.prototype.createLabelDataPoints = function() {
|
25444 | var data = this.mapRendererData, labelDataPoints = [];
|
25445 | if (this.filledMapDataLabelsEnabled) for (var dataShapes = data.shapeData, labelSettings = this.dataLabelsSettings, _i = 0, dataShapes_1 = dataShapes; _i < dataShapes_1.length; _i++) {
|
25446 | var dataShape = dataShapes_1[_i];
|
25447 | if (dataShape.displayLabel) {
|
25448 | var text = void 0, secondRowText = void 0, secondRowTextWidth = 0, hasSecondRow = !1;
|
25449 | if (this.dataLabelsSettings.show && !this.dataLabelsSettings.showCategory) {
|
25450 | if (text = dataShape.catagoryLabeltext, void 0 === text) continue;
|
25451 | } else if (this.dataLabelsSettings.showCategory && !this.dataLabelsSettings.show) {
|
25452 | if (text = dataShape.labeltext, void 0 === text) continue;
|
25453 | } else if (this.dataLabelsSettings.showCategory && this.dataLabelsSettings.show) {
|
25454 | if (text = dataShape.catagoryLabeltext, secondRowText = dataShape.labeltext, void 0 === text && void 0 === secondRowText) continue;
|
25455 | hasSecondRow = !0;
|
25456 | }
|
25457 | if (hasSecondRow) {
|
25458 | var secondRowProperties = {
|
25459 | text: secondRowText,
|
25460 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
25461 | fontSize: visuals.NewDataLabelUtils.LabelTextProperties.fontSize,
|
25462 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
25463 | };
|
25464 | secondRowTextWidth = powerbi.TextMeasurementService.measureSvgTextWidth(secondRowProperties);
|
25465 | }
|
25466 | var firstRowProperties = {
|
25467 | text: text,
|
25468 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
25469 | fontSize: visuals.NewDataLabelUtils.LabelTextProperties.fontSize,
|
25470 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
25471 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(firstRowProperties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(firstRowProperties);
|
25472 | secondRowText && void 0 !== dataShape.labeltext && void 0 !== dataShape.catagoryLabeltext && (textHeight = 2 * textHeight);
|
25473 | var labelDataPoint = {
|
25474 | parentType: 2,
|
25475 | parentShape: {
|
25476 | polygon: new Polygon(dataShape.absolutePointArray),
|
25477 | validPositions: MapShapeDataPointRenderer.validLabelPolygonPositions
|
25478 | },
|
25479 | text: text,
|
25480 | secondRowText: secondRowText,
|
25481 | textSize: {
|
25482 | width: Math.max(textWidth, secondRowTextWidth),
|
25483 | height: textHeight
|
25484 | },
|
25485 | insideFill: labelSettings.labelColor,
|
25486 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
25487 | isPreferred: !1,
|
25488 | identity: void 0,
|
25489 | hasBackground: !0
|
25490 | };
|
25491 | labelDataPoints.push(labelDataPoint);
|
25492 | }
|
25493 | }
|
25494 | return labelDataPoints;
|
25495 | }, MapShapeDataPointRenderer.prototype.drawLabelStems = function(labelsContext, dataLabels, showText, showCategory) {
|
25496 | var filteredLabels = _.filter(dataLabels, function(d) {
|
25497 | return d.isVisible;
|
25498 | }), key = function(d, index) {
|
25499 | return d.identity ? d.identity.getKeyWithoutHighlight() : index;
|
25500 | };
|
25501 | visuals.NewDataLabelUtils.drawLabelLeaderLines(labelsContext, filteredLabels, key, visuals.LeaderLineColor);
|
25502 | }, MapShapeDataPointRenderer.validLabelPolygonPositions = [ 256, 2, 1, 8, 4, 16, 32, 64, 128 ],
|
25503 | MapShapeDataPointRenderer;
|
25504 | }();
|
25505 | visuals.MapShapeDataPointRenderer = MapShapeDataPointRenderer;
|
25506 | var DefaultLocationZoomLevel = 11, Map = function() {
|
25507 | function Map(options) {
|
25508 | options.filledMap ? (this.dataPointRenderer = new MapShapeDataPointRenderer(options.filledMapDataLabelsEnabled, options.tooltipsEnabled),
|
25509 | this.filledMapDataLabelsEnabled = options.filledMapDataLabelsEnabled, this.isFilledMap = !0) : (this.dataPointRenderer = new MapBubbleDataPointRenderer(options.tooltipsEnabled),
|
25510 | this.isFilledMap = !1), this.mapControlFactory = options.mapControlFactory ? options.mapControlFactory : this.getDefaultMapControlFactory(),
|
25511 | this.behavior = options.behavior, this.tooltipsEnabled = options.tooltipsEnabled,
|
25512 | this.disableZooming = options.disableZooming, this.disablePanning = options.disablePanning,
|
25513 | this.isLegendScrollable = !!options.behavior, this.viewChangeThrottleInterval = options.viewChangeThrottleInterval,
|
25514 | this.enableCurrentLocation = options.enableCurrentLocation, this.boundsHaveBeenUpdated = !1;
|
25515 | }
|
25516 | return Map.prototype.init = function(options) {
|
25517 | var _this = this, element = this.element = $("<div>");
|
25518 | element.appendTo(options.element), this.pendingGeocodingRender = !1, this.currentViewport = options.viewport,
|
25519 | this.style = options.style, this.colors = this.style.colorPalette.dataColors, this.behavior && (this.interactivityService = visuals.createInteractivityService(options.host)),
|
25520 | this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings(), this.legend = powerbi.visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, this.interactivityService, this.isLegendScrollable),
|
25521 | this.legendHeight = 0, this.legendData = {
|
25522 | dataPoints: []
|
25523 | }, this.geoTaggingAnalyzerService = powerbi.createGeoTaggingAnalyzerService(options.host.getLocalizedString),
|
25524 | this.host = options.host, options.host.locale && (this.locale = options.host.locale()),
|
25525 | this.geocoder = options.host.geocoder(), this.resetBounds(), this.mapControlFactory.ensureMap(this.locale, function() {
|
25526 | Map.removeHillShading(), Microsoft.Maps.loadModule("Microsoft.Maps.Overlays.Style", {
|
25527 | callback: function() {
|
25528 | _this.initialize(element[0]), _this.enableCurrentLocation && _this.createCurrentLocation(element);
|
25529 | }
|
25530 | });
|
25531 | });
|
25532 | }, Map.prototype.createCurrentLocation = function(element) {
|
25533 | var pushpin, _this = this, myLocBtn = InJs.DomFactory.div().addClass("mapCurrentLocation").appendTo(element);
|
25534 | myLocBtn.on("click", function() {
|
25535 | _this.isCurrentLocation ? (pushpin && _this.mapControl.entities.remove(pushpin),
|
25536 | _this.updateInternal(!1, !1), _this.isCurrentLocation = !1) : _this.host.geolocation().getCurrentPosition(function(position) {
|
25537 | var location = new Microsoft.Maps.Location(position.coords.latitude, position.coords.longitude);
|
25538 | pushpin && _this.mapControl.entities.remove(pushpin), pushpin = visuals.MapUtil.CurrentLocation.createPushpin(location),
|
25539 | _this.mapControl.entities.push(pushpin), _this.updateMapView(location, DefaultLocationZoomLevel),
|
25540 | _this.isCurrentLocation = !0;
|
25541 | });
|
25542 | });
|
25543 | }, Map.prototype.addDataPoint = function(dataPoint) {
|
25544 | var location = dataPoint.location;
|
25545 | this.updateBounds(location.latitude, location.longitude), this.scheduleRedraw();
|
25546 | }, Map.prototype.scheduleRedraw = function() {
|
25547 | var _this = this;
|
25548 | !this.pendingGeocodingRender && this.mapControl && (this.pendingGeocodingRender = !0,
|
25549 | setTimeout(function() {
|
25550 | _this.updateInternal(!0, !0), _this.pendingGeocodingRender = !1;
|
25551 | }, 3e3));
|
25552 | }, Map.prototype.enqueueGeoCode = function(dataPoint) {
|
25553 | var _this = this, location = this.geocoder.tryGeocodeImmediate(dataPoint.geocodingQuery, this.geocodingCategory);
|
25554 | if (location) this.completeGeoCode(dataPoint, location); else {
|
25555 | var geocodingContext_1 = this.geocodingContext;
|
25556 | this.geocoder.geocode(dataPoint.geocodingQuery, this.geocodingCategory).then(function(location) {
|
25557 | location && geocodingContext_1 === _this.geocodingContext && _this.completeGeoCode(dataPoint, location);
|
25558 | });
|
25559 | }
|
25560 | }, Map.prototype.completeGeoCode = function(dataPoint, location) {
|
25561 | dataPoint.location = location, this.addDataPoint(dataPoint);
|
25562 | }, Map.prototype.enqueueGeoCodeAndGeoShape = function(dataPoint, params) {
|
25563 | var _this = this, location = this.geocoder.tryGeocodeImmediate(dataPoint.geocodingQuery, this.geocodingCategory);
|
25564 | if (location) this.completeGeoCodeAndGeoShape(dataPoint, params, location); else {
|
25565 | var geocodingContext_2 = this.geocodingContext;
|
25566 | this.geocoder.geocode(dataPoint.geocodingQuery, this.geocodingCategory).then(function(location) {
|
25567 | location && geocodingContext_2 === _this.geocodingContext && _this.completeGeoCodeAndGeoShape(dataPoint, params, location);
|
25568 | });
|
25569 | }
|
25570 | }, Map.prototype.completeGeoCodeAndGeoShape = function(dataPoint, params, location) {
|
25571 | dataPoint.location = location, this.enqueueGeoShape(dataPoint, params);
|
25572 | }, Map.prototype.enqueueGeoShape = function(dataPoint, params) {
|
25573 | var _this = this, result = this.geocoder.tryGeocodeBoundaryImmediate(dataPoint.location.latitude, dataPoint.location.longitude, this.geocodingCategory, params.level, params.maxPolygons);
|
25574 | if (result) this.completeGeoShape(dataPoint, params, result); else {
|
25575 | var geocodingContext_3 = this.geocodingContext;
|
25576 | this.geocoder.geocodeBoundary(dataPoint.location.latitude, dataPoint.location.longitude, this.geocodingCategory, params.level, params.maxPolygons).then(function(result) {
|
25577 | geocodingContext_3 === _this.geocodingContext && _this.completeGeoShape(dataPoint, params, result);
|
25578 | });
|
25579 | }
|
25580 | }, Map.prototype.completeGeoShape = function(dataPoint, params, result) {
|
25581 | var paths;
|
25582 | 0 === result.locations.length || result.locations[0].geographic ? paths = MapShapeDataPointRenderer.buildPaths(result.locations) : (visuals.MapUtil.calcGeoData(result),
|
25583 | paths = MapShapeDataPointRenderer.buildPaths(result.locations)), dataPoint.paths = paths,
|
25584 | this.addDataPoint(dataPoint);
|
25585 | }, Map.prototype.getOptimumLevelOfDetail = function(width, height) {
|
25586 | var dataPointCount = this.dataPointRenderer.getDataPointCount();
|
25587 | if (0 === dataPointCount) return visuals.MapUtil.MinLevelOfDetail;
|
25588 | for (var threshold = this.dataPointRenderer.getDataPointPadding(), levelOfDetail = visuals.MapUtil.MaxLevelOfDetail; levelOfDetail >= visuals.MapUtil.MinLevelOfDetail; levelOfDetail--) {
|
25589 | var minXmaxY = visuals.MapUtil.latLongToPixelXY(this.minLatitude, this.minLongitude, levelOfDetail), maxXminY = visuals.MapUtil.latLongToPixelXY(this.maxLatitude, this.maxLongitude, levelOfDetail);
|
25590 | if (maxXminY.x - minXmaxY.x + threshold <= width && minXmaxY.y - maxXminY.y + threshold <= height) return 2 > dataPointCount && (levelOfDetail = Math.min(visuals.MapUtil.MaxAutoZoomLevel, levelOfDetail)),
|
25591 | levelOfDetail;
|
25592 | }
|
25593 | return visuals.MapUtil.MinLevelOfDetail;
|
25594 | }, Map.prototype.getViewCenter = function(levelOfDetail) {
|
25595 | var minXmaxY = visuals.MapUtil.latLongToPixelXY(this.minLatitude, this.minLongitude, levelOfDetail), maxXminY = visuals.MapUtil.latLongToPixelXY(this.maxLatitude, this.maxLongitude, levelOfDetail);
|
25596 | return visuals.MapUtil.pixelXYToLocation((minXmaxY.x + maxXminY.x) / 2, (maxXminY.y + minXmaxY.y) / 2, levelOfDetail);
|
25597 | }, Map.prototype.resetBounds = function() {
|
25598 | this.boundsHaveBeenUpdated = !1, this.minLongitude = visuals.MapUtil.MaxAllowedLongitude,
|
25599 | this.maxLongitude = visuals.MapUtil.MinAllowedLongitude, this.minLatitude = visuals.MapUtil.MaxAllowedLatitude,
|
25600 | this.maxLatitude = visuals.MapUtil.MinAllowedLatitude;
|
25601 | }, Map.prototype.updateBounds = function(latitude, longitude) {
|
25602 | this.boundsHaveBeenUpdated = !0, longitude < this.minLongitude && (this.minLongitude = longitude),
|
25603 | longitude > this.maxLongitude && (this.maxLongitude = longitude), latitude < this.minLatitude && (this.minLatitude = latitude),
|
25604 | latitude > this.maxLatitude && (this.maxLatitude = latitude);
|
25605 | }, Map.legendObject = function(dataView) {
|
25606 | return dataView && dataView.metadata && dataView.metadata.objects && dataView.metadata.objects.legend;
|
25607 | }, Map.isLegendHidden = function(dataView) {
|
25608 | var legendObject = Map.legendObject(dataView);
|
25609 | return null != legendObject && legendObject[visuals.legendProps.show] === !1;
|
25610 | }, Map.legendPosition = function(dataView) {
|
25611 | var legendObject = Map.legendObject(dataView);
|
25612 | return legendObject && visuals.LegendPosition[legendObject[visuals.legendProps.position]];
|
25613 | }, Map.getLegendFontSize = function(dataView) {
|
25614 | var legendObject = Map.legendObject(dataView);
|
25615 | return legendObject && legendObject[visuals.legendProps.fontSize] || visuals.SVGLegend.DefaultFontSizeInPt;
|
25616 | }, Map.isShowLegendTitle = function(dataView) {
|
25617 | var legendObject = Map.legendObject(dataView);
|
25618 | return legendObject && legendObject[visuals.legendProps.showTitle];
|
25619 | }, Map.prototype.legendTitle = function() {
|
25620 | var legendObject = Map.legendObject(this.dataView);
|
25621 | return legendObject && legendObject[visuals.legendProps.titleText] || this.legendData.title;
|
25622 | }, Map.prototype.renderLegend = function(legendData) {
|
25623 | var hideLegend = Map.isLegendHidden(this.dataView), showTitle = Map.isShowLegendTitle(this.dataView), title = this.legendTitle(), clonedLegendData = {
|
25624 | dataPoints: hideLegend ? [] : legendData.dataPoints,
|
25625 | grouped: legendData.grouped,
|
25626 | title: showTitle ? title : "",
|
25627 | fontSize: Map.getLegendFontSize(this.dataView)
|
25628 | }, targetOrientation = Map.legendPosition(this.dataView);
|
25629 | void 0 !== targetOrientation ? this.legend.changeOrientation(targetOrientation) : this.legend.changeOrientation(visuals.LegendPosition.Top),
|
25630 | this.legend.drawLegend(clonedLegendData, this.currentViewport);
|
25631 | }, Map.calculateGroupSizes = function(categorical, grouped, groupSizeTotals, sizeMeasureIndex, currentValueScale) {
|
25632 | for (var categoryCount = categorical.values[0].values.length, seriesCount = grouped.length, i = 0, len = categoryCount; len > i; ++i) {
|
25633 | var groupTotal = null;
|
25634 | if (sizeMeasureIndex >= 0) for (var j = 0; seriesCount > j; ++j) {
|
25635 | var value = grouped[j].values[sizeMeasureIndex].values[i];
|
25636 | value && (null === groupTotal ? groupTotal = value : groupTotal += value);
|
25637 | }
|
25638 | groupSizeTotals.push(groupTotal), groupTotal && (currentValueScale ? (currentValueScale.min = Math.min(currentValueScale.min, groupTotal),
|
25639 | currentValueScale.max = Math.max(currentValueScale.max, groupTotal)) : currentValueScale = {
|
25640 | min: groupTotal,
|
25641 | max: groupTotal
|
25642 | });
|
25643 | }
|
25644 | return currentValueScale;
|
25645 | }, Map.calculateRadius = function(range, value) {
|
25646 | var rangeDiff = range ? range.max - range.min : 0, radius = 6;
|
25647 | return null != range && null != value && 0 !== rangeDiff && (radius = 14 * ((value - range.min) / rangeDiff) + 6),
|
25648 | radius;
|
25649 | }, Map.getGeocodingCategory = function(categorical, geoTaggingAnalyzerService) {
|
25650 | if (categorical && categorical.categories && categorical.categories.length > 0 && categorical.categories[0].source) {
|
25651 | var type = categorical.categories[0].source.type;
|
25652 | if (type && type.categoryString) return geoTaggingAnalyzerService.getFieldType(type.categoryString);
|
25653 | var categoryName = categorical.categories[0].source.displayName, geotaggedResult = geoTaggingAnalyzerService.getFieldType(categoryName);
|
25654 | if (geotaggedResult) return geotaggedResult;
|
25655 | var roles = categorical.categories[0].source.roles;
|
25656 | if (roles) for (var roleNames = Object.keys(roles), i = 0, len = roleNames.length; len > i; ++i) {
|
25657 | var typeFromRoleName = geoTaggingAnalyzerService.getFieldType(roleNames[i]);
|
25658 | if (typeFromRoleName) return typeFromRoleName;
|
25659 | }
|
25660 | }
|
25661 | }, Map.hasSizeField = function(values, defaultIndexIfNoRole) {
|
25662 | if (_.isEmpty(values)) return !1;
|
25663 | for (var i = 0, ilen = values.length; ilen > i; i++) {
|
25664 | var roles = values[i].source.roles;
|
25665 | if (!roles && i === defaultIndexIfNoRole && values[i].source.type.numeric) return !0;
|
25666 | if (roles) for (var roleNames = Object.keys(roles), j = 0, jlen = roleNames.length; jlen > j; j++) {
|
25667 | var role = roleNames[j];
|
25668 | if ("Size" === role) return !0;
|
25669 | }
|
25670 | }
|
25671 | return !1;
|
25672 | }, Map.shouldEnumerateDataPoints = function(dataView, usesSizeForGradient) {
|
25673 | var hasSeries = DataRoleHelper.hasRoleInDataView(dataView, "Series"), gradientRole = usesSizeForGradient ? "Size" : "Gradient", hasGradientRole = DataRoleHelper.hasRoleInDataView(dataView, gradientRole);
|
25674 | return hasSeries || !hasGradientRole;
|
25675 | }, Map.shouldEnumerateCategoryLabels = function(isFilledMap, filledMapDataLabelsEnabled) {
|
25676 | return !isFilledMap || filledMapDataLabelsEnabled;
|
25677 | }, Map.prototype.enumerateObjectInstances = function(options) {
|
25678 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
25679 | switch (options.objectName) {
|
25680 | case "dataPoint":
|
25681 | if (Map.shouldEnumerateDataPoints(this.dataView, this.isFilledMap)) {
|
25682 | var bubbleData = [], hasDynamicSeries = this.hasDynamicSeries;
|
25683 | if (!hasDynamicSeries) {
|
25684 | var mapData = this.dataPointRenderer.converter(this.getMapViewPort(), this.dataView, this.dataLabelsSettings, this.interactivityService, this.tooltipsEnabled);
|
25685 | bubbleData = mapData.bubbleData;
|
25686 | }
|
25687 | Map.enumerateDataPoints(enumeration, this.dataPointsToEnumerate, this.colors, hasDynamicSeries, this.defaultDataPointColor, this.showAllDataPoints, bubbleData);
|
25688 | }
|
25689 | break;
|
25690 |
|
25691 | case "categoryLabels":
|
25692 | Map.shouldEnumerateCategoryLabels(this.isFilledMap, this.filledMapDataLabelsEnabled) && visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, this.dataLabelsSettings, !0, !0);
|
25693 | break;
|
25694 |
|
25695 | case "legend":
|
25696 | this.hasDynamicSeries && Map.enumerateLegend(enumeration, this.dataView, this.legend, this.legendTitle());
|
25697 | break;
|
25698 |
|
25699 | case "labels":
|
25700 | if (this.filledMapDataLabelsEnabled) {
|
25701 | this.dataLabelsSettings = this.dataLabelsSettings ? this.dataLabelsSettings : visuals.dataLabelUtils.getDefaultMapLabelSettings();
|
25702 | var labelSettingOptions = {
|
25703 | enumeration: enumeration,
|
25704 | dataLabelsSettings: this.dataLabelsSettings,
|
25705 | show: !0,
|
25706 | displayUnits: !0,
|
25707 | precision: !0
|
25708 | };
|
25709 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
25710 | }
|
25711 | }
|
25712 | return enumeration.complete();
|
25713 | }, Map.enumerateDataPoints = function(enumeration, dataPoints, colors, hasDynamicSeries, defaultDataPointColor, showAllDataPoints, bubbleData) {
|
25714 | var seriesLength = dataPoints && dataPoints.length;
|
25715 | if (hasDynamicSeries) for (var i = 0; seriesLength > i; i++) {
|
25716 | var dataPoint = dataPoints[i];
|
25717 | enumeration.pushInstance({
|
25718 | objectName: "dataPoint",
|
25719 | displayName: dataPoint.label,
|
25720 | selector: visuals.ColorHelper.normalizeSelector(dataPoint.identity.getSelector()),
|
25721 | properties: {
|
25722 | fill: {
|
25723 | solid: {
|
25724 | color: dataPoint.color
|
25725 | }
|
25726 | }
|
25727 | }
|
25728 | });
|
25729 | } else if (enumeration.pushInstance({
|
25730 | objectName: "dataPoint",
|
25731 | selector: null,
|
25732 | properties: {
|
25733 | defaultColor: {
|
25734 | solid: {
|
25735 | color: defaultDataPointColor || colors.getColorByIndex(0).value
|
25736 | }
|
25737 | }
|
25738 | }
|
25739 | }).pushInstance({
|
25740 | objectName: "dataPoint",
|
25741 | selector: null,
|
25742 | properties: {
|
25743 | showAllDataPoints: !!showAllDataPoints
|
25744 | }
|
25745 | }), bubbleData) for (var i = 0; i < bubbleData.length; i++) {
|
25746 | var bubbleDataPoint = bubbleData[i];
|
25747 | enumeration.pushInstance({
|
25748 | objectName: "dataPoint",
|
25749 | displayName: bubbleDataPoint.labeltext,
|
25750 | selector: visuals.ColorHelper.normalizeSelector(bubbleDataPoint.identity.getSelector()),
|
25751 | properties: {
|
25752 | fill: {
|
25753 | solid: {
|
25754 | color: Color.normalizeToHexString(bubbleDataPoint.fill)
|
25755 | }
|
25756 | }
|
25757 | }
|
25758 | });
|
25759 | }
|
25760 | }, Map.enumerateLegend = function(enumeration, dataView, legend, legendTitle) {
|
25761 | enumeration.pushInstance({
|
25762 | selector: null,
|
25763 | properties: {
|
25764 | show: !Map.isLegendHidden(dataView),
|
25765 | position: visuals.LegendPosition[legend.getOrientation()],
|
25766 | showTitle: Map.isShowLegendTitle(dataView),
|
25767 | titleText: legendTitle,
|
25768 | fontSize: Map.getLegendFontSize(dataView)
|
25769 | },
|
25770 | objectName: "legend"
|
25771 | });
|
25772 | }, Map.prototype.onDataChanged = function(options) {
|
25773 | var _this = this;
|
25774 | this.resetBounds(), this.geocodingContext = {}, this.behavior && this.behavior.resetZoomPan(),
|
25775 | this.dataLabelsSettings = visuals.dataLabelUtils.getDefaultMapLabelSettings(), this.defaultDataPointColor = null,
|
25776 | this.showAllDataPoints = null;
|
25777 | var dataView = this.dataView = options.dataViews[0], isFilledMap = this.isFilledMap, warnings = [], data = {
|
25778 | dataPoints: [],
|
25779 | geocodingCategory: null,
|
25780 | hasDynamicSeries: !1,
|
25781 | hasSize: !1
|
25782 | };
|
25783 | if (dataView) {
|
25784 | if (dataView.metadata && dataView.metadata.objects) {
|
25785 | var objects = dataView.metadata.objects;
|
25786 | if (this.defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.mapProps.dataPoint.defaultColor),
|
25787 | this.showAllDataPoints = powerbi.DataViewObjects.getValue(objects, visuals.mapProps.dataPoint.showAllDataPoints),
|
25788 | this.dataLabelsSettings.showCategory = powerbi.DataViewObjects.getValue(objects, visuals.filledMapProps.categoryLabels.show, this.dataLabelsSettings.showCategory),
|
25789 | isFilledMap) {
|
25790 | this.dataLabelsSettings.precision = powerbi.DataViewObjects.getValue(objects, visuals.filledMapProps.labels.labelPrecision, this.dataLabelsSettings.precision),
|
25791 | this.dataLabelsSettings.precision = this.dataLabelsSettings.precision !== visuals.dataLabelUtils.defaultLabelPrecision && this.dataLabelsSettings.precision < 0 ? 0 : this.dataLabelsSettings.precision,
|
25792 | this.dataLabelsSettings.displayUnits = powerbi.DataViewObjects.getValue(objects, visuals.filledMapProps.labels.labelDisplayUnits, this.dataLabelsSettings.displayUnits);
|
25793 | var datalabelsObj = objects.labels;
|
25794 | datalabelsObj && (this.dataLabelsSettings.show = void 0 !== datalabelsObj.show ? datalabelsObj.show : this.dataLabelsSettings.show,
|
25795 | void 0 !== datalabelsObj.color && (this.dataLabelsSettings.labelColor = datalabelsObj.color.solid.color));
|
25796 | } else {
|
25797 | var categoryLabelsObj = objects.categoryLabels;
|
25798 | categoryLabelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(categoryLabelsObj, this.dataLabelsSettings);
|
25799 | }
|
25800 | }
|
25801 | var colorHelper = new visuals.ColorHelper(this.colors, visuals.mapProps.dataPoint.fill, this.defaultDataPointColor);
|
25802 | data = Map.converter(dataView, colorHelper, this.geoTaggingAnalyzerService, isFilledMap),
|
25803 | this.hasDynamicSeries = data.hasDynamicSeries, this.legendData = Map.createLegendData(dataView, colorHelper),
|
25804 | this.dataPointsToEnumerate = this.legendData.dataPoints, this.renderLegend(this.legendData),
|
25805 | null != data ? (this.geocodingCategory = data.geocodingCategory, this.mapControlFactory.ensureMap(this.locale, function() {
|
25806 | Map.removeHillShading();
|
25807 | var params;
|
25808 | isFilledMap && (params = MapShapeDataPointRenderer.getFilledMapParams(_this.geocodingCategory, data.dataPoints.length));
|
25809 | for (var _i = 0, _a = data.dataPoints; _i < _a.length; _i++) {
|
25810 | var dataPoint = _a[_i];
|
25811 | dataPoint.location ? isFilledMap && !dataPoint.paths ? _this.enqueueGeoShape(dataPoint, params) : _this.addDataPoint(dataPoint) : _.isEmpty(dataPoint.categoryValue) || (isFilledMap ? _this.enqueueGeoCodeAndGeoShape(dataPoint, params) : _this.enqueueGeoCode(dataPoint));
|
25812 | }
|
25813 | })) : this.clearDataPoints(), isFilledMap && (this.geocodingCategory && this.geoTaggingAnalyzerService.isGeoshapable(this.geocodingCategory) || warnings.push(new visuals.FilledMapWithoutValidGeotagCategoryWarning()));
|
25814 | } else this.clearDataPoints(), this.renderLegend({
|
25815 | dataPoints: [],
|
25816 | title: void 0
|
25817 | }), this.dataPointsToEnumerate = [];
|
25818 | _.isEmpty(warnings) || this.host.setWarnings(warnings), this.dataPointRenderer.setData(data),
|
25819 | this.updateInternal(!0, !0);
|
25820 | }, Map.converter = function(dataView, colorHelper, geoTaggingAnalyzerService, isFilledMap) {
|
25821 | var reader = powerbi.data.createIDataViewCategoricalReader(dataView), dataPoints = [], hasDynamicSeries = reader.hasDynamicSeries(), seriesColumnIdentifier = reader.getSeriesColumnIdentityFields(), sizeQueryName = reader.getMeasureQueryName("Size");
|
25822 | null == sizeQueryName && (sizeQueryName = "");
|
25823 | var hasSize = reader.hasValues("Size"), geocodingCategory = null, formatStringProp = visuals.mapProps.general.formatString;
|
25824 | if (reader.hasCategories()) {
|
25825 | var categoryTotals = [], categoryTotalRange = void 0;
|
25826 | if (hasSize) {
|
25827 | for (var categoryMin = void 0, categoryMax = void 0, categoryIndex = 0, categoryCount = reader.getCategoryCount(); categoryCount > categoryIndex; categoryIndex++) {
|
25828 | for (var categoryTotal = void 0, seriesIndex = 0, seriesCount = reader.getSeriesCount(); seriesCount > seriesIndex; seriesIndex++) {
|
25829 | var currentValue = reader.getValue("Size", categoryIndex, seriesIndex);
|
25830 | null == categoryTotal && null != currentValue && (categoryTotal = 0), null != categoryTotal && (categoryTotal += currentValue);
|
25831 | }
|
25832 | categoryTotals.push(categoryTotal), null != categoryTotal && ((void 0 === categoryMin || categoryMin > categoryTotal) && (categoryMin = categoryTotal),
|
25833 | (void 0 === categoryMax || categoryTotal > categoryMax) && (categoryMax = categoryTotal));
|
25834 | }
|
25835 | categoryTotalRange = void 0 !== categoryMin && void 0 !== categoryMax ? {
|
25836 | max: categoryMax,
|
25837 | min: categoryMin
|
25838 | } : void 0;
|
25839 | }
|
25840 | var hasLatLongGroup = reader.hasCompositeCategories() && reader.hasCategoryWithRole("X") && reader.hasCategoryWithRole("Y"), hasCategoryGroup = reader.hasCategoryWithRole("Category");
|
25841 | if (geocodingCategory = Map.getGeocodingCategory(dataView.categorical, geoTaggingAnalyzerService),
|
25842 | hasLatLongGroup || hasCategoryGroup) for (var categoryIndex = 0, categoryCount = reader.getCategoryCount(); categoryCount > categoryIndex; categoryIndex++) {
|
25843 | var categoryValue = void 0, categoryObjects = hasCategoryGroup ? reader.getCategoryObjects("Category", categoryIndex) : reader.getCategoryObjects("Y", categoryIndex), location_4 = void 0, categoryTooltipItem = void 0, latitudeTooltipItem = void 0, longitudeTooltipItem = void 0, seriesTooltipItem = void 0, sizeTooltipItem = void 0, gradientTooltipItem = void 0;
|
25844 | if (hasCategoryGroup) {
|
25845 | if (categoryValue = reader.getCategoryValue("Category", categoryIndex), categoryTooltipItem = {
|
25846 | displayName: reader.getCategoryDisplayName("Category"),
|
25847 | value: visuals.converterHelper.formatFromMetadataColumn(categoryValue, reader.getCategoryMetadataColumn("Category"), formatStringProp)
|
25848 | }, reader.hasValues("Y") && reader.hasValues("X")) {
|
25849 | var latitude = reader.getFirstNonNullValueForCategory("Y", categoryIndex), longitude = reader.getFirstNonNullValueForCategory("X", categoryIndex);
|
25850 | null != latitude && null != longitude && (location_4 = {
|
25851 | latitude: latitude,
|
25852 | longitude: longitude
|
25853 | }), latitudeTooltipItem = {
|
25854 | displayName: reader.getValueDisplayName("Y"),
|
25855 | value: visuals.converterHelper.formatFromMetadataColumn(latitude, reader.getValueMetadataColumn("Y"), formatStringProp)
|
25856 | }, longitudeTooltipItem = {
|
25857 | displayName: reader.getValueDisplayName("X"),
|
25858 | value: visuals.converterHelper.formatFromMetadataColumn(longitude, reader.getValueMetadataColumn("X"), formatStringProp)
|
25859 | };
|
25860 | }
|
25861 | } else {
|
25862 | var latitude = reader.getCategoryValue("Y", categoryIndex), longitude = reader.getCategoryValue("X", categoryIndex);
|
25863 | null != latitude && null != longitude && (categoryValue = latitude + ", " + longitude,
|
25864 | location_4 = {
|
25865 | latitude: latitude,
|
25866 | longitude: longitude
|
25867 | }, latitudeTooltipItem = {
|
25868 | displayName: reader.getCategoryDisplayName("Y"),
|
25869 | value: visuals.converterHelper.formatFromMetadataColumn(latitude, reader.getCategoryMetadataColumn("Y"), formatStringProp)
|
25870 | }, longitudeTooltipItem = {
|
25871 | displayName: reader.getCategoryDisplayName("X"),
|
25872 | value: visuals.converterHelper.formatFromMetadataColumn(longitude, reader.getCategoryMetadataColumn("X"), formatStringProp)
|
25873 | });
|
25874 | }
|
25875 | var value = hasSize ? categoryTotals[categoryIndex] : void 0, subDataPoints = [], seriesCount = reader.getSeriesCount();
|
25876 | hasSize || hasDynamicSeries || (seriesCount = 1);
|
25877 | for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) {
|
25878 | var color = void 0;
|
25879 | 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);
|
25880 | var colorRgb = Color.parseColorString(color), stroke = Color.hexString(Color.darken(colorRgb, Map.StrokeDarkenColorValue));
|
25881 | colorRgb.A = .6;
|
25882 | var fill = Color.rgbString(colorRgb), identityBuilder = new visuals.SelectionIdBuilder().withCategory(reader.getCategoryColumn(hasCategoryGroup ? "Category" : "Y"), categoryIndex).withMeasure(sizeQueryName);
|
25883 | hasDynamicSeries && (identityBuilder = identityBuilder.withSeries(reader.getSeriesValueColumns(), reader.getSeriesValueColumnGroup(seriesIndex))),
|
25884 | hasDynamicSeries && (seriesTooltipItem = {
|
25885 | displayName: reader.getSeriesDisplayName(),
|
25886 | value: visuals.converterHelper.formatFromMetadataColumn(reader.getSeriesName(seriesIndex), reader.getSeriesMetadataColumn(), formatStringProp)
|
25887 | });
|
25888 | var subsliceValue = void 0;
|
25889 | hasSize && (subsliceValue = reader.getValue("Size", categoryIndex, seriesIndex),
|
25890 | sizeTooltipItem = {
|
25891 | displayName: reader.getValueDisplayName("Size"),
|
25892 | value: visuals.converterHelper.formatFromMetadataColumn(subsliceValue, reader.getValueMetadataColumn("Size", seriesIndex), formatStringProp)
|
25893 | }), reader.hasValues("Gradient") && (gradientTooltipItem = {
|
25894 | displayName: reader.getValueDisplayName("Gradient"),
|
25895 | value: visuals.converterHelper.formatFromMetadataColumn(reader.getValue("Gradient", categoryIndex, seriesIndex), reader.getValueMetadataColumn("Gradient", seriesIndex), formatStringProp)
|
25896 | });
|
25897 | var tooltipInfo = [];
|
25898 | categoryTooltipItem && tooltipInfo.push(categoryTooltipItem), seriesTooltipItem && tooltipInfo.push(seriesTooltipItem),
|
25899 | latitudeTooltipItem && tooltipInfo.push(latitudeTooltipItem), longitudeTooltipItem && tooltipInfo.push(longitudeTooltipItem),
|
25900 | sizeTooltipItem && tooltipInfo.push(sizeTooltipItem), gradientTooltipItem && tooltipInfo.push(gradientTooltipItem),
|
25901 | (subsliceValue || !hasSize || 0 === subsliceValue && isFilledMap) && subDataPoints.push({
|
25902 | value: subsliceValue,
|
25903 | fill: fill,
|
25904 | stroke: stroke,
|
25905 | identity: identityBuilder.createSelectionId(),
|
25906 | tooltipInfo: tooltipInfo
|
25907 | });
|
25908 | }
|
25909 | (value || !hasSize || 0 === value && isFilledMap) && dataPoints.push({
|
25910 | geocodingQuery: categoryValue,
|
25911 | value: value,
|
25912 | categoryValue: categoryValue,
|
25913 | subDataPoints: subDataPoints,
|
25914 | radius: Map.calculateRadius(categoryTotalRange, value),
|
25915 | location: location_4
|
25916 | });
|
25917 | }
|
25918 | }
|
25919 | var mapData = {
|
25920 | dataPoints: dataPoints,
|
25921 | geocodingCategory: geocodingCategory,
|
25922 | hasDynamicSeries: hasDynamicSeries,
|
25923 | hasSize: hasSize
|
25924 | };
|
25925 | return mapData;
|
25926 | }, Map.createLegendData = function(dataView, colorHelper) {
|
25927 | var legendTitle, reader = powerbi.data.createIDataViewCategoricalReader(dataView), legendDataPoints = [];
|
25928 | if (reader.hasDynamicSeries()) {
|
25929 | legendTitle = reader.getSeriesDisplayName();
|
25930 | for (var seriesColumnIdentifier = reader.getSeriesColumnIdentityFields(), seriesIndex = 0, seriesCount = reader.getSeriesCount(); seriesCount > seriesIndex; seriesIndex++) {
|
25931 | var color = colorHelper.getColorForSeriesValue(reader.getSeriesObjects(seriesIndex), seriesColumnIdentifier, reader.getSeriesName(seriesIndex)), identity = new visuals.SelectionIdBuilder().withSeries(reader.getSeriesValueColumns(), reader.getSeriesValueColumnGroup(seriesIndex)).createSelectionId();
|
25932 | legendDataPoints.push({
|
25933 | color: color,
|
25934 | label: visuals.valueFormatter.format(reader.getSeriesName(seriesIndex)),
|
25935 | icon: visuals.LegendIcon.Circle,
|
25936 | identity: identity,
|
25937 | selected: !1
|
25938 | });
|
25939 | }
|
25940 | }
|
25941 | var legendData = {
|
25942 | dataPoints: legendDataPoints,
|
25943 | title: legendTitle
|
25944 | };
|
25945 | return legendData;
|
25946 | }, Map.prototype.swapLogoContainerChildElement = function() {
|
25947 | var logoContainer = this.element.find(".LogoContainer");
|
25948 | if (logoContainer) {
|
25949 | var aNode = logoContainer.find("a");
|
25950 | if (null == aNode) return;
|
25951 | var divNode = $("<div>");
|
25952 | aNode.children().clone().appendTo(divNode), aNode.remove(), divNode.appendTo(logoContainer);
|
25953 | }
|
25954 | }, Map.prototype.onResizing = function(viewport) {
|
25955 | this.currentViewport.width === viewport.width && this.currentViewport.height === viewport.height || (this.currentViewport = viewport,
|
25956 | this.renderLegend(this.legendData), this.updateInternal(!1, !1));
|
25957 | }, Map.prototype.initialize = function(container) {
|
25958 | var _this = this, mapOptions = {
|
25959 | credentials: visuals.MapUtil.Settings.BingKey,
|
25960 | showMapTypeSelector: !1,
|
25961 | enableClickableLogo: !1,
|
25962 | enableSearchLogo: !1,
|
25963 | mapTypeId: Microsoft.Maps.MapTypeId.road,
|
25964 | customizeOverlays: !0,
|
25965 | showDashboard: !1,
|
25966 | showScalebar: !1,
|
25967 | disableKeyboardInput: !0,
|
25968 | disableZooming: this.disableZooming,
|
25969 | disablePanning: this.disablePanning
|
25970 | }, divQuery = this.root = InJs.DomFactory.div().addClass(Map.MapContainer.cssClass).appendTo(container);
|
25971 | this.mapControl = this.mapControlFactory.createMapControl(divQuery[0], mapOptions),
|
25972 | void 0 !== this.viewChangeThrottleInterval ? Microsoft.Maps.Events.addThrottledHandler(this.mapControl, "viewchange", function() {
|
25973 | _this.onViewChanged();
|
25974 | }, this.viewChangeThrottleInterval) : Microsoft.Maps.Events.addHandler(this.mapControl, "viewchange", function() {
|
25975 | _this.onViewChanged();
|
25976 | }), Microsoft.Maps.Events.addHandler(this.mapControl, "viewchangeend", function() {
|
25977 | _this.onViewChangeEnded();
|
25978 | }), this.dataPointRenderer.init(this.mapControl, divQuery, !!this.behavior), this.pendingGeocodingRender || this.updateInternal(!0, !0);
|
25979 | }, Map.prototype.onViewChanged = function() {
|
25980 | this.updateOffsets(!1, !1), this.behavior && this.behavior.viewChanged(), this.swapLogoContainerChildElement();
|
25981 | }, Map.prototype.onViewChangeEnded = function() {
|
25982 | this.dataPointRenderer.updateInternalDataLabels(this.currentViewport, !0);
|
25983 | }, Map.prototype.getMapViewPort = function() {
|
25984 | var currentViewport = this.currentViewport, legendMargins = this.legend.getMargins(), mapViewport = {
|
25985 | width: currentViewport.width - legendMargins.width,
|
25986 | height: currentViewport.height - legendMargins.height
|
25987 | };
|
25988 | return mapViewport;
|
25989 | }, Map.removeTransform3d = function(mapRoot) {
|
25990 | var userAgent = window.navigator.userAgent.toLowerCase();
|
25991 | if (mapRoot && -1 === userAgent.indexOf("applewebkit")) {
|
25992 | var imageTiles = mapRoot.find("img");
|
25993 | imageTiles.css("transform", "");
|
25994 | }
|
25995 | }, Map.prototype.updateInternal = function(dataChanged, redrawDataLabels) {
|
25996 | if (this.mapControl) {
|
25997 | var isLegendVisible = this.legend.isVisible();
|
25998 | isLegendVisible || (this.legendData = {
|
25999 | dataPoints: []
|
26000 | });
|
26001 | var mapDiv = this.element.children(Map.MapContainer.selector), mapViewport = this.getMapViewPort();
|
26002 | if (mapDiv.height(mapViewport.height), mapDiv.width(mapViewport.width), this.updateOffsets(dataChanged, redrawDataLabels),
|
26003 | this.boundsHaveBeenUpdated && (!this.behavior || !this.behavior.hasReceivedZoomOrPanEvent())) {
|
26004 | var levelOfDetail = this.getOptimumLevelOfDetail(mapViewport.width, mapViewport.height), center = this.getViewCenter(levelOfDetail);
|
26005 | this.updateMapView(center, levelOfDetail);
|
26006 | }
|
26007 | }
|
26008 | }, Map.prototype.updateMapView = function(center, levelOfDetail) {
|
26009 | this.mapControl.setView({
|
26010 | center: center,
|
26011 | zoom: levelOfDetail,
|
26012 | animate: !0
|
26013 | });
|
26014 | }, Map.prototype.updateOffsets = function(dataChanged, redrawDataLabels) {
|
26015 | var data, dataView = this.dataView, viewport = this.getMapViewPort();
|
26016 | data = dataView && dataView.categorical ? this.dataPointRenderer.converter(viewport, this.dataView, this.dataLabelsSettings, this.interactivityService, this.tooltipsEnabled) : {
|
26017 | bubbleData: [],
|
26018 | shapeData: [],
|
26019 | sliceData: []
|
26020 | };
|
26021 | var behaviorOptions = this.dataPointRenderer.updateInternal(data, viewport, dataChanged, this.interactivityService, redrawDataLabels);
|
26022 | visuals.Legend.positionChartArea(d3.select(this.root[0]), this.legend), this.interactivityService && behaviorOptions && this.interactivityService.bind(behaviorOptions.dataPoints, this.behavior, behaviorOptions);
|
26023 | }, Map.prototype.onClearSelection = function() {
|
26024 | this.interactivityService.clearSelection(), this.updateOffsets(!1, !1);
|
26025 | }, Map.prototype.clearDataPoints = function() {
|
26026 | this.dataPointRenderer.clearDataPoints(), this.legend.drawLegend({
|
26027 | dataPoints: []
|
26028 | }, this.currentViewport);
|
26029 | }, Map.prototype.getDefaultMapControlFactory = function() {
|
26030 | return {
|
26031 | createMapControl: function(element, options) {
|
26032 | return new Microsoft.Maps.Map(element, options);
|
26033 | },
|
26034 | ensureMap: jsCommon.ensureMap
|
26035 | };
|
26036 | }, Map.removeHillShading = function() {
|
26037 | Microsoft.Maps.Globals.roadUriFormat = Microsoft.Maps.Globals.roadUriFormat.replace("&shading=hill", "");
|
26038 | }, Map.MapContainer = {
|
26039 | cssClass: "mapControl",
|
26040 | selector: ".mapControl"
|
26041 | }, Map.StrokeDarkenColorValue = 63.75, Map;
|
26042 | }();
|
26043 | visuals.Map = Map;
|
26044 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
26045 | }(powerbi || (powerbi = {}));
|
26046 |
|
26047 | var powerbi;
|
26048 |
|
26049 | !function(powerbi) {
|
26050 | var visuals;
|
26051 | !function(visuals) {
|
26052 | function appendImage(selection) {
|
26053 | selection.append("div").classed("imgCon", !0).append("img");
|
26054 | }
|
26055 | function setImageStyle(selection, imageStyle) {
|
26056 | selection.selectAll(".imgCon").style({
|
26057 | height: getPixelString(imageStyle.maxHeight)
|
26058 | }).selectAll("img").style({
|
26059 | "max-height": getPixelString(imageStyle.maxHeight),
|
26060 | "max-width": getPixelString(imageStyle.maxWidth)
|
26061 | });
|
26062 | }
|
26063 | function getPixelString(value) {
|
26064 | return value + "px";
|
26065 | }
|
26066 | var getKpiImageMetadata = powerbi.visuals.KpiUtil.getKpiImageMetadata, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, UrlUtils = jsCommon.UrlUtils, EdgeSettings = powerbi.visuals.controls.internal.TablixUtils.EdgeSettings, TitleFontFamily = "wf_segoe-ui_semibold", DefaultFontFamily = "wf_segoe-ui_normal", 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() {
|
26067 | function MultiRowCard() {
|
26068 | this.isInteractivityOverflowHidden = !1;
|
26069 | }
|
26070 | return MultiRowCard.prototype.init = function(options) {
|
26071 | this.options = options, this.style = options.style;
|
26072 | var viewport = this.currentViewport = options.viewport, interactivity = this.interactivity = options.interactivity;
|
26073 | interactivity && "hidden" === interactivity.overflow && (this.isInteractivityOverflowHidden = !0);
|
26074 | var multiRowCardDiv = this.element = $("<div/>").addClass(MultiRowCard.MultiRowCardRoot["class"]).css({
|
26075 | height: getPixelString(viewport.height)
|
26076 | });
|
26077 | options.element.append(multiRowCardDiv), this.initializeCardRowSelection();
|
26078 | }, MultiRowCard.prototype.onDataChanged = function(options) {
|
26079 | var dataViews = options.dataViews;
|
26080 | if (dataViews && dataViews.length > 0) {
|
26081 | var dataView = this.dataView = dataViews[0], columnMetadata = dataView.table.columns, tableRows = dataView.table.rows, resetScrollbarPosition = options.operationKind !== powerbi.VisualDataChangeOperationKind.Append, data_2 = this.data = MultiRowCard.converter(dataView, columnMetadata.length, tableRows.length, this.isInteractivityOverflowHidden);
|
26082 | this.setCardDimensions(), this.listView.data(data_2.dataModel, function(d) {
|
26083 | return data_2.dataModel.indexOf(d);
|
26084 | }, resetScrollbarPosition);
|
26085 | } else this.data = {
|
26086 | dataModel: [],
|
26087 | dataColumnCount: 0,
|
26088 | cardTitleSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTitleColor, DefaultTitleFontSizeInPt),
|
26089 | categoryLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultCategoryColor, DefaultDetailFontSizeInPt),
|
26090 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTextColor, DefaultCaptionFontSizeInPt),
|
26091 | cardSettings: MultiRowCard.getCardSettings(null)
|
26092 | };
|
26093 | this.waitingForData = !1;
|
26094 | }, MultiRowCard.getCardSettings = function(dataView) {
|
26095 | var objects = dataView && dataView.metadata && dataView.metadata.objects ? dataView.metadata.objects : null, outlineSettings = {
|
26096 | outline: powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.outline, DefaultOutline),
|
26097 | color: powerbi.DataViewObjects.getFillColor(objects, visuals.multiRowCardProps.card.outlineColor, DefaultOutlineColor),
|
26098 | weight: powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.outlineWeight, DefaultOutlineWeight)
|
26099 | }, barShow = powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.barShow, DefaultBarShow), barSettings = {
|
26100 | outline: barShow ? DefaultBarOutline : visuals.outline.none,
|
26101 | color: powerbi.DataViewObjects.getFillColor(objects, visuals.multiRowCardProps.card.barColor, DefaultBarColor),
|
26102 | weight: powerbi.DataViewObjects.getValue(objects, visuals.multiRowCardProps.card.barWeight, DefaultBarWeight)
|
26103 | }, 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);
|
26104 | return {
|
26105 | outlineSettings: outlineSettings,
|
26106 | barSettings: barSettings,
|
26107 | cardPadding: cardPadding,
|
26108 | cardBackground: cardBackground
|
26109 | };
|
26110 | }, MultiRowCard.prototype.onResizing = function(viewport) {
|
26111 | var heightNotChanged = this.currentViewport.height === viewport.height;
|
26112 | if (this.currentViewport = viewport, this.element.css("height", getPixelString(viewport.height)),
|
26113 | this.dataView) {
|
26114 | var previousMaxColPerRow = this.maxColPerRow;
|
26115 | this.maxColPerRow = this.getMaxColPerRow();
|
26116 | var widthNotChanged = previousMaxColPerRow === this.maxColPerRow;
|
26117 | heightNotChanged && widthNotChanged || this.listView.viewport(viewport);
|
26118 | }
|
26119 | }, MultiRowCard.converter = function(dataView, columnCount, maxCards, isDashboardVisual) {
|
26120 | void 0 === isDashboardVisual && (isDashboardVisual = !1);
|
26121 | var cardTitleSettings, dataLabelsSettings, categoryLabelsSettings, details = [], tableDataRows = dataView.table.rows, columnMetadata = dataView.table.columns;
|
26122 | if (cardTitleSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTitleColor, DefaultTitleFontSizeInPt),
|
26123 | dataLabelsSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultTextColor, DefaultCaptionFontSizeInPt),
|
26124 | categoryLabelsSettings = visuals.dataLabelUtils.getDefaultLabelSettings(!0, DefaultCategoryColor, DefaultDetailFontSizeInPt),
|
26125 | dataView.metadata && dataView.metadata.objects) {
|
26126 | var cardTitleLabelObjects = powerbi.DataViewObjects.getObject(dataView.metadata.objects, "cardTitle");
|
26127 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(cardTitleLabelObjects, cardTitleSettings);
|
26128 | var dataLabelObject = powerbi.DataViewObjects.getObject(dataView.metadata.objects, "dataLabels");
|
26129 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(dataLabelObject, dataLabelsSettings);
|
26130 | var categoryLabelObject = powerbi.DataViewObjects.getObject(dataView.metadata.objects, "categoryLabels");
|
26131 | visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(categoryLabelObject, categoryLabelsSettings);
|
26132 | }
|
26133 | for (var i = 0, len = maxCards; len > i; i++) {
|
26134 | for (var row = tableDataRows[i], isValuePromoted = void 0, title = void 0, showTitleAsURL = !1, showTitleAsImage = !1, showTitleAsKPI = !1, cardData = [], j = 0; columnCount > j; j++) {
|
26135 | var column = columnMetadata[j], statusGraphicInfo = getKpiImageMetadata(column, row[j]), columnCaption = void 0, statusGraphic = void 0;
|
26136 | statusGraphicInfo && (columnCaption = statusGraphicInfo["class"], statusGraphic = statusGraphicInfo.statusGraphic),
|
26137 | columnCaption || (columnCaption = visuals.valueFormatter.format(row[j], visuals.valueFormatter.getFormatString(column, MultiRowCard.formatStringProp)));
|
26138 | var showKPI = void 0 !== statusGraphicInfo && void 0 !== statusGraphicInfo.caption, columnDetail = columnMetadata[j].displayName;
|
26139 | isDashboardVisual || column.type.numeric || (void 0 === isValuePromoted ? (isValuePromoted = !0,
|
26140 | title = columnCaption, showTitleAsURL = visuals.converterHelper.isWebUrlColumn(column) && UrlUtils.isValidUrl(title),
|
26141 | showTitleAsImage = visuals.converterHelper.isImageUrlColumn(column) && UrlUtils.isValidImageUrl(columnCaption),
|
26142 | showTitleAsKPI = showKPI) : isValuePromoted && (isValuePromoted = !1)), cardData.push({
|
26143 | caption: columnCaption,
|
26144 | details: columnDetail,
|
26145 | showURL: visuals.converterHelper.isWebUrlColumn(column) && UrlUtils.isValidUrl(columnCaption),
|
26146 | showImage: visuals.converterHelper.isImageUrlColumn(column) && UrlUtils.isValidImageUrl(columnCaption),
|
26147 | showKPI: showKPI,
|
26148 | columnIndex: j
|
26149 | });
|
26150 | }
|
26151 | details.push({
|
26152 | title: isValuePromoted ? title : void 0,
|
26153 | showTitleAsURL: showTitleAsURL,
|
26154 | showTitleAsImage: showTitleAsImage,
|
26155 | showTitleAsKPI: showTitleAsKPI,
|
26156 | cardItemsData: isValuePromoted ? cardData.filter(function(d) {
|
26157 | return d.caption !== title;
|
26158 | }) : cardData
|
26159 | });
|
26160 | }
|
26161 | return {
|
26162 | dataModel: details,
|
26163 | dataColumnCount: details[0] ? details[0].cardItemsData.length : 0,
|
26164 | cardTitleSettings: cardTitleSettings,
|
26165 | categoryLabelsSettings: categoryLabelsSettings,
|
26166 | dataLabelsSettings: dataLabelsSettings,
|
26167 | cardSettings: MultiRowCard.getCardSettings(dataView)
|
26168 | };
|
26169 | }, MultiRowCard.getSortableRoles = function(options) {
|
26170 | if (options && options.dataViewMappings && !_.isEmpty(options.dataViewMappings)) for (var _i = 0, _a = options.dataViewMappings; _i < _a.length; _i++) {
|
26171 | var dataViewMapping = _a[_i];
|
26172 | if (dataViewMapping.table) {
|
26173 | var rows = dataViewMapping.table.rows;
|
26174 | if (rows && rows["for"] && rows["for"]["in"] && rows["for"]["in"].items) return [ MultiRowCard.ValuesRole ];
|
26175 | }
|
26176 | }
|
26177 | }, MultiRowCard.prototype.initializeCardRowSelection = function() {
|
26178 | var _this = this, isDashboardVisual = this.isInteractivityOverflowHidden, rowEnter = function(rowSelection) {
|
26179 | var cardRow = rowSelection.append("div").classed(MultiRowCard.Card["class"], !0);
|
26180 | isDashboardVisual ? cardRow.classed("mrtile", !0) : _this.cardHasTitle && cardRow.append("div").classed(MultiRowCard.Title["class"], !0).each(function(d) {
|
26181 | 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({
|
26182 | display: "inline-block",
|
26183 | verticalAlign: "sub"
|
26184 | });
|
26185 | });
|
26186 | var cardItem = cardRow.selectAll(MultiRowCard.CardItemContainer.selector).data(function(d) {
|
26187 | return d.cardItemsData;
|
26188 | }).enter().append("div").classed(MultiRowCard.CardItemContainer["class"], !0);
|
26189 | cardItem.append("div").classed(MultiRowCard.Caption["class"], !0).each(function(d) {
|
26190 | 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({
|
26191 | display: "inline-block",
|
26192 | verticalAlign: "sub"
|
26193 | });
|
26194 | }), cardItem.append("div").classed(MultiRowCard.Details["class"], !0);
|
26195 | }, rowUpdate = function(rowSelection) {
|
26196 | 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);
|
26197 | rowSelection.style(rowBorderStyle).style({
|
26198 | "margin-bottom": isDashboardVisual ? "0px" : _this.isSingleRowCard ? "0px" : getPixelString(style.row.marginBottom),
|
26199 | background: style.row.background
|
26200 | }), !isDashboardVisual && _this.cardHasTitle && (rowSelection.selectAll(MultiRowCard.Title.selector).filter(function(d) {
|
26201 | return !d.showTitleAsImage && !d.showTitleAsKPI;
|
26202 | }).style({
|
26203 | "font-size": PixelConverter.fromPoint(style.title.fontSize),
|
26204 | "line-height": PixelConverter.toString(titleLabelHeight),
|
26205 | color: style.title.color
|
26206 | }), rowSelection.selectAll(MultiRowCard.Title.selector).filter(function(d) {
|
26207 | return !d.showTitleAsURL && !d.showTitleAsImage && !d.showTitleAsKPI;
|
26208 | }).text(function(d) {
|
26209 | return d.title;
|
26210 | }).attr("title", function(d) {
|
26211 | return d.title;
|
26212 | }), rowSelection.selectAll(MultiRowCard.TitleUrlSelector).text(function(d) {
|
26213 | return d.title;
|
26214 | }).attr({
|
26215 | href: function(d) {
|
26216 | return d.title;
|
26217 | },
|
26218 | target: "_blank"
|
26219 | }), rowSelection.selectAll(MultiRowCard.TitleImageSelector).attr("src", function(d) {
|
26220 | return d.title;
|
26221 | }), setImageStyle(rowSelection.selectAll(MultiRowCard.Title.selector), style.imageTitle),
|
26222 | rowSelection.selectAll(MultiRowCard.KPITitle.selector).each(function(d) {
|
26223 | var element = d3.select(this);
|
26224 | element.classed(d.title);
|
26225 | }));
|
26226 | var cardSelection = rowSelection.selectAll(MultiRowCard.Card.selector), cardBorderStyle = _this.getBorderStyles(style.card.border);
|
26227 | cardSelection.style(cardBorderStyle), cardSelection.selectAll(MultiRowCard.Caption.selector).filter(function(d) {
|
26228 | return !d.showImage;
|
26229 | }).style({
|
26230 | "line-height": PixelConverter.toString(dataLabelHeight),
|
26231 | "font-size": PixelConverter.fromPoint(style.caption.fontSize)
|
26232 | }).filter(function(d) {
|
26233 | return !d.showKPI;
|
26234 | }).style({
|
26235 | color: style.caption.color
|
26236 | }).filter(function(d) {
|
26237 | return !d.showURL;
|
26238 | }).text(function(d) {
|
26239 | return d.caption;
|
26240 | }).attr("title", function(d) {
|
26241 | return d.caption;
|
26242 | }), cardSelection.selectAll(MultiRowCard.CaptionImageSelector).attr("src", function(d) {
|
26243 | return d.caption;
|
26244 | }).style(style.imageCaption), cardSelection.selectAll(MultiRowCard.CardItemContainer.selector).style({
|
26245 | "padding-right": function(d) {
|
26246 | return _this.isLastRowItem(d.columnIndex, _this.dataView.metadata.columns.length) ? "0px" : getPixelString(style.cardItemContainer.paddingRight);
|
26247 | },
|
26248 | width: function(d) {
|
26249 | return _this.getColumnWidth(d.columnIndex, _this.data.dataColumnCount);
|
26250 | },
|
26251 | display: function(d) {
|
26252 | return _this.hideColumn(d.columnIndex) ? "none" : "inline-block";
|
26253 | }
|
26254 | }), setImageStyle(cardSelection.selectAll(MultiRowCard.Caption.selector), style.imageCaption),
|
26255 | cardSelection.selectAll(MultiRowCard.CaptionUrlSelector).attr({
|
26256 | href: function(d) {
|
26257 | return d.caption;
|
26258 | },
|
26259 | target: "_blank"
|
26260 | }).text(function(d) {
|
26261 | return d.caption;
|
26262 | }), style.details.isVisible && cardSelection.selectAll(MultiRowCard.Details.selector).text(function(d) {
|
26263 | return d.details;
|
26264 | }).style({
|
26265 | "font-size": PixelConverter.fromPoint(style.details.fontSize),
|
26266 | "line-height": PixelConverter.toString(categoryLabelHeight),
|
26267 | color: style.details.color
|
26268 | }).attr("title", function(d) {
|
26269 | return d.details;
|
26270 | });
|
26271 | }, rowExit = function(rowSelection) {
|
26272 | rowSelection.remove();
|
26273 | }, listViewOptions = {
|
26274 | rowHeight: void 0,
|
26275 | enter: rowEnter,
|
26276 | exit: rowExit,
|
26277 | update: rowUpdate,
|
26278 | loadMoreData: function() {
|
26279 | return _this.onLoadMoreData();
|
26280 | },
|
26281 | viewport: this.currentViewport,
|
26282 | baseContainer: d3.select(this.element.get(0)),
|
26283 | scrollEnabled: !this.isInteractivityOverflowHidden,
|
26284 | isReadMode: function() {
|
26285 | return 1 !== _this.options.host.getViewMode();
|
26286 | }
|
26287 | };
|
26288 | this.listView = visuals.ListViewFactory.createListView(listViewOptions);
|
26289 | }, MultiRowCard.prototype.getBorderStyles = function(border) {
|
26290 | return {
|
26291 | "border-top": border && border.top ? border.top.getCSS() : "",
|
26292 | "border-right": border && border.right ? border.right.getCSS() : "",
|
26293 | "border-bottom": border && border.bottom ? border.bottom.getCSS() : "",
|
26294 | "border-left": border && border.left ? border.left.getCSS() : ""
|
26295 | };
|
26296 | }, MultiRowCard.prototype.getMaxColPerRow = function() {
|
26297 | var rowWidth = this.currentViewport.width, minColumnWidth = this.getStyle().cardItemContainer.minWidth, columnCount = this.data.dataColumnCount, maxColumnPerRow = Math.floor(rowWidth / minColumnWidth) || 1;
|
26298 | return Math.min(columnCount, maxColumnPerRow);
|
26299 | }, MultiRowCard.prototype.getRowIndex = function(fieldIndex) {
|
26300 | return Math.floor(1 * fieldIndex / this.getMaxColPerRow());
|
26301 | }, MultiRowCard.prototype.getStyle = function() {
|
26302 | var defaultStyles = MultiRowCard.DefaultStyle, customStyles = this.getCustomStyles();
|
26303 | if (!this.isInteractivityOverflowHidden) return $.extend(!0, {}, defaultStyles, customStyles);
|
26304 | for (var viewportWidth = this.currentViewport.width, overrideStyle = {}, _i = 0, _a = MultiRowCard.tileMediaQueries; _i < _a.length; _i++) {
|
26305 | var currentQuery = _a[_i];
|
26306 | if (viewportWidth <= currentQuery.maxWidth) {
|
26307 | overrideStyle = currentQuery.style;
|
26308 | break;
|
26309 | }
|
26310 | }
|
26311 | return $.extend(!0, {}, defaultStyles, customStyles, overrideStyle);
|
26312 | }, MultiRowCard.prototype.getSurroundSettings = function(outlineSettings) {
|
26313 | var edge = new EdgeSettings(outlineSettings.weight, outlineSettings.color), outlineProp = outlineSettings.outline;
|
26314 | return {
|
26315 | top: visuals.outline.showTop(outlineProp) ? edge : null,
|
26316 | right: visuals.outline.showRight(outlineProp) ? edge : null,
|
26317 | bottom: visuals.outline.showBottom(outlineProp) ? edge : null,
|
26318 | left: visuals.outline.showLeft(outlineProp) ? edge : null
|
26319 | };
|
26320 | }, MultiRowCard.prototype.getCustomStyles = function() {
|
26321 | var dataLabelsSettings = this.data.dataLabelsSettings, categoryLabelSettings = this.data.categoryLabelsSettings, titleLabelSettings = this.data.cardTitleSettings, cardSettings = this.data.cardSettings, customStyle = {
|
26322 | row: {
|
26323 | border: this.getSurroundSettings(cardSettings.outlineSettings),
|
26324 | marginBottom: cardSettings.cardPadding,
|
26325 | background: cardSettings.cardBackground
|
26326 | },
|
26327 | card: {
|
26328 | border: this.getSurroundSettings(cardSettings.barSettings)
|
26329 | },
|
26330 | details: {
|
26331 | fontSize: categoryLabelSettings.fontSize,
|
26332 | color: categoryLabelSettings.labelColor,
|
26333 | isVisible: categoryLabelSettings.show
|
26334 | },
|
26335 | caption: {
|
26336 | fontSize: dataLabelsSettings.fontSize,
|
26337 | color: dataLabelsSettings.labelColor
|
26338 | },
|
26339 | title: {
|
26340 | fontSize: titleLabelSettings.fontSize,
|
26341 | color: titleLabelSettings.labelColor
|
26342 | }
|
26343 | };
|
26344 | return customStyle;
|
26345 | }, MultiRowCard.getTextProperties = function(isTitle, fontSizeInPt) {
|
26346 | return {
|
26347 | fontFamily: isTitle ? TitleFontFamily : DefaultFontFamily,
|
26348 | fontSize: PixelConverter.fromPoint(fontSizeInPt)
|
26349 | };
|
26350 | }, MultiRowCard.prototype.hideColumn = function(fieldIndex) {
|
26351 | var rowIndex = this.getRowIndex(fieldIndex), maxRows = this.getStyle().card.maxRows;
|
26352 | return maxRows && rowIndex >= maxRows;
|
26353 | }, MultiRowCard.prototype.getColumnWidth = function(fieldIndex, columnCount) {
|
26354 | var maxColumnPerRow = this.getMaxColPerRow();
|
26355 | if (maxColumnPerRow >= columnCount) return 100 / columnCount + "%";
|
26356 | var rowIndex = this.getRowIndex(fieldIndex), totalRows = Math.ceil(1 * columnCount / maxColumnPerRow), lastRowCount = columnCount % maxColumnPerRow;
|
26357 | return totalRows > rowIndex || 0 === lastRowCount ? 100 / maxColumnPerRow + "%" : 100 / lastRowCount + "%";
|
26358 | }, MultiRowCard.prototype.isLastRowItem = function(fieldIndex, columnCount) {
|
26359 | if (fieldIndex + 1 === columnCount) return !0;
|
26360 | var maxColumnPerRow = this.getMaxColPerRow();
|
26361 | return maxColumnPerRow - fieldIndex % maxColumnPerRow === 1;
|
26362 | }, MultiRowCard.prototype.setCardDimensions = function() {
|
26363 | this.cardHasTitle = !1;
|
26364 | var dataModel = this.data.dataModel;
|
26365 | !this.isInteractivityOverflowHidden && dataModel && dataModel.length > 0 && (this.cardHasTitle = void 0 !== dataModel[0].title,
|
26366 | this.isSingleRowCard = 1 === dataModel.length);
|
26367 | }, MultiRowCard.prototype.onLoadMoreData = function() {
|
26368 | !this.waitingForData && this.dataView.metadata && this.dataView.metadata.segment && (this.options.host.loadMoreData(),
|
26369 | this.waitingForData = !0);
|
26370 | }, MultiRowCard.getDataLabelSettingsOptions = function(enumeration, labelSettings, show) {
|
26371 | return void 0 === show && (show = !1), {
|
26372 | enumeration: enumeration,
|
26373 | dataLabelsSettings: labelSettings,
|
26374 | show: show,
|
26375 | fontSize: !0
|
26376 | };
|
26377 | }, MultiRowCard.prototype.enumerateObjectInstances = function(options) {
|
26378 | var enumeration = new visuals.ObjectEnumerationBuilder(), cardTitleSettings = this.data.cardTitleSettings, dataLabelsSettings = this.data.dataLabelsSettings, categoryLabelsSettings = this.data.categoryLabelsSettings;
|
26379 | switch (options.objectName) {
|
26380 | case "cardTitle":
|
26381 | !this.isInteractivityOverflowHidden && this.cardHasTitle && visuals.dataLabelUtils.enumerateDataLabels(MultiRowCard.getDataLabelSettingsOptions(enumeration, cardTitleSettings));
|
26382 | break;
|
26383 |
|
26384 | case "dataLabels":
|
26385 | visuals.dataLabelUtils.enumerateDataLabels(MultiRowCard.getDataLabelSettingsOptions(enumeration, dataLabelsSettings));
|
26386 | break;
|
26387 |
|
26388 | case "categoryLabels":
|
26389 | visuals.dataLabelUtils.enumerateDataLabels(MultiRowCard.getDataLabelSettingsOptions(enumeration, categoryLabelsSettings, !0));
|
26390 | break;
|
26391 |
|
26392 | case visuals.multiRowCardProps.card.outline.objectName:
|
26393 | this.enumerateCard(enumeration);
|
26394 | }
|
26395 | return enumeration.complete();
|
26396 | }, MultiRowCard.prototype.enumerateCard = function(enumeration) {
|
26397 | var cardSettings = this.data.cardSettings, propNames = visuals.multiRowCardProps.card, properties = {}, outlineSettings = cardSettings.outlineSettings;
|
26398 | properties[propNames.outline.propertyName] = outlineSettings.outline, outlineSettings.outline !== visuals.outline.none && (properties[propNames.outlineColor.propertyName] = outlineSettings.color,
|
26399 | properties[propNames.outlineWeight.propertyName] = outlineSettings.weight);
|
26400 | var barSettings = cardSettings.barSettings, barShow = barSettings.outline !== visuals.outline.none;
|
26401 | properties[propNames.barShow.propertyName] = barShow, barShow && (properties[propNames.barColor.propertyName] = barSettings.color,
|
26402 | properties[propNames.barWeight.propertyName] = barSettings.weight), properties[propNames.cardPadding.propertyName] = cardSettings.cardPadding,
|
26403 | properties[propNames.cardBackground.propertyName] = cardSettings.cardBackground,
|
26404 | enumeration.pushInstance({
|
26405 | selector: null,
|
26406 | objectName: propNames.outline.objectName,
|
26407 | properties: properties
|
26408 | });
|
26409 | }, MultiRowCard.formatStringProp = {
|
26410 | objectName: "general",
|
26411 | propertyName: "formatString"
|
26412 | }, MultiRowCard.MultiRowCardRoot = createClassAndSelector("multiRowCard"), MultiRowCard.Card = createClassAndSelector("card"),
|
26413 | MultiRowCard.Title = createClassAndSelector("title"), MultiRowCard.CardItemContainer = createClassAndSelector("cardItemContainer"),
|
26414 | MultiRowCard.Caption = createClassAndSelector("caption"), MultiRowCard.Details = createClassAndSelector("details"),
|
26415 | MultiRowCard.TitleUrlSelector = MultiRowCard.Title.selector + " a", MultiRowCard.CaptionUrlSelector = MultiRowCard.Caption.selector + " a",
|
26416 | MultiRowCard.TitleImageSelector = MultiRowCard.Title.selector + " img", MultiRowCard.CaptionImageSelector = MultiRowCard.Caption.selector + " img",
|
26417 | MultiRowCard.KPITitle = createClassAndSelector("kpiTitle"), MultiRowCard.ValuesRole = "Values",
|
26418 | MultiRowCard.DefaultStyle = {
|
26419 | row: {
|
26420 | border: null,
|
26421 | marginBottom: 20,
|
26422 | background: void 0
|
26423 | },
|
26424 | card: {
|
26425 | border: null
|
26426 | },
|
26427 | cardItemContainer: {
|
26428 | paddingRight: 20,
|
26429 | minWidth: 120
|
26430 | },
|
26431 | imageCaption: {
|
26432 | maxHeight: 75,
|
26433 | maxWidth: 100
|
26434 | },
|
26435 | imageTitle: {
|
26436 | maxHeight: 75,
|
26437 | maxWidth: 100
|
26438 | }
|
26439 | }, MultiRowCard.tileMediaQueries = [ {
|
26440 | maxWidth: 250,
|
26441 | style: {
|
26442 | card: {
|
26443 | maxRows: 2
|
26444 | },
|
26445 | cardItemContainer: {
|
26446 | minWidth: 110
|
26447 | },
|
26448 | imageCaption: {
|
26449 | maxHeight: 45
|
26450 | }
|
26451 | }
|
26452 | }, {
|
26453 | maxWidth: 490,
|
26454 | style: {
|
26455 | card: {
|
26456 | maxRows: 2
|
26457 | },
|
26458 | cardItemContainer: {
|
26459 | minWidth: 130
|
26460 | },
|
26461 | imageCaption: {
|
26462 | maxHeight: 52
|
26463 | }
|
26464 | }
|
26465 | }, {
|
26466 | maxWidth: 750,
|
26467 | style: {
|
26468 | card: {
|
26469 | maxRows: 1
|
26470 | },
|
26471 | cardItemContainer: {
|
26472 | minWidth: 120
|
26473 | },
|
26474 | imageCaption: {
|
26475 | maxHeight: 53
|
26476 | }
|
26477 | }
|
26478 | } ], MultiRowCard;
|
26479 | }();
|
26480 | visuals.MultiRowCard = MultiRowCard;
|
26481 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
26482 | }(powerbi || (powerbi = {}));
|
26483 |
|
26484 | var powerbi;
|
26485 |
|
26486 | !function(powerbi) {
|
26487 | var visuals;
|
26488 | !function(visuals) {
|
26489 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, KeyUtils = jsCommon.KeyUtils, StringExtensions = jsCommon.StringExtensions, UrlUtils = jsCommon.UrlUtils, Textbox = function() {
|
26490 | function Textbox() {}
|
26491 | return Textbox.prototype.init = function(options) {
|
26492 | this.element = options.element, this.host = options.host, this.viewport = options.viewport,
|
26493 | this.readOnly = 0 === this.host.getViewMode(), this.paragraphs = [], this.refreshView();
|
26494 | }, Textbox.prototype.onResizing = function(viewport) {
|
26495 | this.viewport = viewport, this.updateSize();
|
26496 | }, Textbox.prototype.onDataChanged = function(options) {
|
26497 | var dataViews = options.dataViews;
|
26498 | if (this.paragraphs = [], dataViews && dataViews.length > 0) {
|
26499 | var objects = dataViews[0].metadata.objects;
|
26500 | objects && objects.general && (this.paragraphs = objects.general.paragraphs);
|
26501 | }
|
26502 | this.refreshView();
|
26503 | }, Textbox.prototype.destroy = function() {}, Textbox.prototype.focus = function() {
|
26504 | return this.editor ? (this.editor.focus(), !0) : void 0;
|
26505 | }, Textbox.prototype.onViewModeChanged = function(viewMode) {
|
26506 | this.readOnly = 0 === viewMode, this.refreshView();
|
26507 | }, Textbox.prototype.setSelection = function(start, end) {
|
26508 | this.editor && this.editor.setSelection(start, end);
|
26509 | }, Textbox.prototype.refreshView = function() {
|
26510 | var _this = this;
|
26511 | if (this.readOnly) {
|
26512 | this.editor && (this.saveContents(), this.editor.destroy(), this.editor = null),
|
26513 | this.element.empty();
|
26514 | var htmlContent = RichTextConversion.convertParagraphsToHtml(this.paragraphs);
|
26515 | htmlContent.addClass(Textbox.ClassName), htmlContent.css({
|
26516 | "font-family": RichText.defaultFont,
|
26517 | "font-size": RichText.defaultFontSize
|
26518 | }), this.element.append(htmlContent);
|
26519 | } else {
|
26520 | if (!this.editor) {
|
26521 | this.editor = new RichText.QuillWrapper(this.readOnly, this.host), this.editor.textChanged = function(delta, source) {
|
26522 | return _this.saveContents();
|
26523 | }, this.element.empty();
|
26524 | var editorElement = this.editor.getElement();
|
26525 | editorElement.addClass(Textbox.ClassName), editorElement.css({
|
26526 | "font-family": RichText.defaultFont,
|
26527 | "font-size": RichText.defaultFontSize
|
26528 | }), this.element.append(editorElement);
|
26529 | }
|
26530 | this.editor.setContents(RichTextConversion.convertParagraphsToOps(this.paragraphs));
|
26531 | }
|
26532 | this.updateSize();
|
26533 | }, Textbox.prototype.saveContents = function() {
|
26534 | if (this.editor) {
|
26535 | var contents = this.editor.getContents();
|
26536 | this.paragraphs = RichTextConversion.convertDeltaToParagraphs(contents);
|
26537 | var changes = [ {
|
26538 | objectName: "general",
|
26539 | properties: {
|
26540 | paragraphs: this.paragraphs
|
26541 | },
|
26542 | selector: null
|
26543 | } ];
|
26544 | this.host.persistProperties(changes);
|
26545 | }
|
26546 | }, Textbox.prototype.updateSize = function() {
|
26547 | this.editor && this.editor.resize(this.viewport);
|
26548 | }, Textbox.ClassName = "textbox", Textbox;
|
26549 | }();
|
26550 | visuals.Textbox = Textbox;
|
26551 | var RichTextConversion;
|
26552 | !function(RichTextConversion) {
|
26553 | function convertDeltaToParagraphs(contents) {
|
26554 | for (var paragraphs = [], paragraph = {
|
26555 | textRuns: []
|
26556 | }, i = 0, len = contents.ops.length; len > i; i++) {
|
26557 | var insertOp = contents.ops[i];
|
26558 | if ("string" == typeof insertOp.insert) {
|
26559 | var text = insertOp.insert, attributes = insertOp.attributes;
|
26560 | attributes && attributes.align && (paragraph.horizontalTextAlignment = attributes.align);
|
26561 | var start = 0, end = 0, newParagraph = void 0;
|
26562 | do {
|
26563 | if (end = text.indexOf("\n", start), 0 > end ? (newParagraph = !1, end = text.length) : newParagraph = !0,
|
26564 | end - start > 0) {
|
26565 | var span = text.substring(start, end), textRun = {
|
26566 | value: span
|
26567 | };
|
26568 | if (attributes) {
|
26569 | void 0 !== attributes.link && UrlUtils.isValidUrl(attributes.link) && (textRun.url = attributes.link);
|
26570 | var textStyle = convertFormatAttributesToTextStyle(attributes);
|
26571 | textStyle && (textRun.textStyle = textStyle);
|
26572 | }
|
26573 | paragraph.textRuns.push(textRun);
|
26574 | }
|
26575 | newParagraph && (0 === paragraph.textRuns.length && paragraph.textRuns.push({
|
26576 | value: ""
|
26577 | }), paragraphs.push(paragraph), paragraph = {
|
26578 | textRuns: []
|
26579 | }), start = end + 1;
|
26580 | } while (start < text.length);
|
26581 | }
|
26582 | }
|
26583 | return paragraph.textRuns.length > 0 && paragraph.textRuns[0].value.length > 0 && paragraphs.push(paragraph),
|
26584 | paragraphs;
|
26585 | }
|
26586 | function convertParagraphsToHtml(paragraphs) {
|
26587 | for (var $paragraphs = $(), paragraphIndex = 0, len = paragraphs.length; len > paragraphIndex; ++paragraphIndex) {
|
26588 | var paragraphDef = paragraphs[paragraphIndex], isParagraphEmpty = !0, $paragraph = $("<div>");
|
26589 | paragraphDef.horizontalTextAlignment && $paragraph.css("text-align", paragraphDef.horizontalTextAlignment);
|
26590 | for (var textRunIndex = 0, jlen = paragraphDef.textRuns.length; jlen > textRunIndex; ++textRunIndex) {
|
26591 | var textRunDef = paragraphDef.textRuns[textRunIndex], $textRun = $("<span>"), styleDef = textRunDef.textStyle;
|
26592 | if (styleDef) {
|
26593 | var css = {};
|
26594 | styleDef.fontFamily && (css["font-family"] = RichText.getCssFontFamily(removeQuotes(styleDef.fontFamily))),
|
26595 | styleDef.fontSize && (css["font-size"] = styleDef.fontSize), styleDef.fontStyle && (css["font-style"] = styleDef.fontStyle),
|
26596 | styleDef.fontWeight && (css["font-weight"] = styleDef.fontWeight), styleDef.textDecoration && (css["text-decoration"] = styleDef.textDecoration),
|
26597 | $textRun.css(css);
|
26598 | }
|
26599 | var text = textRunDef.value;
|
26600 | if (_.isEmpty(text) || (isParagraphEmpty = !1), void 0 !== textRunDef.url) {
|
26601 | var $link = void 0;
|
26602 | $link = UrlUtils.isValidUrl(textRunDef.url) ? $("<a>").attr("href", textRunDef.url).attr("target", "_blank").text(text) : $("<span>").text(text),
|
26603 | $textRun.append($link);
|
26604 | } else $textRun.text(text);
|
26605 | $paragraph.append($textRun);
|
26606 | }
|
26607 | isParagraphEmpty && $paragraph.append($("<br>")), $paragraphs = $paragraphs.add($paragraph);
|
26608 | }
|
26609 | return $paragraphs;
|
26610 | }
|
26611 | function convertParagraphsToOps(paragraphs) {
|
26612 | 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) {
|
26613 | var textRunDef = paragraphDef.textRuns[textRunIndex], formats = {};
|
26614 | paragraphDef.horizontalTextAlignment && (formats.align = paragraphDef.horizontalTextAlignment);
|
26615 | var styleDef = textRunDef.textStyle;
|
26616 | styleDef && (styleDef.fontFamily && (formats.font = RichText.getCssFontFamily(removeQuotes(styleDef.fontFamily))),
|
26617 | styleDef.fontSize && (formats.size = styleDef.fontSize), formats.italic = "italic" === styleDef.fontStyle,
|
26618 | formats.bold = "bold" === styleDef.fontWeight, formats.underline = "underline" === styleDef.textDecoration);
|
26619 | var text = textRunDef.value;
|
26620 | textRunDef.url && UrlUtils.isValidUrl(textRunDef.url) && (formats.link = textRunDef.url);
|
26621 | var op = {
|
26622 | insert: text,
|
26623 | attributes: formats
|
26624 | };
|
26625 | ops.push(op), textRunIndex !== jlen - 1 || StringExtensions.endsWith(text, "\n") || ops.push({
|
26626 | insert: "\n",
|
26627 | attributes: formats
|
26628 | });
|
26629 | }
|
26630 | return ops;
|
26631 | }
|
26632 | function convertFormatAttributesToTextStyle(attributes) {
|
26633 | var style = {};
|
26634 | if (attributes.bold && (style.fontWeight = "bold"), attributes.font) {
|
26635 | var font = removeQuotes(attributes.font);
|
26636 | font = RichText.getFontFamilyForBuiltInFont(font), style.fontFamily = font;
|
26637 | }
|
26638 | return attributes.italic && (style.fontStyle = "italic"), attributes.size && (style.fontSize = attributes.size),
|
26639 | attributes.underline && (style.textDecoration = "underline"), style;
|
26640 | }
|
26641 | function removeQuotes(text) {
|
26642 | return StringExtensions.startsWith(text, "'") ? text.slice(1, text.length - 1) : text;
|
26643 | }
|
26644 | RichTextConversion.convertDeltaToParagraphs = convertDeltaToParagraphs, RichTextConversion.convertParagraphsToHtml = convertParagraphsToHtml,
|
26645 | RichTextConversion.convertParagraphsToOps = convertParagraphsToOps;
|
26646 | }(RichTextConversion || (RichTextConversion = {}));
|
26647 | var RichText;
|
26648 | !function(RichText) {
|
26649 | function getCssFontFamily(font) {
|
26650 | var family = fontMap[font];
|
26651 | return null == family && (family = font), family;
|
26652 | }
|
26653 | function getFontFamilyForBuiltInFont(font) {
|
26654 | var fontFamily = _.findKey(fontMap, function(value) {
|
26655 | return value === font;
|
26656 | });
|
26657 | return fontFamily || font;
|
26658 | }
|
26659 | var fontMap = {
|
26660 | "Segoe (Bold)": "wf_segoe-ui_bold",
|
26661 | "Segoe UI": "wf_segoe-ui_normal",
|
26662 | "Segoe UI Light": "wf_segoe-ui_light",
|
26663 | Heading: "wf_segoe-ui_light",
|
26664 | Body: "wf_segoe-ui_normal"
|
26665 | }, 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) {
|
26666 | return {
|
26667 | label: font,
|
26668 | value: getCssFontFamily(font)
|
26669 | };
|
26670 | });
|
26671 | RichText.defaultFont = getCssFontFamily("Segoe UI Light");
|
26672 | 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) {
|
26673 | return {
|
26674 | label: size,
|
26675 | value: size + "px"
|
26676 | };
|
26677 | });
|
26678 | RichText.defaultFontSize = "14px";
|
26679 | var textAlignments = [ "Left", "Center", "Right" ].map(function(alignment) {
|
26680 | return {
|
26681 | label: alignment,
|
26682 | value: alignment.toLowerCase()
|
26683 | };
|
26684 | });
|
26685 | RichText.getCssFontFamily = getCssFontFamily, RichText.getFontFamilyForBuiltInFont = getFontFamilyForBuiltInFont;
|
26686 | var QuillWrapper = function() {
|
26687 | function QuillWrapper(readOnly, host) {
|
26688 | var _this = this;
|
26689 | this.QuillPackage = {
|
26690 | javaScriptFiles: QuillWrapper.quillJsFiles,
|
26691 | cssFiles: QuillWrapper.quillCssFiles
|
26692 | }, this.textChanged = function(d, s) {}, this.host = host, this.$container = $("<div>"),
|
26693 | this.readOnly = readOnly, this.localizationProvider = {
|
26694 | get: function(stringId) {
|
26695 | return _this.host.getLocalizedString(stringId);
|
26696 | },
|
26697 | getOptional: function(stringId) {
|
26698 | return _this.host.getLocalizedString(stringId);
|
26699 | }
|
26700 | }, this.dependenciesLoaded = $.Deferred(), QuillWrapper.loadQuillResources ? (this.initialized = !1,
|
26701 | this.dependenciesLoaded.done(function() {
|
26702 | _this.rebuildQuillEditor(), _this.initialized = !0;
|
26703 | }), jsCommon.requires(this.QuillPackage, function() {
|
26704 | return _this.dependenciesLoaded.resolve();
|
26705 | })) : (this.rebuildQuillEditor(), this.initialized = !0, this.dependenciesLoaded.resolve());
|
26706 | }
|
26707 | return QuillWrapper.prototype.addModule = function(name, options) {
|
26708 | return this.editor ? this.editor.addModule(name, options) : void 0;
|
26709 | }, QuillWrapper.prototype.getElement = function() {
|
26710 | return this.$container;
|
26711 | }, QuillWrapper.prototype.getContents = function() {
|
26712 | return this.initialized ? this.editor.getContents() : void 0;
|
26713 | }, QuillWrapper.prototype.setContents = function(contents) {
|
26714 | var _this = this;
|
26715 | return this.initialized ? (this.editor.setHTML("", "api"), void (contents && this.editor.setContents(contents, "api"))) : void this.dependenciesLoaded.done(function() {
|
26716 | return _this.setContents(contents);
|
26717 | });
|
26718 | }, QuillWrapper.prototype.resize = function(viewport) {
|
26719 | this.$container.width(viewport.width), this.$container.height(viewport.height);
|
26720 | }, QuillWrapper.prototype.setReadOnly = function(readOnly) {
|
26721 | var readOnlyChanged = readOnly !== this.readOnly;
|
26722 | this.readOnly = readOnly, this.initialized && readOnlyChanged && this.rebuildQuillEditor();
|
26723 | }, QuillWrapper.prototype.setSelection = function(start, end) {
|
26724 | this.editor && this.editor.setSelection(start, end, "api");
|
26725 | }, QuillWrapper.prototype.getSelection = function() {
|
26726 | return this.editor ? this.editor.getSelection() : void 0;
|
26727 | }, QuillWrapper.prototype.focus = function() {
|
26728 | this.editor && 0 === $(document.activeElement).closest(this.$container).length && this.editor.focus();
|
26729 | }, QuillWrapper.prototype.destroy = function() {
|
26730 | this.host.setToolbar(null), this.$container.remove(), this.$container = null, this.$toolbarDiv = null,
|
26731 | this.$editorDiv = null, this.editor = null;
|
26732 | }, QuillWrapper.prototype.getSelectionAtCursor = function() {
|
26733 | var text = this.getTextWithoutTrailingBreak();
|
26734 | this.editor.focus();
|
26735 | var selection = this.getSelection();
|
26736 | return selection && selection.start === selection.end ? jsCommon.WordBreaker.find(selection.start, text) : selection;
|
26737 | }, QuillWrapper.prototype.getWord = function() {
|
26738 | var selection = this.getSelectionAtCursor();
|
26739 | return this.getTextWithoutTrailingBreak().slice(selection.start, selection.end);
|
26740 | }, QuillWrapper.prototype.insertLinkAtCursor = function(link, index) {
|
26741 | var endIndex = index + link.length;
|
26742 | return this.editor.insertText(index, link, "api"), this.editor.formatText(index, endIndex, "link", link, "api"),
|
26743 | this.setSelection(index, endIndex), this.onTextChanged(null, null), endIndex;
|
26744 | }, QuillWrapper.prototype.getEditorContainer = function() {
|
26745 | return this.editor ? $(this.editor.container) : void 0;
|
26746 | }, QuillWrapper.prototype.getTextWithoutTrailingBreak = function() {
|
26747 | return this.editor.getText().slice(0, -1);
|
26748 | }, QuillWrapper.prototype.rebuildQuillEditor = function() {
|
26749 | var _this = this, contents = null;
|
26750 | this.editor && (this.editor.removeAllListeners(), contents = this.editor.getContents()),
|
26751 | this.$container.empty(), this.$container.keydown(function(e) {
|
26752 | e.ctrlKey && _.contains(QuillWrapper.preventDefaultKeys, e.which) && e.stopPropagation(),
|
26753 | KeyUtils.isArrowKey(e.which) && e.stopPropagation();
|
26754 | });
|
26755 | var $editorDiv = this.$editorDiv = $("<div>");
|
26756 | $editorDiv.css("font-family", RichText.defaultFont), $editorDiv.css("font-size", RichText.defaultFontSize);
|
26757 | var configs = {
|
26758 | readOnly: this.readOnly,
|
26759 | formats: [ "bold", "italic", "underline", "font", "size", "link", "align" ],
|
26760 | styles: !1
|
26761 | };
|
26762 | if (this.editor = new Quill($editorDiv.get(0), configs), !this.readOnly) {
|
26763 | var $toolbarDiv = this.$toolbarDiv;
|
26764 | $toolbarDiv || (this.$toolbarDiv = $toolbarDiv = Toolbar.buildToolbar(this, this.localizationProvider)),
|
26765 | $toolbarDiv.addClass("unselectable"), this.host.setToolbar($toolbarDiv), this.editor.addModule("toolbar", {
|
26766 | container: $toolbarDiv.get(0)
|
26767 | }), $editorDiv.attr("drag-resize-disabled", "true");
|
26768 | }
|
26769 | this.$container.append($editorDiv), contents && this.setContents(contents);
|
26770 | var textChangeThrottler = new jsCommon.ThrottleUtility(QuillWrapper.textChangeThrottle);
|
26771 | this.editor.on("text-change", function(delta, source) {
|
26772 | "api" !== source && textChangeThrottler.run(function() {
|
26773 | return _this.onTextChanged(delta, source);
|
26774 | });
|
26775 | }), this.editor.root.addEventListener("blur", function(event) {
|
26776 | var target = event.relatedTarget || document.activeElement;
|
26777 | target && "SELECT" === target.tagName || "INPUT" === target.tagName || target.getAttribute("contentEditable") || _this.setSelection(null, null);
|
26778 | }, !1);
|
26779 | }, QuillWrapper.prototype.onTextChanged = function(delta, source) {
|
26780 | this.textChanged(delta, source);
|
26781 | }, QuillWrapper.textChangeThrottle = 200, QuillWrapper.preventDefaultKeys = [ jsCommon.DOMConstants.aKeyCode, jsCommon.DOMConstants.cKeyCode, jsCommon.DOMConstants.xKeyCode, jsCommon.DOMConstants.vKeyCode ],
|
26782 | QuillWrapper.loadQuillResources = !0, QuillWrapper.quillJsFiles = [ powerbi.build + "/externals/quill.min.js" ],
|
26783 | QuillWrapper.quillCssFiles = [ powerbi.build + "/externals/quill.base.css" ], QuillWrapper;
|
26784 | }();
|
26785 | RichText.QuillWrapper = QuillWrapper;
|
26786 | var Toolbar;
|
26787 | !function(Toolbar) {
|
26788 | function buildToolbar(quillWrapper, localizationProvider) {
|
26789 | var linkTooltipTemplate = buildToolbarLinkInputTemplate(localizationProvider);
|
26790 | quillWrapper.addModule("link-tooltip", {
|
26791 | template: linkTooltipTemplate
|
26792 | });
|
26793 | var toolbarLinkInput = buildToolbarLinkInput(quillWrapper, getTooltip("Link", localizationProvider), localizationProvider.get("RichTextbox_Link_DefaultText")), fontPicker = picker(getTooltip("Font", localizationProvider), fonts, "font", RichText.defaultFont, function($option, option) {
|
26794 | return $option.css("font-family", option.value), $option;
|
26795 | }), $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);
|
26796 | return $container.on("mousedown", function(event) {
|
26797 | var target = event.target || document.activeElement;
|
26798 | "INPUT" !== target.tagName && "SELECT" !== target.tagName && event.preventDefault();
|
26799 | }), $container;
|
26800 | }
|
26801 | function setSelectValue($select, value) {
|
26802 | $select.val(value);
|
26803 | var evt = document.createEvent("UIEvent");
|
26804 | evt.initUIEvent("change", !1, !1, null, 0), $select.get(0).dispatchEvent(evt);
|
26805 | }
|
26806 | function linkTooltipTemplateGenerator(removeText, doneText) {
|
26807 | 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 ");
|
26808 | }
|
26809 | function buildToolbarLinkInputTemplate(localizationProvider) {
|
26810 | var template = div(), doneText = localizationProvider.get("RichTextbox_Link_Done"), removeText = localizationProvider.get("RichTextbox_Link_Remove");
|
26811 | return template.append(linkTooltipTemplateGenerator(removeText, doneText)), template.html();
|
26812 | }
|
26813 | function formatGroup() {
|
26814 | return span().addClass("ql-format-group").attr("drag-resize-disabled", "true");
|
26815 | }
|
26816 | function label(text) {
|
26817 | return $("<label>").text(text);
|
26818 | }
|
26819 | function div() {
|
26820 | return $("<div>");
|
26821 | }
|
26822 | function span() {
|
26823 | return $("<span>");
|
26824 | }
|
26825 | function toggleGroup(title, list, format, defaultValue, localizationProvider) {
|
26826 | 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) {
|
26827 | var $button = formatButton(getTooltip(option.label, localizationProvider), "align" + option.value).attr("data-value", option.value).click(function(e) {
|
26828 | return setSelectValue($select, option.value);
|
26829 | });
|
26830 | return $button;
|
26831 | });
|
26832 | return $select.change(function(e) {
|
26833 | for (var newValue = $select.val(), i = 0; i < $buttons.length; i++) $buttons[i].toggleClass("ql-active", $buttons[i].attr("data-value") === newValue);
|
26834 | }), $group.append($select), $group.append($buttons), $group;
|
26835 | }
|
26836 | function picker(tooltip, list, format, defaultValue, optionModifier) {
|
26837 | var $selector = selector(tooltip, list, defaultValue, optionModifier).addClass("ql-picker ql-" + format);
|
26838 | return $selector;
|
26839 | }
|
26840 | function selector(tooltip, list, defaultValue, optionModifier) {
|
26841 | for (var $selector = $("<select>").attr("title", tooltip), i = 0; i < list.length; i++) {
|
26842 | var option = list[i], $option = $("<option>").attr("value", option.value).text(option.label);
|
26843 | option.value === defaultValue && $option.attr("selected", "selected"), void 0 !== optionModifier && ($option = optionModifier($option, option)),
|
26844 | $selector.append($option);
|
26845 | }
|
26846 | return $selector;
|
26847 | }
|
26848 | function formatButton(tooltip, format) {
|
26849 | var $button = span().addClass("ql-format-button");
|
26850 | return null != tooltip && $button.attr("title", tooltip), null != format && ($button.addClass("ql-" + format),
|
26851 | $button.addClass("powervisuals-glyph " + format)), $button;
|
26852 | }
|
26853 | function getTooltip(name, localizationProvider) {
|
26854 | return localizationProvider.get("RichTextbox_" + name + "_ToolTip");
|
26855 | }
|
26856 | function clearLinkInput(linkTooltip) {
|
26857 | linkTooltip.removeClass("editing"), linkTooltip.removeClass("blank-editing"), linkTooltip.find(".input").val(DefaultLinkInputValue);
|
26858 | }
|
26859 | function buildToolbarLinkInput(quillWrapper, buttonTooltip, defaultLinkText) {
|
26860 | var linkTooltip = quillWrapper.getEditorContainer().find(Toolbar.selectors.linkTooltip.selector), toolbarLinkInput = formatGroup().addClass(Toolbar.selectors.toolbarUrlInput["class"]).append(formatButton(buttonTooltip, "link").append("<div>")).append(linkTooltip);
|
26861 | return toolbarLinkInput.on("keydown mousedown", function(event) {
|
26862 | if (event.keyCode === jsCommon.DOMConstants.enterKeyCode || event.target.classList.contains("done")) {
|
26863 | if (!linkTooltip.hasClass("blank-editing")) return !0;
|
26864 | var link = toolbarLinkInput.find(".input").val(), selection = quillWrapper.getSelectionAtCursor(), word = quillWrapper.getWord();
|
26865 | if (!word) {
|
26866 | var endCursor = quillWrapper.insertLinkAtCursor(link, selection.start);
|
26867 | return clearLinkInput(linkTooltip), quillWrapper.setSelection(endCursor, endCursor),
|
26868 | !1;
|
26869 | }
|
26870 | }
|
26871 | }), toolbarLinkInput.find(".input").blur(function(event) {
|
26872 | var blurTarget = event.relatedTarget;
|
26873 | (null === blurTarget || blurTarget && !blurTarget.classList.contains("done")) && clearLinkInput(linkTooltip);
|
26874 | }), toolbarLinkInput.find(".ql-link div").click(function(event) {
|
26875 | var target = event.target.parentElement;
|
26876 | if (target && target.classList.contains("ql-active")) return toolbarLinkInput.find(".change")[0].click(),
|
26877 | !1;
|
26878 | var word = quillWrapper.getWord();
|
26879 | if (!word) {
|
26880 | linkTooltip.addClass("editing blank-editing");
|
26881 | var inputElem = toolbarLinkInput.find(".input").get(0);
|
26882 | return inputElem.value = DefaultLinkInputValue, inputElem.selectionStart = inputElem.selectionEnd = DefaultLinkInputValue.length,
|
26883 | inputElem.focus(), !1;
|
26884 | }
|
26885 | }).mousedown(function(event) {
|
26886 | var linkButton = event.target.parentElement;
|
26887 | if (linkButton && !linkButton.classList.contains("ql-active")) {
|
26888 | var selection = quillWrapper.getSelectionAtCursor();
|
26889 | quillWrapper.setSelection(selection.start, selection.end);
|
26890 | }
|
26891 | }), toolbarLinkInput;
|
26892 | }
|
26893 | var DefaultLinkInputValue = "http://";
|
26894 | Toolbar.selectors = {
|
26895 | linkTooltip: createClassAndSelector("ql-link-tooltip"),
|
26896 | toolbarUrlInput: createClassAndSelector("toolbar-url-input")
|
26897 | }, Toolbar.buildToolbar = buildToolbar, Toolbar.setSelectValue = setSelectValue;
|
26898 | }(Toolbar || (Toolbar = {}));
|
26899 | }(RichText = visuals.RichText || (visuals.RichText = {}));
|
26900 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
26901 | }(powerbi || (powerbi = {}));
|
26902 |
|
26903 | var powerbi;
|
26904 |
|
26905 | !function(powerbi) {
|
26906 | var visuals;
|
26907 | !function(visuals) {
|
26908 | var SelectionManager = visuals.utility.SelectionManager;
|
26909 | visuals.cheerMeterProps = {
|
26910 | dataPoint: {
|
26911 | defaultColor: {
|
26912 | objectName: "dataPoint",
|
26913 | propertyName: "defaultColor"
|
26914 | },
|
26915 | fill: {
|
26916 | objectName: "dataPoint",
|
26917 | propertyName: "fill"
|
26918 | }
|
26919 | }
|
26920 | };
|
26921 | var CheerMeter = function() {
|
26922 | function CheerMeter() {
|
26923 | this.isFirstTime = !0;
|
26924 | }
|
26925 | return CheerMeter.converter = function(dataView) {
|
26926 | if (!dataView.categorical || !dataView.categorical.categories) return null;
|
26927 | var cat = dataView.categorical.categories[0];
|
26928 | if (!cat) return null;
|
26929 | var catValues = cat.values;
|
26930 | if (!catValues || _.isEmpty(dataView.categorical.values)) return null;
|
26931 | 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;
|
26932 | if (metadataObjects) {
|
26933 | var general = metadataObjects.general;
|
26934 | if (general) {
|
26935 | var fill = general.fill;
|
26936 | fill && (backgroundColor = fill.solid.color);
|
26937 | }
|
26938 | }
|
26939 | 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 = {
|
26940 | teamA: {
|
26941 | name: catValues[0],
|
26942 | value: values[0],
|
26943 | color: color1,
|
26944 | identity: idn1
|
26945 | },
|
26946 | teamB: {
|
26947 | name: catValues[1],
|
26948 | value: values[1],
|
26949 | color: color2,
|
26950 | identity: idn2
|
26951 | },
|
26952 | background: backgroundColor
|
26953 | };
|
26954 | return data;
|
26955 | }, CheerMeter.prototype.init = function(options) {
|
26956 | this.selectionManager = new SelectionManager({
|
26957 | hostServices: options.host
|
26958 | });
|
26959 | var svg = this.svg = d3.select(options.element.get(0)).append("svg");
|
26960 | this.textOne = svg.append("text").style("font-family", CheerMeter.DefaultFontFamily),
|
26961 | this.textTwo = svg.append("text").style("font-family", CheerMeter.DefaultFontFamily);
|
26962 | }, CheerMeter.prototype.update = function(options) {
|
26963 | if (options.dataViews[0]) {
|
26964 | var data = this.data = CheerMeter.converter(options.dataViews[0]);
|
26965 | if (data) {
|
26966 | var duration = options.suppressAnimations ? 0 : visuals.AnimatorCommon.MinervaAnimationDuration;
|
26967 | this.draw(data, duration, options.viewport);
|
26968 | }
|
26969 | }
|
26970 | }, CheerMeter.prototype.getRecomendedFontProperties = function(text1, text2, parentViewport) {
|
26971 | for (var i, textProperties = {
|
26972 | fontSize: "",
|
26973 | fontFamily: CheerMeter.DefaultFontFamily,
|
26974 | text: text1 + text2
|
26975 | }, min = 1, max = 1e3, maxWidth = parentViewport.width, width = 0; max >= min; ) if (i = (min + max) / 2 | 0,
|
26976 | textProperties.fontSize = i + "px", width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
26977 | maxWidth > width) min = i + 1; else {
|
26978 | if (!(width > maxWidth)) break;
|
26979 | max = i - 1;
|
26980 | }
|
26981 | return textProperties.fontSize = i + "px", width = powerbi.TextMeasurementService.measureSvgTextWidth(textProperties),
|
26982 | width > maxWidth && (i--, textProperties.fontSize = i + "px"), textProperties;
|
26983 | }, CheerMeter.prototype.calculateLayout = function(data, viewport) {
|
26984 | var text1 = data.teamA.name, text2 = data.teamB.name, avaliableViewport = {
|
26985 | height: viewport.height,
|
26986 | width: viewport.width - CheerMeter.PaddingBetweenText
|
26987 | }, recomendedFontProperties = this.getRecomendedFontProperties(text1, text2, avaliableViewport);
|
26988 | recomendedFontProperties.text = text1;
|
26989 | var width1 = 0 | powerbi.TextMeasurementService.measureSvgTextWidth(recomendedFontProperties);
|
26990 | recomendedFontProperties.text = text2;
|
26991 | var width2 = 0 | powerbi.TextMeasurementService.measureSvgTextWidth(recomendedFontProperties), padding = (viewport.width - width1 - width2 - CheerMeter.PaddingBetweenText) / 2 | 0;
|
26992 | recomendedFontProperties.text = text1 + text2;
|
26993 | 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;
|
26994 | return {
|
26995 | x1: padding,
|
26996 | x2: padding + width1 + CheerMeter.PaddingBetweenText,
|
26997 | y1: y1,
|
26998 | y2: y2,
|
26999 | fontSize: recomendedFontProperties.fontSize
|
27000 | };
|
27001 | }, CheerMeter.prototype.ensureStartState = function(layout, viewport) {
|
27002 | if (this.isFirstTime) {
|
27003 | this.isFirstTime = !1;
|
27004 | var startY = viewport.height / 2;
|
27005 | this.textOne.attr({
|
27006 | x: layout.x1,
|
27007 | y: startY
|
27008 | }), this.textTwo.attr({
|
27009 | x: layout.x2,
|
27010 | y: startY
|
27011 | });
|
27012 | }
|
27013 | }, CheerMeter.prototype.clearSelection = function() {
|
27014 | var _this = this;
|
27015 | this.selectionManager.clear().then(function() {
|
27016 | _this.clearSelectionUI();
|
27017 | });
|
27018 | }, CheerMeter.prototype.clearSelectionUI = function() {
|
27019 | this.textOne.style("stroke", "#FFF").style("stroke-width", 0), this.textTwo.style("stroke", "#FFF").style("stroke-width", 0);
|
27020 | }, CheerMeter.prototype.updateSelectionUI = function(ids) {
|
27021 | this.textOne.style("stroke", "#FFF").style("stroke-width", SelectionManager.containsSelection(ids, this.data.teamA.identity) ? "2px" : "0px"),
|
27022 | this.textTwo.style("stroke", "#FFF").style("stroke-width", SelectionManager.containsSelection(ids, this.data.teamB.identity) ? "2px" : "0px");
|
27023 | }, CheerMeter.prototype.draw = function(data, duration, viewport) {
|
27024 | var _this = this, easeName = "back", textOne = this.textOne, textTwo = this.textTwo;
|
27025 | this.svg.attr({
|
27026 | height: viewport.height,
|
27027 | width: viewport.width
|
27028 | }).on("click", function() {
|
27029 | _this.clearSelection();
|
27030 | }).style("background-color", data.background);
|
27031 | var layout = this.calculateLayout(data, viewport);
|
27032 | this.ensureStartState(layout, viewport), textOne.style("font-size", layout.fontSize).style("fill", data.teamA.color).on("click", function() {
|
27033 | _this.selectionManager.select(data.teamA.identity, d3.event.ctrlKey).then(function(ids) {
|
27034 | _this.updateSelectionUI(ids);
|
27035 | }), d3.event.stopPropagation();
|
27036 | }).text(data.teamA.name), textTwo.style("font-size", layout.fontSize).style("fill", data.teamB.color).on("click", function() {
|
27037 | _this.selectionManager.select(data.teamB.identity, d3.event.ctrlKey).then(function(ids) {
|
27038 | _this.updateSelectionUI(ids);
|
27039 | }), d3.event.stopPropagation();
|
27040 | }).text(data.teamB.name), textOne.transition().duration(duration).ease(easeName).attr({
|
27041 | y: layout.y1,
|
27042 | x: layout.x1
|
27043 | }), textTwo.transition().duration(duration).ease(easeName).attr({
|
27044 | y: layout.y2,
|
27045 | x: layout.x2
|
27046 | });
|
27047 | }, CheerMeter.prototype.destroy = function() {
|
27048 | this.svg = null, this.textOne = this.textTwo = null;
|
27049 | }, CheerMeter.prototype.enumerateObjectInstances = function(options) {
|
27050 | var instances = [], data = this.data;
|
27051 | switch (options.objectName) {
|
27052 | case "dataPoint":
|
27053 | if (data) for (var teams = [ data.teamA, data.teamB ], i = 0; i < teams.length; i++) {
|
27054 | var slice = teams[i], color = slice.color, selector = slice.identity, dataPointInstance = {
|
27055 | objectName: "dataPoint",
|
27056 | displayName: slice.name,
|
27057 | selector: selector,
|
27058 | properties: {
|
27059 | fill: {
|
27060 | solid: {
|
27061 | color: color
|
27062 | }
|
27063 | }
|
27064 | }
|
27065 | };
|
27066 | instances.push(dataPointInstance);
|
27067 | }
|
27068 | break;
|
27069 |
|
27070 | case "general":
|
27071 | var general = {
|
27072 | objectName: "general",
|
27073 | displayName: "General",
|
27074 | selector: null,
|
27075 | properties: {
|
27076 | fill: {
|
27077 | solid: {
|
27078 | color: data ? data.background : CheerMeter.DefaultBackgroundColor
|
27079 | }
|
27080 | }
|
27081 | }
|
27082 | };
|
27083 | instances.push(general);
|
27084 | }
|
27085 | return instances;
|
27086 | }, CheerMeter.capabilities = {
|
27087 | dataRoles: [ {
|
27088 | displayName: "Category",
|
27089 | name: "Category",
|
27090 | kind: powerbi.VisualDataRoleKind.Grouping
|
27091 | }, {
|
27092 | displayName: "Noise Measure",
|
27093 | name: "Y",
|
27094 | kind: powerbi.VisualDataRoleKind.Measure
|
27095 | } ],
|
27096 | dataViewMappings: [ {
|
27097 | categorical: {
|
27098 | categories: {
|
27099 | "for": {
|
27100 | "in": "Category"
|
27101 | }
|
27102 | },
|
27103 | values: {
|
27104 | select: [ {
|
27105 | bind: {
|
27106 | to: "Y"
|
27107 | }
|
27108 | } ]
|
27109 | }
|
27110 | }
|
27111 | } ],
|
27112 | objects: {
|
27113 | dataPoint: {
|
27114 | displayName: powerbi.data.createDisplayNameGetter("Visual_DataPoint"),
|
27115 | description: powerbi.data.createDisplayNameGetter("Visual_DataPointDescription"),
|
27116 | properties: {
|
27117 | fill: {
|
27118 | displayName: powerbi.data.createDisplayNameGetter("Visual_Fill"),
|
27119 | type: {
|
27120 | fill: {
|
27121 | solid: {
|
27122 | color: !0
|
27123 | }
|
27124 | }
|
27125 | }
|
27126 | },
|
27127 | width: {
|
27128 | displayName: "",
|
27129 | type: {
|
27130 | numeric: !0
|
27131 | }
|
27132 | }
|
27133 | }
|
27134 | },
|
27135 | general: {
|
27136 | displayName: "General",
|
27137 | properties: {
|
27138 | fill: {
|
27139 | displayName: "Background color",
|
27140 | type: {
|
27141 | fill: {
|
27142 | solid: {
|
27143 | color: !0
|
27144 | }
|
27145 | }
|
27146 | }
|
27147 | }
|
27148 | }
|
27149 | }
|
27150 | }
|
27151 | }, CheerMeter.DefaultFontFamily = "cursive", CheerMeter.DefaultFontColor = "rgb(165, 172, 175)",
|
27152 | CheerMeter.DefaultBackgroundColor = "#243C18", CheerMeter.PaddingBetweenText = 15,
|
27153 | CheerMeter;
|
27154 | }();
|
27155 | visuals.CheerMeter = CheerMeter;
|
27156 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
27157 | }(powerbi || (powerbi = {}));
|
27158 |
|
27159 | var powerbi;
|
27160 |
|
27161 | !function(powerbi) {
|
27162 | var visuals;
|
27163 | !function(visuals) {
|
27164 | var Color = jsCommon.Color, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, PixelConverter = jsCommon.PixelConverter, DataRoleHelper = powerbi.data.DataRoleHelper, ScatterChart = function() {
|
27165 | function ScatterChart(options) {
|
27166 | options && (this.tooltipsEnabled = options.tooltipsEnabled, this.interactivityService = options.interactivityService,
|
27167 | this.animator = options.animator), this.renderer = new SvgRenderer();
|
27168 | }
|
27169 | return ScatterChart.prototype.init = function(options) {
|
27170 | this.options = options, this.element = options.element, this.currentViewport = options.viewport,
|
27171 | this.style = options.style, this.host = options.host, this.colors = this.style.colorPalette.dataColors,
|
27172 | this.interactivity = options.interactivity, this.cartesianVisualHost = options.cartesianHost,
|
27173 | this.isMobileChart = options.interactivity && options.interactivity.isInteractiveLegend;
|
27174 | var svg = this.svg = options.svg;
|
27175 | svg.classed(ScatterChart.ClassName + " " + visuals.PlayChart.ClassName, !0), this.renderer.init(svg, options.labelsContext, this.isMobileChart, this.tooltipsEnabled);
|
27176 | }, ScatterChart.getAdditionalTelemetry = function(dataView) {
|
27177 | var telemetry = {
|
27178 | hasSize: DataRoleHelper.hasRoleInDataView(dataView, "Size"),
|
27179 | hasPlayAxis: DataRoleHelper.hasRoleInDataView(dataView, "Play")
|
27180 | };
|
27181 | return telemetry;
|
27182 | }, ScatterChart.getObjectProperties = function(dataView, dataLabelsSettings) {
|
27183 | var objects;
|
27184 | objects = dataView && dataView.metadata && dataView.metadata.objects ? dataView.metadata.objects : {};
|
27185 | var objectProperties = {};
|
27186 | objectProperties.defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.columnChartProps.dataPoint.defaultColor),
|
27187 | objectProperties.showAllDataPoints = powerbi.DataViewObjects.getValue(objects, visuals.columnChartProps.dataPoint.showAllDataPoints, !1);
|
27188 | var labelsObj = objects.categoryLabels;
|
27189 | labelsObj && dataLabelsSettings && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
27190 | var hasGradient = dataView && visuals.GradientUtils.hasGradientRole(dataView.categorical);
|
27191 | return objectProperties.fillPoint = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.fillPoint.show, hasGradient),
|
27192 | objectProperties.colorBorder = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.colorBorder.show, !1),
|
27193 | objectProperties.colorByCategory = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.colorByCategory.show, !1),
|
27194 | objectProperties;
|
27195 | }, ScatterChart.converter = function(dataView, options, playFrameInfo, tooltipsEnabled) {
|
27196 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
27197 | 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);
|
27198 | dataViewCategorical.categories && dataViewCategorical.categories.length > 0 ? (categoryValues = dataViewCategorical.categories[0].values,
|
27199 | categoryFormatter = visuals.valueFormatter.create({
|
27200 | format: visuals.valueFormatter.getFormatString(dataViewCategorical.categories[0].source, visuals.scatterChartProps.general.formatString),
|
27201 | value: categoryValues[0],
|
27202 | value2: categoryValues[categoryValues.length - 1]
|
27203 | }), categoryIdentities = dataViewCategorical.categories[0].identity, categoryObjects = dataViewCategorical.categories[0].objects,
|
27204 | categoryQueryName = dataViewCategorical.categories[0].source.queryName) : (categoryValues = [ null ],
|
27205 | categoryFormatter = visuals.valueFormatter.createDefaultFormatter(null));
|
27206 | 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), dataPoints = _.reduce(dataPointSeries, function(a, s) {
|
27207 | return a.concat(s.dataPoints);
|
27208 | }, []), legendItems = hasDynamicSeries ? ScatterChart.createSeriesLegend(dataValues, colorPalette, dataValues, visuals.valueFormatter.getFormatString(dvSource, visuals.scatterChartProps.general.formatString), objProps.defaultDataPointColor) : [], legendTitle = dataValues && dvSource ? dvSource.displayName : "";
|
27209 | return legendTitle || (legendTitle = categories && categories.length > 0 && categories[0].source.displayName ? categories[0].source.displayName : ""),
|
27210 | categoryAxisProperties && null !== categoryAxisProperties.showAxisTitle && categoryAxisProperties.showAxisTitle === !1 && (scatterMetadata.axesLabels.x = null),
|
27211 | valueAxisProperties && null !== valueAxisProperties.showAxisTitle && valueAxisProperties.showAxisTitle === !1 && (scatterMetadata.axesLabels.y = null),
|
27212 | interactivityService && (interactivityService.applySelectionStateToData(dataPoints),
|
27213 | interactivityService.applySelectionStateToData(legendItems)), {
|
27214 | xCol: scatterMetadata.cols.x,
|
27215 | yCol: scatterMetadata.cols.y,
|
27216 | dataPoints: dataPoints,
|
27217 | dataPointSeries: dataPointSeries,
|
27218 | legendData: {
|
27219 | title: legendTitle,
|
27220 | dataPoints: legendItems
|
27221 | },
|
27222 | axesLabels: scatterMetadata.axesLabels,
|
27223 | size: scatterMetadata.cols.size,
|
27224 | sizeRange: sizeRange,
|
27225 | dataLabelsSettings: dataLabelsSettings,
|
27226 | defaultDataPointColor: objProps.defaultDataPointColor,
|
27227 | hasDynamicSeries: hasDynamicSeries,
|
27228 | showAllDataPoints: objProps.showAllDataPoints,
|
27229 | fillPoint: objProps.fillPoint,
|
27230 | colorBorder: objProps.colorBorder,
|
27231 | colorByCategory: objProps.colorByCategory
|
27232 | };
|
27233 | }, ScatterChart.getSizeRangeForGroups = function(dataViewValueGroups, sizeColumnIndex) {
|
27234 | var result = {};
|
27235 | return dataViewValueGroups && dataViewValueGroups.forEach(function(group) {
|
27236 | var sizeColumn = ScatterChart.getMeasureValue(sizeColumnIndex, group.values), currentRange = visuals.AxisHelper.getRangeForColumn(sizeColumn);
|
27237 | (null == result.min || result.min > currentRange.min) && (result.min = currentRange.min),
|
27238 | (null == result.max || result.max < currentRange.max) && (result.max = currentRange.max);
|
27239 | }), result;
|
27240 | }, ScatterChart.createDataPointSeries = function(reader, dataValues, metadata, categories, categoryValues, categoryFormatter, categoryIdentities, categoryObjects, colorPalette, viewport, hasDynamicSeries, labelSettings, gradientValueColumn, defaultDataPointColor, categoryQueryName, colorByCategory, playFrameInfo, tooltipsEnabled) {
|
27241 | var hasX = reader.hasValues("X"), hasY = reader.hasValues("Y");
|
27242 | if (!hasX && !hasY) return [];
|
27243 | 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++) {
|
27244 | 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;
|
27245 | if (hasDynamicSeries) seriesColor = colorHelper.getColorForSeriesValue(grouping.objects, dataValues.identityFields, grouping.name); else if (!colorByCategory && !categoryObjects) {
|
27246 | var measureSource = null != measureSize ? measureSize.source.queryName : "";
|
27247 | seriesColor = colorHelper.getColorForMeasure(null, measureSource);
|
27248 | }
|
27249 | var series = {
|
27250 | identityKey: grouping && grouping.identity && grouping.identity.key || "",
|
27251 | dataPoints: [],
|
27252 | hasSize: !(!measureSize || !measureSize.values),
|
27253 | fill: seriesColor
|
27254 | };
|
27255 | dataPointSeries.push(series);
|
27256 | for (var categoryIndex = 0, ilen = categoryValues.length; ilen > categoryIndex; categoryIndex++) {
|
27257 | 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));
|
27258 | if (null != xVal && null != yVal) {
|
27259 | var color = void 0;
|
27260 | if (hasDynamicSeries) color = colorHelper.getColorForSeriesValue(grouping.objects, dataValues.identityFields, grouping.name); else if (colorByCategory) color = colorHelper.getColorForSeriesValue(categoryObjects && categoryObjects[categoryIndex], dataValues.identityFields, categoryValue); else {
|
27261 | var measureSource = null != measureSize ? measureSize.source.queryName : "";
|
27262 | color = colorHelper.getColorForMeasure(categoryObjects && categoryObjects[categoryIndex], measureSource);
|
27263 | }
|
27264 | var category = _.isEmpty(categories) ? null : categories[0], identity = visuals.SelectionIdBuilder.builder().withCategory(category, categoryIndex).withSeries(dataValues, grouping).createSelectionId(), tooltipInfo = void 0;
|
27265 | tooltipsEnabled && (tooltipInfo = [], category && tooltipInfo.push({
|
27266 | displayName: category.source.displayName,
|
27267 | value: visuals.converterHelper.formatFromMetadataColumn(categoryValue, category.source, formatStringProp)
|
27268 | }), hasDynamicSeries && (category && category.source === dataValueSource || tooltipInfo.push({
|
27269 | displayName: dataValueSource.displayName,
|
27270 | value: visuals.converterHelper.formatFromMetadataColumn(grouping.name, dataValueSource, formatStringProp)
|
27271 | })), measureX && null != xVal && tooltipInfo.push({
|
27272 | displayName: measureX.source.displayName,
|
27273 | value: visuals.converterHelper.formatFromMetadataColumn(xVal, measureX.source, formatStringProp)
|
27274 | }), measureY && null != yVal && tooltipInfo.push({
|
27275 | displayName: measureY.source.displayName,
|
27276 | value: visuals.converterHelper.formatFromMetadataColumn(yVal, measureY.source, formatStringProp)
|
27277 | }), measureSize && null != measureSize.values[categoryIndex] && tooltipInfo.push({
|
27278 | displayName: measureSize.source.displayName,
|
27279 | value: visuals.converterHelper.formatFromMetadataColumn(measureSize.values[categoryIndex], measureSize.source, formatStringProp)
|
27280 | }), gradientValueColumn && null != gradientValueColumn.values[categoryIndex] && tooltipInfo.push({
|
27281 | displayName: gradientValueColumn.source.displayName,
|
27282 | value: visuals.converterHelper.formatFromMetadataColumn(gradientValueColumn.values[categoryIndex], gradientValueColumn.source, formatStringProp)
|
27283 | }), playFrameInfo && tooltipInfo.push({
|
27284 | displayName: playFrameInfo.column.displayName,
|
27285 | value: visuals.converterHelper.formatFromMetadataColumn(playFrameInfo.label, playFrameInfo.column, formatStringProp)
|
27286 | }));
|
27287 | var dataPoint = {
|
27288 | x: xVal,
|
27289 | y: yVal,
|
27290 | size: size,
|
27291 | radius: {
|
27292 | sizeMeasure: measureSize,
|
27293 | index: categoryIndex
|
27294 | },
|
27295 | fill: color,
|
27296 | formattedCategory: ScatterChart.createLazyFormattedCategory(categoryFormatter, null != categories ? categoryValue : grouping.name),
|
27297 | selected: !1,
|
27298 | identity: identity,
|
27299 | tooltipInfo: tooltipInfo,
|
27300 | labelFill: labelSettings.labelColor
|
27301 | };
|
27302 | series.dataPoints.push(dataPoint);
|
27303 | }
|
27304 | }
|
27305 | }
|
27306 | return dataPointSeries;
|
27307 | }, ScatterChart.createLazyFormattedCategory = function(formatter, value) {
|
27308 | return new jsCommon.Lazy(function() {
|
27309 | return formatter.format(value);
|
27310 | });
|
27311 | }, ScatterChart.createSeriesLegend = function(dataValues, colorPalette, categorical, formatString, defaultDataPointColor) {
|
27312 | for (var grouped = dataValues.grouped(), colorHelper = new visuals.ColorHelper(colorPalette, visuals.scatterChartProps.dataPoint.fill, defaultDataPointColor), legendItems = [], i = 0, len = grouped.length; len > i; i++) {
|
27313 | var grouping = grouped[i], color = colorHelper.getColorForSeriesValue(grouping.objects, dataValues.identityFields, grouping.name);
|
27314 | legendItems.push({
|
27315 | color: color,
|
27316 | icon: visuals.LegendIcon.Circle,
|
27317 | label: visuals.valueFormatter.format(grouping.name, formatString),
|
27318 | identity: grouping.identity ? visuals.SelectionId.createWithId(grouping.identity) : visuals.SelectionId.createNull(),
|
27319 | selected: !1
|
27320 | });
|
27321 | }
|
27322 | return legendItems;
|
27323 | }, ScatterChart.getBubbleRadius = function(radiusData, sizeRange, viewport) {
|
27324 | var actualSizeDataRange = null, bubblePixelAreaSizeRange = null, measureSize = radiusData.sizeMeasure;
|
27325 | if (!measureSize) return ScatterChart.BubbleRadius;
|
27326 | var minSize = sizeRange.min ? sizeRange.min : 0, maxSize = sizeRange.max ? sizeRange.max : 0, min = Math.min(minSize, 0), max = Math.max(maxSize, 0);
|
27327 | if (actualSizeDataRange = {
|
27328 | minRange: min,
|
27329 | maxRange: max,
|
27330 | delta: max - min
|
27331 | }, bubblePixelAreaSizeRange = ScatterChart.getBubblePixelAreaSizeRange(viewport, ScatterChart.MinSizeRange, ScatterChart.MaxSizeRange),
|
27332 | measureSize.values) {
|
27333 | var sizeValue = measureSize.values[radiusData.index];
|
27334 | if (null != sizeValue) return ScatterChart.projectSizeToPixels(sizeValue, actualSizeDataRange, bubblePixelAreaSizeRange) / 2;
|
27335 | }
|
27336 | return ScatterChart.BubbleRadius;
|
27337 | }, ScatterChart.getMeasureValue = function(measureIndex, seriesValues) {
|
27338 | return measureIndex >= 0 ? seriesValues[measureIndex] : null;
|
27339 | }, ScatterChart.getMetadata = function(grouped, source) {
|
27340 | var xCol, yCol, sizeCol, xIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "X"), yIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Y"), sizeIndex = DataRoleHelper.getMeasureIndexOfRole(grouped, "Size"), xAxisLabel = "", yAxisLabel = "";
|
27341 | if (grouped && grouped.length) {
|
27342 | var firstGroup = grouped[0];
|
27343 | xIndex >= 0 && (xCol = firstGroup.values[xIndex].source, xAxisLabel = firstGroup.values[xIndex].source.displayName),
|
27344 | yIndex >= 0 && (yCol = firstGroup.values[yIndex].source, yAxisLabel = firstGroup.values[yIndex].source.displayName),
|
27345 | sizeIndex >= 0 && (sizeCol = firstGroup.values[sizeIndex].source);
|
27346 | }
|
27347 | return {
|
27348 | idx: {
|
27349 | x: xIndex,
|
27350 | y: yIndex,
|
27351 | size: sizeIndex
|
27352 | },
|
27353 | cols: {
|
27354 | x: xCol,
|
27355 | y: yCol,
|
27356 | size: sizeCol
|
27357 | },
|
27358 | axesLabels: {
|
27359 | x: xAxisLabel,
|
27360 | y: yAxisLabel
|
27361 | }
|
27362 | };
|
27363 | }, ScatterChart.getDefaultData = function() {
|
27364 | return {
|
27365 | xCol: void 0,
|
27366 | yCol: void 0,
|
27367 | dataPoints: [],
|
27368 | dataPointSeries: [],
|
27369 | legendData: {
|
27370 | dataPoints: []
|
27371 | },
|
27372 | axesLabels: {
|
27373 | x: "",
|
27374 | y: ""
|
27375 | },
|
27376 | sizeRange: [],
|
27377 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultPointLabelSettings(),
|
27378 | defaultDataPointColor: null,
|
27379 | hasDynamicSeries: !1
|
27380 | };
|
27381 | }, ScatterChart.prototype.renderAtFrame = function(data) {
|
27382 | this.data = data, this.cartesianVisualHost.triggerRender(!1);
|
27383 | }, ScatterChart.prototype.setData = function(dataViews) {
|
27384 | var _this = this;
|
27385 | if (this.data = ScatterChart.getDefaultData(), dataViews.length > 0) {
|
27386 | var dataView = dataViews[0] || dataViews[1];
|
27387 | if (dataView) {
|
27388 | this.categoryAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata, !0),
|
27389 | this.valueAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataView.metadata, !0),
|
27390 | this.dataView = dataView;
|
27391 | var converterOptions_1 = {
|
27392 | viewport: this.currentViewport,
|
27393 | colors: this.colors,
|
27394 | interactivityService: this.interactivityService,
|
27395 | categoryAxisProperties: this.categoryAxisProperties,
|
27396 | valueAxisProperties: this.valueAxisProperties
|
27397 | };
|
27398 | if (visuals.PlayChart.isDataViewPlayable(dataView)) {
|
27399 | this.playAxis || (this.playAxis = new visuals.PlayAxis({
|
27400 | animator: this.animator,
|
27401 | interactivityService: this.interactivityService,
|
27402 | isScrollable: !1
|
27403 | }), this.playAxis.init(this.options));
|
27404 | var playData = this.playAxis.setData(dataView, function(dataView, playFrameInfo) {
|
27405 | return ScatterChart.converter(dataView, converterOptions_1, playFrameInfo, _this.tooltipsEnabled);
|
27406 | });
|
27407 | this.mergeSizeRanges(playData), this.data = playData.currentViewModel, this.playAxis.setRenderFunction(function(data) {
|
27408 | return _this.renderAtFrame(data);
|
27409 | });
|
27410 | } 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));
|
27411 | }
|
27412 | } else this.playAxis && (this.playAxis.remove(), this.playAxis = null);
|
27413 | }, ScatterChart.prototype.mergeSizeRanges = function(playData) {
|
27414 | if (playData && playData.currentViewModel) {
|
27415 | for (var mergedSizeRange = playData.currentViewModel.sizeRange, _i = 0, _a = playData.allViewModels; _i < _a.length; _i++) {
|
27416 | var data_3 = _a[_i], sizeRange = data_3.sizeRange;
|
27417 | null != sizeRange.min && (mergedSizeRange.min = Math.min(mergedSizeRange.min, sizeRange.min)),
|
27418 | null != sizeRange.max && (mergedSizeRange.max = Math.max(mergedSizeRange.max, sizeRange.max));
|
27419 | }
|
27420 | for (var _b = 0, _c = playData.allViewModels; _b < _c.length; _b++) {
|
27421 | var data_4 = _c[_b];
|
27422 | data_4.sizeRange = mergedSizeRange;
|
27423 | }
|
27424 | }
|
27425 | }, ScatterChart.prototype.calculateLegend = function() {
|
27426 | return this.data && this.data.legendData;
|
27427 | }, ScatterChart.prototype.hasLegend = function() {
|
27428 | return this.data && this.data.hasDynamicSeries;
|
27429 | }, ScatterChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
27430 | switch (options.objectName) {
|
27431 | case "colorByCategory":
|
27432 | this.data && (this.data.hasDynamicSeries || enumeration.pushInstance({
|
27433 | objectName: "colorByCategory",
|
27434 | selector: null,
|
27435 | properties: {
|
27436 | show: this.data.colorByCategory
|
27437 | }
|
27438 | }));
|
27439 | break;
|
27440 |
|
27441 | case "dataPoint":
|
27442 | if (!this.playAxis) {
|
27443 | var categoricalDataView = this.dataView && this.dataView.categorical ? this.dataView.categorical : null;
|
27444 | if (!visuals.GradientUtils.hasGradientRole(categoricalDataView)) return this.enumerateDataPoints(enumeration);
|
27445 | }
|
27446 | break;
|
27447 |
|
27448 | case "categoryAxis":
|
27449 | enumeration.pushInstance({
|
27450 | selector: null,
|
27451 | properties: {
|
27452 | showAxisTitle: this.categoryAxisProperties && null != this.categoryAxisProperties.showAxisTitle ? this.categoryAxisProperties.showAxisTitle : !0
|
27453 | },
|
27454 | objectName: "categoryAxis"
|
27455 | });
|
27456 | break;
|
27457 |
|
27458 | case "valueAxis":
|
27459 | enumeration.pushInstance({
|
27460 | selector: null,
|
27461 | properties: {
|
27462 | showAxisTitle: this.valueAxisProperties && null != this.valueAxisProperties.showAxisTitle ? this.valueAxisProperties.showAxisTitle : !0
|
27463 | },
|
27464 | objectName: "valueAxis"
|
27465 | });
|
27466 | break;
|
27467 |
|
27468 | case "categoryLabels":
|
27469 | this.data ? visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, this.data.dataLabelsSettings, !0) : visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, null, !0);
|
27470 | break;
|
27471 |
|
27472 | case "fillPoint":
|
27473 | if (this.hasSizeMeasure()) return;
|
27474 | enumeration.pushInstance({
|
27475 | objectName: "fillPoint",
|
27476 | selector: null,
|
27477 | properties: {
|
27478 | show: this.data.fillPoint
|
27479 | }
|
27480 | });
|
27481 | break;
|
27482 |
|
27483 | case "colorBorder":
|
27484 | this.hasSizeMeasure() && enumeration.pushInstance({
|
27485 | objectName: "colorBorder",
|
27486 | selector: null,
|
27487 | properties: {
|
27488 | show: this.data.colorBorder
|
27489 | }
|
27490 | });
|
27491 | }
|
27492 | }, ScatterChart.prototype.hasSizeMeasure = function() {
|
27493 | var sizeRange = this.data.sizeRange;
|
27494 | return sizeRange && void 0 !== sizeRange.min;
|
27495 | }, ScatterChart.prototype.enumerateDataPoints = function(enumeration) {
|
27496 | var data = this.data;
|
27497 | if (data) {
|
27498 | var seriesCount = data.dataPoints.length;
|
27499 | if (data.hasDynamicSeries) for (var legendDataPointLength = data.legendData.dataPoints.length, i = 0; legendDataPointLength > i; i++) {
|
27500 | var series = data.legendData.dataPoints[i];
|
27501 | enumeration.pushInstance({
|
27502 | objectName: "dataPoint",
|
27503 | displayName: series.label,
|
27504 | selector: visuals.ColorHelper.normalizeSelector(series.identity.getSelector()),
|
27505 | properties: {
|
27506 | fill: {
|
27507 | solid: {
|
27508 | color: series.color
|
27509 | }
|
27510 | }
|
27511 | }
|
27512 | });
|
27513 | } else {
|
27514 | enumeration.pushInstance({
|
27515 | objectName: "dataPoint",
|
27516 | selector: null,
|
27517 | properties: {
|
27518 | defaultColor: {
|
27519 | solid: {
|
27520 | color: data.defaultDataPointColor || this.colors.getColorByIndex(0).value
|
27521 | }
|
27522 | }
|
27523 | }
|
27524 | }).pushInstance({
|
27525 | objectName: "dataPoint",
|
27526 | selector: null,
|
27527 | properties: {
|
27528 | showAllDataPoints: !!data.showAllDataPoints
|
27529 | }
|
27530 | });
|
27531 | for (var i = 0; seriesCount > i; i++) {
|
27532 | var seriesDataPoints = data.dataPoints[i];
|
27533 | enumeration.pushInstance({
|
27534 | objectName: "dataPoint",
|
27535 | displayName: seriesDataPoints.formattedCategory.getValue(),
|
27536 | selector: visuals.ColorHelper.normalizeSelector(seriesDataPoints.identity.getSelector(), !0),
|
27537 | properties: {
|
27538 | fill: {
|
27539 | solid: {
|
27540 | color: seriesDataPoints.fill
|
27541 | }
|
27542 | }
|
27543 | }
|
27544 | });
|
27545 | }
|
27546 | }
|
27547 | }
|
27548 | }, ScatterChart.prototype.supportsTrendLine = function() {
|
27549 | var data = this.data;
|
27550 | return data ? !this.hasSizeMeasure() && data.dataPointSeries.length > 0 : !1;
|
27551 | }, ScatterChart.getExtents = function(data) {
|
27552 | var dps = data.dataPoints;
|
27553 | return _.isEmpty(dps) ? {
|
27554 | minY: 0,
|
27555 | maxY: 0,
|
27556 | minX: 0,
|
27557 | maxX: 0
|
27558 | } : {
|
27559 | minY: d3.min(dps, function(d) {
|
27560 | return d.y;
|
27561 | }),
|
27562 | maxY: d3.max(dps, function(d) {
|
27563 | return d.y;
|
27564 | }),
|
27565 | minX: d3.min(dps, function(d) {
|
27566 | return d.x;
|
27567 | }),
|
27568 | maxX: d3.max(dps, function(d) {
|
27569 | return d.x;
|
27570 | })
|
27571 | };
|
27572 | }, ScatterChart.prototype.calculateAxesProperties = function(options) {
|
27573 | var data = this.data, viewport = this.currentViewport = options.viewport, margin = options.margin;
|
27574 | this.currentViewport = viewport, this.margin = margin;
|
27575 | var width = viewport.width - (margin.left + margin.right), height = viewport.height - (margin.top + margin.bottom), extents = {
|
27576 | minY: 0,
|
27577 | maxY: 10,
|
27578 | minX: 0,
|
27579 | maxX: 10
|
27580 | };
|
27581 | this.playAxis ? (extents = this.playAxis.getCartesianExtents(extents, ScatterChart.getExtents),
|
27582 | this.playAxis.setPlayControlPosition(options.playAxisControlLayout)) : _.isEmpty(data.dataPoints) || (extents = ScatterChart.getExtents(data));
|
27583 | var xDomain = [ extents.minX, extents.maxX ], combinedXDomain = visuals.AxisHelper.combineDomain(options.forcedXDomain, xDomain, options.ensureXDomain);
|
27584 | this.xAxisProperties = visuals.AxisHelper.createAxis({
|
27585 | pixelSpan: width,
|
27586 | dataDomain: combinedXDomain,
|
27587 | metaDataColumn: data.xCol,
|
27588 | formatString: visuals.valueFormatter.getFormatString(data.xCol, visuals.scatterChartProps.general.formatString),
|
27589 | outerPadding: 0,
|
27590 | isScalar: !0,
|
27591 | isVertical: !1,
|
27592 | forcedTickCount: options.forcedTickCount,
|
27593 | useTickIntervalForDisplayUnits: !0,
|
27594 | isCategoryAxis: !0,
|
27595 | scaleType: options.categoryAxisScaleType,
|
27596 | axisDisplayUnits: options.categoryAxisDisplayUnits,
|
27597 | axisPrecision: options.categoryAxisPrecision
|
27598 | }), this.xAxisProperties.axis.tickSize(-height, 0), this.xAxisProperties.axisLabel = this.data.axesLabels.x;
|
27599 | var combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, [ extents.minY, extents.maxY ], options.ensureYDomain);
|
27600 | return this.yAxisProperties = visuals.AxisHelper.createAxis({
|
27601 | pixelSpan: height,
|
27602 | dataDomain: combinedDomain,
|
27603 | metaDataColumn: data.yCol,
|
27604 | formatString: visuals.valueFormatter.getFormatString(data.yCol, visuals.scatterChartProps.general.formatString),
|
27605 | outerPadding: 0,
|
27606 | isScalar: !0,
|
27607 | isVertical: !0,
|
27608 | forcedTickCount: options.forcedTickCount,
|
27609 | useTickIntervalForDisplayUnits: !0,
|
27610 | isCategoryAxis: !1,
|
27611 | scaleType: options.valueAxisScaleType,
|
27612 | axisDisplayUnits: options.valueAxisDisplayUnits,
|
27613 | axisPrecision: options.valueAxisPrecision
|
27614 | }), this.yAxisProperties.axisLabel = this.data.axesLabels.y, [ this.xAxisProperties, this.yAxisProperties ];
|
27615 | }, ScatterChart.prototype.overrideXScale = function(xProperties) {
|
27616 | this.xAxisProperties = xProperties;
|
27617 | }, ScatterChart.prototype.render = function(suppressAnimations, resizeMode) {
|
27618 | if (this.data) {
|
27619 | var data = this.data, margin = this.margin, viewport = this.currentViewport, hasSelection = this.interactivityService && this.interactivityService.hasSelection(), plotArea = {
|
27620 | width: viewport.width - (margin.left + margin.right),
|
27621 | height: viewport.height - (margin.top + margin.bottom)
|
27622 | }, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
27623 | this.playAxis && this.playAxis.isCurrentlyPlaying() && (this.isMobileChart || duration > 0) && (duration = visuals.PlayChart.FrameAnimationDuration);
|
27624 | 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 = {
|
27625 | data: data,
|
27626 | drawBubbles: drawBubbles,
|
27627 | isPlay: !!this.playAxis,
|
27628 | xAxisProperties: this.xAxisProperties,
|
27629 | yAxisProperties: this.yAxisProperties,
|
27630 | viewport: plotArea,
|
27631 | hasSelection: hasSelection,
|
27632 | animationDuration: duration,
|
27633 | animationOptions: this.options.animation,
|
27634 | fillMarkers: fillMarkers,
|
27635 | easeType: easeType,
|
27636 | suppressDataPointRendering: suppressDataPointRendering
|
27637 | };
|
27638 | if (drawBubbles) {
|
27639 | var sortedData = data.dataPoints.sort(ScatterChart.sortBubbles);
|
27640 | viewModel.data = powerbi.Prototype.inherit(viewModel.data), viewModel.data.dataPoints = sortedData;
|
27641 | }
|
27642 | var labelDataPoints = [];
|
27643 | (data.dataLabelsSettings && data.dataLabelsSettings.show || data.dataLabelsSettings.showCategory) && (labelDataPoints = ScatterChartDataLabels.createLabelDataPoints(viewModel));
|
27644 | var behaviorOptions = this.renderer.render(viewModel, this.interactivityService);
|
27645 | this.isMobileChart && (behaviorOptions = {
|
27646 | data: behaviorOptions.data,
|
27647 | dataPointsSelection: behaviorOptions.dataPointsSelection,
|
27648 | eventGroup: behaviorOptions.eventGroup,
|
27649 | plotContext: behaviorOptions.plotContext,
|
27650 | host: this.cartesianVisualHost,
|
27651 | root: this.svg,
|
27652 | visualInitOptions: this.options,
|
27653 | xAxisProperties: this.xAxisProperties,
|
27654 | yAxisProperties: this.yAxisProperties,
|
27655 | background: d3.select(this.element.get(0))
|
27656 | });
|
27657 | var playRenderResult;
|
27658 | if (this.playAxis && (playRenderResult = this.playAxis.render(suppressAnimations, viewModel, viewport, margin),
|
27659 | this.interactivityService)) {
|
27660 | var playBehaviorOptions = {
|
27661 | traceLineRenderer: this.renderer.createTraceLineRenderer(playRenderResult.viewModel)
|
27662 | };
|
27663 | hasSelection && visuals.PlayChart.renderTraceLines(playRenderResult.allDataPoints, playBehaviorOptions.traceLineRenderer, !suppressAnimations),
|
27664 | behaviorOptions.playOptions = playBehaviorOptions;
|
27665 | }
|
27666 | return {
|
27667 | dataPoints: playRenderResult ? playRenderResult.allDataPoints : data.dataPoints,
|
27668 | behaviorOptions: behaviorOptions,
|
27669 | labelDataPoints: labelDataPoints,
|
27670 | labelsAreNumeric: !1
|
27671 | };
|
27672 | }
|
27673 | }, ScatterChart.getStrokeFill = function(d, colorBorder) {
|
27674 | if (null != d.size && colorBorder) {
|
27675 | var colorRgb = Color.parseColorString(d.fill);
|
27676 | return Color.hexString(Color.darken(colorRgb, ScatterChart.StrokeDarkenColorValue));
|
27677 | }
|
27678 | return d.fill;
|
27679 | }, ScatterChart.getBubblePixelAreaSizeRange = function(viewPort, minSizeRange, maxSizeRange) {
|
27680 | var ratio = 1;
|
27681 | if (viewPort.height > 0 && viewPort.width > 0) {
|
27682 | var minSize = Math.min(viewPort.height, viewPort.width);
|
27683 | ratio = minSize * minSize / ScatterChart.AreaOf300By300Chart;
|
27684 | }
|
27685 | var minRange = Math.round(minSizeRange * ratio), maxRange = Math.round(maxSizeRange * ratio);
|
27686 | return {
|
27687 | minRange: minRange,
|
27688 | maxRange: maxRange,
|
27689 | delta: maxRange - minRange
|
27690 | };
|
27691 | }, ScatterChart.project = function(value, actualSizeDataRange, bubblePixelAreaSizeRange) {
|
27692 | if (0 === actualSizeDataRange.delta || 0 === bubblePixelAreaSizeRange.delta) return ScatterChart.rangeContains(actualSizeDataRange, value) ? bubblePixelAreaSizeRange.minRange : null;
|
27693 | var relativeX = (value - actualSizeDataRange.minRange) / actualSizeDataRange.delta;
|
27694 | return bubblePixelAreaSizeRange.minRange + relativeX * bubblePixelAreaSizeRange.delta;
|
27695 | }, ScatterChart.projectSizeToPixels = function(size, actualSizeDataRange, bubblePixelAreaSizeRange) {
|
27696 | var projectedSize = 0;
|
27697 | if (actualSizeDataRange) {
|
27698 | if (projectedSize = bubblePixelAreaSizeRange.maxRange, 0 !== actualSizeDataRange.delta) {
|
27699 | var value = Math.min(Math.max(size, actualSizeDataRange.minRange), actualSizeDataRange.maxRange);
|
27700 | projectedSize = ScatterChart.project(value, actualSizeDataRange, bubblePixelAreaSizeRange);
|
27701 | }
|
27702 | projectedSize = 2 * Math.sqrt(projectedSize / Math.PI);
|
27703 | }
|
27704 | return Math.round(projectedSize);
|
27705 | }, ScatterChart.rangeContains = function(range, value) {
|
27706 | return range.minRange <= value && value <= range.maxRange;
|
27707 | }, ScatterChart.getMarkerFillOpacity = function(hasSize, shouldEnableFill, hasSelection, isSelected) {
|
27708 | return hasSize || shouldEnableFill ? hasSelection && !isSelected ? ScatterChart.DimmedBubbleOpacity : ScatterChart.DefaultBubbleOpacity : 0;
|
27709 | }, ScatterChart.getMarkerStrokeOpacity = function(hasSize, colorBorder, hasSelection, isSelected) {
|
27710 | return hasSize && colorBorder ? 1 : hasSelection && !isSelected ? ScatterChart.DimmedBubbleOpacity : ScatterChart.DefaultBubbleOpacity;
|
27711 | }, ScatterChart.getMarkerStrokeFill = function(hasSize, colorBorder, fill) {
|
27712 | if (hasSize && colorBorder) {
|
27713 | var colorRgb = Color.parseColorString(fill);
|
27714 | return Color.hexString(Color.darken(colorRgb, ScatterChart.StrokeDarkenColorValue));
|
27715 | }
|
27716 | return fill;
|
27717 | }, ScatterChart.getMarkerStyle = function(d, colorBorder, hasSelection, fillMarkers) {
|
27718 | return {
|
27719 | "stroke-opacity": ScatterChart.getMarkerStrokeOpacity(null != d.size, colorBorder, hasSelection, d.selected),
|
27720 | stroke: ScatterChart.getMarkerStrokeFill(null != d.size, colorBorder, d.fill),
|
27721 | fill: d.fill,
|
27722 | "fill-opacity": ScatterChart.getMarkerFillOpacity(null != d.size, fillMarkers, hasSelection, d.selected)
|
27723 | };
|
27724 | }, ScatterChart.getSeriesStyle = function(hasSize, colorBorder, hasSelection, fillMarkers, fill) {
|
27725 | return {
|
27726 | "stroke-opacity": ScatterChart.getMarkerStrokeOpacity(hasSize, colorBorder, hasSelection, !1),
|
27727 | stroke: ScatterChart.getMarkerStrokeFill(hasSize, colorBorder, fill),
|
27728 | fill: fill,
|
27729 | "fill-opacity": ScatterChart.getMarkerFillOpacity(hasSize, fillMarkers, hasSelection, !1)
|
27730 | };
|
27731 | }, ScatterChart.getBubbleOpacity = function(d, hasSelection) {
|
27732 | return hasSelection && !d.selected ? ScatterChart.DimmedBubbleOpacity : ScatterChart.DefaultBubbleOpacity;
|
27733 | }, ScatterChart.prototype.onClearSelection = function() {
|
27734 | this.interactivityService && this.interactivityService.clearSelection();
|
27735 | }, ScatterChart.prototype.getSupportedCategoryAxisType = function() {
|
27736 | return visuals.axisType.scalar;
|
27737 | }, ScatterChart.sortBubbles = function(a, b) {
|
27738 | var diff = b.radius.sizeMeasure.values[b.radius.index] - a.radius.sizeMeasure.values[a.radius.index];
|
27739 | return 0 !== diff ? diff : b.identity.getKey().localeCompare(a.identity.getKey());
|
27740 | }, ScatterChart.BubbleRadius = 6, ScatterChart.DefaultBubbleOpacity = .85, ScatterChart.DimmedBubbleOpacity = .4,
|
27741 | ScatterChart.StrokeDarkenColorValue = 63.75, ScatterChart.dataLabelLayoutStartingOffset = 2,
|
27742 | ScatterChart.dataLabelLayoutOffsetIterationDelta = 6, ScatterChart.dataLabelLayoutMaximumOffset = ScatterChart.dataLabelLayoutStartingOffset + 2 * ScatterChart.dataLabelLayoutOffsetIterationDelta,
|
27743 | ScatterChart.AreaOf300By300Chart = 9e4, ScatterChart.MinSizeRange = 200, ScatterChart.MaxSizeRange = 3e3,
|
27744 | ScatterChart.ClassName = "scatterChart", ScatterChart.NoAnimationThreshold = 1e3,
|
27745 | ScatterChart.NoRenderResizeThreshold = 1e3, ScatterChart;
|
27746 | }();
|
27747 | visuals.ScatterChart = ScatterChart;
|
27748 | var ScatterChartDataLabels, SvgRenderer = function() {
|
27749 | function SvgRenderer() {}
|
27750 | return SvgRenderer.prototype.init = function(element, labelsContext, isMobileChart, tooltipsEnabled) {
|
27751 | this.mainGraphicsG = element.append("g").classed(SvgRenderer.MainGraphicsContext["class"], !0),
|
27752 | this.isMobileChart = isMobileChart, isMobileChart && (this.mainGraphicsBackgroundRect = this.mainGraphicsG.append("rect").classed("backgroundRect", !0).attr({
|
27753 | width: "100%",
|
27754 | height: "100%"
|
27755 | })), this.mainGraphicsContext = this.mainGraphicsG.append("svg"), this.labelGraphicsContext = labelsContext,
|
27756 | this.tooltipsEnabled = tooltipsEnabled, this.mainGraphicsContext.attr("stroke-width", "1");
|
27757 | }, SvgRenderer.prototype.render = function(viewModel, interactivityService) {
|
27758 | var viewport = viewModel.viewport;
|
27759 | this.mainGraphicsContext.attr({
|
27760 | width: viewport.width,
|
27761 | height: viewport.height
|
27762 | });
|
27763 | var scatterMarkers;
|
27764 | return scatterMarkers = viewModel.suppressDataPointRendering ? this.removeScatterMarkers() : viewModel.animationDuration > 0 && viewModel.data.dataPoints.length <= ScatterChart.NoAnimationThreshold ? this.drawScatterMarkers(viewModel) : this.drawScatterMarkersNoAnimation(viewModel, viewModel.drawBubbles),
|
27765 | viewModel.drawBubbles && scatterMarkers.order(), this.tooltipsEnabled && visuals.TooltipManager.addTooltip(this.mainGraphicsContext, function(tooltipEvent) {
|
27766 | return tooltipEvent.data.tooltipInfo;
|
27767 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(viewModel.animationOptions), {
|
27768 | dataPointsSelection: scatterMarkers,
|
27769 | eventGroup: this.mainGraphicsG,
|
27770 | data: viewModel.data,
|
27771 | plotContext: this.mainGraphicsContext
|
27772 | };
|
27773 | }, SvgRenderer.prototype.createTraceLineRenderer = function(viewModel) {
|
27774 | return new ScatterTraceLineRenderer(viewModel, this.mainGraphicsContext, this.tooltipsEnabled);
|
27775 | }, SvgRenderer.prototype.removeScatterMarkers = function() {
|
27776 | return this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).remove(),
|
27777 | this.mainGraphicsContext.selectAll(SvgRenderer.DotClass.selector);
|
27778 | }, SvgRenderer.prototype.drawScatterMarkers = function(viewModel) {
|
27779 | var data = viewModel.data, xScale = viewModel.xAxisProperties.scale, yScale = viewModel.yAxisProperties.scale, fakeDataPointSeries = [ {
|
27780 | identityKey: "",
|
27781 | dataPoints: data.dataPoints
|
27782 | } ], fakeSeriesGroups = this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).data(fakeDataPointSeries, function(s) {
|
27783 | return s.identityKey;
|
27784 | });
|
27785 | fakeSeriesGroups.enter().append("g").classed(SvgRenderer.ScatterMarkerSeriesGroup["class"], !0),
|
27786 | fakeSeriesGroups.exit().remove();
|
27787 | var markers = fakeSeriesGroups.selectAll(SvgRenderer.DotClass.selector).data(function(s) {
|
27788 | return s.dataPoints;
|
27789 | }, function(d) {
|
27790 | return d.identity.getKey();
|
27791 | });
|
27792 | return markers.enter().append("circle").classed(SvgRenderer.DotClass["class"], !0).style("opacity", 0).attr("r", 0),
|
27793 | markers.style({
|
27794 | "stroke-opacity": function(d) {
|
27795 | return ScatterChart.getMarkerStrokeOpacity(null != d.size, data.colorBorder, viewModel.hasSelection, d.selected);
|
27796 | },
|
27797 | stroke: function(d) {
|
27798 | return ScatterChart.getStrokeFill(d, data.colorBorder);
|
27799 | },
|
27800 | fill: function(d) {
|
27801 | return d.fill;
|
27802 | },
|
27803 | "fill-opacity": function(d) {
|
27804 | return ScatterChart.getMarkerFillOpacity(null != d.size, viewModel.fillMarkers, viewModel.hasSelection, d.selected);
|
27805 | }
|
27806 | }).transition().ease(viewModel.easeType).duration(viewModel.animationDuration).style("opacity", 1).attr({
|
27807 | r: function(d) {
|
27808 | return ScatterChart.getBubbleRadius(d.radius, data.sizeRange, viewModel.viewport);
|
27809 | },
|
27810 | cx: function(d) {
|
27811 | return xScale(d.x);
|
27812 | },
|
27813 | cy: function(d) {
|
27814 | return yScale(d.y);
|
27815 | }
|
27816 | }), markers.exit().transition().ease(viewModel.easeType).duration(viewModel.animationDuration).style("opacity", 0).attr("r", 0).remove(),
|
27817 | markers;
|
27818 | }, SvgRenderer.prototype.drawScatterMarkersNoAnimation = function(viewModel, isBubble) {
|
27819 | var seriesGroups, data = viewModel.data, xScale = viewModel.xAxisProperties.scale, yScale = viewModel.yAxisProperties.scale;
|
27820 | if (isBubble) {
|
27821 | var fakeDataPointSeries = [ {
|
27822 | identityKey: "",
|
27823 | dataPoints: data.dataPoints
|
27824 | } ];
|
27825 | seriesGroups = this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).data(fakeDataPointSeries, function(s) {
|
27826 | return s.identityKey;
|
27827 | });
|
27828 | } else seriesGroups = this.mainGraphicsContext.selectAll(SvgRenderer.ScatterMarkerSeriesGroup.selector).data(data.dataPointSeries, function(s) {
|
27829 | return s.identityKey;
|
27830 | });
|
27831 | return seriesGroups.enter().append("g").classed(SvgRenderer.ScatterMarkerSeriesGroup["class"], !0),
|
27832 | seriesGroups.exit().remove(), seriesGroups.each(function(s) {
|
27833 | var seriesStyle = ScatterChart.getSeriesStyle(s.hasSize, data.colorBorder, viewModel.hasSelection, viewModel.fillMarkers, s.fill), g = d3.select(this);
|
27834 | SvgRenderer.applyStyle(this, seriesStyle);
|
27835 | var markers = g.selectAll(SvgRenderer.DotClass.selector).data(s.dataPoints, function(m) {
|
27836 | return m.identity.getKey();
|
27837 | });
|
27838 | markers.enter().append("circle").classed(SvgRenderer.DotClass["class"], !0), markers.exit().remove(),
|
27839 | markers.each(function(d) {
|
27840 | var style = ScatterChart.getMarkerStyle(d, data.colorBorder, viewModel.hasSelection, viewModel.fillMarkers);
|
27841 | SvgRenderer.styleException(style, seriesStyle), SvgRenderer.applyStyle(this, style);
|
27842 | }), markers.attr({
|
27843 | r: function(d) {
|
27844 | return ScatterChart.getBubbleRadius(d.radius, data.sizeRange, viewModel.viewport);
|
27845 | },
|
27846 | cx: function(d) {
|
27847 | return xScale(d.x);
|
27848 | },
|
27849 | cy: function(d) {
|
27850 | return yScale(d.y);
|
27851 | }
|
27852 | });
|
27853 | }), this.mainGraphicsContext.selectAll(SvgRenderer.DotClass.selector);
|
27854 | }, SvgRenderer.styleException = function(elementStyle, seriesStyle) {
|
27855 | if (seriesStyle) for (var name_1 in elementStyle) elementStyle[name_1] === seriesStyle[name_1] && (elementStyle[name_1] = null);
|
27856 | }, SvgRenderer.applyStyle = function(element, style) {
|
27857 | for (var name_2 in style) {
|
27858 | var elementValue = element.style[name_2], styleValue = style[name_2];
|
27859 | if (null == styleValue) {
|
27860 | if ("" === elementValue) continue;
|
27861 | } else if (styleValue = styleValue.toString(), styleValue === elementValue) continue;
|
27862 | element.style[name_2] = styleValue;
|
27863 | }
|
27864 | }, SvgRenderer.DotClass = createClassAndSelector("dot"), SvgRenderer.MainGraphicsContext = createClassAndSelector("mainGraphicsContext"),
|
27865 | SvgRenderer.ScatterMarkerSeriesGroup = createClassAndSelector("scatterMarkerSeriesGroup"),
|
27866 | SvgRenderer;
|
27867 | }();
|
27868 | !function(ScatterChartDataLabels) {
|
27869 | function createLabelDataPoints(viewModel) {
|
27870 | 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_5 = dataPoints; _i < dataPoints_5.length; _i++) {
|
27871 | var dataPoint = dataPoints_5[_i], text = dataPoint.formattedCategory.getValue(), properties = {
|
27872 | text: text,
|
27873 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
27874 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
27875 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
27876 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties);
|
27877 | labelDataPoints.push({
|
27878 | isPreferred: preferredLabelsKeys ? isLabelPreferred(dataPoint.identity.getKey(), preferredLabelsKeys) : !1,
|
27879 | text: text,
|
27880 | textSize: {
|
27881 | width: textWidth,
|
27882 | height: textHeight
|
27883 | },
|
27884 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor,
|
27885 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
27886 | parentType: 0,
|
27887 | parentShape: {
|
27888 | point: {
|
27889 | x: xScale(dataPoint.x),
|
27890 | y: yScale(dataPoint.y)
|
27891 | },
|
27892 | radius: ScatterChart.getBubbleRadius(dataPoint.radius, sizeRange, viewModel.viewport),
|
27893 | validPositions: validLabelPositions
|
27894 | },
|
27895 | identity: dataPoint.identity,
|
27896 | fontSize: labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt
|
27897 | });
|
27898 | }
|
27899 | return labelDataPoints;
|
27900 | }
|
27901 | function getPreferredLabelsKeys(viewModel) {
|
27902 | var width = viewModel.viewport.width, height = viewModel.viewport.height, visualCenter = new visuals.Point(width / 2, height / 2), quadrantsCenters = getQuadrantsCenters(width, height);
|
27903 | return getCandidateLabels(visualCenter, quadrantsCenters, viewModel);
|
27904 | }
|
27905 | function getQuadrantsCenters(visualWidth, visualHeight) {
|
27906 | var quadrantsCenters = [], quarterWidth = visualWidth / 4, quarterHeight = visualHeight / 4;
|
27907 | return quadrantsCenters.push(new visuals.Point(quarterWidth, quarterHeight)), quadrantsCenters.push(new visuals.Point(3 * quarterWidth, quarterHeight)),
|
27908 | quadrantsCenters.push(new visuals.Point(quarterWidth, 3 * quarterHeight)), quadrantsCenters.push(new visuals.Point(3 * quarterWidth, 3 * quarterHeight)),
|
27909 | quadrantsCenters;
|
27910 | }
|
27911 | function getCandidateLabels(visualCenter, quadrantsCenters, viewModel) {
|
27912 | 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++) {
|
27913 | var dp = _a[_i], x = xScale(dp.x), y = yScale(dp.y), quadrantNumber = getPointQuadrantNumber(x, y, visualCenter);
|
27914 | viewModel.drawBubbles ? ids[quadrantNumber] || (ids[quadrantNumber] = dp.identity) : (distance = getDistanceBetweenPoints(quadrantsCenters[quadrantNumber].x, quadrantsCenters[quadrantNumber].y, x, y),
|
27915 | distance < minDistances[quadrantNumber] && (ids[quadrantNumber] = dp.identity, minDistances[quadrantNumber] = distance));
|
27916 | }
|
27917 | for (var preferredLabelsKeys = [], _b = 0, ids_1 = ids; _b < ids_1.length; _b++) {
|
27918 | var id = ids_1[_b];
|
27919 | id && preferredLabelsKeys.push(id.getKey());
|
27920 | }
|
27921 | return preferredLabelsKeys;
|
27922 | }
|
27923 | function getPointQuadrantNumber(x, y, centerPoint) {
|
27924 | return x > centerPoint.x && y <= centerPoint.y ? 0 : x <= centerPoint.x && y <= centerPoint.y ? 1 : x <= centerPoint.x && y > centerPoint.y ? 2 : 3;
|
27925 | }
|
27926 | function getDistanceBetweenPoints(x1, y1, x2, y2) {
|
27927 | return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
|
27928 | }
|
27929 | function isLabelPreferred(key, preferredLabelsKeys) {
|
27930 | for (var _i = 0, preferredLabelsKeys_1 = preferredLabelsKeys; _i < preferredLabelsKeys_1.length; _i++) {
|
27931 | var preferredLabel = preferredLabelsKeys_1[_i];
|
27932 | if (0 === key.localeCompare(preferredLabel)) return !0;
|
27933 | }
|
27934 | return !1;
|
27935 | }
|
27936 | var validLabelPositions = [ 2, 1, 8, 4, 16, 32, 64, 128 ];
|
27937 | ScatterChartDataLabels.createLabelDataPoints = createLabelDataPoints;
|
27938 | }(ScatterChartDataLabels || (ScatterChartDataLabels = {}));
|
27939 | var ScatterTraceLineRenderer = function() {
|
27940 | function ScatterTraceLineRenderer(viewModel, element, tooltipsEnabled) {
|
27941 | this.viewModel = viewModel, this.element = element, this.tooltipsEnabled = tooltipsEnabled;
|
27942 | }
|
27943 | return ScatterTraceLineRenderer.prototype.remove = function() {
|
27944 | this.element.selectAll(ScatterTraceLineRenderer.TraceLine.selector).remove(), this.element.selectAll(ScatterTraceLineRenderer.TraceBubble.selector).remove();
|
27945 | }, ScatterTraceLineRenderer.prototype.render = function(selectedPoints, shouldAnimate) {
|
27946 | var viewModel = this.viewModel, scatterViewModel = viewModel.viewModel, seriesPoints = [];
|
27947 | if (_.isEmpty(selectedPoints) || scatterViewModel.suppressDataPointRendering) this.remove(); else {
|
27948 | for (var currentFrameIndex_1 = viewModel.data.currentFrameIndex, hasBubbleAtCurrentFrame = [], selectedIndex = 0, selectedLen = selectedPoints.length; selectedLen > selectedIndex; selectedIndex++) {
|
27949 | seriesPoints[selectedIndex] = [], hasBubbleAtCurrentFrame[selectedIndex] = !1;
|
27950 | for (var frameIndex = 0, frameLen = viewModel.data.allViewModels.length; frameLen > frameIndex && currentFrameIndex_1 >= frameIndex; frameIndex++) {
|
27951 | var value = _.find(viewModel.data.allViewModels[frameIndex].dataPoints, function(value, index) {
|
27952 | return value.identity.getKey() === selectedPoints[selectedIndex].identity.getKey();
|
27953 | });
|
27954 | null != value && (value.frameIndex = frameIndex, seriesPoints[selectedIndex].push(value),
|
27955 | frameIndex === currentFrameIndex_1 && (hasBubbleAtCurrentFrame[selectedIndex] = !0));
|
27956 | }
|
27957 | }
|
27958 | var xScale_1 = scatterViewModel.xAxisProperties.scale, yScale_1 = scatterViewModel.yAxisProperties.scale, line_1 = d3.svg.line().x(function(d) {
|
27959 | return xScale_1(d.x);
|
27960 | }).y(function(d) {
|
27961 | return yScale_1(d.y);
|
27962 | }).defined(function(d) {
|
27963 | return null !== d.x && null !== d.y;
|
27964 | }), traceLines = this.element.selectAll(ScatterTraceLineRenderer.TraceLine.selector).data(selectedPoints, function(sp) {
|
27965 | return sp.identity.getKey();
|
27966 | });
|
27967 | traceLines.enter().append("path").classed(ScatterTraceLineRenderer.TraceLine["class"], !0);
|
27968 | var previousLengths_1 = [], newLengths_1 = [], reverse_1 = !1;
|
27969 | traceLines.each(function(d, i) {
|
27970 | var existingPath = this, previousLength = existingPath.hasAttribute("d") ? existingPath.getTotalLength() : 0;
|
27971 | previousLengths_1.push(previousLength);
|
27972 | var tempSvgPath = $("<svg><path></path></svg>"), tempPath = $("path", tempSvgPath);
|
27973 | tempPath.attr("d", line_1(seriesPoints[i]));
|
27974 | var newLength = seriesPoints[i].length > 0 ? tempPath.get()[0].getTotalLength() : 0;
|
27975 | newLengths_1.push(newLength), reverse_1 = reverse_1 || previousLength > newLength;
|
27976 | }), reverse_1 ? shouldAnimate ? traceLines.transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).attr("stroke-dashoffset", function(d, i) {
|
27977 | return previousLengths_1[i] - newLengths_1[i];
|
27978 | }).transition().ease("linear").duration(1).delay(visuals.PlayChart.FrameAnimationDuration).style("stroke", function(d) {
|
27979 | return ScatterChart.getStrokeFill(d, !0);
|
27980 | }).attr({
|
27981 | d: function(d, i) {
|
27982 | return line_1(seriesPoints[i]);
|
27983 | },
|
27984 | "stroke-dasharray": function(d, i) {
|
27985 | return newLengths_1[i] + " " + newLengths_1[i];
|
27986 | },
|
27987 | "stroke-dashoffset": 0
|
27988 | }) : traceLines.style("stroke", function(d) {
|
27989 | return ScatterChart.getStrokeFill(d, !0);
|
27990 | }).attr({
|
27991 | d: function(d, i) {
|
27992 | return line_1(seriesPoints[i]);
|
27993 | },
|
27994 | "stroke-dasharray": function(d, i) {
|
27995 | return newLengths_1[i] + " " + newLengths_1[i];
|
27996 | },
|
27997 | "stroke-dashoffset": 0
|
27998 | }) : (traceLines.style("stroke", function(d) {
|
27999 | return ScatterChart.getStrokeFill(d, !0);
|
28000 | }).attr({
|
28001 | d: function(d, i) {
|
28002 | return line_1(seriesPoints[i]);
|
28003 | },
|
28004 | "stroke-dasharray": function(d, i) {
|
28005 | return newLengths_1[i] + " " + newLengths_1[i];
|
28006 | },
|
28007 | "stroke-dashoffset": function(d, i) {
|
28008 | return newLengths_1[i] - previousLengths_1[i];
|
28009 | }
|
28010 | }), shouldAnimate ? traceLines.transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).attr("stroke-dashoffset", 0) : traceLines.attr("stroke-dashoffset", 0)),
|
28011 | traceLines.exit().remove();
|
28012 | for (var circlePoints = [], selectedIndex_1 = 0; selectedIndex_1 < seriesPoints.length; selectedIndex_1++) {
|
28013 | var points = seriesPoints[selectedIndex_1], newPoints = hasBubbleAtCurrentFrame[selectedIndex_1] ? points.slice(0, points.length - 1) : points;
|
28014 | circlePoints = circlePoints.concat(newPoints);
|
28015 | }
|
28016 | var circles = this.element.selectAll(ScatterTraceLineRenderer.TraceBubble.selector).data(circlePoints, function(d) {
|
28017 | return d.identity.getKey() + d.x + d.y + d.size;
|
28018 | });
|
28019 | circles.enter().append("circle").style("opacity", 0).classed(ScatterTraceLineRenderer.TraceBubble["class"], !0),
|
28020 | circles.attr("cx", function(d) {
|
28021 | return xScale_1(d.x);
|
28022 | }).attr("cy", function(d) {
|
28023 | return yScale_1(d.y);
|
28024 | }).attr("r", function(d) {
|
28025 | return ScatterChart.getBubbleRadius(d.radius, viewModel.data.currentViewModel.sizeRange, viewModel.viewport);
|
28026 | }).style({
|
28027 | "stroke-opacity": function(d) {
|
28028 | return ScatterChart.getBubbleOpacity(d, !0);
|
28029 | },
|
28030 | stroke: function(d) {
|
28031 | return ScatterChart.getStrokeFill(d, viewModel.data.currentViewModel.colorBorder);
|
28032 | },
|
28033 | fill: function(d) {
|
28034 | return d.fill;
|
28035 | },
|
28036 | "fill-opacity": function(d) {
|
28037 | return null != d.size ? .2 + d.frameIndex / currentFrameIndex_1 * .6 : 0;
|
28038 | }
|
28039 | }).transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).style("opacity", 1),
|
28040 | circles.exit().transition().ease("linear").duration(visuals.PlayChart.FrameAnimationDuration).style("opacity", 0).remove(),
|
28041 | this.tooltipsEnabled && visuals.TooltipManager.addTooltip(circles, function(tooltipEvent) {
|
28042 | return tooltipEvent.data.tooltipInfo;
|
28043 | }), circles.sort(function(d1, d2) {
|
28044 | return d2.size - d1.size;
|
28045 | });
|
28046 | }
|
28047 | }, ScatterTraceLineRenderer.TraceLine = createClassAndSelector("traceLine"), ScatterTraceLineRenderer.TraceBubble = createClassAndSelector("traceBubble"),
|
28048 | ScatterTraceLineRenderer;
|
28049 | }();
|
28050 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28051 | }(powerbi || (powerbi = {}));
|
28052 |
|
28053 | var powerbi;
|
28054 |
|
28055 | !function(powerbi) {
|
28056 | var visuals;
|
28057 | !function(visuals) {
|
28058 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, createDataViewScopeIdentity = powerbi.data.createDataViewScopeIdentity, DataViewConcatenateCategoricalColumns = powerbi.data.DataViewConcatenateCategoricalColumns, DataViewMatrixUtils = powerbi.data.utils.DataViewMatrixUtils, SQExprBuilder = powerbi.data.SQExprBuilder, PlayAxis = function() {
|
28059 | function PlayAxis(options) {
|
28060 | options && (this.interactivityService = options.interactivityService);
|
28061 | }
|
28062 | return PlayAxis.prototype.init = function(options) {
|
28063 | var _this = this;
|
28064 | this.element = options.element, this.svg = options.svg, this.host = options.host,
|
28065 | this.isMobileChart = options.interactivity && options.interactivity.isInteractiveLegend,
|
28066 | this.interactivityService && (this.playControl = new PlayControl(this.element, function(frameIndex) {
|
28067 | return _this.moveToFrameAndRender(frameIndex);
|
28068 | }, this.isMobileChart), this.playControl.onPlay(function() {
|
28069 | return _this.play();
|
28070 | }));
|
28071 | }, PlayAxis.prototype.setData = function(dataView, visualConverter) {
|
28072 | if (dataView) {
|
28073 | if (this.ridiculousFlagForPersistProperties && dataView.metadata) return this.ridiculousFlagForPersistProperties = !1,
|
28074 | this.playData;
|
28075 | dataView.matrix || dataView.categorical ? this.playData = PlayChart.converter(dataView, visualConverter) : this.playData = PlayChart.getDefaultPlayData();
|
28076 | } else this.playData = PlayChart.getDefaultPlayData();
|
28077 | return this.lastViewport = void 0, this.playData;
|
28078 | }, PlayAxis.prototype.render = function(suppressAnimations, viewModel, viewport, margin) {
|
28079 | var playData = this.playData, resized = !this.lastViewport || this.lastViewport.height !== viewport.height || this.lastViewport.width !== viewport.width;
|
28080 | if (this.lastViewport = viewport, resized && this.stop(), playData) {
|
28081 | var playViewModel = {
|
28082 | data: this.playData,
|
28083 | viewModel: viewModel,
|
28084 | viewport: viewport
|
28085 | }, hasSelection = !1;
|
28086 | if (this.interactivityService) {
|
28087 | var data_5 = playData.currentViewModel;
|
28088 | this.interactivityService.applySelectionStateToData(data_5.dataPoints), hasSelection = this.interactivityService.hasSelection();
|
28089 | }
|
28090 | this.updateCallout(viewport, margin), this.playControl && resized && this.playControl.rebuild(playData, viewport);
|
28091 | var allDataPoints = playData.allViewModels.map(function(vm) {
|
28092 | return vm.dataPoints;
|
28093 | }), flatAllDataPoints = _.flatten(allDataPoints);
|
28094 | return {
|
28095 | allDataPoints: flatAllDataPoints,
|
28096 | viewModel: playViewModel
|
28097 | };
|
28098 | }
|
28099 | }, PlayAxis.prototype.updateCallout = function(viewport, margin) {
|
28100 | 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));
|
28101 | fontSize = Math.min(fontSize, 70);
|
28102 | var textProperties = {
|
28103 | fontSize: jsCommon.PixelConverter.toString(fontSize),
|
28104 | text: frameData[currentFrameIndex].text || "",
|
28105 | fontFamily: "wf_segoe-ui_normal"
|
28106 | }, textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(textProperties) - powerbi.TextMeasurementService.estimateSvgTextBaselineDelta(textProperties), calloutData = [];
|
28107 | if (currentFrameIndex < frameData.length && currentFrameIndex >= 0 && plotAreaHeight > textHeight) {
|
28108 | var maxTextWidth = plotAreaWidth - 2 * PlayAxis.calloutOffsetMultiplier * textHeight, calloutText = powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, maxTextWidth);
|
28109 | calloutData = [ calloutText ];
|
28110 | }
|
28111 | var callout = this.svg.selectAll(PlayAxis.PlayCallout.selector).data(calloutData);
|
28112 | callout.enter().append("text").classed(PlayAxis.PlayCallout["class"], !0), callout.text(function(d) {
|
28113 | return d;
|
28114 | }).attr({
|
28115 | x: plotAreaWidth - PlayAxis.calloutOffsetMultiplier * textHeight,
|
28116 | y: function() {
|
28117 | return textHeight;
|
28118 | }
|
28119 | }).style({
|
28120 | "font-size": fontSize + "px",
|
28121 | "text-anchor": "end"
|
28122 | }), callout.exit().remove();
|
28123 | }, PlayAxis.prototype.play = function() {
|
28124 | var playData = this.playData;
|
28125 | if (this.isPlaying) this.stop(); else if (this.playControl) {
|
28126 | this.isPlaying = !0, this.playControl.play();
|
28127 | var indexToShow = Math.round(this.playControl.getCurrentIndex());
|
28128 | indexToShow >= playData.allViewModels.length - 1 ? playData.currentFrameIndex = -1 : playData.currentFrameIndex = indexToShow - 1,
|
28129 | this.playNextFrame(playData);
|
28130 | }
|
28131 | }, PlayAxis.prototype.playNextFrame = function(playData, startFrame, endFrame) {
|
28132 | var _this = this;
|
28133 | if (!this.isPlaying) return void this.stop();
|
28134 | var nextFrame = playData.currentFrameIndex + 1;
|
28135 | null != startFrame && null != endFrame && (nextFrame = Math.abs(endFrame - startFrame + 1),
|
28136 | startFrame = nextFrame), nextFrame < playData.allViewModels.length && nextFrame > -1 ? (playData.currentFrameIndex = nextFrame,
|
28137 | playData.currentViewModel = playData.allViewModels[nextFrame], this.renderDelegate(playData.currentViewModel),
|
28138 | this.playControl.setFrame(nextFrame), nextFrame < playData.allViewModels.length && window.setTimeout(function() {
|
28139 | _this.playNextFrame(playData, startFrame, endFrame);
|
28140 | }, PlayChart.FrameStepDuration)) : this.stop();
|
28141 | }, PlayAxis.prototype.stop = function() {
|
28142 | this.playControl && this.playControl.pause(), this.isPlaying = !1;
|
28143 | }, PlayAxis.prototype.remove = function() {
|
28144 | this.playControl && this.playControl.remove(), d3.selectAll(PlayAxis.PlayCallout.selector).remove();
|
28145 | }, PlayAxis.prototype.setRenderFunction = function(fn) {
|
28146 | this.renderDelegate = fn;
|
28147 | }, PlayAxis.prototype.getCartesianExtents = function(existingExtents, getExtents) {
|
28148 | return this.playData && this.playData.allViewModels && this.playData.allViewModels.length > 0 ? PlayChart.getMinMaxForAllFrames(this.playData, getExtents) : existingExtents;
|
28149 | }, PlayAxis.prototype.setPlayControlPosition = function(playControlLayout) {
|
28150 | if (this.playControl) {
|
28151 | var container = this.playControl.getContainer();
|
28152 | container.css("left", playControlLayout.left ? playControlLayout.left + "px" : ""),
|
28153 | container.css("top", playControlLayout.top ? playControlLayout.top + "px" : "");
|
28154 | }
|
28155 | }, PlayAxis.prototype.moveToFrameAndRender = function(frameIndex) {
|
28156 | var playData = this.playData;
|
28157 | if (this.isPlaying = !1, playData && frameIndex >= 0 && frameIndex < playData.allViewModels.length && frameIndex !== playData.currentFrameIndex) {
|
28158 | playData.currentFrameIndex = frameIndex;
|
28159 | var data_6 = playData.allViewModels[frameIndex];
|
28160 | playData.currentViewModel = data_6, this.renderDelegate(data_6);
|
28161 | }
|
28162 | }, PlayAxis.prototype.isCurrentlyPlaying = function() {
|
28163 | return this.isPlaying;
|
28164 | }, PlayAxis.PlayCallout = createClassAndSelector("play-callout"), PlayAxis.calloutOffsetMultiplier = .3,
|
28165 | PlayAxis;
|
28166 | }();
|
28167 | visuals.PlayAxis = PlayAxis;
|
28168 | var PlayChart, PlayControl = function() {
|
28169 | function PlayControl(element, renderDelegate, isMobileChart) {
|
28170 | this.isMobileChart = isMobileChart, this.createSliderDOM(element), this.renderDelegate = renderDelegate;
|
28171 | }
|
28172 | return PlayControl.prototype.getContainer = function() {
|
28173 | return this.playAxisContainer;
|
28174 | }, PlayControl.prototype.remove = function() {
|
28175 | this.playAxisContainer && this.playAxisContainer.remove();
|
28176 | }, PlayControl.prototype.pause = function() {
|
28177 | this.playButton.removeClass("pause").addClass("play");
|
28178 | }, PlayControl.prototype.play = function() {
|
28179 | this.playButton.removeClass("play").addClass("pause");
|
28180 | }, PlayControl.prototype.getCurrentIndex = function() {
|
28181 | return Math.round(this.noUiSlider.get());
|
28182 | }, PlayControl.prototype.onPlay = function(handler) {
|
28183 | this.playButtonCircle.off("click"), this.playButtonCircle.on("click", handler);
|
28184 | }, PlayControl.prototype.setFrame = function(frameIndex) {
|
28185 | this.noUiSlider.set([ frameIndex ]);
|
28186 | }, PlayControl.prototype.rebuild = function(playData, viewport) {
|
28187 | var _this = this, slider = this.slider;
|
28188 | this.noUiSlider && this.noUiSlider.destroy();
|
28189 | var labelData = playData.labelData, sliderSize = PlayControl.calucalateSliderSize(labelData, viewport.width), container = this.getContainer();
|
28190 | sliderSize.marginLeft > PlayControl.SliderMarginLeft && (container.css("padding-left", sliderSize.marginLeft - PlayControl.SliderMarginLeft + "px"),
|
28191 | container.css("box-sizing", "border-box"));
|
28192 | var skipStep = this.updateSliderControl(playData, sliderSize.width), width = PlayControl.adjustWidthRegardingLastItem(labelData, skipStep, sliderSize.width);
|
28193 | this.slider.css("width", width + "px"), this.noUiSlider.on("slide", function() {
|
28194 | var indexToShow = _this.getCurrentIndex();
|
28195 | _this.renderDelegate(indexToShow);
|
28196 | });
|
28197 | var nextLabelIndex = 0;
|
28198 | $(".noUi-value", slider).each(function(idx, elem) {
|
28199 | var actualWidth = labelData.labelInfo[nextLabelIndex].labelWidth;
|
28200 | $(elem).width(actualWidth), $(elem).css("margin-left", -actualWidth / 2 + "px"),
|
28201 | nextLabelIndex += skipStep;
|
28202 | });
|
28203 | }, PlayControl.prototype.updateSliderControl = function(playData, sliderWidth) {
|
28204 | var labelData = playData.labelData, sliderElement = this.slider.get(0), numFrames = playData.frameData.length, options = {
|
28205 | start: 0 === numFrames ? 0 : playData.currentFrameIndex,
|
28206 | step: 1,
|
28207 | range: {
|
28208 | min: 0,
|
28209 | max: 0 === numFrames ? 0 : numFrames - 1
|
28210 | }
|
28211 | }, pipOptions = null, skipMode = 0;
|
28212 | if (numFrames > 0) {
|
28213 | var filterPipLabels = PlayControl.createPipsFilterFn(playData, sliderWidth, labelData);
|
28214 | skipMode = filterPipLabels.skipStep, pipOptions = {
|
28215 | mode: "steps",
|
28216 | density: Math.ceil(100 / numFrames),
|
28217 | format: {
|
28218 | to: function(index) {
|
28219 | return playData.frameData[index].escapedText;
|
28220 | },
|
28221 | from: function(value) {
|
28222 | return playData.frameData.indexOf(value);
|
28223 | }
|
28224 | },
|
28225 | filter: filterPipLabels.filter
|
28226 | };
|
28227 | }
|
28228 | return options.pips = pipOptions, noUiSlider.create(sliderElement, options), this.noUiSlider = sliderElement.noUiSlider,
|
28229 | skipMode;
|
28230 | }, PlayControl.createPipsFilterFn = function(playData, sliderWidth, labelData) {
|
28231 | var maxLabelWidth = _.max(_.map(labelData.labelInfo, function(l) {
|
28232 | return l.labelWidth;
|
28233 | })), pipSize = 1, skipMode = 1, maxAllowedLabelWidth = playData.frameData.length > 1 ? sliderWidth / (playData.frameData.length - 1) : sliderWidth, widthRatio = maxLabelWidth / maxAllowedLabelWidth;
|
28234 | widthRatio > 1.25 ? (skipMode = Math.ceil(widthRatio), pipSize = 2) : (widthRatio > 1 || labelData.anyWordBreaks) && (pipSize = 2);
|
28235 | var filterPipLabels = function(index, type) {
|
28236 | return index % skipMode === 0 ? pipSize : 0;
|
28237 | };
|
28238 | return {
|
28239 | filter: filterPipLabels,
|
28240 | skipStep: skipMode
|
28241 | };
|
28242 | }, PlayControl.adjustWidthRegardingLastItem = function(labelData, skipMode, sliderWidth) {
|
28243 | 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;
|
28244 | if (requiredWidth > 0) {
|
28245 | var maxMargin = PlayControl.SliderMaxMargin - PlayControl.SliderMarginRight;
|
28246 | return requiredWidth = requiredWidth > maxMargin ? maxMargin : requiredWidth, sliderWidth - requiredWidth;
|
28247 | }
|
28248 | return sliderWidth;
|
28249 | }, PlayControl.prototype.createSliderDOM = function(element) {
|
28250 | this.playAxisContainer = $('<div class="play-axis-container"></div>').appendTo(element).css("height", PlayControl.PlayControlHeight + "px"),
|
28251 | this.playButtonCircle = $('<div class="button-container"></div>').appendTo(this.playAxisContainer),
|
28252 | this.isMobileChart && this.playButtonCircle.addClass("mobile-button-container"),
|
28253 | this.playButton = $('<div class="play"></div>').appendTo(this.playButtonCircle),
|
28254 | this.slider = $('<div class="sliders"></div>').appendTo(this.playAxisContainer);
|
28255 | }, PlayControl.calucalateSliderSize = function(labelData, viewportWidth) {
|
28256 | var leftMargin = 0;
|
28257 | _.isEmpty(labelData.labelInfo) || (leftMargin = _.first(labelData.labelInfo).labelWidth / 2);
|
28258 | var sliderLeftMargin = Math.max(leftMargin, PlayControl.SliderMarginLeft);
|
28259 | sliderLeftMargin = Math.min(PlayControl.SliderMaxMargin, sliderLeftMargin);
|
28260 | var sliderWidth = Math.max(viewportWidth - sliderLeftMargin - PlayControl.SliderMarginRight, 1);
|
28261 | return {
|
28262 | width: sliderWidth,
|
28263 | marginLeft: sliderLeftMargin
|
28264 | };
|
28265 | }, PlayControl.SliderMarginLeft = 44, PlayControl.SliderMarginRight = 20, PlayControl.SliderMaxMargin = 100,
|
28266 | PlayControl.PlayControlHeight = 80, PlayControl;
|
28267 | }();
|
28268 | !function(PlayChart) {
|
28269 | function convertMatrixToCategorical(sourceDataView, frame) {
|
28270 | var matrix = sourceDataView.matrix, categorical = {
|
28271 | categories: [],
|
28272 | values: powerbi.data.DataViewTransform.createValueColumns()
|
28273 | };
|
28274 | if (_.isEmpty(matrix.columns.levels) || matrix.rows.levels.length < 2 && matrix.columns.levels.length < 2) return {
|
28275 | metadata: sourceDataView.metadata,
|
28276 | categorical: categorical
|
28277 | };
|
28278 | for (var CategoryRowLevelsStartingIndex = 1, categories = [], i_2 = CategoryRowLevelsStartingIndex, ilen = matrix.rows.levels.length; ilen > i_2; i_2++) {
|
28279 | var sourceColumn = matrix.rows.levels[i_2].sources[0];
|
28280 | categories.push({
|
28281 | source: sourceColumn,
|
28282 | values: [],
|
28283 | identity: [],
|
28284 | objects: void 0
|
28285 | });
|
28286 | }
|
28287 | 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;
|
28288 | if (hasSeries && !hasPlayAndCategory) {
|
28289 | categorical.categories = void 0;
|
28290 | var node = matrix.columns.root;
|
28291 | categorical.values.source = matrix.columns.levels[0].sources[0];
|
28292 | for (var columnLength_1 = matrix.valueSources.length, i_3 = 0, len_1 = node.children.length; len_1 > i_3; i_3++) for (var columnNode = node.children[i_3], j = 0; columnLength_1 > j; j++) {
|
28293 | var source = _.create(matrix.valueSources[j], {
|
28294 | groupName: void 0 === columnNode.value ? null : columnNode.value
|
28295 | }), dataViewColumn = {
|
28296 | identity: columnNode.identity,
|
28297 | values: [],
|
28298 | source: source
|
28299 | };
|
28300 | categorical.values.push(dataViewColumn);
|
28301 | }
|
28302 | 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);
|
28303 | } else if (hasSeries && hasRowChildren) {
|
28304 | var playFrameNode = matrix.rows.root.children[frame];
|
28305 | DataViewMatrixUtils.forEachLeafNode(playFrameNode.children, function(categoryGroupLeafNode, index, categoryHierarchicalGroupNodes) {
|
28306 | addMatrixHierarchicalGroupToCategories(categoryHierarchicalGroupNodes, categories);
|
28307 | }), categorical.categories = categories, categorical.values.source = matrix.columns.levels[0].sources[0];
|
28308 | for (var nodeQueue = [], columnNode = matrix.columns.root, seriesIndex_1 = -1; columnNode; ) {
|
28309 | 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) {
|
28310 | for (var columnLength = columnNode.children.length, j = 0; columnLength > j; j++) {
|
28311 | var source = _.create(matrix.valueSources[j], {
|
28312 | groupName: columnNode.value
|
28313 | }), dataViewColumn = {
|
28314 | identity: columnNode.identity,
|
28315 | values: [],
|
28316 | source: source
|
28317 | };
|
28318 | categorical.values.push(dataViewColumn);
|
28319 | }
|
28320 | DataViewMatrixUtils.forEachLeafNode(playFrameNode.children, function(leafNode) {
|
28321 | for (var j = 0; columnLength > j; j++) categorical.values[seriesIndex_1 * columnLength + j].values.push(leafNode.values[seriesIndex_1 * columnLength + j].value);
|
28322 | });
|
28323 | }
|
28324 | nodeQueue.length > 0 ? (columnNode = nodeQueue[0], nodeQueue = nodeQueue.splice(1),
|
28325 | seriesIndex_1++) : columnNode = void 0;
|
28326 | }
|
28327 | } else if (hasPlayAndCategory) {
|
28328 | for (var playFrameNode = matrix.rows.root.children[frame], measureLength_1 = matrix.valueSources.length, j = 0; measureLength_1 > j; j++) {
|
28329 | var dataViewColumn = {
|
28330 | identity: void 0,
|
28331 | values: [],
|
28332 | source: matrix.valueSources[j]
|
28333 | };
|
28334 | categorical.values.push(dataViewColumn);
|
28335 | }
|
28336 | DataViewMatrixUtils.forEachLeafNode(playFrameNode.children, function(categoryGroupLeafNode, index, categoryHierarchicalGroupNodes) {
|
28337 | addMatrixHierarchicalGroupToCategories(categoryHierarchicalGroupNodes, categories);
|
28338 | for (var j = 0; measureLength_1 > j; j++) categorical.values[j].values.push(categoryGroupLeafNode.values[j].value);
|
28339 | }), categorical.categories = categories;
|
28340 | }
|
28341 | return DataViewConcatenateCategoricalColumns.applyToPlayChartCategorical(sourceDataView.metadata, visuals.scatterChartCapabilities.objects, "Category", categorical);
|
28342 | }
|
28343 | function addMatrixHierarchicalGroupToCategories(sourceCategoryHierarchicalGroupNodes, destinationCategories) {
|
28344 | var identity = sourceCategoryHierarchicalGroupNodes[0].identity;
|
28345 | if (sourceCategoryHierarchicalGroupNodes.length > 1) {
|
28346 | for (var identityExpr = identity.expr, i = 1, ilen = sourceCategoryHierarchicalGroupNodes.length; ilen > i; i++) {
|
28347 | var identityExprToAdd = sourceCategoryHierarchicalGroupNodes[i].identity.expr;
|
28348 | identityExpr = SQExprBuilder.and(identityExpr, identityExprToAdd);
|
28349 | }
|
28350 | identity = createDataViewScopeIdentity(identityExpr);
|
28351 | }
|
28352 | for (var j = 0, jlen = destinationCategories.length; jlen > j; j++) {
|
28353 | destinationCategories[j].identity.push(identity);
|
28354 | var node = sourceCategoryHierarchicalGroupNodes[j];
|
28355 | destinationCategories[j].values.push(node.value);
|
28356 | }
|
28357 | }
|
28358 | function getObjectProperties(dataViewMetadata, dataLabelsSettings) {
|
28359 | var objectProperties = {};
|
28360 | if (dataViewMetadata && dataViewMetadata.objects) {
|
28361 | var objects = dataViewMetadata.objects;
|
28362 | objectProperties.currentFrameIndex = powerbi.DataViewObjects.getValue(objects, visuals.scatterChartProps.currentFrameIndex.index, null);
|
28363 | }
|
28364 | return objectProperties;
|
28365 | }
|
28366 | function converter(dataView, visualConverter) {
|
28367 | 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;
|
28368 | if (dataView.matrix && rowChildrenLength > 0 && !_.isEmpty(matrixRows.levels) && !_.isEmpty(matrixRows.levels[0].sources)) {
|
28369 | keySourceColumn = matrixRows.levels[0].sources[0];
|
28370 | var formatString = visuals.valueFormatter.getFormatString(keySourceColumn, visuals.scatterChartProps.general.formatString), keyFormatter = void 0;
|
28371 | if (keySourceColumn.type.numeric) {
|
28372 | var valueRange = Math.abs(matrixRows.root.children[rowChildrenLength - 1].value - matrixRows.root.children[0].value);
|
28373 | keyFormatter = visuals.valueFormatter.create({
|
28374 | format: formatString,
|
28375 | value: valueRange,
|
28376 | value2: 0
|
28377 | });
|
28378 | } else keyFormatter = visuals.valueFormatter.createDefaultFormatter(formatString, !0);
|
28379 | for (var i = 0, len = rowChildrenLength; len > i; i++) {
|
28380 | var key = matrixRows.root.children[i], frameLabelText = keyFormatter.format(key.value), frameLabelHtml = $("<div/>").text(frameLabelText).html();
|
28381 | frameKeys.push({
|
28382 | escapedText: frameLabelHtml,
|
28383 | text: frameLabelText
|
28384 | });
|
28385 | var dataViewCategorical = convertMatrixToCategorical(dataView, i), frameInfo = {
|
28386 | label: frameLabelHtml,
|
28387 | column: keySourceColumn
|
28388 | };
|
28389 | convertedData = visualConverter(dataViewCategorical, frameInfo), allViewModels.push(convertedData);
|
28390 | }
|
28391 | } else {
|
28392 | var dataViewCategorical = convertMatrixToCategorical(dataView, 0);
|
28393 | convertedData = visualConverter(dataViewCategorical), allViewModels.push(convertedData);
|
28394 | }
|
28395 | return objectProperties.currentFrameIndex = frameKeys.length - 1, {
|
28396 | allViewModels: allViewModels,
|
28397 | currentViewModel: convertedData,
|
28398 | frameData: frameKeys,
|
28399 | currentFrameIndex: objectProperties.currentFrameIndex,
|
28400 | labelData: getLabelData(frameKeys, keySourceColumn)
|
28401 | };
|
28402 | }
|
28403 | function getDefaultPlayData() {
|
28404 | var defaultData = {
|
28405 | frameData: [],
|
28406 | allViewModels: [],
|
28407 | currentFrameIndex: 0,
|
28408 | currentViewModel: void 0,
|
28409 | labelData: {
|
28410 | anyWordBreaks: !1,
|
28411 | labelInfo: []
|
28412 | }
|
28413 | };
|
28414 | return defaultData;
|
28415 | }
|
28416 | function getMinMaxForAllFrames(playData, getExtents) {
|
28417 | var extents = {
|
28418 | minY: 0,
|
28419 | maxY: 10,
|
28420 | minX: 0,
|
28421 | maxX: 10
|
28422 | };
|
28423 | if (playData.allViewModels && playData.allViewModels.length > 0) {
|
28424 | extents.minY = extents.minX = Number.MAX_VALUE, extents.maxY = extents.maxX = Number.MIN_VALUE;
|
28425 | for (var i = 0, len = playData.allViewModels.length; len > i; i++) {
|
28426 | var data_7 = playData.allViewModels[i], e = getExtents(data_7);
|
28427 | extents = {
|
28428 | minY: d3.min([ e.minY, extents.minY ]),
|
28429 | maxY: d3.max([ e.maxY, extents.maxY ]),
|
28430 | minX: d3.min([ e.minX, extents.minX ]),
|
28431 | maxX: d3.max([ e.maxX, extents.maxX ])
|
28432 | };
|
28433 | }
|
28434 | }
|
28435 | return extents;
|
28436 | }
|
28437 | function getLabelData(keys, keyColumn) {
|
28438 | for (var textProperties = {
|
28439 | fontFamily: "wf_segoe-ui_normal",
|
28440 | fontSize: jsCommon.PixelConverter.toString(14)
|
28441 | }, labelInfo = [], anyWordBreaks = !1, _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
28442 | var key = keys_1[_i], labelWidth = jsCommon.WordBreaker.getMaxWordWidth(key.escapedText, powerbi.TextMeasurementService.measureSvgTextWidth, textProperties);
|
28443 | anyWordBreaks = anyWordBreaks || jsCommon.WordBreaker.hasBreakers(key.escapedText) || key.escapedText.indexOf("-") > -1,
|
28444 | labelInfo.push({
|
28445 | label: key.escapedText,
|
28446 | labelWidth: labelWidth
|
28447 | });
|
28448 | }
|
28449 | return {
|
28450 | labelInfo: labelInfo,
|
28451 | anyWordBreaks: anyWordBreaks,
|
28452 | labelFieldName: keyColumn && keyColumn.displayName
|
28453 | };
|
28454 | }
|
28455 | function isDataViewPlayable(dataView, playRole) {
|
28456 | void 0 === playRole && (playRole = "Play");
|
28457 | 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;
|
28458 | return firstRowSourceRoles && firstRowSourceRoles[playRole];
|
28459 | }
|
28460 | function renderTraceLines(allDataPoints, traceLineRenderer, shouldAnimate) {
|
28461 | var selectedDataPoints = _.filter(allDataPoints, function(d) {
|
28462 | return d.selected;
|
28463 | });
|
28464 | selectedDataPoints = _.uniq(selectedDataPoints, function(d) {
|
28465 | return d.identity.getKey();
|
28466 | }), traceLineRenderer.render(selectedDataPoints, shouldAnimate);
|
28467 | }
|
28468 | PlayChart.FrameStepDuration = 800, PlayChart.FrameAnimationDuration = 750, PlayChart.ClassName = "playChart",
|
28469 | PlayChart.convertMatrixToCategorical = convertMatrixToCategorical, PlayChart.converter = converter,
|
28470 | PlayChart.getDefaultPlayData = getDefaultPlayData, PlayChart.getMinMaxForAllFrames = getMinMaxForAllFrames,
|
28471 | PlayChart.isDataViewPlayable = isDataViewPlayable, PlayChart.renderTraceLines = renderTraceLines;
|
28472 | }(PlayChart = visuals.PlayChart || (visuals.PlayChart = {}));
|
28473 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28474 | }(powerbi || (powerbi = {}));
|
28475 |
|
28476 | var powerbi;
|
28477 |
|
28478 | !function(powerbi) {
|
28479 | var visuals;
|
28480 | !function(visuals) {
|
28481 | var PixelConverter = jsCommon.PixelConverter, VerticalSlicerRenderer = function() {
|
28482 | function VerticalSlicerRenderer(options) {
|
28483 | this.textProperties = {
|
28484 | fontFamily: "wf_segoe-ui_normal, helvetica, arial, sans-serif",
|
28485 | fontSize: "14px"
|
28486 | }, options && (this.behavior = options.behavior), this.domHelper = options.domHelper;
|
28487 | }
|
28488 | return VerticalSlicerRenderer.prototype.getDefaultValue = function() {
|
28489 | return this.data && this.data.defaultValue ? this.data.defaultValue.value : void 0;
|
28490 | }, VerticalSlicerRenderer.prototype.getIdentityFields = function() {
|
28491 | return visuals.SlicerUtil.DefaultValueHandler.getIdentityFields(this.dataView);
|
28492 | }, VerticalSlicerRenderer.prototype.init = function(slicerInitOptions) {
|
28493 | var _this = this;
|
28494 | this.element = slicerInitOptions.visualInitOptions.element, this.currentViewport = slicerInitOptions.visualInitOptions.viewport;
|
28495 | 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);
|
28496 | this.behavior && (interactivityService = visuals.createInteractivityService(hostServices));
|
28497 | var containerDiv = document.createElement("div");
|
28498 | containerDiv.className = Selectors.Container["class"];
|
28499 | var container = this.container = d3.select(containerDiv), header = domHelper.createSlicerHeader(hostServices);
|
28500 | containerDiv.appendChild(header), this.header = d3.select(header), this.body = container.append("div").classed(visuals.SlicerUtil.Selectors.Body["class"], !0).style({
|
28501 | height: PixelConverter.toString(bodyViewport.height),
|
28502 | width: PixelConverter.toString(bodyViewport.width)
|
28503 | });
|
28504 | var rowEnter = function(rowSelection) {
|
28505 | _this.onEnterSelection(rowSelection);
|
28506 | }, rowUpdate = function(rowSelection) {
|
28507 | _this.onUpdateSelection(rowSelection, interactivityService);
|
28508 | }, rowExit = function(rowSelection) {
|
28509 | rowSelection.remove();
|
28510 | }, listViewOptions = {
|
28511 | rowHeight: domHelper.getRowHeight(settings, this.textProperties),
|
28512 | enter: rowEnter,
|
28513 | exit: rowExit,
|
28514 | update: rowUpdate,
|
28515 | loadMoreData: function() {
|
28516 | return slicerInitOptions.loadMoreData();
|
28517 | },
|
28518 | scrollEnabled: !0,
|
28519 | viewport: domHelper.getSlicerBodyViewport(this.currentViewport, settings, this.textProperties),
|
28520 | baseContainer: this.body,
|
28521 | isReadMode: function() {
|
28522 | return 1 !== _this.hostServices.getViewMode();
|
28523 | }
|
28524 | };
|
28525 | return this.listView = visuals.ListViewFactory.createListView(listViewOptions),
|
28526 | this.element.get(0).appendChild(containerDiv), interactivityService;
|
28527 | }, VerticalSlicerRenderer.prototype.render = function(options) {
|
28528 | var data = this.data = options.data;
|
28529 | this.currentViewport = options.viewport;
|
28530 | var dataView = options.dataView;
|
28531 | if (!dataView || !data) return void this.listView.empty();
|
28532 | this.dataView = dataView;
|
28533 | var settings = this.settings = data.slicerSettings, domHelper = this.domHelper;
|
28534 | domHelper.updateSlicerBodyDimensions(this.currentViewport, this.body, settings),
|
28535 | this.updateSelectionStyle(), this.listView.viewport(domHelper.getSlicerBodyViewport(this.currentViewport, settings, this.textProperties)).rowHeight(domHelper.getRowHeight(settings, this.textProperties)).data(data.slicerDataPoints, function(d) {
|
28536 | return $.inArray(d, data.slicerDataPoints);
|
28537 | }, options.resetScrollbarPosition);
|
28538 | }, VerticalSlicerRenderer.prototype.updateSelectionStyle = function() {
|
28539 | var settings = this.settings;
|
28540 | this.container.classed("isMultiSelectEnabled", settings && settings.selection && !settings.selection.singleSelect);
|
28541 | }, VerticalSlicerRenderer.prototype.onEnterSelection = function(rowSelection) {
|
28542 | var settings = this.settings, listItemElement = rowSelection.append("li").classed(Selectors.ItemContainer["class"], !0), labelElement = listItemElement.append("div").classed(Selectors.Input["class"], !0);
|
28543 | labelElement.append("input").attr("type", "checkbox"), labelElement.append("span").classed(Selectors.Checkbox["class"], !0),
|
28544 | listItemElement.each(function(d, i) {
|
28545 | var item = d3.select(this);
|
28546 | d.isImage ? item.append("img").classed(visuals.SlicerUtil.Selectors.LabelImage["class"], !0) : item.append("span").classed(visuals.SlicerUtil.Selectors.LabelText["class"], !0),
|
28547 | null != d.count && item.append("span").classed(visuals.SlicerUtil.Selectors.CountText["class"], !0).style("font-size", PixelConverter.fromPoint(settings.slicerText.textSize));
|
28548 | });
|
28549 | }, VerticalSlicerRenderer.prototype.onUpdateSelection = function(rowSelection, interactivityService) {
|
28550 | var settings = this.settings, data = this.data;
|
28551 | if (data && settings) {
|
28552 | var domHelper = this.domHelper;
|
28553 | domHelper.styleSlicerHeader(this.header, settings, data.categorySourceName), this.header.attr("title", data.categorySourceName);
|
28554 | var labelText = rowSelection.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector);
|
28555 | labelText.text(function(d) {
|
28556 | return d.value;
|
28557 | }).attr("title", function(d) {
|
28558 | return d.tooltip;
|
28559 | }), domHelper.setSlicerTextStyle(labelText, settings);
|
28560 | var labelImage = rowSelection.selectAll(visuals.SlicerUtil.Selectors.LabelImage.selector);
|
28561 | labelImage.empty() || labelImage.attr("src", function(d) {
|
28562 | return d.value;
|
28563 | });
|
28564 | var countText = rowSelection.selectAll(visuals.SlicerUtil.Selectors.CountText.selector);
|
28565 | if (countText.empty() || (countText.text(function(d) {
|
28566 | return d.count;
|
28567 | }), domHelper.setSlicerTextStyle(countText, settings)), interactivityService && this.body) {
|
28568 | 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), behaviorOptions = {
|
28569 | dataPoints: data.slicerDataPoints,
|
28570 | slicerContainer: this.container,
|
28571 | itemContainers: slicerItemContainers,
|
28572 | itemLabels: slicerItemLabels,
|
28573 | itemInputs: slicerItemInputs,
|
28574 | clear: slicerClear,
|
28575 | interactivityService: interactivityService,
|
28576 | settings: data.slicerSettings
|
28577 | }, orientationBehaviorOptions = {
|
28578 | behaviorOptions: behaviorOptions,
|
28579 | orientation: 0
|
28580 | };
|
28581 | interactivityService.bind(data.slicerDataPoints, this.behavior, orientationBehaviorOptions, {
|
28582 | overrideSelectionFromData: !0,
|
28583 | hasSelectionOverride: data.hasSelectionOverride,
|
28584 | slicerDefaultValueHandler: this
|
28585 | }), visuals.SlicerWebBehavior.styleSlicerItems(rowSelection.select(Selectors.Input.selector), data.hasSelectionOverride, interactivityService.isSelectionModeInverted());
|
28586 | } else visuals.SlicerWebBehavior.styleSlicerItems(rowSelection.select(Selectors.Input.selector), !1, !1);
|
28587 | }
|
28588 | }, VerticalSlicerRenderer;
|
28589 | }();
|
28590 | visuals.VerticalSlicerRenderer = VerticalSlicerRenderer;
|
28591 | var Selectors;
|
28592 | !function(Selectors) {
|
28593 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector;
|
28594 | Selectors.Container = createClassAndSelector("slicerContainer"), Selectors.ItemContainer = createClassAndSelector("slicerItemContainer"),
|
28595 | Selectors.Input = createClassAndSelector("slicerCheckbox"), Selectors.Checkbox = createClassAndSelector("checkbox");
|
28596 | }(Selectors || (Selectors = {}));
|
28597 | var CheckboxSprite;
|
28598 | !function(CheckboxSprite) {
|
28599 | CheckboxSprite.MinimumSize = 8, CheckboxSprite.Size = 13, CheckboxSprite.SizeRange = CheckboxSprite.Size - CheckboxSprite.MinimumSize;
|
28600 | }(CheckboxSprite || (CheckboxSprite = {}));
|
28601 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28602 | }(powerbi || (powerbi = {}));
|
28603 |
|
28604 | var powerbi;
|
28605 |
|
28606 | !function(powerbi) {
|
28607 | var visuals;
|
28608 | !function(visuals) {
|
28609 | var PixelConverter = jsCommon.PixelConverter, ItemWidthSampleSize = 50, MinTextWidth = 80, LoadMoreDataThreshold = .8, DefaultStyleProperties = {
|
28610 | labelText: {
|
28611 | marginRight: 2,
|
28612 | paddingLeft: 8,
|
28613 | paddingRight: 8
|
28614 | }
|
28615 | }, HorizontalSlicerRenderer = function() {
|
28616 | function HorizontalSlicerRenderer(options) {
|
28617 | this.textProperties = {
|
28618 | fontFamily: "wf_segoe-ui_normal",
|
28619 | fontSize: "14px"
|
28620 | }, options && (this.behavior = options.behavior), this.domHelper = options.domHelper,
|
28621 | this.dataStartIndex = 0;
|
28622 | }
|
28623 | return HorizontalSlicerRenderer.prototype.getDefaultValue = function() {
|
28624 | return this.data && this.data.defaultValue ? this.data.defaultValue.value : void 0;
|
28625 | }, HorizontalSlicerRenderer.prototype.getIdentityFields = function() {
|
28626 | return visuals.SlicerUtil.DefaultValueHandler.getIdentityFields(this.dataView);
|
28627 | }, HorizontalSlicerRenderer.prototype.init = function(slicerInitOptions) {
|
28628 | this.element = slicerInitOptions.visualInitOptions.element, this.currentViewport = slicerInitOptions.visualInitOptions.viewport;
|
28629 | var hostServices = this.hostServices = slicerInitOptions.visualInitOptions.host;
|
28630 | this.behavior && (this.interactivityService = visuals.createInteractivityService(hostServices)),
|
28631 | this.loadMoreData = function() {
|
28632 | return slicerInitOptions.loadMoreData();
|
28633 | };
|
28634 | var containerDiv = document.createElement("div");
|
28635 | containerDiv.className = Selectors.container["class"];
|
28636 | var container = this.container = d3.select(containerDiv), header = this.domHelper.createSlicerHeader(this.hostServices);
|
28637 | containerDiv.appendChild(header), this.header = d3.select(header);
|
28638 | var body = this.body = container.append("div").classed(visuals.SlicerUtil.Selectors.Body["class"] + " " + Selectors.FlexDisplay["class"], !0);
|
28639 | return this.leftNavigationArrow = body.append("button").classed(Selectors.NavigationArrow["class"] + " " + Selectors.LeftNavigationArrow["class"], !0),
|
28640 | this.itemsContainer = body.append("div").classed(Selectors.ItemsContainer["class"] + " " + Selectors.FlexDisplay["class"], !0),
|
28641 | this.rightNavigationArrow = body.append("button").classed(Selectors.NavigationArrow["class"] + " " + Selectors.RightNavigationArrow["class"], !0),
|
28642 | this.element.get(0).appendChild(containerDiv), this.bindNavigationEvents(), this.interactivityService;
|
28643 | }, HorizontalSlicerRenderer.prototype.render = function(options) {
|
28644 | var data = options.data, dataView = options.dataView;
|
28645 | if (!dataView || !data) return void this.itemsContainer.selectAll("*").remove();
|
28646 | this.data = data, this.dataView = dataView;
|
28647 | var resized = this.currentViewport && options.viewport && (this.currentViewport.height !== options.viewport.height || this.currentViewport.width !== options.viewport.width);
|
28648 | this.isMaxWidthCalculated() && resized || (this.calculateAndSetMaxItemWidth(), this.calculateAndSetTotalItemWidth()),
|
28649 | this.currentViewport = options.viewport, this.updateStyle();
|
28650 | var availableWidthForItemsContainer = this.element.find(Selectors.ItemsContainer.selector).width();
|
28651 | this.itemsToDisplay = this.getNumberOfItemsToDisplay(availableWidthForItemsContainer),
|
28652 | 0 !== this.itemsToDisplay && this.renderCore();
|
28653 | }, HorizontalSlicerRenderer.prototype.renderCore = function() {
|
28654 | var data = this.data;
|
28655 | if (data && data.slicerDataPoints) {
|
28656 | this.normalizePosition(data.slicerDataPoints);
|
28657 | var itemsToDisplay = this.itemsToDisplay, dataStartIndex = this.dataStartIndex;
|
28658 | this.container.classed(Selectors.CanScrollRight["class"], dataStartIndex + this.itemsToDisplay <= data.slicerDataPoints.length - 1),
|
28659 | this.container.classed(Selectors.CanScrollLeft["class"], dataStartIndex > 0), this.renderItems(data.slicerSettings),
|
28660 | this.bindInteractivityService(), dataStartIndex + itemsToDisplay >= data.slicerDataPoints.length * LoadMoreDataThreshold && this.loadMoreData();
|
28661 | }
|
28662 | }, HorizontalSlicerRenderer.prototype.updateStyle = function() {
|
28663 | var viewport = this.currentViewport, data = this.data, defaultSettings = data.slicerSettings, domHelper = this.domHelper;
|
28664 | this.container.classed(Selectors.MultiSelectEnabled["class"], !defaultSettings.selection.singleSelect).style({
|
28665 | width: PixelConverter.toString(viewport.width),
|
28666 | height: PixelConverter.toString(viewport.height)
|
28667 | }), domHelper.styleSlicerHeader(this.header, defaultSettings, data.categorySourceName);
|
28668 | var headerTextProperties = domHelper.getHeaderTextProperties(defaultSettings);
|
28669 | this.header.attr("title", data.categorySourceName);
|
28670 | var bodyViewport = this.bodyViewport = domHelper.getSlicerBodyViewport(viewport, defaultSettings, headerTextProperties);
|
28671 | this.body.style({
|
28672 | height: PixelConverter.toString(bodyViewport.height),
|
28673 | width: PixelConverter.toString(bodyViewport.width)
|
28674 | });
|
28675 | }, HorizontalSlicerRenderer.prototype.renderItems = function(defaultSettings) {
|
28676 | 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) {
|
28677 | return _.indexOf(_this.data.slicerDataPoints, d);
|
28678 | });
|
28679 | items.enter().append("div").classed(visuals.SlicerUtil.Selectors.LabelText["class"] + " " + Selectors.FlexDisplay["class"], !0),
|
28680 | items.order(), items.style({
|
28681 | "font-family": this.textProperties.fontFamily,
|
28682 | "padding-left": PixelConverter.toString(DefaultStyleProperties.labelText.paddingLeft),
|
28683 | "padding-right": PixelConverter.toString(DefaultStyleProperties.labelText.paddingRight),
|
28684 | "margin-right": function(d, i) {
|
28685 | return _this.isLastRowItem(i, itemsToDisplay) ? "0px" : PixelConverter.toString(DefaultStyleProperties.labelText.marginRight);
|
28686 | }
|
28687 | }), this.domHelper.setSlicerTextStyle(items, defaultSettings), items.exit().remove(),
|
28688 | window.setTimeout(function() {
|
28689 | items.attr("title", function(d) {
|
28690 | return d.tooltip;
|
28691 | }).text(function(d) {
|
28692 | return d.value;
|
28693 | });
|
28694 | var labels = _this.element.find(visuals.SlicerUtil.Selectors.LabelText.selector), item = labels.first(), itemWidth = item.width(), itemHeight = item.height();
|
28695 | labels.each(function(i, element) {
|
28696 | powerbi.TextMeasurementService.wordBreakOverflowingText(element, itemWidth, itemHeight);
|
28697 | });
|
28698 | });
|
28699 | }, HorizontalSlicerRenderer.prototype.bindInteractivityService = function() {
|
28700 | if (this.interactivityService && this.body) {
|
28701 | 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_8 = this.data, behaviorOptions = {
|
28702 | dataPoints: data_8.slicerDataPoints,
|
28703 | slicerContainer: this.container,
|
28704 | itemsContainer: itemsContainer,
|
28705 | itemLabels: itemLabels,
|
28706 | clear: clear,
|
28707 | interactivityService: this.interactivityService,
|
28708 | settings: data_8.slicerSettings
|
28709 | }, orientationBehaviorOptions = {
|
28710 | behaviorOptions: behaviorOptions,
|
28711 | orientation: 1
|
28712 | };
|
28713 | this.interactivityService.bind(data_8.slicerDataPoints, this.behavior, orientationBehaviorOptions, {
|
28714 | overrideSelectionFromData: !0,
|
28715 | hasSelectionOverride: data_8.hasSelectionOverride
|
28716 | }), visuals.SlicerWebBehavior.styleSlicerItems(this.itemsContainer.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector), this.interactivityService.hasSelection(), this.interactivityService.isSelectionModeInverted());
|
28717 | } else visuals.SlicerWebBehavior.styleSlicerItems(this.itemsContainer.selectAll(visuals.SlicerUtil.Selectors.LabelText.selector), !1, !1);
|
28718 | }, HorizontalSlicerRenderer.prototype.normalizePosition = function(points) {
|
28719 | var dataStartIndex = this.dataStartIndex;
|
28720 | dataStartIndex = Math.min(dataStartIndex, points.length - 1), this.dataStartIndex = Math.max(dataStartIndex, 0);
|
28721 | }, HorizontalSlicerRenderer.prototype.bindNavigationEvents = function() {
|
28722 | this.registerMouseWheelScrollEvents(), this.registerMouseClickEvents();
|
28723 | }, HorizontalSlicerRenderer.prototype.registerMouseClickEvents = function() {
|
28724 | var _this = this, rightNavigationArrow = this.container.selectAll(Selectors.RightNavigationArrow.selector), leftNavigationArrow = this.container.selectAll(Selectors.LeftNavigationArrow.selector);
|
28725 | rightNavigationArrow.on("click", function() {
|
28726 | _this.scrollRight();
|
28727 | }), leftNavigationArrow.on("click", function() {
|
28728 | _this.scrollLeft();
|
28729 | });
|
28730 | }, HorizontalSlicerRenderer.prototype.registerMouseWheelScrollEvents = function() {
|
28731 | var _this = this, scrollableElement = this.body.node();
|
28732 | scrollableElement.addEventListener("mousewheel", function(e) {
|
28733 | _this.onMouseWheel(e.wheelDelta);
|
28734 | }), scrollableElement.addEventListener("DOMMouseScroll", function(e) {
|
28735 | _this.onMouseWheel(e.detail);
|
28736 | });
|
28737 | }, HorizontalSlicerRenderer.prototype.onMouseWheel = function(wheelDelta) {
|
28738 | 0 > wheelDelta ? this.scrollRight() : wheelDelta > 0 && this.scrollLeft();
|
28739 | }, HorizontalSlicerRenderer.prototype.scrollRight = function() {
|
28740 | var itemsToDisplay = this.itemsToDisplay, startIndex = this.dataStartIndex, dataPointsLength = this.data.slicerDataPoints.length, lastItemIndex = dataPointsLength - 1;
|
28741 | itemsToDisplay + startIndex > lastItemIndex || (startIndex += 1 === itemsToDisplay ? itemsToDisplay : itemsToDisplay - 1,
|
28742 | itemsToDisplay + startIndex > lastItemIndex && (startIndex = lastItemIndex - itemsToDisplay + 1),
|
28743 | this.dataStartIndex = startIndex, this.renderCore());
|
28744 | }, HorizontalSlicerRenderer.prototype.scrollLeft = function() {
|
28745 | var itemsToDisplay = this.itemsToDisplay, startIndex = this.dataStartIndex, firstItemIndex = 0;
|
28746 | 0 !== startIndex && (1 === itemsToDisplay && (startIndex -= itemsToDisplay), startIndex = firstItemIndex > startIndex - itemsToDisplay ? firstItemIndex : startIndex - itemsToDisplay + 1,
|
28747 | this.dataStartIndex = startIndex, this.renderCore());
|
28748 | }, HorizontalSlicerRenderer.prototype.isLastRowItem = function(fieldIndex, columnsToDisplay) {
|
28749 | return fieldIndex === columnsToDisplay - 1;
|
28750 | }, HorizontalSlicerRenderer.prototype.getScaledTextWidth = function(textSize) {
|
28751 | return textSize / jsCommon.TextSizeDefaults.TextSizeMin * MinTextWidth;
|
28752 | }, HorizontalSlicerRenderer.prototype.isMaxWidthCalculated = function() {
|
28753 | return void 0 !== this.maxItemWidth;
|
28754 | }, HorizontalSlicerRenderer.prototype.calculateAndSetMaxItemWidth = function() {
|
28755 | var dataPointsLength = this.getDataPointsCount(), maxItemWidth = 0;
|
28756 | if (0 === dataPointsLength) return void (this.maxItemWidth = maxItemWidth);
|
28757 | var data = this.data, dataPoints = data.slicerDataPoints, sampleSize = Math.min(dataPointsLength, ItemWidthSampleSize), properties = jQuery.extend(!0, {}, this.textProperties), textSize = data.slicerSettings.slicerText.textSize;
|
28758 | properties.fontSize = PixelConverter.fromPoint(textSize);
|
28759 | for (var getMaxWordWidth = jsCommon.WordBreaker.getMaxWordWidth, i = 0; sampleSize > i; i++) {
|
28760 | var itemText = dataPoints[i].value;
|
28761 | properties.text = itemText, maxItemWidth = Math.max(maxItemWidth, getMaxWordWidth(itemText, powerbi.TextMeasurementService.measureSvgTextWidth, properties));
|
28762 | }
|
28763 | this.maxItemWidth = Math.min(maxItemWidth, this.getScaledTextWidth(textSize));
|
28764 | }, HorizontalSlicerRenderer.prototype.calculateAndSetTotalItemWidth = function() {
|
28765 | 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);
|
28766 | this.totalItemWidth = this.maxItemWidth + itemPadding + borderWidth;
|
28767 | }, HorizontalSlicerRenderer.prototype.getNumberOfItemsToDisplay = function(widthAvailable) {
|
28768 | var totalItemWidth = this.totalItemWidth;
|
28769 | if (0 === totalItemWidth) return 0;
|
28770 | var dataPointsLength = this.getDataPointsCount(), numberOfItems = Math.min(dataPointsLength, Math.round(widthAvailable / totalItemWidth));
|
28771 | return Math.max(numberOfItems, 1);
|
28772 | }, HorizontalSlicerRenderer.prototype.getDataPointsCount = function() {
|
28773 | return _.size(this.data.slicerDataPoints);
|
28774 | }, HorizontalSlicerRenderer;
|
28775 | }();
|
28776 | visuals.HorizontalSlicerRenderer = HorizontalSlicerRenderer;
|
28777 | var Selectors;
|
28778 | !function(Selectors) {
|
28779 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector;
|
28780 | Selectors.container = createClassAndSelector("horizontalSlicerContainer"), Selectors.ItemsContainer = createClassAndSelector("slicerItemsContainer"),
|
28781 | Selectors.NavigationArrow = createClassAndSelector("navigationArrow"), Selectors.LeftNavigationArrow = createClassAndSelector("left"),
|
28782 | Selectors.RightNavigationArrow = createClassAndSelector("right"), Selectors.MultiSelectEnabled = createClassAndSelector("isMultiSelectEnabled"),
|
28783 | Selectors.FlexDisplay = createClassAndSelector("flexDisplay"), Selectors.CanScrollRight = createClassAndSelector("canScrollRight"),
|
28784 | Selectors.CanScrollLeft = createClassAndSelector("canScrollLeft");
|
28785 | }(Selectors || (Selectors = {}));
|
28786 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28787 | }(powerbi || (powerbi = {}));
|
28788 |
|
28789 | var powerbi;
|
28790 |
|
28791 | !function(powerbi) {
|
28792 | var visuals;
|
28793 | !function(visuals) {
|
28794 | var DisplayNameKeys = visuals.SlicerUtil.DisplayNameKeys, DOMHelper = visuals.SlicerUtil.DOMHelper, SettingsHelper = visuals.SlicerUtil.SettingsHelper, Slicer = function() {
|
28795 | function Slicer(options) {
|
28796 | options && (this.behavior = options.behavior), this.domHelper = new DOMHelper();
|
28797 | }
|
28798 | return Slicer.DefaultStyleProperties = function() {
|
28799 | return {
|
28800 | general: {
|
28801 | outlineColor: "#808080",
|
28802 | outlineWeight: 1,
|
28803 | orientation: 0
|
28804 | },
|
28805 | header: {
|
28806 | borderBottomWidth: 1,
|
28807 | show: !0,
|
28808 | outline: visuals.outline.bottomOnly,
|
28809 | fontColor: "#000000",
|
28810 | textSize: 10
|
28811 | },
|
28812 | slicerText: {
|
28813 | color: "#666666",
|
28814 | outline: visuals.outline.none,
|
28815 | textSize: 10
|
28816 | },
|
28817 | selection: {
|
28818 | selectAllCheckboxEnabled: !1,
|
28819 | singleSelect: !0
|
28820 | }
|
28821 | };
|
28822 | }, Slicer.prototype.init = function(options) {
|
28823 | this.initOptions = options, this.element = options.element, this.currentViewport = options.viewport,
|
28824 | this.hostServices = options.host;
|
28825 | var settings = this.settings = Slicer.DefaultStyleProperties();
|
28826 | this.slicerOrientation = settings.general.orientation, this.waitingForData = !1,
|
28827 | this.initializeSlicerRenderer(this.slicerOrientation);
|
28828 | }, Slicer.prototype.onDataChanged = function(options) {
|
28829 | var dataViews = options.dataViews;
|
28830 | if (!_.isEmpty(dataViews)) {
|
28831 | var existingDataView = this.dataView;
|
28832 | this.dataView = dataViews[0];
|
28833 | var resetScrollbarPosition = options.operationKind !== powerbi.VisualDataChangeOperationKind.Append && !powerbi.DataViewAnalysis.hasSameCategoryIdentity(existingDataView, this.dataView);
|
28834 | this.render(resetScrollbarPosition, !0);
|
28835 | }
|
28836 | }, Slicer.prototype.onResizing = function(finalViewport) {
|
28837 | this.currentViewport = finalViewport, this.render(!1);
|
28838 | }, Slicer.prototype.enumerateObjectInstances = function(options) {
|
28839 | return ObjectEnumerator.enumerateObjectInstances(options, this.slicerData, this.settings, this.dataView);
|
28840 | }, Slicer.prototype.loadMoreData = function() {
|
28841 | var dataView = this.dataView;
|
28842 | if (dataView) {
|
28843 | var dataViewMetadata = dataView.metadata;
|
28844 | !this.waitingForData && dataViewMetadata && dataViewMetadata.segment && (this.hostServices.loadMoreData(),
|
28845 | this.waitingForData = !0);
|
28846 | }
|
28847 | }, Slicer.prototype.onClearSelection = function() {
|
28848 | this.interactivityService && (this.interactivityService.clearSelection(), this.render(!1));
|
28849 | }, Slicer.prototype.render = function(resetScrollbarPosition, stopWaitingForData) {
|
28850 | var localizedSelectAllText = this.hostServices.getLocalizedString(DisplayNameKeys.SelectAll);
|
28851 | if (this.slicerData = visuals.DataConversion.convert(this.dataView, localizedSelectAllText, this.interactivityService, this.hostServices),
|
28852 | this.slicerData) {
|
28853 | this.slicerData.slicerSettings.general.outlineWeight = Math.max(this.slicerData.slicerSettings.general.outlineWeight, 0),
|
28854 | this.settings = this.slicerData.slicerSettings;
|
28855 | 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);
|
28856 | orientationHasChanged && (this.slicerOrientation = slicerOrientation_1, this.element.empty(),
|
28857 | this.initializeSlicerRenderer(slicerOrientation_1));
|
28858 | }
|
28859 | this.slicerRenderer.render({
|
28860 | dataView: this.dataView,
|
28861 | data: this.slicerData,
|
28862 | viewport: this.currentViewport,
|
28863 | resetScrollbarPosition: resetScrollbarPosition
|
28864 | }), stopWaitingForData && (this.waitingForData = !1);
|
28865 | }, Slicer.prototype.orientationHasChanged = function(slicerOrientation) {
|
28866 | return this.slicerOrientation !== slicerOrientation;
|
28867 | }, Slicer.prototype.initializeSlicerRenderer = function(slicerOrientation) {
|
28868 | switch (slicerOrientation) {
|
28869 | case 1:
|
28870 | this.initializeHorizontalSlicer();
|
28871 | break;
|
28872 |
|
28873 | case 0:
|
28874 | this.initializeVerticalSlicer();
|
28875 | }
|
28876 | }, Slicer.prototype.initializeVerticalSlicer = function() {
|
28877 | var verticalSlicerRenderer = this.slicerRenderer = new visuals.VerticalSlicerRenderer({
|
28878 | domHelper: this.domHelper,
|
28879 | behavior: this.behavior
|
28880 | }), options = this.createInitOptions();
|
28881 | this.interactivityService = verticalSlicerRenderer.init(options);
|
28882 | }, Slicer.prototype.initializeHorizontalSlicer = function() {
|
28883 | var horizontalSlicerRenderer = this.slicerRenderer = new visuals.HorizontalSlicerRenderer({
|
28884 | domHelper: this.domHelper,
|
28885 | behavior: this.behavior
|
28886 | }), options = this.createInitOptions();
|
28887 | this.interactivityService = horizontalSlicerRenderer.init(options);
|
28888 | }, Slicer.prototype.createInitOptions = function() {
|
28889 | var _this = this;
|
28890 | return {
|
28891 | visualInitOptions: this.initOptions,
|
28892 | loadMoreData: function() {
|
28893 | return _this.loadMoreData();
|
28894 | }
|
28895 | };
|
28896 | }, Slicer;
|
28897 | }();
|
28898 | visuals.Slicer = Slicer;
|
28899 | var ObjectEnumerator;
|
28900 | !function(ObjectEnumerator) {
|
28901 | function enumerateObjectInstances(options, data, settings, dataView) {
|
28902 | if (data) switch (options.objectName) {
|
28903 | case "items":
|
28904 | return enumerateItems(data, settings);
|
28905 |
|
28906 | case "header":
|
28907 | return enumerateHeader(data, settings);
|
28908 |
|
28909 | case "general":
|
28910 | return enumerateGeneral(data, settings);
|
28911 |
|
28912 | case "selection":
|
28913 | if (shouldShowSelectionOption(dataView)) return enumerateSelection(data, settings);
|
28914 | }
|
28915 | }
|
28916 | function shouldShowSelectionOption(dataView) {
|
28917 | return !(dataView && dataView.metadata && dataView.metadata.columns && _.some(dataView.metadata.columns, function(column) {
|
28918 | return column.discourageAggregationAcrossGroups;
|
28919 | }));
|
28920 | }
|
28921 | function enumerateSelection(data, settings) {
|
28922 | 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;
|
28923 | return [ {
|
28924 | selector: null,
|
28925 | objectName: "selection",
|
28926 | properties: {
|
28927 | selectAllCheckboxEnabled: selectAllCheckboxEnabled,
|
28928 | singleSelect: singleSelect
|
28929 | }
|
28930 | } ];
|
28931 | }
|
28932 | function enumerateHeader(data, settings) {
|
28933 | 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;
|
28934 | return [ {
|
28935 | selector: null,
|
28936 | objectName: "header",
|
28937 | properties: {
|
28938 | show: slicerSettings.header.show,
|
28939 | fontColor: fontColor,
|
28940 | background: background,
|
28941 | outline: slicerSettings.header.outline,
|
28942 | textSize: slicerSettings.header.textSize
|
28943 | }
|
28944 | } ];
|
28945 | }
|
28946 | function enumerateItems(data, settings) {
|
28947 | 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;
|
28948 | return [ {
|
28949 | selector: null,
|
28950 | objectName: "items",
|
28951 | properties: {
|
28952 | fontColor: fontColor,
|
28953 | background: background,
|
28954 | outline: slicerSettings.slicerText.outline,
|
28955 | textSize: slicerSettings.slicerText.textSize
|
28956 | }
|
28957 | } ];
|
28958 | }
|
28959 | function enumerateGeneral(data, settings) {
|
28960 | 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;
|
28961 | return [ {
|
28962 | selector: null,
|
28963 | objectName: "general",
|
28964 | properties: {
|
28965 | outlineColor: outlineColor,
|
28966 | outlineWeight: outlineWeight,
|
28967 | orientation: orientation
|
28968 | }
|
28969 | } ];
|
28970 | }
|
28971 | ObjectEnumerator.enumerateObjectInstances = enumerateObjectInstances;
|
28972 | }(ObjectEnumerator || (ObjectEnumerator = {}));
|
28973 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
28974 | }(powerbi || (powerbi = {}));
|
28975 |
|
28976 | var powerbi;
|
28977 |
|
28978 | !function(powerbi) {
|
28979 | var visuals;
|
28980 | !function(visuals) {
|
28981 | var TablixUtils = visuals.controls.internal.TablixUtils, TablixObjects = visuals.controls.internal.TablixObjects, TableHierarchyNavigator = function() {
|
28982 | function TableHierarchyNavigator(tableDataView, formatter) {
|
28983 | this.tableDataView = tableDataView, this.formatter = formatter;
|
28984 | }
|
28985 | return TableHierarchyNavigator.prototype.getColumnHierarchyDepth = function() {
|
28986 | return 1;
|
28987 | }, TableHierarchyNavigator.prototype.getRowHierarchyDepth = function() {
|
28988 | return 1;
|
28989 | }, TableHierarchyNavigator.prototype.getLeafCount = function(hierarchy) {
|
28990 | return hierarchy.length;
|
28991 | }, TableHierarchyNavigator.prototype.getLeafAt = function(hierarchy, index) {
|
28992 | return hierarchy[index];
|
28993 | }, TableHierarchyNavigator.prototype.getParent = function(item) {
|
28994 | return null;
|
28995 | }, TableHierarchyNavigator.prototype.getIndex = function(item) {
|
28996 | return item ? this.isRow(item) ? item.index : this.getColumnIndex(item) : -1;
|
28997 | }, TableHierarchyNavigator.prototype.isRow = function(item) {
|
28998 | if (!item) return !1;
|
28999 | var row = item;
|
29000 | return void 0 !== row.index && void 0 !== row.values;
|
29001 | }, TableHierarchyNavigator.prototype.getColumnIndex = function(item) {
|
29002 | return TableHierarchyNavigator.getIndex(this.tableDataView.columns, item);
|
29003 | }, TableHierarchyNavigator.prototype.isLeaf = function(item) {
|
29004 | return !0;
|
29005 | }, TableHierarchyNavigator.prototype.isRowHierarchyLeaf = function(cornerItem) {
|
29006 | return !1;
|
29007 | }, TableHierarchyNavigator.prototype.isColumnHierarchyLeaf = function(cornerItem) {
|
29008 | return !0;
|
29009 | }, TableHierarchyNavigator.prototype.isFirstItem = function(item, items) {
|
29010 | return item === items[0];
|
29011 | }, TableHierarchyNavigator.prototype.areAllParentsFirst = function(item, items) {
|
29012 | return this.isFirstItem(item, items);
|
29013 | }, TableHierarchyNavigator.prototype.isLastItem = function(item, items) {
|
29014 | return items[items.length - 1] === item;
|
29015 | }, TableHierarchyNavigator.prototype.areAllParentsLast = function(item, items) {
|
29016 | return this.isLastItem(item, items);
|
29017 | }, TableHierarchyNavigator.prototype.getChildren = function(item) {
|
29018 | return null;
|
29019 | }, TableHierarchyNavigator.prototype.getChildrenLevelDifference = function(item) {
|
29020 | return 1 / 0;
|
29021 | }, TableHierarchyNavigator.prototype.getCount = function(items) {
|
29022 | return items.length;
|
29023 | }, TableHierarchyNavigator.prototype.getAt = function(items, index) {
|
29024 | return items[index];
|
29025 | }, TableHierarchyNavigator.prototype.getLevel = function(item) {
|
29026 | return 0;
|
29027 | }, TableHierarchyNavigator.prototype.getIntersection = function(rowItem, columnItem) {
|
29028 | var value, isTotal = !1, position = new TablixUtils.CellPosition(), columnIndex = TableHierarchyNavigator.getIndex(this.tableDataView.columns, columnItem);
|
29029 | position.column.index = columnIndex, position.column.isFirst = 0 === columnIndex,
|
29030 | position.column.isLast = columnIndex === this.tableDataView.columns.length - 1;
|
29031 | var totalRow = rowItem;
|
29032 | if (null != totalRow.totalCells) isTotal = !0, value = totalRow.totalCells[columnIndex]; else {
|
29033 | var row = rowItem, rowIndex = row.index;
|
29034 | position.row.index = rowIndex, position.row.isFirst = 0 === rowIndex, position.row.isLast = rowIndex === this.tableDataView.rows.length - 1,
|
29035 | value = row.values[columnIndex];
|
29036 | }
|
29037 | var cellItem = new TablixUtils.TablixVisualCell(value, isTotal, columnItem, this.formatter);
|
29038 | cellItem.position = position;
|
29039 | var tableRow = rowItem;
|
29040 | if (tableRow && tableRow.values) {
|
29041 | var rowObjects = tableRow.values.objects;
|
29042 | if (rowObjects) {
|
29043 | var cellObject = rowObjects[columnIndex];
|
29044 | cellObject && (cellItem.backColor = TablixObjects.PropValuesBackColor.getValue(cellObject));
|
29045 | }
|
29046 | }
|
29047 | return cellItem;
|
29048 | }, TableHierarchyNavigator.prototype.getCorner = function(rowLevel, columnLevel) {
|
29049 | return null;
|
29050 | }, TableHierarchyNavigator.prototype.headerItemEquals = function(item1, item2) {
|
29051 | if (item1 === item2) return !0;
|
29052 | if (item1.displayName && item2.displayName) {
|
29053 | var column1 = item1, column2 = item2;
|
29054 | return powerbi.DataViewAnalysis.areMetadataColumnsEquivalent(column1, column2);
|
29055 | }
|
29056 | return this.isRow(item1) && this.isRow(item2) ? item1.index === item2.index : !1;
|
29057 | }, TableHierarchyNavigator.prototype.bodyCellItemEquals = function(item1, item2) {
|
29058 | return item1.isMatch(item2);
|
29059 | }, TableHierarchyNavigator.prototype.cornerCellItemEquals = function(item1, item2) {
|
29060 | return !0;
|
29061 | }, TableHierarchyNavigator.prototype.update = function(table) {
|
29062 | this.tableDataView = table;
|
29063 | }, TableHierarchyNavigator.getIndex = function(items, item) {
|
29064 | for (var index = 0, len = items.length; len > index; index++) {
|
29065 | var arrayItem = items[index];
|
29066 | if (null != arrayItem.index && null != item.index && arrayItem.index === item.index) return index;
|
29067 | if (item === items[index]) return index;
|
29068 | }
|
29069 | return -1;
|
29070 | }, TableHierarchyNavigator;
|
29071 | }();
|
29072 | visuals.TableHierarchyNavigator = TableHierarchyNavigator;
|
29073 | var TableBinder = function() {
|
29074 | function TableBinder(options) {
|
29075 | this.options = options;
|
29076 | }
|
29077 | return TableBinder.prototype.onDataViewChanged = function(dataView) {
|
29078 | this.tableDataView = dataView, this.formattingProperties = dataView.formattingProperties,
|
29079 | this.updateTextHeights();
|
29080 | }, TableBinder.prototype.updateTextHeights = function() {
|
29081 | var textProps = {
|
29082 | fontFamily: "",
|
29083 | fontSize: TablixObjects.getTextSizeInPx(this.formattingProperties.general.textSize),
|
29084 | text: "a"
|
29085 | };
|
29086 | textProps.fontFamily = TablixUtils.FontFamilyHeader, this.textHeightHeader = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(textProps)),
|
29087 | textProps.fontFamily = TablixUtils.FontFamilyCell, this.textHeightValue = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(textProps)),
|
29088 | textProps.fontFamily = TablixUtils.FontFamilyTotal, this.textHeightTotal = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(textProps));
|
29089 | }, TableBinder.prototype.onStartRenderingSession = function() {}, TableBinder.prototype.onEndRenderingSession = function() {},
|
29090 | TableBinder.prototype.bindRowHeader = function(item, cell) {
|
29091 | cell.contentHeight = this.textHeightValue, TablixUtils.clearCellStyle(cell), this.options.onBindRowHeader && this.options.onBindRowHeader(item);
|
29092 | }, TableBinder.prototype.unbindRowHeader = function(item, cell) {}, TableBinder.prototype.bindColumnHeader = function(item, cell) {
|
29093 | var _this = this;
|
29094 | cell.extension.disableDragResize(), TablixUtils.resetCellCssClass(cell), TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixHeader),
|
29095 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixColumnHeaderLeaf);
|
29096 | var cellStyle = new TablixUtils.CellStyle();
|
29097 | if (cellStyle.fontFamily = TablixUtils.FontFamilyHeader, cellStyle.fontColor = TablixUtils.FontColorHeaders,
|
29098 | cellStyle.borders.bottom = new TablixUtils.EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue),
|
29099 | cell.contentHeight = this.textHeightHeader, this.sortIconsEnabled() ? TablixUtils.createColumnHeaderWithSortIcon(item, cell) : TablixUtils.setCellTextAndTooltip(cell, item.displayName),
|
29100 | this.options.onColumnHeaderClick) {
|
29101 | var handler = function(e) {
|
29102 | if (TablixUtils.isValidSortClick(e)) {
|
29103 | var sortDirection = TablixUtils.reverseSort(item.sort);
|
29104 | _this.options.onColumnHeaderClick(item.queryName ? item.queryName : item.displayName, sortDirection);
|
29105 | }
|
29106 | };
|
29107 | cell.extension.registerClickHandler(handler);
|
29108 | }
|
29109 | this.setColumnHeaderStyle(cell, cellStyle), cell.applyStyle(cellStyle);
|
29110 | }, TableBinder.prototype.setColumnHeaderStyle = function(cell, style) {
|
29111 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.columnHeaders, propsTotal = this.formattingProperties.total, propsValues = this.formattingProperties.values;
|
29112 | style.borders.top = new TablixUtils.EdgeSettings(), style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29113 | style.borders.bottom = new TablixUtils.EdgeSettings(), style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29114 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29115 | visuals.outline.showLeft(props.outline) || !visuals.outline.showLeft(propsTotal.outline) && !visuals.outline.showLeft(propsValues.outline) || (style.paddings.left += propsGrid.outlineWeight)),
|
29116 | style.borders.right = new TablixUtils.EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29117 | 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),
|
29118 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29119 | }, TableBinder.prototype.unbindColumnHeader = function(item, cell) {
|
29120 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell), this.sortIconsEnabled() && TablixUtils.removeSortIcons(cell),
|
29121 | this.options.onColumnHeaderClick && cell.extension.unregisterClickHandler();
|
29122 | }, TableBinder.prototype.bindBodyCell = function(item, cell) {
|
29123 | TablixUtils.resetCellCssClass(cell);
|
29124 | var imgHeight;
|
29125 | imgHeight = this.formattingProperties.grid.imageHeight;
|
29126 | var cellStyle = new TablixUtils.CellStyle();
|
29127 | item.isImage ? cell.contentHeight = imgHeight : cell.contentHeight = this.textHeightValue,
|
29128 | item.isUrl && item.isValidUrl ? TablixUtils.appendATagToBodyCell(item.textContent, cell, this.formattingProperties.values.urlIcon) : item.isImage && item.isValidUrl ? (TablixUtils.appendImgTagToBodyCell(item.textContent, cell, imgHeight),
|
29129 | cellStyle.hasImage = !0) : item.domContent ? $(cell.extension.contentHost).append(item.domContent) : item.textContent ? TablixUtils.setCellTextAndTooltip(cell, item.textContent) : TablixUtils.setCellTextAndTooltip(cell, " "),
|
29130 | item.isTotal ? (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueTotal),
|
29131 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTableFooter), cellStyle.fontFamily = TablixUtils.FontFamilyTotal,
|
29132 | cellStyle.borders.top = new TablixUtils.EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue),
|
29133 | cell.contentHeight = this.textHeightTotal) : item.position.row.isLast ? TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTableBodyCellBottom) : (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTableBodyCell),
|
29134 | cellStyle.borders.bottom = new TablixUtils.EdgeSettings(TablixObjects.PropGridHorizontalWeight.defaultValue, TablixObjects.PropGridHorizontalColor.defaultValue)),
|
29135 | item.isNumeric && TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueNumeric),
|
29136 | item.isTotal ? this.setFooterStyle(cell, cellStyle) : this.setBodyStyle(item, cell, cellStyle),
|
29137 | cell.applyStyle(cellStyle);
|
29138 | }, TableBinder.prototype.setBodyStyle = function(item, cell, style) {
|
29139 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.values, propsTotal = this.formattingProperties.total, propsColumns = this.formattingProperties.columnHeaders;
|
29140 | style.borders.top = new TablixUtils.EdgeSettings(), cell.position.row.isFirst && style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29141 | style.borders.bottom = new TablixUtils.EdgeSettings(), cell.position.row.isLast ? style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor),
|
29142 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29143 | visuals.outline.showLeft(props.outline) || !visuals.outline.showLeft(propsTotal.outline) && !visuals.outline.showLeft(propsColumns.outline) || (style.paddings.left += propsGrid.outlineWeight)),
|
29144 | style.borders.right = new TablixUtils.EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29145 | 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),
|
29146 | style.fontColor = cell.position.row.index % 2 === 0 ? props.fontColorPrimary : props.fontColorSecondary,
|
29147 | item.backColor ? style.backColor = item.backColor : style.backColor = cell.position.row.index % 2 === 0 ? props.backColorPrimary : props.backColorSecondary,
|
29148 | style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29149 | }, TableBinder.prototype.setFooterStyle = function(cell, style) {
|
29150 | var props = this.formattingProperties.total, propsGrid = this.formattingProperties.grid, propsValues = this.formattingProperties.values, propsColumns = this.formattingProperties.columnHeaders;
|
29151 | style.borders.top = new TablixUtils.EdgeSettings(), style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29152 | style.borders.bottom = new TablixUtils.EdgeSettings(), style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29153 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29154 | visuals.outline.showLeft(props.outline) || !visuals.outline.showLeft(propsValues.outline) && !visuals.outline.showLeft(propsColumns.outline) || (style.paddings.left += propsGrid.outlineWeight)),
|
29155 | style.borders.right = new TablixUtils.EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29156 | 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),
|
29157 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29158 | }, TableBinder.prototype.unbindBodyCell = function(item, cell) {
|
29159 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29160 | }, TableBinder.prototype.bindCornerCell = function(item, cell) {}, TableBinder.prototype.unbindCornerCell = function(item, cell) {},
|
29161 | TableBinder.prototype.bindEmptySpaceHeaderCell = function(cell) {}, TableBinder.prototype.unbindEmptySpaceHeaderCell = function(cell) {},
|
29162 | TableBinder.prototype.bindEmptySpaceFooterCell = function(cell) {}, TableBinder.prototype.unbindEmptySpaceFooterCell = function(cell) {},
|
29163 | TableBinder.prototype.getHeaderLabel = function(item) {
|
29164 | return item.displayName;
|
29165 | }, TableBinder.prototype.getCellContent = function(item) {
|
29166 | return item;
|
29167 | }, TableBinder.prototype.hasRowGroups = function() {
|
29168 | return !1;
|
29169 | }, TableBinder.prototype.sortIconsEnabled = function() {
|
29170 | return 0 === this.options.layoutKind;
|
29171 | }, TableBinder;
|
29172 | }();
|
29173 | visuals.TableBinder = TableBinder;
|
29174 | var Table = function() {
|
29175 | function Table(options) {
|
29176 | options && (this.isConditionalFormattingEnabled = options.isConditionalFormattingEnabled,
|
29177 | this.isTouchEnabled = options.isTouchEnabled);
|
29178 | }
|
29179 | return Table.customizeQuery = function(options) {
|
29180 | var dataViewMapping = options.dataViewMappings[0];
|
29181 | if (dataViewMapping && dataViewMapping.table && dataViewMapping.metadata) {
|
29182 | var dataViewTableRows = dataViewMapping.table.rows, objects = dataViewMapping.metadata.objects;
|
29183 | dataViewTableRows["for"]["in"].subtotalType = TablixObjects.shouldShowTableTotals(objects) ? 1 : 0;
|
29184 | }
|
29185 | }, Table.getSortableRoles = function() {
|
29186 | return [ "Values" ];
|
29187 | }, Table.prototype.init = function(options) {
|
29188 | this.element = options.element, this.style = options.style, this.updateViewport(options.viewport),
|
29189 | this.formatter = visuals.valueFormatter.formatValueColumn, this.isInteractive = options.interactivity && null != options.interactivity.selection,
|
29190 | this.getLocalizedString = options.host.getLocalizedString, this.hostServices = options.host,
|
29191 | this.persistingObjects = !1, this.waitingForData = !1, this.lastAllowHeaderResize = !0,
|
29192 | this.waitingForSort = !1;
|
29193 | }, Table.converter = function(dataView) {
|
29194 | var table = dataView.table, visualTable = powerbi.Prototype.inherit(table);
|
29195 | visualTable.visualRows = [];
|
29196 | for (var i = 0; i < table.rows.length; i++) {
|
29197 | var visualRow = {
|
29198 | index: i,
|
29199 | values: table.rows[i]
|
29200 | };
|
29201 | visualTable.visualRows.push(visualRow);
|
29202 | }
|
29203 | return visualTable.formattingProperties = TablixObjects.getTableObjects(dataView),
|
29204 | visualTable;
|
29205 | }, Table.prototype.onResizing = function(finalViewport) {
|
29206 | this.updateViewport(finalViewport);
|
29207 | }, Table.prototype.getColumnWidthManager = function() {
|
29208 | return this.columnWidthManager;
|
29209 | }, Table.prototype.onDataChanged = function(options) {
|
29210 | var dataViews = options.dataViews;
|
29211 | if (dataViews && dataViews.length > 0) {
|
29212 | var previousDataView = this.dataView;
|
29213 | if (this.dataView = dataViews[0], this.persistingObjects) return void (this.persistingObjects = !1);
|
29214 | var visualTable = Table.converter(this.dataView), textSize = visualTable.formattingProperties.general.textSize;
|
29215 | if (options.operationKind === powerbi.VisualDataChangeOperationKind.Append) this.hierarchyNavigator.update(visualTable),
|
29216 | this.tablixControl.updateModels(!1, visualTable.visualRows, visualTable.columns),
|
29217 | this.refreshControl(!1); else {
|
29218 | this.createOrUpdateHierarchyNavigator(visualTable), this.createColumnWidthManager(),
|
29219 | this.createTablixControl(textSize);
|
29220 | var binder = this.tablixControl.getBinder();
|
29221 | binder.onDataViewChanged(visualTable), this.updateInternal(textSize, previousDataView, visualTable);
|
29222 | }
|
29223 | }
|
29224 | this.waitingForData = !1, this.waitingForSort = !1;
|
29225 | }, Table.prototype.createColumnWidthManager = function() {
|
29226 | var _this = this;
|
29227 | this.columnWidthManager ? this.columnWidthManager.updateDataView(this.dataView) : this.columnWidthManager = new visuals.controls.TablixColumnWidthManager(this.dataView, !1, function(objectInstances) {
|
29228 | return _this.persistColumnWidths(objectInstances);
|
29229 | });
|
29230 | }, Table.prototype.persistColumnWidths = function(objectInstances) {
|
29231 | this.persistingObjects = !0, this.hostServices.persistProperties(objectInstances);
|
29232 | }, Table.prototype.updateViewport = function(newViewport) {
|
29233 | this.currentViewport = newViewport, this.tablixControl && (this.tablixControl.viewport = this.currentViewport,
|
29234 | this.verifyHeaderResize(), this.refreshControl(!1));
|
29235 | }, Table.prototype.refreshControl = function(clear) {
|
29236 | (visuals.visibilityHelper.partiallyVisible(this.element) || 1 === this.getLayoutKind()) && this.tablixControl.refresh(clear);
|
29237 | }, Table.prototype.getLayoutKind = function() {
|
29238 | return this.isInteractive ? 0 : 1;
|
29239 | }, Table.prototype.createOrUpdateHierarchyNavigator = function(visualTable) {
|
29240 | if (this.tablixControl) this.hierarchyNavigator.update(visualTable); else {
|
29241 | var dataNavigator = new TableHierarchyNavigator(visualTable, this.formatter);
|
29242 | this.hierarchyNavigator = dataNavigator;
|
29243 | }
|
29244 | }, Table.prototype.createTablixControl = function(textSize) {
|
29245 | this.tablixControl || (this.tablixControl = this.createControl(this.hierarchyNavigator, textSize));
|
29246 | }, Table.prototype.createControl = function(dataNavigator, textSize) {
|
29247 | var _this = this, layoutKind = this.getLayoutKind(), tableBinderOptions = {
|
29248 | onBindRowHeader: function(item) {
|
29249 | return _this.onBindRowHeader(item);
|
29250 | },
|
29251 | onColumnHeaderClick: function(queryName, sortDirection) {
|
29252 | return _this.onColumnHeaderClick(queryName, sortDirection);
|
29253 | },
|
29254 | layoutKind: layoutKind
|
29255 | }, tableBinder = new TableBinder(tableBinderOptions), layoutManager = 1 === layoutKind ? visuals.controls.internal.DashboardTablixLayoutManager.createLayoutManager(tableBinder) : visuals.controls.internal.CanvasTablixLayoutManager.createLayoutManager(tableBinder, this.columnWidthManager), tablixContainer = document.createElement("div");
|
29256 | this.element.append(tablixContainer);
|
29257 | var tablixOptions = {
|
29258 | interactive: this.isInteractive,
|
29259 | enableTouchSupport: this.isTouchEnabled,
|
29260 | layoutKind: layoutKind,
|
29261 | fontSize: TablixObjects.getTextSizeInPx(textSize)
|
29262 | };
|
29263 | return new visuals.controls.TablixControl(dataNavigator, layoutManager, tableBinder, tablixContainer, tablixOptions);
|
29264 | }, Table.prototype.updateInternal = function(textSize, previousDataView, visualTable) {
|
29265 | var _this = this;
|
29266 | 1 === this.getLayoutKind() && this.tablixControl.layoutManager.adjustContentSize(visuals.converterHelper.hasImageUrlColumn(this.dataView)),
|
29267 | this.tablixControl.fontSize = TablixObjects.getTextSizeInPx(textSize), this.verifyHeaderResize(),
|
29268 | this.tablixControl.updateModels(!0, visualTable.visualRows, visualTable.columns);
|
29269 | var totals = this.createTotalsRow(this.dataView);
|
29270 | this.tablixControl.rowDimension.setFooter(totals), this.tablixControl.viewport = this.currentViewport;
|
29271 | var shouldClearControl = this.shouldClearControl(previousDataView, this.dataView);
|
29272 | setTimeout(function() {
|
29273 | _this.refreshControl(shouldClearControl), _this.columnWidthManager.shouldPersistAllColumnWidths() && _this.columnWidthManager.persistAllColumnWidths(_this.tablixControl.layoutManager.columnWidthsToPersist);
|
29274 | }, 0);
|
29275 | }, Table.prototype.shouldClearControl = function(previousDataView, newDataView) {
|
29276 | return this.waitingForSort && previousDataView && newDataView ? !powerbi.DataViewAnalysis.isMetadataEquivalent(previousDataView.metadata, newDataView.metadata) : !0;
|
29277 | }, Table.prototype.createTotalsRow = function(dataView) {
|
29278 | if (!TablixObjects.shouldShowTableTotals(dataView.metadata.objects)) return null;
|
29279 | var totals = dataView.table.totals;
|
29280 | if (!totals || 0 === totals.length) return null;
|
29281 | for (var totalRow = [], columns = dataView.table.columns, i = 0, len = columns.length; len > i; ++i) {
|
29282 | var column = columns[i], totalValue = totals[column.index];
|
29283 | null != totalValue ? totalRow.push(totalValue) : totalRow.push(0 === i ? this.getLocalizedString("TableTotalLabel") : "");
|
29284 | }
|
29285 | return {
|
29286 | totalCells: totalRow
|
29287 | };
|
29288 | }, Table.prototype.onBindRowHeader = function(item) {
|
29289 | this.needsMoreData(item) && (this.hostServices.loadMoreData(), this.waitingForData = !0);
|
29290 | }, Table.prototype.onColumnHeaderClick = function(queryName, sortDirection) {
|
29291 | this.waitingForSort = !0, this.hostServices.onCustomSort(TablixUtils.getCustomSortEventArgs(queryName, sortDirection));
|
29292 | }, Table.prototype.needsMoreData = function(item) {
|
29293 | if (this.waitingForData || !this.dataView.metadata || !this.dataView.metadata.segment) return !1;
|
29294 | var leafCount = this.tablixControl.rowDimension.getItemsCount(), loadMoreThreshold = leafCount * Table.preferredLoadMoreThreshold;
|
29295 | return this.hierarchyNavigator.getIndex(item) >= loadMoreThreshold;
|
29296 | }, Table.prototype.enumerateObjectInstances = function(options) {
|
29297 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
29298 | return this.dataView && TablixObjects.enumerateObjectInstances(options, enumeration, this.dataView, visuals.controls.TablixType.Table),
|
29299 | enumeration.complete();
|
29300 | }, Table.prototype.enumerateObjectRepetition = function() {
|
29301 | var enumeration = [];
|
29302 | return this.isConditionalFormattingEnabled && this.dataView && TablixObjects.enumerateObjectRepetition(enumeration, this.dataView, visuals.controls.TablixType.Table),
|
29303 | enumeration;
|
29304 | }, Table.prototype.shouldAllowHeaderResize = function() {
|
29305 | return 1 === this.hostServices.getViewMode();
|
29306 | }, Table.prototype.onViewModeChanged = function(viewMode) {
|
29307 | this.updateViewport(this.currentViewport);
|
29308 | }, Table.prototype.verifyHeaderResize = function() {
|
29309 | var currentAllowHeaderResize = this.shouldAllowHeaderResize();
|
29310 | currentAllowHeaderResize !== this.lastAllowHeaderResize && (this.lastAllowHeaderResize = currentAllowHeaderResize,
|
29311 | this.tablixControl.layoutManager.setAllowHeaderResize(currentAllowHeaderResize));
|
29312 | }, Table.preferredLoadMoreThreshold = .8, Table;
|
29313 | }();
|
29314 | visuals.Table = Table;
|
29315 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
29316 | }(powerbi || (powerbi = {}));
|
29317 |
|
29318 | var powerbi;
|
29319 |
|
29320 | !function(powerbi) {
|
29321 | var visuals;
|
29322 | !function(visuals) {
|
29323 | function createMatrixHierarchyNavigator(matrix, formatter) {
|
29324 | return new MatrixHierarchyNavigator(matrix, formatter);
|
29325 | }
|
29326 | var TablixUtils = visuals.controls.internal.TablixUtils, TablixObjects = visuals.controls.internal.TablixObjects, UrlUtils = jsCommon.UrlUtils, MatrixVisualBodyItem = function(_super) {
|
29327 | function MatrixVisualBodyItem() {
|
29328 | _super.apply(this, arguments);
|
29329 | }
|
29330 | return __extends(MatrixVisualBodyItem, _super), Object.defineProperty(MatrixVisualBodyItem.prototype, "isMeasure", {
|
29331 | get: function() {
|
29332 | return !0;
|
29333 | },
|
29334 | enumerable: !0,
|
29335 | configurable: !0
|
29336 | }), Object.defineProperty(MatrixVisualBodyItem.prototype, "isValidUrl", {
|
29337 | get: function() {
|
29338 | return !1;
|
29339 | },
|
29340 | enumerable: !0,
|
29341 | configurable: !0
|
29342 | }), Object.defineProperty(MatrixVisualBodyItem.prototype, "isValidImage", {
|
29343 | get: function() {
|
29344 | return !1;
|
29345 | },
|
29346 | enumerable: !0,
|
29347 | configurable: !0
|
29348 | }), MatrixVisualBodyItem;
|
29349 | }(TablixUtils.TablixVisualCell);
|
29350 | visuals.MatrixVisualBodyItem = MatrixVisualBodyItem, visuals.createMatrixHierarchyNavigator = createMatrixHierarchyNavigator;
|
29351 | var MatrixHierarchyNavigator = function() {
|
29352 | function MatrixHierarchyNavigator(matrix, formatter) {
|
29353 | this.matrix = matrix, this.rowHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(matrix.rows),
|
29354 | this.columnHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(matrix.columns),
|
29355 | this.formatter = formatter, this.update();
|
29356 | }
|
29357 | return MatrixHierarchyNavigator.prototype.getDataViewMatrix = function() {
|
29358 | return this.matrix;
|
29359 | }, MatrixHierarchyNavigator.prototype.getColumnHierarchyDepth = function() {
|
29360 | return Math.max(this.columnHierarchy.levels.length, 1);
|
29361 | }, MatrixHierarchyNavigator.prototype.getRowHierarchyDepth = function() {
|
29362 | return Math.max(this.rowHierarchy.levels.length, 1);
|
29363 | }, MatrixHierarchyNavigator.prototype.getLeafCount = function(hierarchy) {
|
29364 | var matrixHierarchy = this.getMatrixHierarchy(hierarchy);
|
29365 | return matrixHierarchy ? matrixHierarchy.leafNodes.length : 0;
|
29366 | }, MatrixHierarchyNavigator.prototype.getLeafAt = function(hierarchy, index) {
|
29367 | var matrixHierarchy = this.getMatrixHierarchy(hierarchy);
|
29368 | return matrixHierarchy ? matrixHierarchy.leafNodes[index] : null;
|
29369 | }, MatrixHierarchyNavigator.prototype.getLeafIndex = function(item) {
|
29370 | return item.leafIndex;
|
29371 | }, MatrixHierarchyNavigator.prototype.getParent = function(item) {
|
29372 | return 0 === item.level ? null : item.parent;
|
29373 | }, MatrixHierarchyNavigator.prototype.getIndex = function(item) {
|
29374 | return item.index;
|
29375 | }, MatrixHierarchyNavigator.prototype.isLeaf = function(item) {
|
29376 | return !item.children || 0 === item.children.length;
|
29377 | }, MatrixHierarchyNavigator.prototype.isRowHierarchyLeaf = function(item) {
|
29378 | return !0;
|
29379 | }, MatrixHierarchyNavigator.prototype.isColumnHierarchyLeaf = function(item) {
|
29380 | return !1;
|
29381 | }, MatrixHierarchyNavigator.prototype.isFirstItem = function(item, items) {
|
29382 | return item === _.first(items);
|
29383 | }, MatrixHierarchyNavigator.prototype.areAllParentsFirst = function(item, items) {
|
29384 | if (!item) return !1;
|
29385 | var parent = this.getParent(item);
|
29386 | return parent ? this.isFirstItem(item, item.siblings) && this.areAllParentsFirst(parent, parent.siblings) : this.isFirstItem(item, item.siblings);
|
29387 | }, MatrixHierarchyNavigator.prototype.isLastItem = function(item, items) {
|
29388 | return item === _.last(items);
|
29389 | }, MatrixHierarchyNavigator.prototype.areAllParentsLast = function(item, items) {
|
29390 | if (!item) return !1;
|
29391 | var parent = this.getParent(item);
|
29392 | return parent ? this.isLastItem(item, item.siblings) && this.areAllParentsLast(parent, parent.siblings) : this.isLastItem(item, item.siblings);
|
29393 | }, MatrixHierarchyNavigator.prototype.getChildren = function(item) {
|
29394 | return item.children;
|
29395 | }, MatrixHierarchyNavigator.prototype.getChildrenLevelDifference = function(item) {
|
29396 | 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);
|
29397 | return diff;
|
29398 | }, MatrixHierarchyNavigator.prototype.getCount = function(items) {
|
29399 | return items.length;
|
29400 | }, MatrixHierarchyNavigator.prototype.getAt = function(items, index) {
|
29401 | return items[index];
|
29402 | }, MatrixHierarchyNavigator.prototype.getLevel = function(item) {
|
29403 | return item.level;
|
29404 | }, MatrixHierarchyNavigator.prototype.getIntersection = function(rowItem, columnItem) {
|
29405 | var node, valueSource, bodyCell, isSubtotalItem = rowItem.isSubtotal === !0 || columnItem.isSubtotal === !0, rowIndex = rowItem.leafIndex, colIndex = columnItem.leafIndex;
|
29406 | return node = rowItem.values ? rowItem.values[columnItem.leafIndex] : void 0, node ? (valueSource = this.matrix.valueSources[node.valueSourceIndex || 0],
|
29407 | bodyCell = new MatrixVisualBodyItem(node.value, isSubtotalItem, valueSource, this.formatter)) : bodyCell = new MatrixVisualBodyItem(void 0, isSubtotalItem, void 0, this.formatter),
|
29408 | bodyCell.position.row.index = rowIndex, bodyCell.position.row.indexInSiblings = rowItem.siblings.indexOf(rowItem),
|
29409 | bodyCell.position.row.isFirst = 0 === rowIndex, bodyCell.position.row.isLast = rowIndex === this.rowHierarchy.leafNodes.length - 1,
|
29410 | bodyCell.position.column.index = colIndex, bodyCell.position.column.indexInSiblings = columnItem.siblings.indexOf(columnItem),
|
29411 | bodyCell.position.column.isFirst = 0 === colIndex, bodyCell.position.column.isLast = colIndex === this.columnHierarchy.leafNodes.length - 1,
|
29412 | bodyCell;
|
29413 | }, MatrixHierarchyNavigator.prototype.getCorner = function(rowLevel, columnLevel) {
|
29414 | var columnLevels = this.columnHierarchy.levels, rowLevels = this.rowHierarchy.levels;
|
29415 | if (columnLevel === columnLevels.length - 1 || 0 === columnLevels.length) {
|
29416 | var levelSource = rowLevels[rowLevel];
|
29417 | if (levelSource) return {
|
29418 | metadata: levelSource.sources[0],
|
29419 | isColumnHeaderLeaf: !0,
|
29420 | isRowHeaderLeaf: rowLevel === rowLevels.length - 1
|
29421 | };
|
29422 | }
|
29423 | if (rowLevel === rowLevels.length - 1) {
|
29424 | var levelSource = columnLevels[columnLevel];
|
29425 | if (levelSource) return {
|
29426 | metadata: levelSource.sources[0],
|
29427 | isColumnHeaderLeaf: !1,
|
29428 | isRowHeaderLeaf: !0
|
29429 | };
|
29430 | }
|
29431 | return {
|
29432 | metadata: null,
|
29433 | isColumnHeaderLeaf: !1,
|
29434 | isRowHeaderLeaf: !1
|
29435 | };
|
29436 | }, MatrixHierarchyNavigator.prototype.headerItemEquals = function(item1, item2) {
|
29437 | return item1 && item2 ? item1 === item2 : !1;
|
29438 | }, MatrixHierarchyNavigator.prototype.bodyCellItemEquals = function(item1, item2) {
|
29439 | return item1.position.isMatch(item2.position);
|
29440 | }, MatrixHierarchyNavigator.prototype.cornerCellItemEquals = function(item1, item2) {
|
29441 | return item1 === item2;
|
29442 | }, MatrixHierarchyNavigator.prototype.getMatrixColumnHierarchy = function() {
|
29443 | return this.columnHierarchy;
|
29444 | }, MatrixHierarchyNavigator.prototype.getMatrixRowHierarchy = function() {
|
29445 | return this.rowHierarchy;
|
29446 | }, MatrixHierarchyNavigator.prototype.update = function(dataViewMatrix, updateColumns) {
|
29447 | void 0 === updateColumns && (updateColumns = !0), dataViewMatrix && (this.matrix = dataViewMatrix,
|
29448 | this.rowHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(dataViewMatrix.rows),
|
29449 | updateColumns && (this.columnHierarchy = MatrixHierarchyNavigator.wrapMatrixHierarchy(dataViewMatrix.columns))),
|
29450 | this.updateHierarchy(this.rowHierarchy), updateColumns && (this.updateHierarchy(this.columnHierarchy),
|
29451 | MatrixHierarchyNavigator.updateStaticColumnHeaders(this.columnHierarchy));
|
29452 | }, MatrixHierarchyNavigator.wrapMatrixHierarchy = function(hierarchy) {
|
29453 | var matrixHierarchy = powerbi.Prototype.inherit(hierarchy);
|
29454 | return matrixHierarchy.leafNodes = [], matrixHierarchy;
|
29455 | }, MatrixHierarchyNavigator.prototype.updateHierarchy = function(hierarchy) {
|
29456 | hierarchy.leafNodes.length > 0 && (hierarchy.leafNodes.length = 0), hierarchy.root.children && this.updateRecursive(hierarchy, hierarchy.root.children, null, hierarchy.leafNodes);
|
29457 | }, MatrixHierarchyNavigator.prototype.updateRecursive = function(hierarchy, nodes, parent, cache) {
|
29458 | for (var level, i = 0, ilen = nodes.length; ilen > i; i++) {
|
29459 | var node = nodes[i];
|
29460 | if (node.siblings = nodes, parent && (node.parent = parent), level || (level = hierarchy.levels[node.level]),
|
29461 | level) {
|
29462 | var source = level.sources[node.levelSourceIndex ? node.levelSourceIndex : 0], formatString = visuals.valueFormatter.getFormatString(source, TablixObjects.PropColumnFormatString.getPropertyID());
|
29463 | formatString && (node.name = this.formatter(node.value, source, TablixObjects.PropColumnFormatString.getPropertyID())),
|
29464 | node.queryName = source.queryName;
|
29465 | }
|
29466 | node.index = i, node.children && node.children.length > 0 ? this.updateRecursive(hierarchy, node.children, node, cache) : (node.leafIndex = cache.length,
|
29467 | cache.push(node));
|
29468 | }
|
29469 | }, MatrixHierarchyNavigator.updateStaticColumnHeaders = function(columnHierarchy) {
|
29470 | var columnLeafNodes = columnHierarchy.leafNodes;
|
29471 | if (columnLeafNodes && columnLeafNodes.length > 0) for (var columnLeafSources = columnHierarchy.levels[columnLeafNodes[0].level].sources, i = 0, ilen = columnLeafNodes.length; ilen > i; i++) {
|
29472 | var columnLeafNode = columnLeafNodes[i];
|
29473 | if (!columnLeafNode.identity && void 0 === columnLeafNode.value) {
|
29474 | var source = columnLeafSources[columnLeafNode.levelSourceIndex ? columnLeafNode.levelSourceIndex : 0];
|
29475 | source && (columnLeafNode.name = source.displayName);
|
29476 | }
|
29477 | }
|
29478 | }, MatrixHierarchyNavigator.prototype.getMatrixHierarchy = function(rootNodes) {
|
29479 | var rowHierarchyRootNodes = this.rowHierarchy.root.children;
|
29480 | if (rowHierarchyRootNodes && rootNodes === rowHierarchyRootNodes) return this.rowHierarchy;
|
29481 | var columnHierarchyRootNodes = this.columnHierarchy.root.children;
|
29482 | return columnHierarchyRootNodes && rootNodes === columnHierarchyRootNodes ? this.columnHierarchy : null;
|
29483 | }, MatrixHierarchyNavigator;
|
29484 | }(), MatrixBinder = function() {
|
29485 | function MatrixBinder(hierarchyNavigator, options) {
|
29486 | this.hierarchyNavigator = hierarchyNavigator, this.options = options;
|
29487 | }
|
29488 | return MatrixBinder.prototype.onDataViewChanged = function(formattingProperties) {
|
29489 | this.formattingProperties = formattingProperties, this.updateTextHeights();
|
29490 | }, MatrixBinder.prototype.updateTextHeights = function() {
|
29491 | var textProps = {
|
29492 | fontFamily: "",
|
29493 | fontSize: TablixObjects.getTextSizeInPx(this.formattingProperties.general.textSize),
|
29494 | text: "a"
|
29495 | };
|
29496 | textProps.fontFamily = TablixUtils.FontFamilyHeader, this.textHeightHeader = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(textProps)),
|
29497 | textProps.fontFamily = TablixUtils.FontFamilyCell, this.textHeightValue = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(textProps)),
|
29498 | textProps.fontFamily = TablixUtils.FontFamilyTotal, this.textHeightTotal = Math.ceil(powerbi.TextMeasurementService.measureSvgTextHeight(textProps));
|
29499 | }, MatrixBinder.prototype.onStartRenderingSession = function() {}, MatrixBinder.prototype.onEndRenderingSession = function() {},
|
29500 | MatrixBinder.prototype.bindRowHeader = function(item, cell) {
|
29501 | TablixUtils.resetCellCssClass(cell);
|
29502 | var cellStyle = new TablixUtils.CellStyle(), isLeaf = this.hierarchyNavigator && this.hierarchyNavigator.isLeaf(item);
|
29503 | isLeaf && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassMatrixRowHeaderLeaf),
|
29504 | cellStyle.borders.right = new TablixUtils.EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue)),
|
29505 | item.isSubtotal && (cellStyle.paddings.left = TablixUtils.CellPaddingLeftMatrixTotal),
|
29506 | this.bindHeader(item, cell, this.getRowHeaderMetadata(item), cellStyle), this.options.onBindRowHeader && this.options.onBindRowHeader(item),
|
29507 | this.setRowHeaderStyle(cell, cellStyle), cell.applyStyle(cellStyle);
|
29508 | }, MatrixBinder.prototype.setRowHeaderStyle = function(cell, style) {
|
29509 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.rowHeaders, propsValues = this.formattingProperties.values, propsCols = this.formattingProperties.columnHeaders;
|
29510 | style.borders.top = new TablixUtils.EdgeSettings(), cell.position.row.isFirst && (style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29511 | !visuals.outline.showTop(props.outline) && visuals.outline.showTop(propsValues.outline) && (style.paddings.top += propsGrid.outlineWeight)),
|
29512 | style.borders.bottom = new TablixUtils.EdgeSettings(), cell.position.row.isLast ? (style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29513 | !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),
|
29514 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29515 | !visuals.outline.showLeft(props.outline) && visuals.outline.showLeft(propsCols.outline) && (style.paddings.left += propsGrid.outlineWeight)),
|
29516 | style.borders.right = new TablixUtils.EdgeSettings(), cell.position.column.isLast ? style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor) : style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor),
|
29517 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding;
|
29518 | }, MatrixBinder.prototype.unbindRowHeader = function(item, cell) {
|
29519 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29520 | }, MatrixBinder.prototype.bindColumnHeader = function(item, cell) {
|
29521 | TablixUtils.resetCellCssClass(cell);
|
29522 | var cellStyle = new TablixUtils.CellStyle(), overwriteTotalLabel = !1, isLeaf = this.hierarchyNavigator && this.hierarchyNavigator.isLeaf(item);
|
29523 | if (isLeaf) {
|
29524 | cellStyle.borders.bottom = new TablixUtils.EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue),
|
29525 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixColumnHeaderLeaf), TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueNumeric);
|
29526 | var sortableHeaderColumnMetadata = this.getSortableHeaderColumnMetadata(item);
|
29527 | sortableHeaderColumnMetadata && this.options.showSortIcons && (this.registerColumnHeaderClickHandler(sortableHeaderColumnMetadata, cell),
|
29528 | TablixUtils.createColumnHeaderWithSortIcon(sortableHeaderColumnMetadata, cell)),
|
29529 | item.isSubtotal && item.parent && item.parent.children.length > 1 && item.parent.children[0].isSubtotal && (overwriteTotalLabel = !0);
|
29530 | }
|
29531 | cell.extension.disableDragResize(), this.bindHeader(item, cell, this.getColumnHeaderMetadata(item), cellStyle, overwriteTotalLabel),
|
29532 | this.setColumnHeaderStyle(cell, cellStyle), cell.applyStyle(cellStyle);
|
29533 | }, MatrixBinder.prototype.setColumnHeaderStyle = function(cell, style) {
|
29534 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.columnHeaders, propsValues = this.formattingProperties.values;
|
29535 | style.fontColor = props.fontColor, style.backColor = props.backColor, style.paddings.top = style.paddings.bottom = propsGrid.rowPadding,
|
29536 | style.borders.top = new TablixUtils.EdgeSettings(), cell.position.row.isFirst && style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29537 | style.borders.bottom = new TablixUtils.EdgeSettings(), cell.position.row.isLast ? style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor),
|
29538 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && !visuals.outline.showLeft(props.outline) && visuals.outline.showLeft(propsValues.outline) && (style.paddings.left += propsGrid.outlineWeight),
|
29539 | style.borders.right = new TablixUtils.EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29540 | !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);
|
29541 | }, MatrixBinder.prototype.unbindColumnHeader = function(item, cell) {
|
29542 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29543 | var sortableHeaderColumnMetadata = this.getSortableHeaderColumnMetadata(item);
|
29544 | sortableHeaderColumnMetadata && this.unregisterColumnHeaderClickHandler(cell), this.options.showSortIcons && TablixUtils.removeSortIcons(cell);
|
29545 | }, MatrixBinder.prototype.bindHeader = function(item, cell, metadata, style, overwriteSubtotalLabel) {
|
29546 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixHeader), style.fontFamily = TablixUtils.FontFamilyHeader,
|
29547 | style.fontColor = TablixUtils.FontColorHeaders;
|
29548 | var imgHeight = this.formattingProperties.grid.imageHeight;
|
29549 | if (visuals.converterHelper.isImageUrlColumn(metadata) ? cell.contentHeight = imgHeight : item.isSubtotal ? cell.contentHeight = this.textHeightTotal : cell.contentHeight = this.textHeightValue,
|
29550 | item.isSubtotal && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueTotal),
|
29551 | style.fontFamily = TablixUtils.FontFamilyTotal, !overwriteSubtotalLabel)) return void TablixUtils.setCellTextAndTooltip(cell, this.options.totalLabel);
|
29552 | var value = MatrixBinder.getNodeLabel(item);
|
29553 | value ? visuals.converterHelper.isWebUrlColumn(metadata) && UrlUtils.isValidUrl(value) ? TablixUtils.appendATagToBodyCell(item.value, cell) : visuals.converterHelper.isImageUrlColumn(metadata) ? (style.hasImage = !0,
|
29554 | UrlUtils.isValidImageUrl(value) ? TablixUtils.appendImgTagToBodyCell(item.value, cell, imgHeight) : TablixUtils.setCellTextAndTooltip(cell, value)) : TablixUtils.setCellTextAndTooltip(cell, value) : cell.extension.contentHost.innerHTML = TablixUtils.StringNonBreakingSpace;
|
29555 | }, MatrixBinder.prototype.registerColumnHeaderClickHandler = function(columnMetadata, cell) {
|
29556 | var _this = this;
|
29557 | if (this.options.onColumnHeaderClick) {
|
29558 | var handler = function(e) {
|
29559 | if (TablixUtils.isValidSortClick(e)) {
|
29560 | var sortDirection = TablixUtils.reverseSort(columnMetadata.sort);
|
29561 | _this.options.onColumnHeaderClick(columnMetadata.queryName ? columnMetadata.queryName : columnMetadata.displayName, sortDirection);
|
29562 | }
|
29563 | };
|
29564 | cell.extension.registerClickHandler(handler);
|
29565 | }
|
29566 | }, MatrixBinder.prototype.unregisterColumnHeaderClickHandler = function(cell) {
|
29567 | this.options.onColumnHeaderClick && cell.extension.unregisterClickHandler();
|
29568 | }, MatrixBinder.prototype.bindBodyCell = function(item, cell) {
|
29569 | TablixUtils.resetCellCssClass(cell);
|
29570 | var cellStyle = new TablixUtils.CellStyle();
|
29571 | cell.contentHeight = this.textHeightValue, item.domContent ? $(cell.extension.contentHost).append(item.domContent) : (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueNumeric),
|
29572 | item.isTotal && (TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixValueTotal),
|
29573 | cellStyle.fontFamily = TablixUtils.FontFamilyTotal, cell.contentHeight = this.textHeightTotal),
|
29574 | item.textContent && TablixUtils.setCellTextAndTooltip(cell, item.textContent)),
|
29575 | this.setBodyCellStyle(cell, item, cellStyle), cell.applyStyle(cellStyle);
|
29576 | }, MatrixBinder.prototype.setBodyCellStyle = function(cell, item, style) {
|
29577 | var propsGrid = this.formattingProperties.grid, props = this.formattingProperties.values, propsTotal = this.formattingProperties.subtotals, propsRows = this.formattingProperties.rowHeaders, propsColumns = this.formattingProperties.columnHeaders;
|
29578 | style.paddings.top = style.paddings.bottom = propsGrid.rowPadding, style.borders.top = new TablixUtils.EdgeSettings(),
|
29579 | cell.position.row.isFirst && (style.borders.top.applyParams(visuals.outline.showTop(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29580 | !visuals.outline.showTop(props.outline) && visuals.outline.showTop(propsRows.outline) && (style.paddings.top += propsGrid.outlineWeight)),
|
29581 | style.borders.bottom = new TablixUtils.EdgeSettings(), cell.position.row.isLast ? (style.borders.bottom.applyParams(visuals.outline.showBottom(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29582 | !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),
|
29583 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && style.borders.left.applyParams(visuals.outline.showLeft(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29584 | style.borders.right = new TablixUtils.EdgeSettings(), cell.position.column.isLast ? (style.borders.right.applyParams(visuals.outline.showRight(props.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29585 | !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);
|
29586 | var rowBandingIndex;
|
29587 | rowBandingIndex = this.formattingProperties.general.rowSubtotals && propsTotal.backColor ? item.position.row.indexInSiblings : item.position.row.index,
|
29588 | item.isTotal && propsTotal.fontColor ? style.fontColor = propsTotal.fontColor : style.fontColor = rowBandingIndex % 2 === 0 ? props.fontColorPrimary : props.fontColorSecondary,
|
29589 | item.isTotal && propsTotal.backColor ? style.backColor = propsTotal.backColor : style.backColor = rowBandingIndex % 2 === 0 ? props.backColorPrimary : props.backColorSecondary;
|
29590 | }, MatrixBinder.prototype.unbindBodyCell = function(item, cell) {
|
29591 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell);
|
29592 | }, MatrixBinder.prototype.bindCornerCell = function(item, cell) {
|
29593 | TablixUtils.resetCellCssClass(cell);
|
29594 | var cellStyle = new TablixUtils.CellStyle();
|
29595 | if (cellStyle.fontFamily = TablixUtils.FontFamilyHeader, cellStyle.fontColor = TablixUtils.FontColorHeaders,
|
29596 | cell.contentHeight = this.textHeightHeader, item.isColumnHeaderLeaf) {
|
29597 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixColumnHeaderLeaf), cellStyle.borders.bottom = new TablixUtils.EdgeSettings(TablixObjects.PropGridOutlineWeight.defaultValue, TablixObjects.PropGridOutlineColor.defaultValue);
|
29598 | var cornerHeaderMetadata = this.getSortableCornerColumnMetadata(item);
|
29599 | cornerHeaderMetadata && this.registerColumnHeaderClickHandler(cornerHeaderMetadata, cell),
|
29600 | this.options.showSortIcons ? TablixUtils.createColumnHeaderWithSortIcon(cornerHeaderMetadata, cell) : TablixUtils.setCellTextAndTooltip(cell, cornerHeaderMetadata.displayName);
|
29601 | } else {
|
29602 | var itemText = item.metadata ? item.metadata.displayName : "";
|
29603 | TablixUtils.setCellTextAndTooltip(cell, itemText);
|
29604 | }
|
29605 | item.isRowHeaderLeaf && TablixUtils.addCellCssClass(cell, TablixUtils.CssClassMatrixRowHeaderLeaf),
|
29606 | TablixUtils.addCellCssClass(cell, TablixUtils.CssClassTablixHeader), this.setCornerCellsStyle(cell, cellStyle),
|
29607 | cell.applyStyle(cellStyle), cell.extension.disableDragResize();
|
29608 | }, MatrixBinder.prototype.setCornerCellsStyle = function(cell, style) {
|
29609 | var propsGrid = this.formattingProperties.grid, propsCol = this.formattingProperties.columnHeaders, propsRow = this.formattingProperties.rowHeaders;
|
29610 | style.fontColor = propsCol.fontColor || propsRow.fontColor, style.backColor = propsCol.backColor || propsRow.backColor,
|
29611 | style.paddings.top = style.paddings.bottom = propsGrid.rowPadding, style.borders.top = new TablixUtils.EdgeSettings(),
|
29612 | cell.position.row.isFirst && style.borders.top.applyParams(visuals.outline.showTop(propsCol.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29613 | style.borders.bottom = new TablixUtils.EdgeSettings(), cell.position.row.isLast ? style.borders.bottom.applyParams(visuals.outline.showBottom(propsCol.outline), propsGrid.outlineWeight, propsGrid.outlineColor) : style.borders.bottom.applyParams(propsGrid.gridHorizontal, propsGrid.gridHorizontalWeight, propsGrid.gridHorizontalColor),
|
29614 | style.borders.left = new TablixUtils.EdgeSettings(), cell.position.column.isFirst && (style.borders.left.applyParams(visuals.outline.showLeft(propsCol.outline), propsGrid.outlineWeight, propsGrid.outlineColor),
|
29615 | !visuals.outline.showLeft(propsCol.outline) && visuals.outline.showLeft(propsRow.outline) && (style.paddings.left += propsGrid.outlineWeight)),
|
29616 | style.borders.right = new TablixUtils.EdgeSettings(), style.borders.right.applyParams(propsGrid.gridVertical, propsGrid.gridVerticalWeight, propsGrid.gridVerticalColor);
|
29617 | }, MatrixBinder.prototype.unbindCornerCell = function(item, cell) {
|
29618 | TablixUtils.clearCellStyle(cell), TablixUtils.clearCellTextAndTooltip(cell), this.options.showSortIcons && TablixUtils.removeSortIcons(cell),
|
29619 | item.isColumnHeaderLeaf && this.unregisterColumnHeaderClickHandler(cell);
|
29620 | }, MatrixBinder.prototype.bindEmptySpaceHeaderCell = function(cell) {}, MatrixBinder.prototype.unbindEmptySpaceHeaderCell = function(cell) {},
|
29621 | MatrixBinder.prototype.bindEmptySpaceFooterCell = function(cell) {}, MatrixBinder.prototype.unbindEmptySpaceFooterCell = function(cell) {},
|
29622 | MatrixBinder.prototype.getHeaderLabel = function(item) {
|
29623 | return MatrixBinder.getNodeLabel(item);
|
29624 | }, MatrixBinder.prototype.getCellContent = function(item) {
|
29625 | return item.textContent || "";
|
29626 | }, MatrixBinder.prototype.hasRowGroups = function() {
|
29627 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29628 | return !!(dataView && dataView.rows && dataView.rows.levels && 0 !== dataView.rows.levels.length);
|
29629 | }, MatrixBinder.getNodeLabel = function(node) {
|
29630 | return node.name ? node.name : null != node.value ? node.value.toString() : "";
|
29631 | }, MatrixBinder.prototype.getSortableCornerColumnMetadata = function(item) {
|
29632 | return item.isColumnHeaderLeaf ? item.metadata : void 0;
|
29633 | }, MatrixBinder.prototype.getRowHeaderMetadata = function(item) {
|
29634 | if (this.hierarchyNavigator && item) {
|
29635 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29636 | if (dataView && dataView.rows) return this.getHierarchyMetadata(dataView.rows, item.level);
|
29637 | }
|
29638 | }, MatrixBinder.prototype.getColumnHeaderMetadata = function(item) {
|
29639 | if (this.hierarchyNavigator && item) {
|
29640 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29641 | if (dataView && dataView.columns) return this.getHierarchyMetadata(dataView.columns, item.level);
|
29642 | }
|
29643 | }, MatrixBinder.prototype.getHierarchyMetadata = function(hierarchy, level) {
|
29644 | if (hierarchy && hierarchy.levels && !(hierarchy.levels.length < level)) {
|
29645 | var levelInfo = hierarchy.levels[level];
|
29646 | if (levelInfo && levelInfo.sources && 0 !== levelInfo.sources.length) return levelInfo.sources[0];
|
29647 | }
|
29648 | }, MatrixBinder.prototype.getSortableHeaderColumnMetadata = function(item) {
|
29649 | var dataView = this.hierarchyNavigator.getDataViewMatrix();
|
29650 | if (!dataView.rows || !dataView.rows.levels || 0 === dataView.rows.levels.length) return null;
|
29651 | var isMultiMeasure = dataView.valueSources && dataView.valueSources.length > 1, columnGroupCount = dataView.columns ? dataView.columns.levels.length : 0;
|
29652 | 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);
|
29653 | var valueIndex = -1;
|
29654 | return 0 === columnGroupCount ? valueIndex = item.levelSourceIndex : item.isSubtotal && (isMultiMeasure ? item.parent && 0 === item.parent.level && (valueIndex = item.levelSourceIndex) : 0 === item.level && (valueIndex = item.levelSourceIndex)),
|
29655 | -1 !== valueIndex ? (valueIndex = valueIndex ? valueIndex : 0, dataView.valueSources[valueIndex]) : null;
|
29656 | }, MatrixBinder;
|
29657 | }();
|
29658 | visuals.MatrixBinder = MatrixBinder;
|
29659 | var Matrix = function() {
|
29660 | function Matrix(options) {
|
29661 | options && (this.isTouchEnabled = options.isTouchEnabled);
|
29662 | }
|
29663 | return Matrix.customizeQuery = function(options) {
|
29664 | var dataViewMapping = options.dataViewMappings[0];
|
29665 | if (dataViewMapping && dataViewMapping.matrix && dataViewMapping.metadata) {
|
29666 | var dataViewMatrix = dataViewMapping.matrix;
|
29667 | _.isEmpty(dataViewMatrix.columns["for"]["in"].items) || (dataViewMatrix.rows.dataReductionAlgorithm.window.count = 100);
|
29668 | var objects = dataViewMapping.metadata.objects;
|
29669 | dataViewMatrix.rows["for"]["in"].subtotalType = TablixObjects.shouldShowRowSubtotals(objects) ? 2 : 0,
|
29670 | dataViewMatrix.columns["for"]["in"].subtotalType = TablixObjects.shouldShowColumnSubtotals(objects) ? 2 : 0;
|
29671 | }
|
29672 | }, Matrix.getSortableRoles = function() {
|
29673 | return [ "Rows", "Values" ];
|
29674 | }, Matrix.prototype.init = function(options) {
|
29675 | this.element = options.element, this.style = options.style, this.updateViewport(options.viewport),
|
29676 | this.formatter = visuals.valueFormatter.formatValueColumn, this.isInteractive = options.interactivity && null != options.interactivity.selection,
|
29677 | this.hostServices = options.host, this.persistingObjects = !1, this.waitingForData = !1,
|
29678 | this.lastAllowHeaderResize = !0, this.waitingForSort = !1;
|
29679 | }, Matrix.converter = function(dataView) {
|
29680 | return TablixObjects.getMatrixObjects(dataView);
|
29681 | }, Matrix.prototype.onResizing = function(finalViewport) {
|
29682 | this.updateViewport(finalViewport);
|
29683 | }, Matrix.prototype.getColumnWidthManager = function() {
|
29684 | return this.columnWidthManager;
|
29685 | }, Matrix.prototype.onDataChanged = function(options) {
|
29686 | var dataViews = options.dataViews;
|
29687 | if (dataViews && dataViews.length > 0) {
|
29688 | var previousDataView = this.dataView;
|
29689 | this.dataView = dataViews[0];
|
29690 | var formattingProperties = Matrix.converter(this.dataView), textSize = formattingProperties.general.textSize;
|
29691 | if (options.operationKind === powerbi.VisualDataChangeOperationKind.Append) {
|
29692 | var rootChanged = previousDataView.matrix.rows.root !== this.dataView.matrix.rows.root;
|
29693 | this.hierarchyNavigator.update(this.dataView.matrix, rootChanged), rootChanged && this.tablixControl.updateModels(!1, this.dataView.matrix.rows.root.children, this.dataView.matrix.columns.root.children),
|
29694 | this.refreshControl(!1);
|
29695 | } else {
|
29696 | this.createOrUpdateHierarchyNavigator(), this.createColumnWidthManager(), this.createTablixControl(textSize);
|
29697 | var binder = this.tablixControl.getBinder();
|
29698 | binder.onDataViewChanged(formattingProperties), this.updateInternal(textSize, previousDataView);
|
29699 | }
|
29700 | }
|
29701 | this.waitingForData = !1, this.waitingForSort = !1;
|
29702 | }, Matrix.prototype.createColumnWidthManager = function() {
|
29703 | var _this = this, columnHierarchy = this.hierarchyNavigator.getMatrixColumnHierarchy();
|
29704 | this.columnWidthManager ? this.persistingObjects || this.columnWidthManager.updateDataView(this.dataView, columnHierarchy.leafNodes) : this.columnWidthManager = new visuals.controls.TablixColumnWidthManager(this.dataView, !0, function(objectInstances) {
|
29705 | return _this.persistColumnWidths(objectInstances);
|
29706 | }, columnHierarchy.leafNodes);
|
29707 | }, Matrix.prototype.persistColumnWidths = function(objectInstances) {
|
29708 | this.persistingObjects = !0, this.hostServices.persistProperties(objectInstances);
|
29709 | }, Matrix.prototype.updateViewport = function(newViewport) {
|
29710 | this.currentViewport = newViewport, this.tablixControl && (this.tablixControl.viewport = this.currentViewport,
|
29711 | this.verifyHeaderResize(), this.refreshControl(!1));
|
29712 | }, Matrix.prototype.refreshControl = function(clear) {
|
29713 | (visuals.visibilityHelper.partiallyVisible(this.element) || 1 === this.getLayoutKind()) && this.tablixControl.refresh(clear);
|
29714 | }, Matrix.prototype.getLayoutKind = function() {
|
29715 | return this.isInteractive ? 0 : 1;
|
29716 | }, Matrix.prototype.createOrUpdateHierarchyNavigator = function() {
|
29717 | if (this.tablixControl) this.hierarchyNavigator.update(this.dataView.matrix); else {
|
29718 | var matrixNavigator = createMatrixHierarchyNavigator(this.dataView.matrix, this.formatter);
|
29719 | this.hierarchyNavigator = matrixNavigator;
|
29720 | }
|
29721 | }, Matrix.prototype.createTablixControl = function(textSize) {
|
29722 | this.tablixControl || (this.tablixControl = this.createControl(this.hierarchyNavigator, textSize));
|
29723 | }, Matrix.prototype.createControl = function(matrixNavigator, textSize) {
|
29724 | var _this = this, layoutKind = this.getLayoutKind(), matrixBinderOptions = {
|
29725 | onBindRowHeader: function(item) {
|
29726 | _this.onBindRowHeader(item);
|
29727 | },
|
29728 | totalLabel: this.hostServices.getLocalizedString(Matrix.TotalLabel),
|
29729 | onColumnHeaderClick: function(queryName, sortDirection) {
|
29730 | return _this.onColumnHeaderClick(queryName, sortDirection);
|
29731 | },
|
29732 | showSortIcons: 0 === layoutKind
|
29733 | }, 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");
|
29734 | this.element.append(tablixContainer);
|
29735 | var tablixOptions = {
|
29736 | interactive: this.isInteractive,
|
29737 | enableTouchSupport: this.isTouchEnabled,
|
29738 | layoutKind: layoutKind,
|
29739 | fontSize: TablixObjects.getTextSizeInPx(textSize)
|
29740 | };
|
29741 | return new visuals.controls.TablixControl(matrixNavigator, layoutManager, matrixBinder, tablixContainer, tablixOptions);
|
29742 | }, Matrix.prototype.updateInternal = function(textSize, previousDataView) {
|
29743 | var _this = this;
|
29744 | 1 === this.getLayoutKind() && this.tablixControl.layoutManager.adjustContentSize(visuals.converterHelper.hasImageUrlColumn(this.dataView)),
|
29745 | this.tablixControl.fontSize = TablixObjects.getTextSizeInPx(textSize), this.verifyHeaderResize(),
|
29746 | this.tablixControl.updateModels(!this.persistingObjects, this.dataView.matrix.rows.root.children, this.dataView.matrix.columns.root.children),
|
29747 | this.tablixControl.viewport = this.currentViewport;
|
29748 | var shouldClearControl = this.shouldClearControl(previousDataView, this.dataView);
|
29749 | setTimeout(function() {
|
29750 | return _this.refreshControl(shouldClearControl), _this.persistingObjects ? void (_this.persistingObjects = !1) : void (_this.columnWidthManager.shouldPersistAllColumnWidths() && _this.columnWidthManager.persistAllColumnWidths(_this.tablixControl.layoutManager.columnWidthsToPersist));
|
29751 | }, 0);
|
29752 | }, Matrix.prototype.shouldClearControl = function(previousDataView, newDataView) {
|
29753 | return this.waitingForSort && previousDataView && newDataView ? !powerbi.DataViewAnalysis.isMetadataEquivalent(previousDataView.metadata, newDataView.metadata) : !0;
|
29754 | }, Matrix.prototype.onBindRowHeader = function(item) {
|
29755 | this.needsMoreData(item) && (this.hostServices.loadMoreData(), this.waitingForData = !0);
|
29756 | }, Matrix.prototype.onColumnHeaderClick = function(queryName, sortDirection) {
|
29757 | this.waitingForSort = !0, this.hostServices.onCustomSort(TablixUtils.getCustomSortEventArgs(queryName, sortDirection));
|
29758 | }, Matrix.prototype.needsMoreData = function(item) {
|
29759 | if (this.waitingForData || !this.hierarchyNavigator.isLeaf(item) || !this.dataView.metadata || !this.dataView.metadata.segment) return !1;
|
29760 | var leafCount = this.tablixControl.rowDimension.getItemsCount(), loadMoreThreshold = leafCount * Matrix.preferredLoadMoreThreshold;
|
29761 | return this.hierarchyNavigator.getLeafIndex(item) >= loadMoreThreshold;
|
29762 | }, Matrix.prototype.enumerateObjectInstances = function(options) {
|
29763 | var enumeration = new visuals.ObjectEnumerationBuilder();
|
29764 | return this.dataView && TablixObjects.enumerateObjectInstances(options, enumeration, this.dataView, visuals.controls.TablixType.Matrix),
|
29765 | enumeration.complete();
|
29766 | }, Matrix.prototype.shouldAllowHeaderResize = function() {
|
29767 | return 1 === this.hostServices.getViewMode();
|
29768 | }, Matrix.prototype.onViewModeChanged = function(viewMode) {
|
29769 | this.updateViewport(this.currentViewport);
|
29770 | }, Matrix.prototype.verifyHeaderResize = function() {
|
29771 | var currentAllowHeaderResize = this.shouldAllowHeaderResize();
|
29772 | currentAllowHeaderResize !== this.lastAllowHeaderResize && (this.lastAllowHeaderResize = currentAllowHeaderResize,
|
29773 | this.tablixControl.layoutManager.setAllowHeaderResize(currentAllowHeaderResize));
|
29774 | }, Matrix.preferredLoadMoreThreshold = .8, Matrix.TotalLabel = "TableTotalLabel",
|
29775 | Matrix;
|
29776 | }();
|
29777 | visuals.Matrix = Matrix;
|
29778 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
29779 | }(powerbi || (powerbi = {}));
|
29780 |
|
29781 | var powerbi;
|
29782 |
|
29783 | !function(powerbi) {
|
29784 | var visuals;
|
29785 | !function(visuals) {
|
29786 | var CssConstants = jsCommon.CssConstants, Treemap = function() {
|
29787 | function Treemap(options) {
|
29788 | this.tooltipsEnabled = options && options.tooltipsEnabled, options && options.animator && (this.animator = options.animator,
|
29789 | this.isScrollable = options.isScrollable ? options.isScrollable : !1, this.behavior = options.behavior);
|
29790 | }
|
29791 | return Treemap.getLayout = function(labelsSettings, alternativeScale) {
|
29792 | var formattersCache = visuals.dataLabelUtils.createColumnFormatterCacheManager(), majorLabelsEnabled = labelsSettings.showCategory, minorLabelsEnabled = labelsSettings.show || labelsSettings.showCategory;
|
29793 | return {
|
29794 | shapeClass: function(d) {
|
29795 | return Treemap.getNodeClass(d, !1);
|
29796 | },
|
29797 | shapeLayout: Treemap.createTreemapShapeLayout(!1),
|
29798 | highlightShapeClass: function(d) {
|
29799 | return Treemap.getNodeClass(d, !0);
|
29800 | },
|
29801 | highlightShapeLayout: Treemap.createTreemapShapeLayout(!0),
|
29802 | zeroShapeLayout: Treemap.createTreemapZeroShapeLayout(),
|
29803 | majorLabelClass: function(d) {
|
29804 | return Treemap.MajorLabelClassName;
|
29805 | },
|
29806 | majorLabelLayout: {
|
29807 | x: function(d) {
|
29808 | return d.x + Treemap.TextMargin;
|
29809 | },
|
29810 | y: function(d) {
|
29811 | return d.y + Treemap.TextMargin + Treemap.MajorLabelTextSize;
|
29812 | }
|
29813 | },
|
29814 | majorLabelText: function(d) {
|
29815 | return Treemap.createMajorLabelText(d, labelsSettings, alternativeScale, formattersCache);
|
29816 | },
|
29817 | minorLabelClass: function(d) {
|
29818 | return Treemap.MinorLabelClassName;
|
29819 | },
|
29820 | minorLabelLayout: {
|
29821 | x: function(d) {
|
29822 | return d.x + Treemap.TextMargin;
|
29823 | },
|
29824 | y: function(d) {
|
29825 | return d.y + d.dy - Treemap.TextMargin;
|
29826 | }
|
29827 | },
|
29828 | minorLabelText: function(d) {
|
29829 | return Treemap.createMinorLabelText(d, labelsSettings, alternativeScale, formattersCache);
|
29830 | },
|
29831 | areMajorLabelsEnabled: function() {
|
29832 | return majorLabelsEnabled;
|
29833 | },
|
29834 | areMinorLabelsEnabled: function() {
|
29835 | return minorLabelsEnabled;
|
29836 | }
|
29837 | };
|
29838 | }, Treemap.prototype.init = function(options) {
|
29839 | this.options = options;
|
29840 | var element = options.element;
|
29841 | element.empty(), this.svg = d3.select(element.get(0)).append("svg").style("position", "absolute").classed(Treemap.ClassName, !0),
|
29842 | this.shapeGraphicsContext = this.svg.append("g").classed(Treemap.ShapesClassName, !0),
|
29843 | this.labelGraphicsContext = this.svg.append("g").classed(Treemap.LabelsGroupClassName, !0),
|
29844 | this.element = element, this.currentViewport = {
|
29845 | height: options.viewport.height,
|
29846 | width: options.viewport.width
|
29847 | }, this.style = options.style, this.treemap = d3.layout.treemap().sticky(!1).sort(function(a, b) {
|
29848 | return a.size - b.size;
|
29849 | }).value(function(d) {
|
29850 | return d.size;
|
29851 | }).round(!1), this.behavior && (this.interactivityService = visuals.createInteractivityService(options.host)),
|
29852 | this.legend = visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, this.interactivityService, this.isScrollable),
|
29853 | this.colors = this.style.colorPalette.dataColors, this.hostService = options.host;
|
29854 | }, Treemap.converter = function(dataView, colors, labelSettings, interactivityService, viewport, legendObjectProperties, tooltipsEnabled) {
|
29855 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
29856 | var hasHighlights, reader = powerbi.data.createIDataViewCategoricalReader(dataView), rootNode = {
|
29857 | key: "root",
|
29858 | name: "root",
|
29859 | children: [],
|
29860 | selected: !1,
|
29861 | highlightMultiplier: 0,
|
29862 | identity: visuals.SelectionId.createNull(),
|
29863 | color: void 0
|
29864 | }, allNodes = [], legendDataPoints = [], legendTitle = "", colorHelper = new visuals.ColorHelper(colors, visuals.treemapProps.dataPoint.fill), dataWasCulled = void 0;
|
29865 | if (dataView && dataView.metadata && dataView.metadata.objects) {
|
29866 | var objects = dataView.metadata.objects;
|
29867 | labelSettings.show = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.labels.show, labelSettings.show),
|
29868 | labelSettings.labelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.treemapProps.labels.color, labelSettings.labelColor),
|
29869 | labelSettings.displayUnits = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.labels.labelDisplayUnits, labelSettings.displayUnits),
|
29870 | labelSettings.precision = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.labels.labelPrecision, labelSettings.precision),
|
29871 | labelSettings.showCategory = powerbi.DataViewObjects.getValue(objects, visuals.treemapProps.categoryLabels.show, labelSettings.showCategory);
|
29872 | }
|
29873 | if (dataView && dataView.categorical && dataView.categorical.values) {
|
29874 | var categorical = dataView.categorical, valueColumns = categorical.values;
|
29875 | hasHighlights = !!(valueColumns.length > 0 && valueColumns[0].highlights);
|
29876 | var formatStringProp = visuals.treemapProps.general.formatString, result = Treemap.getValuesFromCategoricalDataView(categorical, hasHighlights), values = result.values, highlights = result.highlights, totalValue = result.totalValue;
|
29877 | result.highlightsOverflow && (hasHighlights = !1, values = highlights);
|
29878 | var cullableValue = Treemap.getCullableValue(totalValue, viewport), grouped = valueColumns.grouped(), isMultiSeries = grouped && grouped.length > 0 && grouped[0].values && grouped[0].values.length > 1, hasDynamicSeries = !!valueColumns.source;
|
29879 | dataWasCulled = !1;
|
29880 | var shouldCullValue = void 0, gradientValueColumn = visuals.GradientUtils.getGradientValueColumn(categorical);
|
29881 | if (null != categorical.categories || _.isEmpty(values)) {
|
29882 | if (categorical.categories && categorical.categories.length > 0) {
|
29883 | var valueColumnCount = _.filter(valueColumns, function(x) {
|
29884 | return x.source && x.source.roles && x.source.roles[Treemap.ValuesRoleName] === !0;
|
29885 | }).length, omitSecondLevel = 1 === valueColumnCount && null == valueColumns[0].source.groupName, categoryColumn = categorical.categories[0];
|
29886 | legendTitle = categoryColumn.source.displayName;
|
29887 | for (var categoryFormat = visuals.valueFormatter.getFormatString(categoryColumn.source, formatStringProp), categoryIndex = 0, categoryLen = values.length; categoryLen > categoryIndex; categoryIndex++) {
|
29888 | 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 = powerbi.data.DataRoleHelper.getMeasureIndexOfRole(grouped, Treemap.ValuesRoleName), value = currentValues[seriesIndex], highlightValue = hasHighlights && highlights ? highlights[categoryIndex][seriesIndex] : void 0, tooltipInfo = void 0, categoryTooltipItem = void 0;
|
29889 | if (tooltipsEnabled) {
|
29890 | tooltipInfo = [], categoryTooltipItem = {
|
29891 | displayName: categoryColumn.source.displayName,
|
29892 | value: categoryValue
|
29893 | }, tooltipInfo.push(categoryTooltipItem);
|
29894 | var valueColumnMetadata = void 0;
|
29895 | null != value && (valueColumnMetadata = valueColumns[seriesIndex].source, tooltipInfo.push({
|
29896 | displayName: valueColumnMetadata.displayName,
|
29897 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueColumnMetadata, formatStringProp)
|
29898 | })), null != highlightValue && tooltipInfo.push({
|
29899 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
29900 | value: visuals.converterHelper.formatFromMetadataColumn(highlightValue, valueColumnMetadata, formatStringProp)
|
29901 | });
|
29902 | var gradientValueColumnMetadata = gradientValueColumn ? gradientValueColumn.source : void 0;
|
29903 | omitSecondLevel && gradientValueColumnMetadata && gradientValueColumnMetadata !== valueColumnMetadata && null != gradientValueColumn.values[categoryIndex] && tooltipInfo.push({
|
29904 | displayName: gradientValueColumnMetadata.displayName,
|
29905 | value: visuals.converterHelper.formatFromMetadataColumn(gradientValueColumn.values[categoryIndex], gradientValueColumnMetadata, formatStringProp)
|
29906 | });
|
29907 | }
|
29908 | var identity = visuals.SelectionIdBuilder.builder().withCategory(categoryColumn, categoryIndex).withMeasure(omitSecondLevel ? valueColumns[seriesIndex].source.queryName : void 0).createSelectionId(), key = JSON.stringify({
|
29909 | nodeKey: identity.getKey(),
|
29910 | depth: 1
|
29911 | }), node = {
|
29912 | key: key,
|
29913 | name: categoryValue,
|
29914 | color: color,
|
29915 | selected: !1,
|
29916 | identity: identity,
|
29917 | tooltipInfo: tooltipInfo,
|
29918 | highlightedTooltipInfo: tooltipInfo,
|
29919 | labelFormatString: 1 === valueColumnCount ? visuals.valueFormatter.getFormatString(valueColumns[seriesIndex].source, formatStringProp) : categoryFormat
|
29920 | };
|
29921 | hasHighlights && (node.highlightMultiplier = 0 !== value ? highlightValue / value : 0,
|
29922 | node.highlightValue = highlightValue), legendDataPoints.push({
|
29923 | label: categoryValue,
|
29924 | color: color,
|
29925 | icon: visuals.LegendIcon.Box,
|
29926 | identity: identity,
|
29927 | selected: !1
|
29928 | });
|
29929 | for (var total = 0, highlightTotal = 0, j = 0, jlen = currentValues.length; jlen > j; j++) {
|
29930 | var valueColumn = valueColumns[j];
|
29931 | if (powerbi.data.DataRoleHelper.hasRoleInValueColumn(valueColumn, Treemap.ValuesRoleName)) {
|
29932 | var value_1 = currentValues[j], highlight = void 0;
|
29933 | if (shouldCullValue = cullableValue > value_1, Treemap.checkValueForShape(value_1) && !shouldCullValue) {
|
29934 | if (total += value_1, hasHighlights && (highlight = highlights[categoryIndex][j],
|
29935 | highlightTotal += highlight), !omitSecondLevel) {
|
29936 | var childName = null;
|
29937 | childName = isMultiSeries ? valueColumn.source.displayName : valueColumn.source.groupName;
|
29938 | 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({
|
29939 | nodeKey: childIdentity.getKey(),
|
29940 | depth: 2
|
29941 | }), highlightedValue = hasHighlights && 0 !== highlight ? highlight : void 0, tooltipInfo_1 = void 0;
|
29942 | tooltipsEnabled && (tooltipInfo_1 = [], tooltipInfo_1.push(categoryTooltipItem),
|
29943 | hasDynamicSeries && (categoryColumn && categoryColumn.source === categoricalValues.source || tooltipInfo_1.push({
|
29944 | displayName: categoricalValues.source.displayName,
|
29945 | value: visuals.converterHelper.formatFromMetadataColumn(grouped[j].name, categoricalValues.source, formatStringProp)
|
29946 | })), null != value_1 && tooltipInfo_1.push({
|
29947 | displayName: valueColumn.source.displayName,
|
29948 | value: visuals.converterHelper.formatFromMetadataColumn(value_1, valueColumn.source, formatStringProp)
|
29949 | }), null != highlightValue && tooltipInfo_1.push({
|
29950 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
29951 | value: visuals.converterHelper.formatFromMetadataColumn(highlightedValue, valueColumn.source, formatStringProp)
|
29952 | }));
|
29953 | var childNode = {
|
29954 | key: childKey,
|
29955 | name: childName,
|
29956 | size: value_1,
|
29957 | color: color,
|
29958 | selected: !1,
|
29959 | identity: childIdentity,
|
29960 | tooltipInfo: tooltipInfo_1,
|
29961 | highlightedTooltipInfo: tooltipInfo_1,
|
29962 | labelFormatString: visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp)
|
29963 | };
|
29964 | hasHighlights && (childNode.highlightMultiplier = 0 !== value_1 ? highlight / value_1 : 0,
|
29965 | childNode.highlightValue = highlight), null == node.children && (node.children = []),
|
29966 | node.children.push(childNode), allNodes.push(childNode);
|
29967 | }
|
29968 | } else dataWasCulled = dataWasCulled || shouldCullValue;
|
29969 | }
|
29970 | }
|
29971 | Treemap.checkValueForShape(total) && (node.size = total, rootNode.children.push(node),
|
29972 | allNodes.push(node)), hasHighlights && (node.highlightMultiplier = total ? highlightTotal / total : 0);
|
29973 | }
|
29974 | }
|
29975 | } else for (var i = 0, ilen = values[0].length; ilen > i; i++) {
|
29976 | var valueColumn = valueColumns[i];
|
29977 | if (powerbi.data.DataRoleHelper.hasRoleInValueColumn(valueColumn, Treemap.ValuesRoleName)) {
|
29978 | var value = values[0][i];
|
29979 | if (Treemap.checkValueForShape(value)) if (cullableValue > value) dataWasCulled = dataWasCulled || shouldCullValue; else {
|
29980 | var nodeName = hasDynamicSeries ? reader.getSeriesValueColumnGroup(i).name : visuals.converterHelper.formatFromMetadataColumn(reader.getValueDisplayName("Values", i), valueColumn.source, formatStringProp), identity = new visuals.SelectionIdBuilder().withSeries(valueColumns, hasDynamicSeries ? valueColumns[i] : void 0).withMeasure(valueColumns[i].source.queryName).createSelectionId(), key = identity.getKey(), color = hasDynamicSeries ? colorHelper.getColorForSeriesValue(grouped[i] && grouped[i].objects, categorical.values.identityFields, visuals.converterHelper.getSeriesName(valueColumn.source)) : colorHelper.getColorForMeasure(valueColumn.source.objects, valueColumn.source.queryName), highlightedValue = hasHighlights ? highlights[0][i] : void 0, tooltipInfo = void 0;
|
29981 | if (tooltipsEnabled) {
|
29982 | if (tooltipInfo = [], hasDynamicSeries) {
|
29983 | var seriesMetadataColumn = reader.getSeriesMetadataColumn(), seriesValue = reader.getSeriesValueColumnGroup(i).name;
|
29984 | tooltipInfo.push({
|
29985 | displayName: seriesMetadataColumn.displayName,
|
29986 | value: visuals.converterHelper.formatFromMetadataColumn(seriesValue, seriesMetadataColumn, formatStringProp)
|
29987 | });
|
29988 | }
|
29989 | null != value && tooltipInfo.push({
|
29990 | displayName: valueColumn.source.displayName,
|
29991 | value: visuals.converterHelper.formatFromMetadataColumn(value, valueColumn.source, formatStringProp)
|
29992 | }), null != highlightedValue && tooltipInfo.push({
|
29993 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
29994 | value: visuals.converterHelper.formatFromMetadataColumn(highlightedValue, valueColumn.source, formatStringProp)
|
29995 | });
|
29996 | }
|
29997 | var node = {
|
29998 | key: key,
|
29999 | name: nodeName,
|
30000 | size: value,
|
30001 | color: color,
|
30002 | selected: !1,
|
30003 | identity: identity,
|
30004 | tooltipInfo: tooltipInfo,
|
30005 | highlightedTooltipInfo: tooltipInfo,
|
30006 | labelFormatString: visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp)
|
30007 | };
|
30008 | hasHighlights && highlights && (node.highlightMultiplier = 0 !== value ? highlights[0][i] / value : 0,
|
30009 | node.highlightValue = highlights[0][i]), rootNode.children.push(node), allNodes.push(node),
|
30010 | legendDataPoints.push({
|
30011 | label: nodeName,
|
30012 | color: color,
|
30013 | icon: visuals.LegendIcon.Box,
|
30014 | identity: identity,
|
30015 | selected: !1
|
30016 | });
|
30017 | }
|
30018 | }
|
30019 | }
|
30020 | }
|
30021 | return interactivityService && (interactivityService.applySelectionStateToData(allNodes),
|
30022 | interactivityService.applySelectionStateToData(legendDataPoints)), {
|
30023 | root: rootNode,
|
30024 | hasHighlights: hasHighlights,
|
30025 | legendData: {
|
30026 | title: legendTitle,
|
30027 | dataPoints: legendDataPoints,
|
30028 | fontSize: visuals.SVGLegend.DefaultFontSizeInPt
|
30029 | },
|
30030 | dataLabelsSettings: labelSettings,
|
30031 | legendObjectProperties: legendObjectProperties,
|
30032 | dataWasCulled: dataWasCulled
|
30033 | };
|
30034 | }, Treemap.getValuesFromCategoricalDataView = function(data, hasHighlights) {
|
30035 | var categoryValueCount, valueColumns = data.values;
|
30036 | valueColumns && null == data.categories ? categoryValueCount = 1 : valueColumns && data.categories && data.categories.length > 0 && (categoryValueCount = data.categories[0].values.length);
|
30037 | for (var values = [], highlights = [], totalValue = 0, i = 0; categoryValueCount > i; i++) values.push([]),
|
30038 | hasHighlights && highlights.push([]);
|
30039 | for (var highlightsOverflow, j = 0; j < valueColumns.length; j++) for (var valueColumn = valueColumns[j], i = 0; categoryValueCount > i; i++) {
|
30040 | var value = valueColumn.values[i];
|
30041 | if (values[i].push(value), totalValue += isNaN(value) ? 0 : value, hasHighlights) {
|
30042 | var highlight = valueColumn.highlights[i];
|
30043 | highlight || (highlight = 0), highlights[i].push(highlight), highlight > value && (highlightsOverflow = !0);
|
30044 | }
|
30045 | }
|
30046 | return {
|
30047 | values: values,
|
30048 | highlights: hasHighlights ? highlights : void 0,
|
30049 | highlightsOverflow: hasHighlights ? highlightsOverflow : void 0,
|
30050 | totalValue: totalValue
|
30051 | };
|
30052 | }, Treemap.getCullableValue = function(totalValue, viewport) {
|
30053 | var totalArea = viewport.width * viewport.height, culledPercent = Treemap.CullableArea / totalArea;
|
30054 | return culledPercent * totalValue;
|
30055 | }, Treemap.prototype.update = function(options) {
|
30056 | var dataViews = this.dataViews = options.dataViews;
|
30057 | this.currentViewport = options.viewport;
|
30058 | var dataViewCategorical = dataViews && dataViews.length > 0 && dataViews[0].categorical ? dataViews[0].categorical : void 0, labelSettings = visuals.dataLabelUtils.getDefaultTreemapLabelSettings(), legendObjectProperties = null;
|
30059 | if (dataViewCategorical) {
|
30060 | var dataView = dataViews[0], dataViewMetadata = dataView.metadata, objects = void 0;
|
30061 | dataViewMetadata && (objects = dataViewMetadata.objects), objects && (legendObjectProperties = objects.legend),
|
30062 | this.data = Treemap.converter(dataView, this.colors, labelSettings, this.interactivityService, this.currentViewport, legendObjectProperties, this.tooltipsEnabled);
|
30063 | } else {
|
30064 | var rootNode = {
|
30065 | key: "root",
|
30066 | name: "root",
|
30067 | children: [],
|
30068 | selected: !1,
|
30069 | highlightMultiplier: 0,
|
30070 | identity: visuals.SelectionId.createNull(),
|
30071 | color: void 0
|
30072 | }, legendData = {
|
30073 | title: "",
|
30074 | dataPoints: []
|
30075 | }, treeMapData = {
|
30076 | root: rootNode,
|
30077 | hasHighlights: !1,
|
30078 | legendData: legendData,
|
30079 | dataLabelsSettings: labelSettings,
|
30080 | dataWasCulled: !1
|
30081 | };
|
30082 | this.data = treeMapData;
|
30083 | }
|
30084 | if (this.updateInternal(options.suppressAnimations), dataViews) {
|
30085 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
30086 | this.hostService.setWarnings(warnings);
|
30087 | }
|
30088 | }, Treemap.prototype.onDataChanged = function(options) {
|
30089 | this.update({
|
30090 | suppressAnimations: options.suppressAnimations,
|
30091 | dataViews: options.dataViews,
|
30092 | viewport: this.currentViewport
|
30093 | });
|
30094 | }, Treemap.prototype.onResizing = function(viewport) {
|
30095 | this.update({
|
30096 | suppressAnimations: !0,
|
30097 | dataViews: this.dataViews,
|
30098 | viewport: viewport
|
30099 | });
|
30100 | }, Treemap.prototype.onClearSelection = function() {
|
30101 | this.interactivityService && this.interactivityService.clearSelection();
|
30102 | }, Treemap.prototype.enumerateObjectInstances = function(options) {
|
30103 | var data = this.data;
|
30104 | if (data) {
|
30105 | var objectName = options.objectName, enumeration = new visuals.ObjectEnumerationBuilder(), dataLabelsSettings = this.data.dataLabelsSettings ? this.data.dataLabelsSettings : visuals.dataLabelUtils.getDefaultTreemapLabelSettings();
|
30106 | switch (objectName) {
|
30107 | case "dataPoint":
|
30108 | var dataViewCat = this.dataViews && this.dataViews.length > 0 && this.dataViews[0] && this.dataViews[0].categorical, hasGradientRole = visuals.GradientUtils.hasGradientRole(dataViewCat);
|
30109 | hasGradientRole || this.enumerateDataPoints(enumeration, data);
|
30110 | break;
|
30111 |
|
30112 | case "legend":
|
30113 | return this.enumerateLegend(data);
|
30114 |
|
30115 | case "labels":
|
30116 | var labelSettingOptions = {
|
30117 | enumeration: enumeration,
|
30118 | dataLabelsSettings: dataLabelsSettings,
|
30119 | show: !0,
|
30120 | displayUnits: !0,
|
30121 | precision: !0
|
30122 | };
|
30123 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
30124 | break;
|
30125 |
|
30126 | case "categoryLabels":
|
30127 | visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, dataLabelsSettings, !1, !0);
|
30128 | }
|
30129 | return enumeration.complete();
|
30130 | }
|
30131 | }, Treemap.prototype.enumerateDataPoints = function(enumeration, data) {
|
30132 | var rootChildren = data.root.children;
|
30133 | if (!_.isEmpty(rootChildren)) for (var y = 0; y < rootChildren.length; y++) {
|
30134 | var treemapNode = rootChildren[y];
|
30135 | enumeration.pushInstance({
|
30136 | displayName: treemapNode.name,
|
30137 | selector: visuals.ColorHelper.normalizeSelector(treemapNode.identity.getSelector()),
|
30138 | properties: {
|
30139 | fill: {
|
30140 | solid: {
|
30141 | color: treemapNode.color
|
30142 | }
|
30143 | }
|
30144 | },
|
30145 | objectName: "dataPoint"
|
30146 | });
|
30147 | }
|
30148 | }, Treemap.prototype.enumerateLegend = function(data) {
|
30149 | var legendObjectProperties = {
|
30150 | legend: data.legendObjectProperties
|
30151 | }, 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);
|
30152 | return [ {
|
30153 | selector: null,
|
30154 | objectName: "legend",
|
30155 | properties: {
|
30156 | show: show,
|
30157 | position: visuals.LegendPosition[this.legend.getOrientation()],
|
30158 | showTitle: showTitle,
|
30159 | titleText: titleText,
|
30160 | labelColor: labelColor,
|
30161 | fontSize: labelFontSize
|
30162 | }
|
30163 | } ];
|
30164 | }, Treemap.checkValueForShape = function(value) {
|
30165 | return value ? value > 0 : !1;
|
30166 | }, Treemap.prototype.calculateTreemapSize = function() {
|
30167 | var legendMargins = this.legend.getMargins();
|
30168 | return {
|
30169 | height: this.currentViewport.height - legendMargins.height,
|
30170 | width: this.currentViewport.width - legendMargins.width
|
30171 | };
|
30172 | }, Treemap.prototype.initViewportDependantProperties = function(duration) {
|
30173 | void 0 === duration && (duration = 0);
|
30174 | var viewport = this.calculateTreemapSize();
|
30175 | this.svg.attr({
|
30176 | width: viewport.width,
|
30177 | height: viewport.height
|
30178 | }), visuals.Legend.positionChartArea(this.svg, this.legend), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
30179 | }, Treemap.hasChildrenWithIdentity = function(node) {
|
30180 | var children = node.children;
|
30181 | if (!children) return !1;
|
30182 | var count = children.length;
|
30183 | if (0 === count) return !1;
|
30184 | for (var i = count - 1; i >= 0; i--) if (children[i].identity.hasIdentity()) return !0;
|
30185 | return !1;
|
30186 | }, Treemap.canDisplayMajorLabel = function(node) {
|
30187 | if (1 !== node.depth) return !1;
|
30188 | if (_.isEmpty(node.name)) return !1;
|
30189 | var availableWidth = node.dx - 2 * Treemap.TextMargin;
|
30190 | if (availableWidth < Treemap.MinTextWidthForMajorLabel) return !1;
|
30191 | var textHeightWithMargin = Treemap.MajorLabelTextSize + 2 * Treemap.TextMargin;
|
30192 | return !(node.dy < textHeightWithMargin);
|
30193 | }, Treemap.canDisplayMinorLabel = function(node, labelSettings) {
|
30194 | if (node.depth < 1 || node.depth > 2) return !1;
|
30195 | if (1 === node.depth && (node.children || !labelSettings.show)) return !1;
|
30196 | if (_.isEmpty(node.name)) return !1;
|
30197 | var availableWidth = node.dx - 2 * Treemap.TextMargin;
|
30198 | if (availableWidth < Treemap.MinTextWidthForMinorLabel) return !1;
|
30199 | var textHeightWithMargin = Treemap.MinorLabelTextSize + 2 * Treemap.TextMargin;
|
30200 | if (node.dy < textHeightWithMargin) return !1;
|
30201 | if (1 === node.depth) {
|
30202 | var roomTop = node.y + Treemap.MajorLabelTextSize + 2 * Treemap.TextMargin;
|
30203 | if (node.y + node.dy - roomTop < textHeightWithMargin) return !1;
|
30204 | } else if (2 === node.depth) {
|
30205 | var parent_1 = node.parent, roomTop = Math.max(parent_1.y + Treemap.MajorLabelTextSize + 2 * Treemap.TextMargin, node.y);
|
30206 | if (node.y + node.dy - roomTop < textHeightWithMargin) return !1;
|
30207 | }
|
30208 | return !0;
|
30209 | }, Treemap.createMajorLabelText = function(node, labelsSettings, alternativeScale, formattersCache) {
|
30210 | var spaceAvaliableForLabels = node.dx - 2 * Treemap.TextMargin, baseTextProperties = Treemap.MajorLabelTextProperties, textProperties = {
|
30211 | text: node.name,
|
30212 | fontFamily: baseTextProperties.fontFamily,
|
30213 | fontSize: baseTextProperties.fontSize
|
30214 | };
|
30215 | return powerbi.TextMeasurementService.getTailoredTextOrDefault(textProperties, spaceAvaliableForLabels);
|
30216 | }, Treemap.createMinorLabelText = function(node, labelsSettings, alternativeScale, formattersCache) {
|
30217 | var spaceAvaliableForLabels = node.dx - 2 * Treemap.TextMargin, label = node.name;
|
30218 | if (labelsSettings.show) {
|
30219 | var measureFormatter = formattersCache.getOrCreate(node.labelFormatString, labelsSettings, alternativeScale);
|
30220 | label = visuals.dataLabelUtils.getLabelFormattedText({
|
30221 | label: null != node.highlightValue ? node.highlightValue : node.value,
|
30222 | maxWidth: spaceAvaliableForLabels,
|
30223 | formatter: measureFormatter
|
30224 | }), labelsSettings.showCategory && 2 === node.depth && (label = visuals.dataLabelUtils.getLabelFormattedText({
|
30225 | label: node.name,
|
30226 | maxWidth: spaceAvaliableForLabels
|
30227 | }) + " " + label);
|
30228 | }
|
30229 | return visuals.dataLabelUtils.getLabelFormattedText({
|
30230 | label: label,
|
30231 | maxWidth: spaceAvaliableForLabels,
|
30232 | fontSize: labelsSettings.fontSize
|
30233 | });
|
30234 | }, Treemap.getFill = function(d, isHighlightRect) {
|
30235 | return d.depth > 1 && !d.identity.hasIdentity() && !isHighlightRect ? CssConstants.noneValue : Treemap.hasChildrenWithIdentity(d) ? CssConstants.noneValue : d.color;
|
30236 | }, Treemap.getFillOpacity = function(d, hasSelection, hasHighlights, isHighlightRect) {
|
30237 | 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();
|
30238 | }, Treemap.prototype.updateInternal = function(suppressAnimations) {
|
30239 | var data = this.data, hasHighlights = data && data.hasHighlights, labelSettings = data ? data.dataLabelsSettings : null, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
30240 | this.options.interactivity && this.options.interactivity.isInteractiveLegend || !this.data || this.renderLegend(),
|
30241 | this.initViewportDependantProperties(duration);
|
30242 | var viewport = this.calculateTreemapSize();
|
30243 | this.treemap.size([ viewport.width, viewport.height ]);
|
30244 | var nodes = data && data.root ? this.treemap.nodes(data.root) : [], highlightNodes = nodes.filter(function(value) {
|
30245 | return null != value.highlightMultiplier && (!value.children || 0 === value.children.length);
|
30246 | }), majorLabeledNodes = [], minorLabeledNodes = [], alternativeScale = null;
|
30247 | labelSettings.showCategory && (majorLabeledNodes = nodes.filter(function(d) {
|
30248 | return Treemap.canDisplayMajorLabel(d);
|
30249 | })), (labelSettings.show || labelSettings.showCategory) && (minorLabeledNodes = nodes.filter(function(d) {
|
30250 | return Treemap.canDisplayMinorLabel(d, labelSettings);
|
30251 | }), 0 === labelSettings.displayUnits && (alternativeScale = d3.max(minorLabeledNodes, function(d) {
|
30252 | return Math.abs(d.value);
|
30253 | })));
|
30254 | var shapes, highlightShapes, majorLabels, minorLabels, result, treemapLayout = Treemap.getLayout(labelSettings, alternativeScale);
|
30255 | if (this.animator && !suppressAnimations) {
|
30256 | var options = {
|
30257 | viewModel: data,
|
30258 | nodes: nodes,
|
30259 | highlightNodes: highlightNodes,
|
30260 | majorLabeledNodes: majorLabeledNodes,
|
30261 | minorLabeledNodes: minorLabeledNodes,
|
30262 | shapeGraphicsContext: this.shapeGraphicsContext,
|
30263 | labelGraphicsContext: this.labelGraphicsContext,
|
30264 | interactivityService: this.interactivityService,
|
30265 | layout: treemapLayout,
|
30266 | labelSettings: labelSettings
|
30267 | };
|
30268 | result = this.animator.animate(options), shapes = result.shapes, highlightShapes = result.highlightShapes,
|
30269 | majorLabels = result.majorLabels, minorLabels = result.minorLabels;
|
30270 | }
|
30271 | if (!this.animator || suppressAnimations || result.failed) {
|
30272 | var hasSelection = this.interactivityService && this.interactivityService.hasSelection(), shapeGraphicsContext = this.shapeGraphicsContext;
|
30273 | shapes = Treemap.drawDefaultShapes(shapeGraphicsContext, nodes, hasSelection, hasHighlights, treemapLayout),
|
30274 | highlightShapes = Treemap.drawDefaultHighlightShapes(shapeGraphicsContext, highlightNodes, hasSelection, hasHighlights, treemapLayout);
|
30275 | var labelGraphicsContext = this.labelGraphicsContext;
|
30276 | majorLabels = Treemap.drawDefaultMajorLabels(labelGraphicsContext, majorLabeledNodes, labelSettings, treemapLayout),
|
30277 | minorLabels = Treemap.drawDefaultMinorLabels(labelGraphicsContext, minorLabeledNodes, labelSettings, treemapLayout);
|
30278 | }
|
30279 | if (this.interactivityService) {
|
30280 | var behaviorOptions = {
|
30281 | shapes: shapes,
|
30282 | highlightShapes: highlightShapes,
|
30283 | majorLabels: majorLabels,
|
30284 | minorLabels: minorLabels,
|
30285 | nodes: nodes,
|
30286 | hasHighlights: data.hasHighlights
|
30287 | };
|
30288 | this.interactivityService.bind(nodes, this.behavior, behaviorOptions);
|
30289 | }
|
30290 | this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(shapes, function(tooltipEvent) {
|
30291 | return tooltipEvent.data.highlightedTooltipInfo ? tooltipEvent.data.highlightedTooltipInfo : tooltipEvent.data.tooltipInfo;
|
30292 | }), visuals.TooltipManager.addTooltip(highlightShapes, function(tooltipEvent) {
|
30293 | return tooltipEvent.data.highlightedTooltipInfo;
|
30294 | })), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
30295 | }, Treemap.prototype.renderLegend = function() {
|
30296 | var legendObjectProperties = this.data.legendObjectProperties;
|
30297 | if (legendObjectProperties) {
|
30298 | var legendData = this.data.legendData;
|
30299 | visuals.LegendData.update(legendData, legendObjectProperties);
|
30300 | var position = legendObjectProperties[visuals.legendProps.position];
|
30301 | position && this.legend.changeOrientation(visuals.LegendPosition[position]), this.legend.drawLegend(legendData, this.currentViewport);
|
30302 | } else this.legend.changeOrientation(visuals.LegendPosition.Top), this.legend.drawLegend({
|
30303 | dataPoints: []
|
30304 | }, this.currentViewport);
|
30305 | }, Treemap.getNodeClass = function(d, highlight) {
|
30306 | var nodeClass;
|
30307 | switch (d.depth) {
|
30308 | case 1:
|
30309 | nodeClass = Treemap.ParentGroupClassName;
|
30310 | break;
|
30311 |
|
30312 | case 2:
|
30313 | nodeClass = Treemap.NodeGroupClassName;
|
30314 | break;
|
30315 |
|
30316 | case 0:
|
30317 | nodeClass = Treemap.RootNodeClassName;
|
30318 | }
|
30319 | return nodeClass += " " + (highlight ? Treemap.HighlightNodeClassName : Treemap.TreemapNodeClassName);
|
30320 | }, Treemap.createTreemapShapeLayout = function(isHighlightRect) {
|
30321 | return void 0 === isHighlightRect && (isHighlightRect = !1), {
|
30322 | x: function(d) {
|
30323 | return d.x;
|
30324 | },
|
30325 | y: function(d) {
|
30326 | return d.y + (isHighlightRect ? d.dy * (1 - d.highlightMultiplier) : 0);
|
30327 | },
|
30328 | width: function(d) {
|
30329 | return Math.max(0, d.dx);
|
30330 | },
|
30331 | height: function(d) {
|
30332 | return Math.max(0, d.dy * (isHighlightRect ? d.highlightMultiplier : 1));
|
30333 | }
|
30334 | };
|
30335 | }, Treemap.createTreemapZeroShapeLayout = function() {
|
30336 | return {
|
30337 | x: function(d) {
|
30338 | return d.x;
|
30339 | },
|
30340 | y: function(d) {
|
30341 | return d.y + d.dy;
|
30342 | },
|
30343 | width: function(d) {
|
30344 | return Math.max(0, d.dx);
|
30345 | },
|
30346 | height: function(d) {
|
30347 | return 0;
|
30348 | }
|
30349 | };
|
30350 | }, Treemap.drawDefaultShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
30351 | var isHighlightShape = !1, shapes = context.selectAll("." + Treemap.TreemapNodeClassName).data(nodes, function(d) {
|
30352 | return d.key;
|
30353 | });
|
30354 | return shapes.enter().append("rect").attr("class", layout.shapeClass), shapes.style("fill", function(d) {
|
30355 | return Treemap.getFill(d, isHighlightShape);
|
30356 | }).style("fill-opacity", function(d) {
|
30357 | return Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
30358 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
30359 | }, Treemap.drawDefaultHighlightShapes = function(context, nodes, hasSelection, hasHighlights, layout) {
|
30360 | var isHighlightShape = !0, highlightShapes = context.selectAll("." + Treemap.HighlightNodeClassName).data(nodes, function(d) {
|
30361 | return d.key + "highlight";
|
30362 | });
|
30363 | return highlightShapes.enter().append("rect").attr("class", layout.highlightShapeClass),
|
30364 | highlightShapes.style("fill", function(d) {
|
30365 | return Treemap.getFill(d, isHighlightShape);
|
30366 | }).style("fill-opacity", function(d) {
|
30367 | return Treemap.getFillOpacity(d, hasSelection, hasHighlights, isHighlightShape);
|
30368 | }).attr(layout.highlightShapeLayout), highlightShapes.exit().remove(), highlightShapes;
|
30369 | }, Treemap.drawDefaultMajorLabels = function(context, nodes, labelSettings, layout) {
|
30370 | var labels = context.selectAll("." + Treemap.MajorLabelClassName).data(nodes, function(d) {
|
30371 | return d.key;
|
30372 | });
|
30373 | return labels.enter().append("text").attr("class", layout.majorLabelClass), labels.attr(layout.majorLabelLayout).text(layout.majorLabelText).style("fill", function() {
|
30374 | return labelSettings.labelColor;
|
30375 | }), labels.exit().remove(), labels;
|
30376 | }, Treemap.drawDefaultMinorLabels = function(context, nodes, labelSettings, layout) {
|
30377 | var labels = context.selectAll("." + Treemap.MinorLabelClassName).data(nodes, function(d) {
|
30378 | return d.key;
|
30379 | });
|
30380 | return labels.enter().append("text").attr("class", layout.minorLabelClass), labels.attr(layout.minorLabelLayout).text(layout.minorLabelText).style("fill", function() {
|
30381 | return labelSettings.labelColor;
|
30382 | }), labels.exit().remove(), labels;
|
30383 | }, Treemap.cleanMinorLabels = function(context) {
|
30384 | var empty = [], labels = context.selectAll("." + Treemap.LabelsGroupClassName).selectAll("." + Treemap.MinorLabelClassName).data(empty);
|
30385 | labels.exit().remove();
|
30386 | }, Treemap.DimmedShapeOpacity = .4, Treemap.ClassName = "treemap", Treemap.LabelsGroupClassName = "labels",
|
30387 | Treemap.MajorLabelClassName = "majorLabel", Treemap.MinorLabelClassName = "minorLabel",
|
30388 | Treemap.ShapesClassName = "shapes", Treemap.TreemapNodeClassName = "treemapNode",
|
30389 | Treemap.RootNodeClassName = "rootNode", Treemap.ParentGroupClassName = "parentGroup",
|
30390 | Treemap.NodeGroupClassName = "nodeGroup", Treemap.HighlightNodeClassName = "treemapNodeHighlight",
|
30391 | Treemap.TextMargin = 5, Treemap.MinorLabelTextSize = 10, Treemap.MinTextWidthForMinorLabel = 18,
|
30392 | Treemap.MajorLabelTextSize = 12, Treemap.MinTextWidthForMajorLabel = 22, Treemap.MajorLabelTextProperties = {
|
30393 | fontFamily: "wf_segoe-ui_normal",
|
30394 | fontSize: Treemap.MajorLabelTextSize + "px"
|
30395 | }, Treemap.ValuesRoleName = "Values", Treemap.CullableArea = 9, Treemap;
|
30396 | }();
|
30397 | visuals.Treemap = Treemap;
|
30398 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30399 | }(powerbi || (powerbi = {}));
|
30400 |
|
30401 | var powerbi;
|
30402 |
|
30403 | !function(powerbi) {
|
30404 | var visuals;
|
30405 | !function(visuals) {
|
30406 | var getKpiImageMetadata = powerbi.visuals.KpiUtil.getKpiImageMetadata, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, Card = function(_super) {
|
30407 | function Card(options) {
|
30408 | _super.call(this, Card.cardClassName), this.isScrollable = !1, this.displayUnitSystemType = powerbi.DisplayUnitSystemType.WholeUnits,
|
30409 | options && (this.isScrollable = !!options.isScrollable, options.animator && (this.animator = options.animator),
|
30410 | null != options.displayUnitSystemType && (this.displayUnitSystemType = options.displayUnitSystemType));
|
30411 | }
|
30412 | return __extends(Card, _super), Card.prototype.init = function(options) {
|
30413 | this.animationOptions = options.animation;
|
30414 | var element = options.element;
|
30415 | this.kpiImage = d3.select(element.get(0)).append("div").classed(Card.KPIImage["class"], !0);
|
30416 | var svg = this.svg = d3.select(element.get(0)).append("svg");
|
30417 | this.graphicsContext = svg.append("g"), this.currentViewport = options.viewport,
|
30418 | this.hostServices = options.host, this.style = options.style, this.updateViewportProperties(),
|
30419 | this.isScrollable && (svg.attr("class", Card.cardClassName), this.labelContext = svg.append("g"));
|
30420 | }, Card.prototype.onDataChanged = function(options) {
|
30421 | var value, dataView = options.dataViews[0];
|
30422 | if (dataView) {
|
30423 | this.getMetaDataColumn(dataView), dataView.single && (value = dataView.single.value),
|
30424 | this.cardFormatSetting = this.getDefaultFormatSettings();
|
30425 | var dataViewMetadata = dataView.metadata;
|
30426 | if (dataViewMetadata) {
|
30427 | var objects = dataViewMetadata.objects;
|
30428 | if (objects) {
|
30429 | var labelSettings = this.cardFormatSetting.labelSettings;
|
30430 | labelSettings.labelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.cardProps.labels.color, labelSettings.labelColor),
|
30431 | labelSettings.precision = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.labels.labelPrecision, labelSettings.precision),
|
30432 | labelSettings.fontSize = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.labels.fontSize, labelSettings.fontSize),
|
30433 | labelSettings.precision !== visuals.dataLabelUtils.defaultLabelPrecision && labelSettings.precision < 0 && (labelSettings.precision = 0),
|
30434 | labelSettings.displayUnits = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.labels.labelDisplayUnits, labelSettings.displayUnits),
|
30435 | labelSettings.showCategory = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.categoryLabels.show, labelSettings.showCategory),
|
30436 | labelSettings.categoryLabelColor = powerbi.DataViewObjects.getFillColor(objects, visuals.cardProps.categoryLabels.color, labelSettings.categoryLabelColor),
|
30437 | this.cardFormatSetting.wordWrap = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.wordWrap.show, this.cardFormatSetting.wordWrap),
|
30438 | this.cardFormatSetting.textSize = powerbi.DataViewObjects.getValue(objects, visuals.cardProps.categoryLabels.fontSize, this.cardFormatSetting.textSize);
|
30439 | }
|
30440 | }
|
30441 | }
|
30442 | this.updateInternal(value, !0, !0);
|
30443 | }, Card.prototype.onResizing = function(viewport) {
|
30444 | this.currentViewport = viewport, this.updateViewportProperties(), this.updateInternal(this.value, !0, !0);
|
30445 | }, Card.prototype.updateViewportProperties = function() {
|
30446 | var viewport = this.currentViewport;
|
30447 | this.svg.attr("width", viewport.width).attr("height", viewport.height);
|
30448 | }, Card.prototype.setTextProperties = function(text, fontSize) {
|
30449 | Card.cardTextProperties.fontSize = jsCommon.PixelConverter.fromPoint(fontSize),
|
30450 | Card.cardTextProperties.text = text;
|
30451 | }, Card.prototype.getCardFormatTextSize = function() {
|
30452 | return this.cardFormatSetting.textSize;
|
30453 | }, Card.prototype.getAdjustedFontHeight = function(availableWidth, textToMeasure, seedFontHeight) {
|
30454 | var adjustedFontHeight = _super.prototype.getAdjustedFontHeight.call(this, availableWidth, textToMeasure, seedFontHeight);
|
30455 | return Math.min(adjustedFontHeight, Card.DefaultStyle.card.maxFontSize);
|
30456 | }, Card.prototype.clear = function(valueOnly) {
|
30457 | void 0 === valueOnly && (valueOnly = !1), this.svg.select(Card.Value.selector).text(""),
|
30458 | valueOnly || this.svg.select(Card.Label.selector).text(""), _super.prototype.clear.call(this);
|
30459 | }, Card.prototype.updateInternal = function(target, suppressAnimations, forceUpdate) {
|
30460 | void 0 === forceUpdate && (forceUpdate = !1);
|
30461 | var start = this.value, duration = visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations);
|
30462 | if (void 0 === target) return void (void 0 !== start && this.clear());
|
30463 | var metaDataColumn = this.metaDataColumn, labelSettings = this.cardFormatSetting.labelSettings, isDefaultDisplayUnit = 0 === labelSettings.displayUnits, format = this.getFormatString(metaDataColumn), formatter = visuals.valueFormatter.create({
|
30464 | format: format,
|
30465 | value: isDefaultDisplayUnit ? target : labelSettings.displayUnits,
|
30466 | precision: visuals.dataLabelUtils.getLabelPrecision(labelSettings.precision, format),
|
30467 | displayUnitSystemType: isDefaultDisplayUnit && labelSettings.precision === visuals.dataLabelUtils.defaultLabelPrecision ? this.displayUnitSystemType : powerbi.DisplayUnitSystemType.WholeUnits,
|
30468 | formatSingleValues: !!isDefaultDisplayUnit,
|
30469 | allowFormatBeautification: !0,
|
30470 | columnType: metaDataColumn ? metaDataColumn.type : void 0
|
30471 | }), formatSettings = this.cardFormatSetting, valueTextHeightInPx = jsCommon.PixelConverter.fromPointToPixel(labelSettings.fontSize), valueStyles = Card.DefaultStyle.value;
|
30472 | this.setTextProperties(target, this.getCardFormatTextSize());
|
30473 | var labelTextHeightInPx = powerbi.TextMeasurementService.estimateSvgTextHeight(Card.cardTextProperties), 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);
|
30474 | if (this.isScrollable) {
|
30475 | if (!forceUpdate && start === target) return;
|
30476 | start === target || !_.isEmpty(target) && "string" == typeof target || (target = formatter.format(target));
|
30477 | var label = metaDataColumn ? metaDataColumn.displayName : void 0, labelData = labelSettings.showCategory ? [ label ] : [], translatedLabelY = this.getTranslateY(valueTextHeightInPx + labelHeightWithPadding + translateY), labelElement = this.labelContext.attr("transform", visuals.SVGUtil.translate(translateX, translatedLabelY)).selectAll("text").data(labelData);
|
30478 | labelElement.enter().append("text").attr("class", Card.Label["class"]), labelElement.text(function(d) {
|
30479 | return d;
|
30480 | }).style({
|
30481 | "font-size": jsCommon.PixelConverter.fromPoint(this.getCardFormatTextSize()),
|
30482 | fill: labelSettings.categoryLabelColor,
|
30483 | "text-anchor": this.getTextAnchor()
|
30484 | });
|
30485 | var labelElementNode = labelElement.node();
|
30486 | if (labelElementNode && (formatSettings.wordWrap ? powerbi.TextMeasurementService.wordBreak(labelElementNode, width / 2, height - translatedLabelY) : labelElement.call(visuals.AxisHelper.LabelLayoutStrategy.clip, width, powerbi.TextMeasurementService.svgEllipsis)),
|
30487 | labelElement.append("title").text(function(d) {
|
30488 | return d;
|
30489 | }), labelElement.exit().remove(), statusGraphicInfo) this.graphicsContext.selectAll("text").remove(),
|
30490 | this.displayStatusGraphic(statusGraphicInfo, translateX, translateY, valueTextHeightInPx); else {
|
30491 | this.kpiImage.selectAll("div").remove();
|
30492 | var valueElement = this.graphicsContext.attr("transform", visuals.SVGUtil.translate(translateX, this.getTranslateY(valueTextHeightInPx + translateY))).selectAll("text").data([ target ]);
|
30493 | valueElement.enter().append("text").attr("class", Card.Value["class"]), valueElement.text(function(d) {
|
30494 | return d;
|
30495 | }).style({
|
30496 | "font-size": jsCommon.PixelConverter.fromPoint(labelSettings.fontSize),
|
30497 | fill: labelSettings.labelColor,
|
30498 | "font-family": valueStyles.fontFamily,
|
30499 | "text-anchor": this.getTextAnchor()
|
30500 | }), valueElement.call(visuals.AxisHelper.LabelLayoutStrategy.clip, width, powerbi.TextMeasurementService.svgEllipsis),
|
30501 | valueElement.append("title").text(function(d) {
|
30502 | return d;
|
30503 | }), valueElement.exit().remove();
|
30504 | }
|
30505 | } else statusGraphicInfo ? (this.graphicsContext.selectAll("text").remove(), this.displayStatusGraphic(statusGraphicInfo, translateX, translateY, valueTextHeightInPx)) : (this.kpiImage.selectAll("div").remove(),
|
30506 | this.doValueTransition(start, target, this.displayUnitSystemType, this.animationOptions, duration, forceUpdate, formatter),
|
30507 | this.graphicsContext.call(visuals.tooltipUtils.tooltipUpdate, [ target ]));
|
30508 | this.value = target;
|
30509 | }, Card.prototype.displayStatusGraphic = function(statusGraphicInfo, translateX, translateY, labelTextSizeInPx) {
|
30510 | this.graphicsContext.selectAll("text").remove();
|
30511 | var kpiImageDiv = this.kpiImage.select("div");
|
30512 | kpiImageDiv && !kpiImageDiv.empty() || (kpiImageDiv = this.kpiImage.append("div")),
|
30513 | kpiImageDiv.attr("class", statusGraphicInfo["class"]).style("position", "absolute").style("font-size", labelTextSizeInPx + "px");
|
30514 | var imageWidth = kpiImageDiv.node().offsetWidth, imageHeight = kpiImageDiv.node().offsetHeight;
|
30515 | kpiImageDiv.style("transform", visuals.SVGUtil.translateWithPixels(translateX - imageWidth / 2, this.getTranslateY(labelTextSizeInPx + translateY) - imageHeight));
|
30516 | }, Card.prototype.getDefaultFormatSettings = function() {
|
30517 | return {
|
30518 | labelSettings: visuals.dataLabelUtils.getDefaultCardLabelSettings(Card.DefaultStyle.value.color, Card.DefaultStyle.label.color, Card.DefaultStyle.value.textSize),
|
30519 | wordWrap: !1,
|
30520 | textSize: Card.DefaultStyle.label.textSize
|
30521 | };
|
30522 | }, Card.prototype.enumerateObjectInstances = function(options) {
|
30523 | this.cardFormatSetting || (this.cardFormatSetting = this.getDefaultFormatSettings());
|
30524 | var formatSettings = this.cardFormatSetting, enumeration = new visuals.ObjectEnumerationBuilder();
|
30525 | switch (options.objectName) {
|
30526 | case "categoryLabels":
|
30527 | visuals.dataLabelUtils.enumerateCategoryLabels(enumeration, formatSettings.labelSettings, !0, !0, formatSettings.textSize);
|
30528 | break;
|
30529 |
|
30530 | case "labels":
|
30531 | var labelSettingOptions = {
|
30532 | enumeration: enumeration,
|
30533 | dataLabelsSettings: formatSettings.labelSettings,
|
30534 | show: !0,
|
30535 | displayUnits: !0,
|
30536 | precision: !0,
|
30537 | fontSize: !0
|
30538 | };
|
30539 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
30540 | break;
|
30541 |
|
30542 | case "wordWrap":
|
30543 | enumeration.pushInstance({
|
30544 | objectName: "wordWrap",
|
30545 | selector: null,
|
30546 | properties: {
|
30547 | show: formatSettings.wordWrap
|
30548 | }
|
30549 | });
|
30550 | }
|
30551 | return enumeration.complete();
|
30552 | }, Card.cardClassName = "card", Card.Label = createClassAndSelector("label"), Card.Value = createClassAndSelector("value"),
|
30553 | Card.KPIImage = createClassAndSelector("caption"), Card.cardTextProperties = {
|
30554 | fontSize: null,
|
30555 | text: null,
|
30556 | fontFamily: visuals.dataLabelUtils.LabelTextProperties.fontFamily
|
30557 | }, Card.DefaultStyle = {
|
30558 | card: {
|
30559 | maxFontSize: 200
|
30560 | },
|
30561 | label: {
|
30562 | textSize: 12,
|
30563 | color: "#a6a6a6",
|
30564 | paddingTop: 8
|
30565 | },
|
30566 | value: {
|
30567 | textSize: 27,
|
30568 | color: "#333333",
|
30569 | fontFamily: "wf_standard-font"
|
30570 | }
|
30571 | }, Card;
|
30572 | }(visuals.AnimatedText);
|
30573 | visuals.Card = Card;
|
30574 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30575 | }(powerbi || (powerbi = {}));
|
30576 |
|
30577 | var powerbi;
|
30578 |
|
30579 | !function(powerbi) {
|
30580 | var visuals;
|
30581 | !function(visuals) {
|
30582 | var OwlHappiness;
|
30583 | !function(OwlHappiness) {
|
30584 | OwlHappiness[OwlHappiness.Sad = 0] = "Sad", OwlHappiness[OwlHappiness.Meh = 1] = "Meh",
|
30585 | OwlHappiness[OwlHappiness.Happy = 2] = "Happy";
|
30586 | }(OwlHappiness || (OwlHappiness = {}));
|
30587 | var OwlGauge = function() {
|
30588 | function OwlGauge() {}
|
30589 | return OwlGauge.converter = function(dataView) {
|
30590 | return {};
|
30591 | }, OwlGauge.getGaugeData = function(dataView) {
|
30592 | var settings = {
|
30593 | max: 100,
|
30594 | min: 0,
|
30595 | target: void 0,
|
30596 | total: 0,
|
30597 | tooltipItems: []
|
30598 | };
|
30599 | 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++) {
|
30600 | var col = metadataColumns[i], value = values[i].values[0] || 0;
|
30601 | col && col.roles && (col.roles[visuals.gaugeRoleNames.y] ? (settings.total = value,
|
30602 | value && settings.tooltipItems.push({
|
30603 | displayName: values[i].source.displayName,
|
30604 | value: visuals.converterHelper.formatFromMetadataColumn(value, values[i].source, visuals.Gauge.formatStringProp)
|
30605 | })) : col.roles[visuals.gaugeRoleNames.minValue] ? settings.min = value : col.roles[visuals.gaugeRoleNames.maxValue] ? settings.max = value : col.roles[visuals.gaugeRoleNames.targetValue] && (settings.target = value,
|
30606 | value && settings.tooltipItems.push({
|
30607 | displayName: values[i].source.displayName,
|
30608 | value: visuals.converterHelper.formatFromMetadataColumn(value, values[i].source, visuals.Gauge.formatStringProp)
|
30609 | })));
|
30610 | }
|
30611 | return settings;
|
30612 | }, OwlGauge.prototype.init = function(options) {
|
30613 | var _this = this;
|
30614 | this.rootElem = options.element, this.rootElem.addClass("owlGaugeVisual"), this.svgTailElem = $(OwlGauge.owlTailSvg),
|
30615 | this.svgBgElem = $(OwlGauge.visualBgSvg), this.svgBodyElem = $(OwlGauge.owlBodySvg),
|
30616 | this.rootElem.append(this.svgBgElem).append(this.svgTailElem).append(this.svgBodyElem),
|
30617 | OwlGauge.OwlDemoMode && window.setInterval(function() {
|
30618 | var randomPercentage = 100 * Math.random() + 1;
|
30619 | _this.updateGauge(randomPercentage);
|
30620 | }, 2e3), this.updateViewportSize(options.viewport.width, options.viewport.height);
|
30621 | }, OwlGauge.prototype.update = function(options) {
|
30622 | this.updateViewportSize(options.viewport.width, options.viewport.height);
|
30623 | var dataView = options.dataViews.length > 0 ? options.dataViews[0] : null;
|
30624 | if (dataView) {
|
30625 | var gaugeData = OwlGauge.getGaugeData(options.dataViews[0]), percentage = (gaugeData.total - gaugeData.min) / (gaugeData.max - gaugeData.min);
|
30626 | this.updateGauge(100 * percentage | 0);
|
30627 | } else this.updateGauge(0);
|
30628 | }, OwlGauge.prototype.updateGauge = function(percentage) {
|
30629 | if (percentage >= 0 && 100 >= percentage) {
|
30630 | var rotationDeg = -180 + 180 * percentage / 100;
|
30631 | this.svgBgElem.css({
|
30632 | transform: "rotate(" + rotationDeg + "deg)"
|
30633 | }), percentage >= 66 ? this.happinessLevel = OwlHappiness.Happy : percentage >= 33 ? this.happinessLevel = OwlHappiness.Meh : this.happinessLevel = OwlHappiness.Sad;
|
30634 | }
|
30635 | }, Object.defineProperty(OwlGauge.prototype, "happinessLevel", {
|
30636 | set: function(level) {
|
30637 | switch (this.rootElem.removeClass("sad").removeClass("meh").removeClass("happy"),
|
30638 | level) {
|
30639 | case OwlHappiness.Sad:
|
30640 | this.rootElem.addClass("sad");
|
30641 | break;
|
30642 |
|
30643 | case OwlHappiness.Meh:
|
30644 | this.rootElem.addClass("meh");
|
30645 | break;
|
30646 |
|
30647 | case OwlHappiness.Happy:
|
30648 | this.rootElem.addClass("happy");
|
30649 | }
|
30650 | },
|
30651 | enumerable: !0,
|
30652 | configurable: !0
|
30653 | }), OwlGauge.prototype.updateViewportSize = function(width, height) {
|
30654 | var _this = this, smoothingFn = window.setImmediate || window.requestAnimationFrame;
|
30655 | smoothingFn(function() {
|
30656 | _this.rootElem.css({
|
30657 | height: height,
|
30658 | width: width
|
30659 | }), _this.svgBodyElem.height(_this.svgBodyElem.width() * OwlGauge.owlBodyHeightMultiplier),
|
30660 | _this.svgBgElem.height(_this.svgBgElem.width() * OwlGauge.visualBgHeightMultiplier),
|
30661 | _this.svgTailElem.height(_this.svgTailElem.width() * OwlGauge.owlTailHeightMultiplier);
|
30662 | });
|
30663 | }, 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>',
|
30664 | 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>',
|
30665 | 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>',
|
30666 | OwlGauge.owlBodyHeightMultiplier = 291.2 / 267.7, OwlGauge.owlTailHeightMultiplier = 295.5 / 587.8,
|
30667 | OwlGauge.visualBgHeightMultiplier = 295.5 / 587.8, OwlGauge.OwlDemoMode = !1, OwlGauge.capabilities = {
|
30668 | dataRoles: [ {
|
30669 | displayName: "Category",
|
30670 | name: "Category",
|
30671 | kind: powerbi.VisualDataRoleKind.Grouping
|
30672 | }, {
|
30673 | displayName: "Y Axis",
|
30674 | name: "Y",
|
30675 | kind: powerbi.VisualDataRoleKind.Measure
|
30676 | } ],
|
30677 | dataViewMappings: [ {
|
30678 | categories: {
|
30679 | "for": {
|
30680 | "in": "Category"
|
30681 | },
|
30682 | dataReductionAlgorithm: {
|
30683 | top: {}
|
30684 | }
|
30685 | },
|
30686 | values: {
|
30687 | select: [ {
|
30688 | bind: {
|
30689 | to: "Y"
|
30690 | }
|
30691 | } ]
|
30692 | }
|
30693 | } ]
|
30694 | }, OwlGauge;
|
30695 | }();
|
30696 | visuals.OwlGauge = OwlGauge;
|
30697 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30698 | }(powerbi || (powerbi = {}));
|
30699 |
|
30700 | var powerbi;
|
30701 |
|
30702 | !function(powerbi) {
|
30703 | var visuals;
|
30704 | !function(visuals) {
|
30705 | var NoMapLocationWarning = function() {
|
30706 | function NoMapLocationWarning() {}
|
30707 | return Object.defineProperty(NoMapLocationWarning.prototype, "code", {
|
30708 | get: function() {
|
30709 | return "NoMapLocation";
|
30710 | },
|
30711 | enumerable: !0,
|
30712 | configurable: !0
|
30713 | }), NoMapLocationWarning.prototype.getMessages = function(resourceProvider) {
|
30714 | var messageKey = "NoMapLocationMessage", titleKey = "NoMapLocationKey", detailKey = "NoMapLocationValue", visualMessage = {
|
30715 | message: resourceProvider.get(messageKey),
|
30716 | title: resourceProvider.get(titleKey),
|
30717 | detail: resourceProvider.get(detailKey)
|
30718 | };
|
30719 | return visualMessage;
|
30720 | }, NoMapLocationWarning;
|
30721 | }();
|
30722 | visuals.NoMapLocationWarning = NoMapLocationWarning;
|
30723 | var FilledMapWithoutValidGeotagCategoryWarning = function() {
|
30724 | function FilledMapWithoutValidGeotagCategoryWarning() {}
|
30725 | return Object.defineProperty(FilledMapWithoutValidGeotagCategoryWarning.prototype, "code", {
|
30726 | get: function() {
|
30727 | return "NoValidGeotaggedCategory";
|
30728 | },
|
30729 | enumerable: !0,
|
30730 | configurable: !0
|
30731 | }), FilledMapWithoutValidGeotagCategoryWarning.prototype.getMessages = function(resourceProvider) {
|
30732 | var messageKey = "NoValidGeotaggedCategoryMessage", titleKey = "NoValidGeotaggedCategoryKey", detailKey = "NoValidGeotaggedCategoryValue", visualMessage = {
|
30733 | message: resourceProvider.get(messageKey),
|
30734 | title: resourceProvider.get(titleKey),
|
30735 | detail: resourceProvider.get(detailKey)
|
30736 | };
|
30737 | return visualMessage;
|
30738 | }, FilledMapWithoutValidGeotagCategoryWarning;
|
30739 | }();
|
30740 | visuals.FilledMapWithoutValidGeotagCategoryWarning = FilledMapWithoutValidGeotagCategoryWarning;
|
30741 | var GeometryCulledWarning = function() {
|
30742 | function GeometryCulledWarning() {}
|
30743 | return Object.defineProperty(GeometryCulledWarning.prototype, "code", {
|
30744 | get: function() {
|
30745 | return "GeometryCulledWarning";
|
30746 | },
|
30747 | enumerable: !0,
|
30748 | configurable: !0
|
30749 | }), GeometryCulledWarning.prototype.getMessages = function(resourceProvider) {
|
30750 | var messageKey = "GeometryCulledWarningMessage", titleKey = "GeometryCulledWarningKey", detailKey = "GeometryCulledWarningVal", visualMessage = {
|
30751 | message: resourceProvider.get(messageKey),
|
30752 | title: resourceProvider.get(titleKey),
|
30753 | detail: resourceProvider.get(detailKey)
|
30754 | };
|
30755 | return visualMessage;
|
30756 | }, GeometryCulledWarning;
|
30757 | }();
|
30758 | visuals.GeometryCulledWarning = GeometryCulledWarning;
|
30759 | var NegativeValuesNotSupportedWarning = function() {
|
30760 | function NegativeValuesNotSupportedWarning() {}
|
30761 | return Object.defineProperty(NegativeValuesNotSupportedWarning.prototype, "code", {
|
30762 | get: function() {
|
30763 | return "NegativeValuesNotSupported";
|
30764 | },
|
30765 | enumerable: !0,
|
30766 | configurable: !0
|
30767 | }), NegativeValuesNotSupportedWarning.prototype.getMessages = function(resourceProvider) {
|
30768 | var messageKey = "VisualWarning_NegativeValues", visualMessage = {
|
30769 | message: resourceProvider.get(messageKey),
|
30770 | title: "",
|
30771 | detail: ""
|
30772 | };
|
30773 | return visualMessage;
|
30774 | }, NegativeValuesNotSupportedWarning;
|
30775 | }();
|
30776 | visuals.NegativeValuesNotSupportedWarning = NegativeValuesNotSupportedWarning;
|
30777 | var AllNegativeValuesWarning = function() {
|
30778 | function AllNegativeValuesWarning() {}
|
30779 | return Object.defineProperty(AllNegativeValuesWarning.prototype, "code", {
|
30780 | get: function() {
|
30781 | return "AllNegativeValuesNotSupported";
|
30782 | },
|
30783 | enumerable: !0,
|
30784 | configurable: !0
|
30785 | }), AllNegativeValuesWarning.prototype.getMessages = function(resourceProvider) {
|
30786 | var messageKey = "VisualWarning_AllNegativeValues", visualMessage = {
|
30787 | message: resourceProvider.get(messageKey),
|
30788 | title: "",
|
30789 | detail: ""
|
30790 | };
|
30791 | return visualMessage;
|
30792 | }, AllNegativeValuesWarning;
|
30793 | }();
|
30794 | visuals.AllNegativeValuesWarning = AllNegativeValuesWarning;
|
30795 | var NaNNotSupportedWarning = function() {
|
30796 | function NaNNotSupportedWarning() {}
|
30797 | return Object.defineProperty(NaNNotSupportedWarning.prototype, "code", {
|
30798 | get: function() {
|
30799 | return "NaNNotSupported";
|
30800 | },
|
30801 | enumerable: !0,
|
30802 | configurable: !0
|
30803 | }), NaNNotSupportedWarning.prototype.getMessages = function(resourceProvider) {
|
30804 | var messageKey = "VisualWarning_NanValues", visualMessage = {
|
30805 | message: resourceProvider.get(messageKey),
|
30806 | title: "",
|
30807 | detail: ""
|
30808 | };
|
30809 | return visualMessage;
|
30810 | }, NaNNotSupportedWarning;
|
30811 | }();
|
30812 | visuals.NaNNotSupportedWarning = NaNNotSupportedWarning;
|
30813 | var InfinityValuesNotSupportedWarning = function() {
|
30814 | function InfinityValuesNotSupportedWarning() {}
|
30815 | return Object.defineProperty(InfinityValuesNotSupportedWarning.prototype, "code", {
|
30816 | get: function() {
|
30817 | return "InfinityValuesNotSupported";
|
30818 | },
|
30819 | enumerable: !0,
|
30820 | configurable: !0
|
30821 | }), InfinityValuesNotSupportedWarning.prototype.getMessages = function(resourceProvider) {
|
30822 | var messageKey = "VisualWarning_InfinityValues", visualMessage = {
|
30823 | message: resourceProvider.get(messageKey),
|
30824 | title: "",
|
30825 | detail: ""
|
30826 | };
|
30827 | return visualMessage;
|
30828 | }, InfinityValuesNotSupportedWarning;
|
30829 | }();
|
30830 | visuals.InfinityValuesNotSupportedWarning = InfinityValuesNotSupportedWarning;
|
30831 | var ValuesOutOfRangeWarning = function() {
|
30832 | function ValuesOutOfRangeWarning() {}
|
30833 | return Object.defineProperty(ValuesOutOfRangeWarning.prototype, "code", {
|
30834 | get: function() {
|
30835 | return "ValuesOutOfRange";
|
30836 | },
|
30837 | enumerable: !0,
|
30838 | configurable: !0
|
30839 | }), ValuesOutOfRangeWarning.prototype.getMessages = function(resourceProvider) {
|
30840 | var messageKey = "VisualWarning_VisualizationOutOfRange", visualMessage = {
|
30841 | message: resourceProvider.get(messageKey),
|
30842 | title: "",
|
30843 | detail: ""
|
30844 | };
|
30845 | return visualMessage;
|
30846 | }, ValuesOutOfRangeWarning;
|
30847 | }();
|
30848 | visuals.ValuesOutOfRangeWarning = ValuesOutOfRangeWarning;
|
30849 | var ZeroValueWarning = function() {
|
30850 | function ZeroValueWarning() {}
|
30851 | return Object.defineProperty(ZeroValueWarning.prototype, "code", {
|
30852 | get: function() {
|
30853 | return "ZeroValuesNotSupported";
|
30854 | },
|
30855 | enumerable: !0,
|
30856 | configurable: !0
|
30857 | }), ZeroValueWarning.prototype.getMessages = function(resourceProvider) {
|
30858 | var messageKey = "VisualWarning_ZeroValues", visualMessage = {
|
30859 | message: resourceProvider.get(messageKey),
|
30860 | title: "",
|
30861 | detail: ""
|
30862 | };
|
30863 | return visualMessage;
|
30864 | }, ZeroValueWarning;
|
30865 | }();
|
30866 | visuals.ZeroValueWarning = ZeroValueWarning;
|
30867 | var VisualKPIDataMissingWarning = function() {
|
30868 | function VisualKPIDataMissingWarning() {}
|
30869 | return Object.defineProperty(VisualKPIDataMissingWarning.prototype, "code", {
|
30870 | get: function() {
|
30871 | return "VisualKPIDataMissing";
|
30872 | },
|
30873 | enumerable: !0,
|
30874 | configurable: !0
|
30875 | }), VisualKPIDataMissingWarning.prototype.getMessages = function(resourceProvider) {
|
30876 | var messageKey = "Visual_KPI_DataMissing", visualMessage = {
|
30877 | message: resourceProvider.get(messageKey),
|
30878 | title: "",
|
30879 | detail: ""
|
30880 | };
|
30881 | return visualMessage;
|
30882 | }, VisualKPIDataMissingWarning;
|
30883 | }();
|
30884 | visuals.VisualKPIDataMissingWarning = VisualKPIDataMissingWarning;
|
30885 | var ScriptVisualRefreshWarning = function() {
|
30886 | function ScriptVisualRefreshWarning() {}
|
30887 | return Object.defineProperty(ScriptVisualRefreshWarning.prototype, "code", {
|
30888 | get: function() {
|
30889 | return "ScriptVisualNotRefreshed";
|
30890 | },
|
30891 | enumerable: !0,
|
30892 | configurable: !0
|
30893 | }), ScriptVisualRefreshWarning.prototype.getMessages = function(resourceProvider) {
|
30894 | var messageKey = "ScriptVisualRefreshWarningMessage", detailKey = "ScriptVisualRefreshWarningValue", visualMessage = {
|
30895 | message: resourceProvider.get(messageKey),
|
30896 | title: resourceProvider.get(messageKey),
|
30897 | detail: resourceProvider.get(detailKey)
|
30898 | };
|
30899 | return visualMessage;
|
30900 | }, ScriptVisualRefreshWarning;
|
30901 | }();
|
30902 | visuals.ScriptVisualRefreshWarning = ScriptVisualRefreshWarning;
|
30903 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
30904 | }(powerbi || (powerbi = {}));
|
30905 |
|
30906 | var powerbi;
|
30907 |
|
30908 | !function(powerbi) {
|
30909 | var visuals;
|
30910 | !function(visuals) {
|
30911 | var PixelConverter = jsCommon.PixelConverter, createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, WaterfallChart = function() {
|
30912 | function WaterfallChart(options) {
|
30913 | this.isScrollable = options.isScrollable, this.tooltipsEnabled = options.tooltipsEnabled,
|
30914 | this.interactivityService = options.interactivityService;
|
30915 | }
|
30916 | return WaterfallChart.prototype.init = function(options) {
|
30917 | this.svg = options.svg, this.svg.classed(WaterfallChart.WaterfallClassName, !0),
|
30918 | this.style = options.style, this.currentViewport = options.viewport, this.hostServices = options.host,
|
30919 | this.interactivity = options.interactivity, this.cartesianVisualHost = options.cartesianHost,
|
30920 | this.options = options, this.element = options.element, this.colors = this.style.colorPalette.dataColors,
|
30921 | this.mainGraphicsSVG = this.svg.append("svg"), this.mainGraphicsContext = this.mainGraphicsSVG.append("g").classed(WaterfallChart.MainGraphicsContextClassName, !0),
|
30922 | this.labelGraphicsContext = this.mainGraphicsSVG.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0);
|
30923 | }, WaterfallChart.converter = function(dataView, palette, hostServices, dataLabelSettings, sentimentColors, interactivityService, tooltipsEnabled) {
|
30924 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
30925 | var categoryMetadata, 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 = [ {
|
30926 | label: increaseLabel,
|
30927 | color: increaseColor,
|
30928 | icon: visuals.LegendIcon.Box,
|
30929 | identity: visuals.SelectionIdBuilder.builder().withMeasure("increase").createSelectionId(),
|
30930 | selected: !1
|
30931 | }, {
|
30932 | label: decreaseLabel,
|
30933 | color: decreaseColor,
|
30934 | icon: visuals.LegendIcon.Box,
|
30935 | identity: visuals.SelectionIdBuilder.builder().withMeasure("decrease").createSelectionId(),
|
30936 | selected: !1
|
30937 | }, {
|
30938 | label: totalLabel,
|
30939 | color: totalColor,
|
30940 | icon: visuals.LegendIcon.Box,
|
30941 | identity: visuals.SelectionIdBuilder.builder().withMeasure("total").createSelectionId(),
|
30942 | selected: !1
|
30943 | } ], pos = 0, posMin = 0, posMax = 0, dataPoints = [], categoryValues = [], valuesMetadata = void 0;
|
30944 | if (reader.hasValues("Y")) {
|
30945 | valuesMetadata = reader.getValueMetadataColumn("Y");
|
30946 | var labelFormatString = valuesMetadata.format;
|
30947 | if (_.isEmpty(categories)) pos = posMax = reader.getValue("Y", 0), posMin = 0; else {
|
30948 | var categoryColumn = categories[0];
|
30949 | categoryMetadata = categoryColumn.source, categoryValues = categoryColumn.values.slice(),
|
30950 | categoryValues.push(totalLabel);
|
30951 | for (var categoryIndex = 0, catLen = reader.getCategoryCount(); catLen > categoryIndex; categoryIndex++) {
|
30952 | var category = categoryValues[categoryIndex], value = reader.getValue("Y", categoryIndex) || 0, identity = visuals.SelectionIdBuilder.builder().withCategory(categoryColumn, categoryIndex).withMeasure(valuesMetadata.queryName).createSelectionId(), tooltipInfo_2 = void 0;
|
30953 | tooltipsEnabled && (tooltipInfo_2 = [], tooltipInfo_2.push({
|
30954 | displayName: categoryMetadata.displayName,
|
30955 | value: visuals.converterHelper.formatFromMetadataColumn(category, categoryMetadata, formatStringProp)
|
30956 | }), null != value && tooltipInfo_2.push({
|
30957 | displayName: valuesMetadata.displayName,
|
30958 | value: visuals.converterHelper.formatFromMetadataColumn(value, valuesMetadata, formatStringProp)
|
30959 | }));
|
30960 | var color = value > 0 ? increaseColor : decreaseColor;
|
30961 | dataPoints.push({
|
30962 | value: value,
|
30963 | position: pos,
|
30964 | color: color,
|
30965 | categoryValue: category,
|
30966 | categoryIndex: categoryIndex,
|
30967 | seriesIndex: 0,
|
30968 | selected: !1,
|
30969 | identity: identity,
|
30970 | highlight: !1,
|
30971 | key: identity.getKey(),
|
30972 | tooltipInfo: tooltipInfo_2,
|
30973 | labelFill: dataLabelSettings.labelColor,
|
30974 | labelFormatString: labelFormatString
|
30975 | }), pos += value, pos > posMax && (posMax = pos), posMin > pos && (posMin = pos);
|
30976 | }
|
30977 | }
|
30978 | var tooltipInfo = void 0;
|
30979 | tooltipsEnabled && (tooltipInfo = [], categoryMetadata && tooltipInfo.push({
|
30980 | displayName: categoryMetadata.displayName,
|
30981 | value: totalLabel
|
30982 | }), null != pos && tooltipInfo.push({
|
30983 | displayName: valuesMetadata.displayName,
|
30984 | value: visuals.converterHelper.formatFromMetadataColumn(pos, valuesMetadata, formatStringProp)
|
30985 | }));
|
30986 | var totalIdentity = visuals.SelectionId.createNull();
|
30987 | dataPoints.push({
|
30988 | value: pos,
|
30989 | position: 0,
|
30990 | color: totalColor,
|
30991 | categoryValue: totalLabel,
|
30992 | categoryIndex: categoryIndex,
|
30993 | identity: totalIdentity,
|
30994 | seriesIndex: 0,
|
30995 | selected: !1,
|
30996 | highlight: !1,
|
30997 | key: totalIdentity.getKey(),
|
30998 | tooltipInfo: tooltipInfo,
|
30999 | labelFill: dataLabelSettings.labelColor,
|
31000 | labelFormatString: labelFormatString,
|
31001 | isTotal: !0
|
31002 | });
|
31003 | }
|
31004 | interactivityService && interactivityService.applySelectionStateToData(dataPoints);
|
31005 | var xAxisProperties = visuals.CartesianHelper.getCategoryAxisProperties(dataView.metadata), yAxisProperties = visuals.CartesianHelper.getValueAxisProperties(dataView.metadata), axesLabels = visuals.converterHelper.createAxesLabels(xAxisProperties, yAxisProperties, categoryMetadata, [ valuesMetadata ]);
|
31006 | return {
|
31007 | series: [ {
|
31008 | data: dataPoints
|
31009 | } ],
|
31010 | categories: categoryValues,
|
31011 | categoryMetadata: categoryMetadata,
|
31012 | valuesMetadata: valuesMetadata,
|
31013 | legend: {
|
31014 | dataPoints: legend
|
31015 | },
|
31016 | hasHighlights: !1,
|
31017 | positionMin: posMin,
|
31018 | positionMax: posMax,
|
31019 | dataLabelsSettings: dataLabelSettings,
|
31020 | sentimentColors: sentimentColors,
|
31021 | axesLabels: {
|
31022 | x: axesLabels.xAxisLabel,
|
31023 | y: axesLabels.yAxisLabel
|
31024 | }
|
31025 | };
|
31026 | }, WaterfallChart.prototype.setData = function(dataViews) {
|
31027 | var sentimentColors = this.getSentimentColorsFromObjects(null), dataView = dataViews.length > 0 ? dataViews[0] : void 0;
|
31028 | if (this.data = {
|
31029 | series: [ {
|
31030 | data: []
|
31031 | } ],
|
31032 | categories: [],
|
31033 | valuesMetadata: null,
|
31034 | legend: {
|
31035 | dataPoints: []
|
31036 | },
|
31037 | hasHighlights: !1,
|
31038 | categoryMetadata: null,
|
31039 | scalarCategoryAxis: !1,
|
31040 | positionMax: 0,
|
31041 | positionMin: 0,
|
31042 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultLabelSettings(!1, void 0),
|
31043 | sentimentColors: sentimentColors,
|
31044 | axesLabels: {
|
31045 | x: null,
|
31046 | y: null
|
31047 | }
|
31048 | }, dataView) {
|
31049 | if (dataView.metadata && dataView.metadata.objects) {
|
31050 | var objects = dataView.metadata.objects, labelsObj = objects.labels;
|
31051 | labelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, this.data.dataLabelsSettings),
|
31052 | sentimentColors = this.getSentimentColorsFromObjects(objects);
|
31053 | }
|
31054 | dataView.categorical && (this.data = WaterfallChart.converter(dataView, this.colors, this.hostServices, this.data.dataLabelsSettings, sentimentColors, this.interactivityService, this.tooltipsEnabled));
|
31055 | }
|
31056 | }, WaterfallChart.prototype.enumerateObjectInstances = function(enumeration, options) {
|
31057 | switch (options.objectName) {
|
31058 | case "sentimentColors":
|
31059 | this.enumerateSentimentColors(enumeration);
|
31060 | break;
|
31061 |
|
31062 | case "labels":
|
31063 | var labelSettingOptions = {
|
31064 | enumeration: enumeration,
|
31065 | dataLabelsSettings: this.data.dataLabelsSettings,
|
31066 | show: !0,
|
31067 | displayUnits: !0,
|
31068 | precision: !0,
|
31069 | fontSize: !0
|
31070 | };
|
31071 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
31072 | }
|
31073 | }, WaterfallChart.prototype.enumerateSentimentColors = function(enumeration) {
|
31074 | var sentimentColors = this.data.sentimentColors;
|
31075 | enumeration.pushInstance({
|
31076 | selector: null,
|
31077 | properties: {
|
31078 | increaseFill: sentimentColors.increaseFill,
|
31079 | decreaseFill: sentimentColors.decreaseFill,
|
31080 | totalFill: sentimentColors.totalFill
|
31081 | },
|
31082 | objectName: "sentimentColors"
|
31083 | });
|
31084 | }, WaterfallChart.prototype.calculateLegend = function() {
|
31085 | return this.data.legend;
|
31086 | }, WaterfallChart.prototype.hasLegend = function() {
|
31087 | return !0;
|
31088 | }, WaterfallChart.createClippedDataIfOverflowed = function(data, renderableDataCount) {
|
31089 | var clipped = data, dataPoints = data.series[0].data;
|
31090 | return data && renderableDataCount < dataPoints.length && (clipped = powerbi.Prototype.inherit(data),
|
31091 | clipped.series = [ {
|
31092 | data: dataPoints.slice(0, renderableDataCount)
|
31093 | } ], clipped.categories = data.categories.slice(0, renderableDataCount)), clipped;
|
31094 | }, WaterfallChart.prototype.calculateAxesProperties = function(options) {
|
31095 | var _this = this;
|
31096 | this.currentViewport = options.viewport, this.margin = options.margin;
|
31097 | var data = this.clippedData = this.data, categoryCount = data.categories.length, preferredPlotArea = this.getPreferredPlotArea(!1, categoryCount, visuals.CartesianChart.MinOrdinalRectThickness), cartesianLayout = visuals.CartesianChart.getLayout(null, {
|
31098 | availableWidth: preferredPlotArea.width,
|
31099 | categoryCount: categoryCount,
|
31100 | domain: null,
|
31101 | isScalar: !1,
|
31102 | isScrollable: this.isScrollable,
|
31103 | trimOrdinalDataOnOverflow: options.trimOrdinalDataOnOverflow
|
31104 | });
|
31105 | this.isScrollable || (data = this.clippedData = WaterfallChart.createClippedDataIfOverflowed(data, cartesianLayout.categoryCount));
|
31106 | 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);
|
31107 | return this.layout = {
|
31108 | categoryCount: cartesianLayout.categoryCount,
|
31109 | categoryThickness: cartesianLayout.categoryThickness,
|
31110 | isScalar: cartesianLayout.isScalar,
|
31111 | outerPaddingRatio: cartesianLayout.outerPaddingRatio,
|
31112 | categoryWidth: categoryWidth,
|
31113 | labelText: function(d) {
|
31114 | var formatter = formattersCache.getOrCreate(d.labelFormatString, labelSettings, value2);
|
31115 | return visuals.dataLabelUtils.getLabelFormattedText({
|
31116 | label: formatter.format(d.value)
|
31117 | });
|
31118 | },
|
31119 | labelLayout: visuals.dataLabelUtils.getLabelLayoutXYForWaterfall(xAxisProperties, categoryWidth, yAxisProperties, yAxisCreationOptions.dataDomain),
|
31120 | filter: function(d) {
|
31121 | return visuals.dataLabelUtils.doesDataLabelFitInShape(d, yAxisProperties, _this.layout);
|
31122 | },
|
31123 | style: {
|
31124 | fill: function(d) {
|
31125 | return d.isLabelInside ? visuals.dataLabelUtils.defaultInsideLabelColor : d.labelFill;
|
31126 | }
|
31127 | }
|
31128 | }, this.xAxisProperties.axisLabel = options.showCategoryAxisLabel ? data.axesLabels.x : null,
|
31129 | this.yAxisProperties.axisLabel = options.showValueAxisLabel ? data.axesLabels.y : null,
|
31130 | [ xAxisProperties, yAxisProperties ];
|
31131 | }, WaterfallChart.getDisplayUnitValueFromAxisFormatter = function(yAxisProperties, labelSettings) {
|
31132 | return yAxisProperties.formatter && yAxisProperties.formatter.displayUnit && 0 === labelSettings.displayUnits ? yAxisProperties.formatter.displayUnit.value : null;
|
31133 | }, WaterfallChart.lookupXValue = function(data, index, type) {
|
31134 | var dataPoints = data.series[0].data;
|
31135 | return index === dataPoints.length - 1 ? dataPoints[index].categoryValue : visuals.CartesianHelper.lookupXValue(data, index, type, !1);
|
31136 | }, WaterfallChart.getXAxisCreationOptions = function(data, width, layout, options) {
|
31137 | 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;
|
31138 | return {
|
31139 | pixelSpan: width,
|
31140 | dataDomain: domain,
|
31141 | metaDataColumn: data.categoryMetadata,
|
31142 | formatString: visuals.valueFormatter.getFormatString(data.categoryMetadata, WaterfallChart.formatStringProp),
|
31143 | isScalar: !1,
|
31144 | outerPadding: outerPadding,
|
31145 | categoryThickness: categoryThickness,
|
31146 | getValueFn: function(index, type) {
|
31147 | return WaterfallChart.lookupXValue(data, index, type);
|
31148 | },
|
31149 | forcedTickCount: options.forcedTickCount,
|
31150 | isCategoryAxis: !0,
|
31151 | axisDisplayUnits: options.categoryAxisDisplayUnits,
|
31152 | axisPrecision: options.categoryAxisPrecision
|
31153 | };
|
31154 | }, WaterfallChart.getYAxisCreationOptions = function(data, height, options) {
|
31155 | var combinedDomain = visuals.AxisHelper.combineDomain(options.forcedYDomain, [ data.positionMin, data.positionMax ], options.ensureYDomain);
|
31156 | return {
|
31157 | pixelSpan: height,
|
31158 | dataDomain: combinedDomain,
|
31159 | isScalar: !0,
|
31160 | isVertical: !0,
|
31161 | metaDataColumn: data.valuesMetadata,
|
31162 | formatString: visuals.valueFormatter.getFormatString(data.valuesMetadata, WaterfallChart.formatStringProp),
|
31163 | outerPadding: 0,
|
31164 | forcedTickCount: options.forcedTickCount,
|
31165 | useTickIntervalForDisplayUnits: !0,
|
31166 | isCategoryAxis: !1,
|
31167 | axisDisplayUnits: options.valueAxisDisplayUnits,
|
31168 | axisPrecision: options.valueAxisPrecision
|
31169 | };
|
31170 | }, WaterfallChart.prototype.getPreferredPlotArea = function(isScalar, categoryCount, categoryThickness) {
|
31171 | return visuals.CartesianChart.getPreferredPlotArea(categoryCount, categoryThickness, this.currentViewport, this.isScrollable, isScalar, this.margin);
|
31172 | }, WaterfallChart.prototype.getVisualCategoryAxisIsScalar = function() {
|
31173 | return !1;
|
31174 | }, WaterfallChart.prototype.overrideXScale = function(xProperties) {
|
31175 | this.xAxisProperties = xProperties;
|
31176 | }, WaterfallChart.prototype.setFilteredData = function(startIndex, endIndex) {
|
31177 | var data = this.clippedData = powerbi.Prototype.inherit(this.data);
|
31178 | return data.series = [ {
|
31179 | data: data.series[0].data.slice(startIndex, endIndex)
|
31180 | } ], data.categories = data.categories.slice(startIndex, endIndex), data;
|
31181 | }, WaterfallChart.prototype.createRects = function(data) {
|
31182 | var mainGraphicsContext = this.mainGraphicsContext, colsSelection = mainGraphicsContext.selectAll(WaterfallChart.CategoryValueClasses.selector), cols = colsSelection.data(data, function(d) {
|
31183 | return d.key;
|
31184 | });
|
31185 | return cols.enter().append("rect").attr("class", function(d) {
|
31186 | return WaterfallChart.CategoryValueClasses["class"].concat(d.highlight ? "highlight" : "");
|
31187 | }), cols.exit().remove(), cols;
|
31188 | }, WaterfallChart.prototype.createConnectors = function(data) {
|
31189 | var mainGraphicsContext = this.mainGraphicsContext, connectorSelection = mainGraphicsContext.selectAll(WaterfallChart.WaterfallConnectorClasses.selector), connectors = connectorSelection.data(data.slice(0, data.length - 1), function(d) {
|
31190 | return d.key;
|
31191 | });
|
31192 | return connectors.enter().append("line").classed(WaterfallChart.WaterfallConnectorClasses["class"], !0),
|
31193 | connectors.exit().remove(), connectors;
|
31194 | }, WaterfallChart.prototype.render = function(suppressAnimations) {
|
31195 | var _this = this, dataPoints = this.clippedData.series[0].data, bars = this.createRects(dataPoints), connectors = this.createConnectors(dataPoints);
|
31196 | this.tooltipsEnabled && visuals.TooltipManager.addTooltip(bars, function(tooltipEvent) {
|
31197 | return tooltipEvent.data.tooltipInfo;
|
31198 | });
|
31199 | var hasSelection = this.interactivityService && this.interactivityService.hasSelection(), xScale = this.xAxisProperties.scale, yScale = this.yAxisProperties.scale, y0 = yScale(0);
|
31200 | this.mainGraphicsSVG.attr("height", this.getAvailableHeight()).attr("width", this.getAvailableWidth()),
|
31201 | bars.style("fill", function(d) {
|
31202 | return d.color;
|
31203 | }).style("fill-opacity", function(d) {
|
31204 | return d.isTotal ? visuals.ColumnUtil.DefaultOpacity : visuals.ColumnUtil.getFillOpacity(d.selected, d.highlight, hasSelection, _this.data.hasHighlights);
|
31205 | }).attr("width", this.layout.categoryWidth).attr("x", function(d) {
|
31206 | return xScale(d.categoryIndex);
|
31207 | }).attr("y", function(d) {
|
31208 | return WaterfallChart.getRectTop(yScale, d.position, d.value);
|
31209 | }).attr("height", function(d) {
|
31210 | return y0 - yScale(Math.abs(d.value));
|
31211 | }), connectors.attr({
|
31212 | x1: function(d) {
|
31213 | return xScale(d.categoryIndex);
|
31214 | },
|
31215 | y1: function(d) {
|
31216 | return yScale(d.position + d.value);
|
31217 | },
|
31218 | x2: function(d) {
|
31219 | return xScale(d.categoryIndex + 1) + _this.layout.categoryWidth;
|
31220 | },
|
31221 | y2: function(d) {
|
31222 | return yScale(d.position + d.value);
|
31223 | }
|
31224 | });
|
31225 | var labelSettings = this.data.dataLabelsSettings, labelDataPoints = [];
|
31226 | (labelSettings && labelSettings.show || labelSettings.showCategory) && (labelDataPoints = this.createLabelDataPoints());
|
31227 | var behaviorOptions = void 0;
|
31228 | return this.interactivityService && (behaviorOptions = {
|
31229 | bars: bars,
|
31230 | datapoints: dataPoints
|
31231 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), {
|
31232 | dataPoints: dataPoints,
|
31233 | behaviorOptions: behaviorOptions,
|
31234 | labelDataPoints: labelDataPoints,
|
31235 | labelsAreNumeric: !0
|
31236 | };
|
31237 | }, WaterfallChart.prototype.onClearSelection = function() {
|
31238 | this.interactivityService && this.interactivityService.clearSelection();
|
31239 | }, WaterfallChart.prototype.getSupportedCategoryAxisType = function() {
|
31240 | return visuals.axisType.categorical;
|
31241 | }, WaterfallChart.getRectTop = function(scale, pos, value) {
|
31242 | return 0 > value ? scale(pos) : scale(pos) - (scale(0) - scale(value));
|
31243 | }, WaterfallChart.prototype.getAvailableWidth = function() {
|
31244 | return this.currentViewport.width - (this.margin.left + this.margin.right);
|
31245 | }, WaterfallChart.prototype.getAvailableHeight = function() {
|
31246 | return this.currentViewport.height - (this.margin.top + this.margin.bottom);
|
31247 | }, WaterfallChart.prototype.getSentimentColorsFromObjects = function(objects) {
|
31248 | 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);
|
31249 | return {
|
31250 | increaseFill: {
|
31251 | solid: {
|
31252 | color: increaseColor
|
31253 | }
|
31254 | },
|
31255 | decreaseFill: {
|
31256 | solid: {
|
31257 | color: decreaseColor
|
31258 | }
|
31259 | },
|
31260 | totalFill: {
|
31261 | solid: {
|
31262 | color: totalColor
|
31263 | }
|
31264 | }
|
31265 | };
|
31266 | }, WaterfallChart.prototype.createLabelDataPoints = function() {
|
31267 | 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_6 = series; _i < series_6.length; _i++) for (var currentSeries = series_6[_i], _a = 0, _b = currentSeries.data; _a < _b.length; _a++) {
|
31268 | var dataPoint = _b[_a], parentRect = {
|
31269 | left: xScale(dataPoint.categoryIndex),
|
31270 | top: WaterfallChart.getRectTop(yScale, dataPoint.position, dataPoint.value),
|
31271 | width: this.layout.categoryWidth,
|
31272 | height: y0 - yScale(Math.abs(dataPoint.value))
|
31273 | }, formatString = dataPoint.labelFormatString, formatter = formattersCache.getOrCreate(formatString, this.data.dataLabelsSettings, axisFormatter), text = visuals.NewDataLabelUtils.getLabelFormattedText(formatter.format(dataPoint.value)), properties = {
|
31274 | text: text,
|
31275 | fontFamily: visuals.NewDataLabelUtils.LabelTextProperties.fontFamily,
|
31276 | fontSize: PixelConverter.fromPoint(labelSettings.fontSize || visuals.NewDataLabelUtils.DefaultLabelFontSizeInPt),
|
31277 | fontWeight: visuals.NewDataLabelUtils.LabelTextProperties.fontWeight
|
31278 | }, textWidth = powerbi.TextMeasurementService.measureSvgTextWidth(properties), textHeight = powerbi.TextMeasurementService.estimateSvgTextHeight(properties, !0);
|
31279 | labelDataPoints.push({
|
31280 | isPreferred: !0,
|
31281 | text: text,
|
31282 | textSize: {
|
31283 | width: textWidth,
|
31284 | height: textHeight
|
31285 | },
|
31286 | outsideFill: labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor,
|
31287 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
31288 | parentType: 1,
|
31289 | parentShape: {
|
31290 | rect: parentRect,
|
31291 | orientation: dataPoint.value >= 0 ? 1 : 2,
|
31292 | validPositions: 0 === dataPoint.value ? WaterfallChart.validZeroLabelPosition : WaterfallChart.validLabelPositions
|
31293 | },
|
31294 | fontSize: labelSettings.fontSize,
|
31295 | identity: void 0
|
31296 | });
|
31297 | }
|
31298 | return labelDataPoints;
|
31299 | }, WaterfallChart.formatStringProp = {
|
31300 | objectName: "general",
|
31301 | propertyName: "formatString"
|
31302 | }, WaterfallChart.WaterfallClassName = "waterfallChart", WaterfallChart.MainGraphicsContextClassName = "mainGraphicsContext",
|
31303 | WaterfallChart.IncreaseLabel = "Waterfall_IncreaseLabel", WaterfallChart.DecreaseLabel = "Waterfall_DecreaseLabel",
|
31304 | WaterfallChart.TotalLabel = "Waterfall_TotalLabel", WaterfallChart.CategoryValueClasses = createClassAndSelector("column"),
|
31305 | WaterfallChart.WaterfallConnectorClasses = createClassAndSelector("waterfall-connector"),
|
31306 | WaterfallChart.defaultTotalColor = "#00b8aa", WaterfallChart.validLabelPositions = [ 16, 4 ],
|
31307 | WaterfallChart.validZeroLabelPosition = [ 16, 8 ], WaterfallChart;
|
31308 | }();
|
31309 | visuals.WaterfallChart = WaterfallChart;
|
31310 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
31311 | }(powerbi || (powerbi = {}));
|
31312 |
|
31313 | var powerbi;
|
31314 |
|
31315 | !function(powerbi) {
|
31316 | var visuals;
|
31317 | !function(visuals) {
|
31318 | 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() {
|
31319 | function ToolTipComponent(tooltipOptions) {
|
31320 | this.tooltipOptions = tooltipOptions, this.isTooltipVisible = !1, tooltipOptions || (this.tooltipOptions = ToolTipComponent.DefaultTooltipOptions);
|
31321 | }
|
31322 | return ToolTipComponent.prototype.isTooltipComponentVisible = function() {
|
31323 | return this.isTooltipVisible;
|
31324 | }, ToolTipComponent.prototype.setTestScreenSize = function(width, height) {
|
31325 | this.customScreenWidth = width, this.customScreenHeight = height;
|
31326 | }, ToolTipComponent.prototype.show = function(tooltipData, clickedArea) {
|
31327 | this.isTooltipVisible = !0, this.tooltipContainer || (this.tooltipContainer = this.createTooltipContainer()),
|
31328 | this.setTooltipContent(tooltipData), this.tooltipContainer.style("visibility", "visible").transition().duration(0).style("opacity", this.tooltipOptions.opacity),
|
31329 | this.setPosition(clickedArea);
|
31330 | }, ToolTipComponent.prototype.move = function(tooltipData, clickedArea) {
|
31331 | this.isTooltipVisible && (tooltipData && this.setTooltipContent(tooltipData), this.setPosition(clickedArea));
|
31332 | }, ToolTipComponent.prototype.hide = function() {
|
31333 | this.isTooltipVisible && (this.isTooltipVisible = !1, this.tooltipContainer.transition().duration(this.tooltipOptions.animationDuration).style("opacity", 0).each("end", function() {
|
31334 | this.style.visibility = "hidden";
|
31335 | }));
|
31336 | }, ToolTipComponent.prototype.createTooltipContainer = function() {
|
31337 | var container = d3.select(ToolTipComponent.parentContainerSelector).append("div").attr("class", ContainerClassName["class"]);
|
31338 | return container.append("div").attr("class", ArrowClassName["class"]), container.append("div").attr("class", ContentContainerClassName["class"]),
|
31339 | container;
|
31340 | }, ToolTipComponent.prototype.setTooltipContent = function(tooltipData) {
|
31341 | if (!_.isEqual(tooltipData, this.currentTooltipData)) {
|
31342 | this.currentTooltipData = tooltipData;
|
31343 | var rowsSelector = TooltipRowClassName.selector, contentContainer = this.tooltipContainer.select(ContentContainerClassName.selector);
|
31344 | if (contentContainer.selectAll(TooltipHeaderClassName.selector).remove(), contentContainer.selectAll(TooltipRowClassName.selector).remove(),
|
31345 | 0 !== tooltipData.length) {
|
31346 | tooltipData[0].header && contentContainer.append("div").attr("class", TooltipHeaderClassName["class"]).text(tooltipData[0].header);
|
31347 | var tooltipRow = contentContainer.selectAll(rowsSelector).data(tooltipData), newRow = tooltipRow.enter().append("div").attr("class", TooltipRowClassName["class"]);
|
31348 | if (tooltipData[0].color) {
|
31349 | var newColorCell = newRow.append("div").attr("class", TooltipColorCellClassName["class"]);
|
31350 | newColorCell.append("svg").attr({
|
31351 | width: "100%",
|
31352 | height: "15px"
|
31353 | }).append("circle").attr({
|
31354 | cx: "5",
|
31355 | cy: "8",
|
31356 | r: "5"
|
31357 | }).style({
|
31358 | fill: function(d) {
|
31359 | return d.color;
|
31360 | }
|
31361 | });
|
31362 | }
|
31363 | var newTitleCell = newRow.append("div").attr("class", TooltipTitleCellClassName["class"]), newValueCell = newRow.append("div").attr("class", TooltipValueCellClassName["class"]);
|
31364 | newTitleCell.text(function(d) {
|
31365 | return d.displayName;
|
31366 | }), newValueCell.text(function(d) {
|
31367 | return d.value;
|
31368 | });
|
31369 | }
|
31370 | }
|
31371 | }, ToolTipComponent.prototype.getTooltipPosition = function(clickedArea, clickedScreenArea) {
|
31372 | 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;
|
31373 | return 0 === clickedScreenArea ? (offsetX += 3 * arrowOffset + centerPointOffset,
|
31374 | offsetY -= 2 * arrowOffset + centerPointOffset) : 1 === clickedScreenArea ? (offsetX -= 2 * arrowOffset + tooltipContainerBounds.width + centerPointOffset,
|
31375 | offsetY -= 2 * arrowOffset + centerPointOffset) : 3 === clickedScreenArea ? (offsetX += 3 * arrowOffset + centerPointOffset,
|
31376 | offsetY -= tooltipContainerBounds.height - 2 * arrowOffset + centerPointOffset) : 2 === clickedScreenArea && (offsetX -= 2 * arrowOffset + tooltipContainerBounds.width + centerPointOffset,
|
31377 | offsetY -= tooltipContainerBounds.height - 2 * arrowOffset + centerPointOffset),
|
31378 | centerPoint.offset(offsetX, offsetY), centerPoint;
|
31379 | }, ToolTipComponent.prototype.setPosition = function(clickedArea) {
|
31380 | var clickedScreenArea = this.getClickedScreenArea(clickedArea), tooltipPosition = this.getTooltipPosition(clickedArea, clickedScreenArea);
|
31381 | this.tooltipContainer.style({
|
31382 | left: tooltipPosition.x + "px",
|
31383 | top: tooltipPosition.y + "px"
|
31384 | }), this.setArrowPosition(clickedArea, clickedScreenArea);
|
31385 | }, ToolTipComponent.prototype.setArrowPosition = function(clickedArea, clickedScreenArea) {
|
31386 | var arrowClassName, arrow = this.getArrowElement();
|
31387 | 0 === clickedScreenArea ? arrowClassName = "top left" : 1 === clickedScreenArea ? arrowClassName = "top right" : 3 === clickedScreenArea ? arrowClassName = "bottom left" : 2 === clickedScreenArea && (arrowClassName = "bottom right"),
|
31388 | arrow.attr("class", "arrow").classed(arrowClassName, !0);
|
31389 | }, ToolTipComponent.prototype.getArrowElement = function() {
|
31390 | return this.tooltipContainer.select(ArrowClassName.selector);
|
31391 | }, ToolTipComponent.prototype.getClickedScreenArea = function(clickedArea) {
|
31392 | 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;
|
31393 | 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;
|
31394 | }, ToolTipComponent.DefaultTooltipOptions = {
|
31395 | opacity: 1,
|
31396 | animationDuration: 250,
|
31397 | offsetX: 10,
|
31398 | offsetY: 10
|
31399 | }, ToolTipComponent.parentContainerSelector = "body", ToolTipComponent.highlightedValueDisplayNameResorceKey = "Tooltip_HighlightedValueDisplayName",
|
31400 | ToolTipComponent;
|
31401 | }();
|
31402 | visuals.ToolTipComponent = ToolTipComponent;
|
31403 | var TooltipManager;
|
31404 | !function(TooltipManager) {
|
31405 | function addTooltip(selection, getTooltipInfoDelegate, reloadTooltipDataOnMouseMove, onMouseOutDelegate) {
|
31406 | if (TooltipManager.ShowTooltips) {
|
31407 | var rootNode = d3.select(ToolTipComponent.parentContainerSelector).node();
|
31408 | selection.on("mouseover", function() {
|
31409 | var target = d3.event.target, data = d3.select(target).datum();
|
31410 | if (!handleTouchTimeoutId && canDisplayTooltip(d3.event)) {
|
31411 | mouseCoordinates = getCoordinates(rootNode, !0);
|
31412 | var elementCoordinates = getCoordinates(target, !0), tooltipEvent = {
|
31413 | data: data,
|
31414 | coordinates: mouseCoordinates,
|
31415 | elementCoordinates: elementCoordinates,
|
31416 | context: target,
|
31417 | isTouchEvent: !1
|
31418 | };
|
31419 | clearTooltipTimeout();
|
31420 | var delay = TooltipManager.ToolTipInstance.isTooltipComponentVisible() ? 16 : tooltipMouseOverDelay;
|
31421 | tooltipTimeoutId = showDelayedTooltip(tooltipEvent, getTooltipInfoDelegate, delay);
|
31422 | }
|
31423 | }), selection.on("mouseout", function() {
|
31424 | handleTouchTimeoutId || (clearTooltipTimeout(), tooltipTimeoutId = hideDelayedTooltip(tooltipMouseOutDelay)),
|
31425 | onMouseOutDelegate && onMouseOutDelegate();
|
31426 | }), selection.on("mousemove", function() {
|
31427 | var target = d3.event.target, data = d3.select(target).datum();
|
31428 | if (!handleTouchTimeoutId && canDisplayTooltip(d3.event)) {
|
31429 | mouseCoordinates = getCoordinates(rootNode, !0);
|
31430 | var elementCoordinates = getCoordinates(target, !0), tooltipEvent = {
|
31431 | data: data,
|
31432 | coordinates: mouseCoordinates,
|
31433 | elementCoordinates: elementCoordinates,
|
31434 | context: target,
|
31435 | isTouchEvent: !1
|
31436 | };
|
31437 | moveTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate, reloadTooltipDataOnMouseMove);
|
31438 | }
|
31439 | });
|
31440 | var touchStartEventName = getTouchStartEventName(), touchEndEventName = getTouchEndEventName(), isPointerEvent = "pointerdown" === touchStartEventName || "MSPointerDown" === touchStartEventName;
|
31441 | GlobalTooltipEventsAttached || (attachGlobalEvents(touchStartEventName), GlobalTooltipEventsAttached = !0),
|
31442 | selection.on(touchStartEventName, function() {
|
31443 | var target = d3.event.target, data = d3.select(target).datum();
|
31444 | hideTooltipEventHandler();
|
31445 | var coordinates = getCoordinates(rootNode, isPointerEvent), elementCoordinates = getCoordinates(target, isPointerEvent), tooltipEvent = {
|
31446 | data: data,
|
31447 | coordinates: coordinates,
|
31448 | elementCoordinates: elementCoordinates,
|
31449 | context: target,
|
31450 | isTouchEvent: !0
|
31451 | };
|
31452 | clearTooltipTimeout(), tooltipTimeoutId = showDelayedTooltip(tooltipEvent, getTooltipInfoDelegate, tooltipTouchDelay);
|
31453 | }), selection.on(touchEndEventName, function() {
|
31454 | clearTooltipTimeout(), handleTouchTimeoutId && clearTimeout(handleTouchTimeoutId),
|
31455 | handleTouchTimeoutId = setTimeout(function() {
|
31456 | handleTouchTimeoutId = 0;
|
31457 | }, handleTouchDelay);
|
31458 | });
|
31459 | }
|
31460 | }
|
31461 | function showDelayedTooltip(tooltipEvent, getTooltipInfoDelegate, delayInMs) {
|
31462 | return setTimeout(function() {
|
31463 | return showTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate);
|
31464 | }, delayInMs);
|
31465 | }
|
31466 | function hideDelayedTooltip(delayInMs) {
|
31467 | return setTimeout(function() {
|
31468 | return hideTooltipEventHandler();
|
31469 | }, delayInMs);
|
31470 | }
|
31471 | function setLocalizedStrings(localizationOptions) {
|
31472 | ToolTipComponent.localizationOptions = localizationOptions;
|
31473 | }
|
31474 | function showTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate) {
|
31475 | var tooltipInfo = tooltipData || getTooltipInfoDelegate(tooltipEvent);
|
31476 | if (!_.isEmpty(tooltipInfo)) {
|
31477 | var coordinates = mouseCoordinates || tooltipEvent.coordinates, clickedArea = getClickedArea(coordinates[0], coordinates[1], tooltipEvent.isTouchEvent);
|
31478 | TooltipManager.ToolTipInstance.show(tooltipInfo, clickedArea);
|
31479 | }
|
31480 | }
|
31481 | function moveTooltipEventHandler(tooltipEvent, getTooltipInfoDelegate, reloadTooltipDataOnMouseMove) {
|
31482 | tooltipData = void 0, reloadTooltipDataOnMouseMove && (tooltipData = getTooltipInfoDelegate(tooltipEvent));
|
31483 | var clickedArea = getClickedArea(tooltipEvent.coordinates[0], tooltipEvent.coordinates[1], tooltipEvent.isTouchEvent);
|
31484 | TooltipManager.ToolTipInstance.move(tooltipData, clickedArea);
|
31485 | }
|
31486 | function hideTooltipEventHandler() {
|
31487 | TooltipManager.ToolTipInstance.hide();
|
31488 | }
|
31489 | function clearTooltipTimeout() {
|
31490 | tooltipTimeoutId && clearTimeout(tooltipTimeoutId);
|
31491 | }
|
31492 | function canDisplayTooltip(d3Event) {
|
31493 | var cadDisplay = !0, mouseEvent = d3Event;
|
31494 | if (void 0 !== mouseEvent.buttons) {
|
31495 | var hasMouseButtonPressed = 0 !== mouseEvent.buttons;
|
31496 | cadDisplay = !hasMouseButtonPressed;
|
31497 | }
|
31498 | return cadDisplay;
|
31499 | }
|
31500 | function getTouchStartEventName() {
|
31501 | var eventName = "touchstart";
|
31502 | return window.PointerEvent ? eventName = "pointerdown" : window.MSPointerEvent && (eventName = "MSPointerDown"),
|
31503 | eventName;
|
31504 | }
|
31505 | function getTouchEndEventName() {
|
31506 | var eventName = "touchend";
|
31507 | return window.PointerEvent ? eventName = "pointerup" : window.MSPointerEvent && (eventName = "MSPointerUp"),
|
31508 | eventName;
|
31509 | }
|
31510 | function getCoordinates(rootNode, isPointerEvent) {
|
31511 | var coordinates;
|
31512 | if (isPointerEvent) {
|
31513 | for (var e = d3.event, s = void 0; s = e.sourceEvent; ) e = s;
|
31514 | var rect = rootNode.getBoundingClientRect();
|
31515 | coordinates = [ e.clientX - rect.left - rootNode.clientLeft, e.clientY - rect.top - rootNode.clientTop ];
|
31516 | } else {
|
31517 | var touchCoordinates = d3.touches(rootNode);
|
31518 | touchCoordinates && touchCoordinates.length > 0 && (coordinates = touchCoordinates[0]);
|
31519 | }
|
31520 | return coordinates;
|
31521 | }
|
31522 | function attachGlobalEvents(touchStartEventName) {
|
31523 | d3.select(ToolTipComponent.parentContainerSelector).on(touchStartEventName, function(d, i) {
|
31524 | TooltipManager.ToolTipInstance.hide();
|
31525 | });
|
31526 | }
|
31527 | function getClickedArea(x, y, isTouchEvent) {
|
31528 | var width = 0, pointX = x, pointY = y;
|
31529 | if (isTouchEvent) {
|
31530 | width = 12;
|
31531 | var offset = width / 2;
|
31532 | pointX = Math.max(x - offset, 0), pointY = Math.max(y - offset, 0);
|
31533 | }
|
31534 | return new TouchUtils.Rectangle(pointX, pointY, width, width);
|
31535 | }
|
31536 | TooltipManager.ShowTooltips = !0, TooltipManager.ToolTipInstance = new ToolTipComponent();
|
31537 | var tooltipTimeoutId, mouseCoordinates, tooltipData, GlobalTooltipEventsAttached = !1, tooltipMouseOverDelay = 350, tooltipMouseOutDelay = 500, tooltipTouchDelay = 350, handleTouchDelay = 1e3, handleTouchTimeoutId = 0;
|
31538 | TooltipManager.addTooltip = addTooltip, TooltipManager.showDelayedTooltip = showDelayedTooltip,
|
31539 | TooltipManager.hideDelayedTooltip = hideDelayedTooltip, TooltipManager.setLocalizedStrings = setLocalizedStrings;
|
31540 | }(TooltipManager = visuals.TooltipManager || (visuals.TooltipManager = {}));
|
31541 | var TooltipBuilder;
|
31542 | !function(TooltipBuilder) {
|
31543 | function createTooltipInfo(formatStringProp, dataViewCat, categoryValue, value, categories, seriesData, seriesIndex, categoryIndex, highlightedValue, gradientValueColumn) {
|
31544 | var categorySource, seriesSource = [], valuesSource = void 0;
|
31545 | seriesIndex = 0 | seriesIndex;
|
31546 | var categoriesData = dataViewCat ? dataViewCat.categories : categories;
|
31547 | if (categoriesData && categoriesData.length > 0) if (categoriesData.length > 1) {
|
31548 | for (var compositeCategoriesData = [], i = 0, ilen = categoriesData.length; ilen > i; i++) compositeCategoriesData.push(categoriesData[i].source);
|
31549 | categorySource = {
|
31550 | value: categoryValue,
|
31551 | metadata: compositeCategoriesData
|
31552 | };
|
31553 | } else categorySource = {
|
31554 | value: categoryValue,
|
31555 | metadata: [ categoriesData[0].source ]
|
31556 | };
|
31557 | if (dataViewCat && dataViewCat.values) {
|
31558 | if (categorySource && categorySource.metadata[0] === dataViewCat.values.source || (valuesSource = dataViewCat.values.source),
|
31559 | dataViewCat.values.length > 0) {
|
31560 | var valueColumn = dataViewCat.values[seriesIndex], isAutoGeneratedColumn = !!(valueColumn && valueColumn.source && valueColumn.source.isAutoGeneratedColumn);
|
31561 | isAutoGeneratedColumn || seriesSource.push({
|
31562 | value: value,
|
31563 | highlightedValue: highlightedValue,
|
31564 | metadata: valueColumn
|
31565 | });
|
31566 | }
|
31567 | var gradientToolTipData = createGradientToolTipData(gradientValueColumn, categoryIndex);
|
31568 | null != gradientToolTipData && seriesSource.push(gradientToolTipData);
|
31569 | }
|
31570 | if (seriesData) for (var i = 0, len = seriesData.length; len > i; i++) {
|
31571 | var singleSeriesData = seriesData[i];
|
31572 | categorySource && categorySource.metadata[0] === singleSeriesData.metadata.source || seriesSource.push({
|
31573 | value: singleSeriesData.value,
|
31574 | metadata: singleSeriesData.metadata
|
31575 | });
|
31576 | }
|
31577 | var tooltipInfo = createTooltipData(formatStringProp, categorySource, valuesSource, seriesSource);
|
31578 | return tooltipInfo;
|
31579 | }
|
31580 | function createGradientToolTipData(gradientValueColumn, categoryIndex) {
|
31581 | return gradientValueColumn ? {
|
31582 | value: gradientValueColumn.values[categoryIndex],
|
31583 | metadata: {
|
31584 | source: gradientValueColumn.source,
|
31585 | values: []
|
31586 | }
|
31587 | } : null;
|
31588 | }
|
31589 | function createTooltipData(formatStringProp, categoryValue, valuesSource, seriesValues) {
|
31590 | var items = [];
|
31591 | if (categoryValue) if (categoryValue.metadata.length > 1) {
|
31592 | for (var displayName = "", i = 0, ilen = categoryValue.metadata.length; ilen > i; i++) 0 !== i && (displayName += "/"),
|
31593 | displayName += categoryValue.metadata[i].displayName;
|
31594 | var categoryFormattedValue = getFormattedValue(categoryValue.metadata[0], formatStringProp, categoryValue.value);
|
31595 | items.push({
|
31596 | displayName: displayName,
|
31597 | value: categoryFormattedValue
|
31598 | });
|
31599 | } else {
|
31600 | var categoryFormattedValue = getFormattedValue(categoryValue.metadata[0], formatStringProp, categoryValue.value);
|
31601 | items.push({
|
31602 | displayName: categoryValue.metadata[0].displayName,
|
31603 | value: categoryFormattedValue
|
31604 | });
|
31605 | }
|
31606 | if (valuesSource) {
|
31607 | var dynamicValue = void 0;
|
31608 | if (seriesValues.length > 0) {
|
31609 | var dynamicValueMetadata = seriesValues[0].metadata.source;
|
31610 | dynamicValue = getFormattedValue(valuesSource, formatStringProp, dynamicValueMetadata.groupName);
|
31611 | }
|
31612 | items.push({
|
31613 | displayName: valuesSource.displayName,
|
31614 | value: dynamicValue
|
31615 | });
|
31616 | }
|
31617 | for (var i = 0; i < seriesValues.length; i++) {
|
31618 | var seriesData = seriesValues[i];
|
31619 | if (seriesData && seriesData.metadata) {
|
31620 | var seriesMetadataColumn = seriesData.metadata.source, value = seriesData.value, highlightedValue = seriesData.highlightedValue;
|
31621 | if (value || 0 === value) {
|
31622 | var formattedValue = getFormattedValue(seriesMetadataColumn, formatStringProp, value);
|
31623 | items.push({
|
31624 | displayName: seriesMetadataColumn.displayName,
|
31625 | value: formattedValue
|
31626 | });
|
31627 | }
|
31628 | if (highlightedValue || 0 === highlightedValue) {
|
31629 | var formattedHighlightedValue = getFormattedValue(seriesMetadataColumn, formatStringProp, highlightedValue), displayName = ToolTipComponent.localizationOptions.highlightedValueDisplayName;
|
31630 | items.push({
|
31631 | displayName: displayName,
|
31632 | value: formattedHighlightedValue
|
31633 | });
|
31634 | }
|
31635 | }
|
31636 | }
|
31637 | return items;
|
31638 | }
|
31639 | function getFormattedValue(column, formatStringProp, value) {
|
31640 | var formatString = getFormatStringFromColumn(column, formatStringProp);
|
31641 | return visuals.valueFormatter.format(value, formatString);
|
31642 | }
|
31643 | function getFormatStringFromColumn(column, formatStringProp) {
|
31644 | if (column) {
|
31645 | var formatString = visuals.valueFormatter.getFormatString(column, formatStringProp, !0);
|
31646 | return formatString || column.format;
|
31647 | }
|
31648 | return null;
|
31649 | }
|
31650 | TooltipBuilder.createTooltipInfo = createTooltipInfo, TooltipBuilder.createGradientToolTipData = createGradientToolTipData;
|
31651 | }(TooltipBuilder = visuals.TooltipBuilder || (visuals.TooltipBuilder = {}));
|
31652 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
31653 | }(powerbi || (powerbi = {}));
|
31654 |
|
31655 | var powerbi;
|
31656 |
|
31657 | !function(powerbi) {
|
31658 | var visuals;
|
31659 | !function(visuals) {
|
31660 | var visualStyles;
|
31661 | !function(visualStyles) {
|
31662 | function create(dataColors) {
|
31663 | return void 0 === dataColors && (dataColors = new visuals.DataColorPalette()), {
|
31664 | titleText: {
|
31665 | color: {
|
31666 | value: "rgba(51,51,51,1)"
|
31667 | }
|
31668 | },
|
31669 | subTitleText: {
|
31670 | color: {
|
31671 | value: "rgba(145,145,145,1)"
|
31672 | }
|
31673 | },
|
31674 | colorPalette: {
|
31675 | dataColors: dataColors
|
31676 | },
|
31677 | labelText: {
|
31678 | color: {
|
31679 | value: "rgba(51,51,51,1)"
|
31680 | },
|
31681 | fontSize: "11px"
|
31682 | },
|
31683 | isHighContrast: !1
|
31684 | };
|
31685 | }
|
31686 | visualStyles.create = create;
|
31687 | }(visualStyles = visuals.visualStyles || (visuals.visualStyles = {}));
|
31688 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
31689 | }(powerbi || (powerbi = {}));
|
31690 |
|
31691 | var powerbi;
|
31692 |
|
31693 | !function(powerbi) {
|
31694 | var visuals;
|
31695 | !function(visuals) {
|
31696 | var createClassAndSelector = jsCommon.CssConstants.createClassAndSelector, DonutChart = function() {
|
31697 | function DonutChart(options) {
|
31698 | options && (this.sliceWidthRatio = options.sliceWidthRatio, this.animator = options.animator,
|
31699 | this.isScrollable = options.isScrollable ? options.isScrollable : !1, this.disableGeometricCulling = options.disableGeometricCulling ? options.disableGeometricCulling : !1,
|
31700 | this.behavior = options.behavior, this.tooltipsEnabled = options.tooltipsEnabled,
|
31701 | options.smallViewPortProperties && (this.maxHeightToScaleDonutLegend = options.smallViewPortProperties.maxHeightToScaleDonutLegend)),
|
31702 | null == this.sliceWidthRatio && (this.sliceWidthRatio = DonutChart.defaultSliceWidthRatio);
|
31703 | }
|
31704 | return DonutChart.converter = function(dataView, colors, defaultDataPointColor, viewport, disableGeometricCulling, interactivityService, tooltipsEnabled) {
|
31705 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
31706 | var converter = new DonutChartConversion.DonutChartConverter(dataView, colors, defaultDataPointColor, tooltipsEnabled);
|
31707 | converter.convert();
|
31708 | var d3PieLayout = d3.layout.pie().sort(null).value(function(d) {
|
31709 | return d.percentage;
|
31710 | });
|
31711 | interactivityService && (interactivityService.applySelectionStateToData(converter.dataPoints),
|
31712 | interactivityService.applySelectionStateToData(converter.legendData.dataPoints));
|
31713 | var culledDataPoints = !disableGeometricCulling && viewport ? DonutChart.cullDataByViewport(converter.dataPoints, converter.maxValue, viewport) : converter.dataPoints;
|
31714 | return {
|
31715 | dataPointsToDeprecate: culledDataPoints,
|
31716 | dataPoints: d3PieLayout(culledDataPoints),
|
31717 | unCulledDataPoints: converter.dataPoints,
|
31718 | dataPointsToEnumerate: converter.legendData.dataPoints,
|
31719 | legendData: converter.legendData,
|
31720 | hasHighlights: converter.hasHighlights,
|
31721 | dataLabelsSettings: converter.dataLabelsSettings,
|
31722 | legendObjectProperties: converter.legendObjectProperties,
|
31723 | maxValue: converter.maxValue,
|
31724 | visibleGeometryCulled: converter.dataPoints.length !== culledDataPoints.length
|
31725 | };
|
31726 | }, DonutChart.prototype.init = function(options) {
|
31727 | this.options = options;
|
31728 | var element = options.element;
|
31729 | element.empty(), this.parentViewport = options.viewport, this.currentViewport = {
|
31730 | height: options.viewport.height,
|
31731 | width: options.viewport.width
|
31732 | }, this.formatter = visuals.valueFormatter.format, this.data = {
|
31733 | dataPointsToDeprecate: [],
|
31734 | dataPointsToEnumerate: [],
|
31735 | dataPoints: [],
|
31736 | unCulledDataPoints: [],
|
31737 | legendData: {
|
31738 | title: "",
|
31739 | dataPoints: [],
|
31740 | fontSize: visuals.SVGLegend.DefaultFontSizeInPt
|
31741 | },
|
31742 | hasHighlights: !1,
|
31743 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultDonutLabelSettings()
|
31744 | }, this.drilled = !1, this.allowDrilldown = !1, this.style = options.style, this.colors = this.style.colorPalette.dataColors,
|
31745 | this.radius = 0, this.isInteractive = options.interactivity && options.interactivity.isInteractiveLegend;
|
31746 | var donutChartSettings = this.settings;
|
31747 | if (this.behavior && (this.interactivityService = visuals.createInteractivityService(options.host)),
|
31748 | this.legend = visuals.createLegend(element, options.interactivity && options.interactivity.isInteractiveLegend, this.interactivityService, this.isScrollable),
|
31749 | this.hostService = options.host, this.isInteractive) {
|
31750 | this.chartRotationAnimationDuration = donutChartSettings && donutChartSettings.chartRotationAnimationDuration ? donutChartSettings.chartRotationAnimationDuration : 0;
|
31751 | var legendContainer = this.legendContainer = d3.select(element.get(0)).append("div").classed(DonutChart.InteractiveLegendClassName, !0);
|
31752 | this.interactivityState = {
|
31753 | interactiveLegend: new DonutChartInteractiveLegend(this, legendContainer, this.colors, options, this.settings),
|
31754 | valueToAngleFactor: 0,
|
31755 | sliceAngles: [],
|
31756 | currentRotate: 0,
|
31757 | interactiveChosenSliceFinishedSetting: !1,
|
31758 | lastChosenInteractiveSliceIndex: 0,
|
31759 | totalDragAngleDifference: 0,
|
31760 | currentIndexDrag: 0,
|
31761 | previousIndexDrag: 0,
|
31762 | previousDragAngle: 0,
|
31763 | donutCenter: {
|
31764 | x: 0,
|
31765 | y: 0
|
31766 | }
|
31767 | };
|
31768 | }
|
31769 | this.svg = d3.select(element.get(0)).append("svg").style("position", "absolute").classed(DonutChart.ClassName, !0),
|
31770 | this.behavior && (this.clearCatcher = visuals.appendClearCatcher(this.svg)), this.mainGraphicsContext = this.svg.append("g"),
|
31771 | this.mainGraphicsContext.append("g").classed("slices", !0), this.labelGraphicsContext = this.svg.append("g").classed(visuals.NewDataLabelUtils.labelGraphicsContextClass["class"], !0),
|
31772 | this.pie = d3.layout.pie().sort(null).value(function(d) {
|
31773 | return d.percentage;
|
31774 | });
|
31775 | }, DonutChart.prototype.update = function(options) {
|
31776 | var viewport = options.viewport;
|
31777 | this.parentViewport = viewport;
|
31778 | var dataViews = this.dataViews = options.dataViews;
|
31779 | if (dataViews && dataViews.length > 0 && dataViews[0].categorical) {
|
31780 | var dataViewMetadata = dataViews[0].metadata, defaultDataPointColor = void 0;
|
31781 | if (dataViewMetadata) {
|
31782 | var objects = dataViewMetadata.objects;
|
31783 | objects && (defaultDataPointColor = powerbi.DataViewObjects.getFillColor(objects, visuals.donutChartProps.dataPoint.defaultColor));
|
31784 | }
|
31785 | this.data = DonutChart.converter(dataViews[0], this.colors, defaultDataPointColor, this.currentViewport, this.disableGeometricCulling, this.interactivityService, this.tooltipsEnabled),
|
31786 | this.data.defaultDataPointColor = defaultDataPointColor, this.options.interactivity && this.options.interactivity.isInteractiveLegend || this.renderLegend();
|
31787 | } else this.data = {
|
31788 | dataPointsToDeprecate: [],
|
31789 | dataPointsToEnumerate: [],
|
31790 | dataPoints: [],
|
31791 | unCulledDataPoints: [],
|
31792 | legendData: {
|
31793 | title: "",
|
31794 | dataPoints: []
|
31795 | },
|
31796 | hasHighlights: !1,
|
31797 | dataLabelsSettings: visuals.dataLabelUtils.getDefaultDonutLabelSettings()
|
31798 | };
|
31799 | if (this.initViewportDependantProperties(), this.initDonutProperties(), this.updateInternal(this.data, options.suppressAnimations),
|
31800 | this.hasSetData = !0, dataViews) {
|
31801 | var warnings = visuals.getInvalidValueWarnings(dataViews, !1, !1, !1);
|
31802 | this.hostService.setWarnings(warnings);
|
31803 | }
|
31804 | }, DonutChart.prototype.onDataChanged = function(options) {
|
31805 | this.update({
|
31806 | dataViews: options.dataViews,
|
31807 | suppressAnimations: options.suppressAnimations,
|
31808 | viewport: this.currentViewport
|
31809 | });
|
31810 | }, DonutChart.prototype.onResizing = function(viewport) {
|
31811 | this.update({
|
31812 | dataViews: this.dataViews,
|
31813 | suppressAnimations: !0,
|
31814 | viewport: viewport
|
31815 | });
|
31816 | }, DonutChart.prototype.enumerateObjectInstances = function(options) {
|
31817 | var enumeration = new visuals.ObjectEnumerationBuilder(), dataLabelsSettings = this.data && this.data.dataLabelsSettings ? this.data.dataLabelsSettings : visuals.dataLabelUtils.getDefaultDonutLabelSettings();
|
31818 | switch (options.objectName) {
|
31819 | case "legend":
|
31820 | this.enumerateLegend(enumeration);
|
31821 | break;
|
31822 |
|
31823 | case "dataPoint":
|
31824 | this.enumerateDataPoints(enumeration);
|
31825 | break;
|
31826 |
|
31827 | case "labels":
|
31828 | var labelSettingOptions = {
|
31829 | enumeration: enumeration,
|
31830 | dataLabelsSettings: dataLabelsSettings,
|
31831 | show: !0,
|
31832 | displayUnits: !0,
|
31833 | precision: !0,
|
31834 | fontSize: !0,
|
31835 | labelStyle: !0
|
31836 | };
|
31837 | visuals.dataLabelUtils.enumerateDataLabels(labelSettingOptions);
|
31838 | }
|
31839 | return enumeration.complete();
|
31840 | }, DonutChart.prototype.enumerateDataPoints = function(enumeration) {
|
31841 | var data = this.data;
|
31842 | if (data) for (var dataPoints = data.dataPointsToEnumerate, dataPointsLength = dataPoints.length, i = 0; dataPointsLength > i; i++) {
|
31843 | var dataPoint = dataPoints[i];
|
31844 | enumeration.pushInstance({
|
31845 | objectName: "dataPoint",
|
31846 | displayName: dataPoint.label,
|
31847 | selector: visuals.ColorHelper.normalizeSelector(dataPoint.identity.getSelector()),
|
31848 | properties: {
|
31849 | fill: {
|
31850 | solid: {
|
31851 | color: dataPoint.color
|
31852 | }
|
31853 | }
|
31854 | }
|
31855 | });
|
31856 | }
|
31857 | }, DonutChart.prototype.enumerateLegend = function(enumeration) {
|
31858 | var data = this.data;
|
31859 | if (data) {
|
31860 | var legendObjectProperties = {
|
31861 | legend: data.legendObjectProperties
|
31862 | }, 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);
|
31863 | enumeration.pushInstance({
|
31864 | selector: null,
|
31865 | objectName: "legend",
|
31866 | properties: {
|
31867 | show: show,
|
31868 | position: visuals.LegendPosition[this.legend.getOrientation()],
|
31869 | showTitle: showTitle,
|
31870 | titleText: titleText,
|
31871 | labelColor: labelColor,
|
31872 | fontSize: labelFontSize
|
31873 | }
|
31874 | });
|
31875 | }
|
31876 | }, DonutChart.prototype.setInteractiveChosenSlice = function(sliceIndex) {
|
31877 | var _this = this;
|
31878 | if (0 !== this.interactivityState.sliceAngles.length) {
|
31879 | this.interactivityState.lastChosenInteractiveSliceIndex = sliceIndex, this.interactivityState.interactiveChosenSliceFinishedSetting = !1;
|
31880 | var viewport = this.currentViewport, moduledIndex = sliceIndex % this.data.dataPoints.length, angle = this.interactivityState.sliceAngles[moduledIndex];
|
31881 | 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() {
|
31882 | _this.interactivityState.interactiveChosenSliceFinishedSetting = !0;
|
31883 | }), this.interactivityState.currentRotate = angle, this.interactivityState.interactiveLegend.updateLegend(moduledIndex),
|
31884 | this.svg.selectAll(".slice").attr("opacity", function(d, index) {
|
31885 | return index === moduledIndex ? 1 : .6;
|
31886 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
31887 | }
|
31888 | }, DonutChart.prototype.calculateRadius = function() {
|
31889 | var viewport = this.currentViewport;
|
31890 | if (!this.isInteractive && this.data && this.data.dataLabelsSettings.show) {
|
31891 | var hw = viewport.height / viewport.width, denom = 2 + 1 / (1 + Math.exp(-5 * (hw - 1)));
|
31892 | return Math.min(viewport.height, viewport.width) / denom;
|
31893 | }
|
31894 | return Math.min(viewport.height, viewport.width) / 2;
|
31895 | }, DonutChart.prototype.getScaleForLegendArrow = function() {
|
31896 | var ratio = 1;
|
31897 | return this.maxHeightToScaleDonutLegend && this.currentViewport.height < this.maxHeightToScaleDonutLegend && (ratio = this.currentViewport.height / this.maxHeightToScaleDonutLegend),
|
31898 | ratio;
|
31899 | }, DonutChart.prototype.initViewportDependantProperties = function(duration) {
|
31900 | void 0 === duration && (duration = 0), this.currentViewport.height = this.parentViewport.height,
|
31901 | this.currentViewport.width = this.parentViewport.width;
|
31902 | var viewport = this.currentViewport;
|
31903 | if (this.isInteractive) viewport.height -= DonutChart.InteractiveLegendContainerHeight; else {
|
31904 | var legendMargins = this.legend.getMargins();
|
31905 | viewport.height -= legendMargins.height, viewport.width -= legendMargins.width;
|
31906 | }
|
31907 | this.svg.attr({
|
31908 | width: viewport.width,
|
31909 | height: viewport.height
|
31910 | }), this.isInteractive ? (this.legendContainer.style({
|
31911 | width: "100%",
|
31912 | height: DonutChart.InteractiveLegendContainerHeight + "px",
|
31913 | overflow: "hidden",
|
31914 | top: 0
|
31915 | }), this.svg.style("top", DonutChart.InteractiveLegendContainerHeight)) : visuals.Legend.positionChartArea(this.svg, this.legend),
|
31916 | this.previousRadius = this.radius;
|
31917 | var radius = this.radius = this.calculateRadius(), halfViewportWidth = viewport.width / 2, halfViewportHeight = viewport.height / 2;
|
31918 | this.arc = d3.svg.arc(), this.outerArc = d3.svg.arc().innerRadius(radius * DonutChart.OuterArcRadiusRatio).outerRadius(radius * DonutChart.OuterArcRadiusRatio),
|
31919 | this.isInteractive ? (this.mainGraphicsContext.attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight)),
|
31920 | this.labelGraphicsContext.attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight))) : (this.mainGraphicsContext.transition().duration(duration).attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight)),
|
31921 | this.labelGraphicsContext.transition().duration(duration).attr("transform", visuals.SVGUtil.translate(halfViewportWidth, halfViewportHeight))),
|
31922 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
31923 | }, DonutChart.prototype.initDonutProperties = function() {
|
31924 | this.donutProperties = {
|
31925 | viewport: this.currentViewport,
|
31926 | radius: this.radius,
|
31927 | arc: this.arc.innerRadius(0).outerRadius(this.radius * DonutChart.InnerArcRadiusRatio),
|
31928 | outerArc: this.outerArc,
|
31929 | innerArcRadiusRatio: DonutChart.InnerArcRadiusRatio,
|
31930 | outerArcRadiusRatio: DonutChart.OuterArcRadiusRatio,
|
31931 | dataLabelsSettings: this.data.dataLabelsSettings
|
31932 | };
|
31933 | }, DonutChart.prototype.mergeDatasets = function(first, second) {
|
31934 | var secondSet = d3.set();
|
31935 | second.forEach(function(d) {
|
31936 | secondSet.add(d.identity ? d.identity.getKey() : d.data.identity.getKey());
|
31937 | });
|
31938 | var onlyFirst = first.filter(function(d) {
|
31939 | return !secondSet.has(d.identity ? d.identity.getKey() : d.data.identity.getKey());
|
31940 | }).map(function(d) {
|
31941 | var derived = powerbi.Prototype.inherit(d);
|
31942 | return void 0 === derived.percentage ? derived.data.percentage = 0 : derived.percentage = 0,
|
31943 | derived;
|
31944 | });
|
31945 | return d3.merge([ second, onlyFirst ]);
|
31946 | }, DonutChart.prototype.updateInternal = function(data, suppressAnimations, duration) {
|
31947 | void 0 === duration && (duration = 0);
|
31948 | var viewport = this.currentViewport;
|
31949 | if (duration = duration || visuals.AnimatorCommon.GetAnimationDuration(this.animator, suppressAnimations),
|
31950 | this.animator) {
|
31951 | var shapes_1, layout = DonutChart.getLayout(this.radius, this.sliceWidthRatio, viewport), result = void 0, highlightShapes = void 0, labelSettings = data.dataLabelsSettings, labels = [];
|
31952 | if (labelSettings && labelSettings.show && (labels = this.createLabels()), !suppressAnimations) {
|
31953 | var animationOptions = {
|
31954 | viewModel: data,
|
31955 | colors: this.colors,
|
31956 | graphicsContext: this.mainGraphicsContext,
|
31957 | labelGraphicsContext: this.labelGraphicsContext,
|
31958 | interactivityService: this.interactivityService,
|
31959 | layout: layout,
|
31960 | radius: this.radius,
|
31961 | sliceWidthRatio: this.sliceWidthRatio,
|
31962 | viewport: viewport,
|
31963 | labels: labels,
|
31964 | innerArcRadiusRatio: DonutChart.InnerArcRadiusRatio
|
31965 | };
|
31966 | result = this.animator.animate(animationOptions), shapes_1 = result.shapes, highlightShapes = result.highlightShapes;
|
31967 | }
|
31968 | (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),
|
31969 | highlightShapes = DonutChart.drawDefaultHighlightShapes(this.svg, data, layout, this.colors, this.radius, this.sliceWidthRatio),
|
31970 | visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, labels, !1, !0, !0),
|
31971 | visuals.NewDataLabelUtils.drawLabelLeaderLines(this.labelGraphicsContext, labels)),
|
31972 | this.assignInteractions(shapes_1, highlightShapes, data), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(shapes_1, function(tooltipEvent) {
|
31973 | return tooltipEvent.data.data.tooltipInfo;
|
31974 | }), visuals.TooltipManager.addTooltip(highlightShapes, function(tooltipEvent) {
|
31975 | return tooltipEvent.data.data.tooltipInfo;
|
31976 | }));
|
31977 | } else this.updateInternalToMove(data, duration);
|
31978 | visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options);
|
31979 | }, DonutChart.prototype.createLabels = function() {
|
31980 | var labelLayout = new powerbi.DonutLabelLayout({
|
31981 | maximumOffset: visuals.NewDataLabelUtils.maxLabelOffset,
|
31982 | startingOffset: visuals.NewDataLabelUtils.startingLabelOffset
|
31983 | }, this.donutProperties), labelDataPoints = this.createLabelDataPoints();
|
31984 | return labelLayout.layout(labelDataPoints);
|
31985 | }, DonutChart.prototype.createLabelDataPoints = function() {
|
31986 | var data = this.data, labelDataPoints = [], measureFormatterCache = visuals.dataLabelUtils.createColumnFormatterCacheManager(), alternativeScale = null;
|
31987 | 0 === data.dataLabelsSettings.displayUnits && (alternativeScale = d3.max(data.dataPoints, function(d) {
|
31988 | return Math.abs(d.data.measure);
|
31989 | }));
|
31990 | for (var i = 0; i < this.data.dataPoints.length; i++) {
|
31991 | var label = this.createLabelDataPoint(data.dataPoints[i], alternativeScale, measureFormatterCache);
|
31992 | labelDataPoints.push(label);
|
31993 | }
|
31994 | return labelDataPoints;
|
31995 | }, DonutChart.prototype.createLabelDataPoint = function(d, alternativeScale, measureFormatterCache) {
|
31996 | 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 = {
|
31997 | point: {
|
31998 | x: labelX,
|
31999 | y: labelY
|
32000 | },
|
32001 | validPositions: [ position ],
|
32002 | radius: 0
|
32003 | }, outsideFill = labelSettings.labelColor ? labelSettings.labelColor : visuals.NewDataLabelUtils.defaultLabelColor, labelSettingsStyle = labelSettings.labelStyle, fontSize = labelSettings.fontSize, tooltip = "";
|
32004 | switch (labelSettingsStyle !== visuals.labelStyle.both && labelSettingsStyle !== visuals.labelStyle.data || (dataLabel = measureFormatter.format(null != d.data.highlightValue ? d.data.highlightValue : d.data.measure),
|
32005 | dataLabelSize = visuals.NewDataLabelUtils.getTextSize(dataLabel, fontSize)), labelSettingsStyle !== visuals.labelStyle.both && labelSettingsStyle !== visuals.labelStyle.category || (categoryLabel = d.data.label,
|
32006 | categoryLabelSize = visuals.NewDataLabelUtils.getTextSize(categoryLabel, fontSize)),
|
32007 | labelSettingsStyle) {
|
32008 | case visuals.labelStyle.both:
|
32009 | var text = categoryLabel + " (" + dataLabel + ")";
|
32010 | tooltip = text, textSize = visuals.NewDataLabelUtils.getTextSize(text, fontSize);
|
32011 | break;
|
32012 |
|
32013 | case visuals.labelStyle.category:
|
32014 | textSize = _.clone(categoryLabelSize), tooltip = categoryLabel;
|
32015 | break;
|
32016 |
|
32017 | case visuals.labelStyle.data:
|
32018 | textSize = _.clone(dataLabelSize), tooltip = dataLabel;
|
32019 | }
|
32020 | var leaderLinePoints = visuals.DonutLabelUtils.getLabelLeaderLineForDonutChart(d, this.donutProperties, pointPosition.point), leaderLinesSize = visuals.DonutLabelUtils.getLabelLeaderLinesSizeForDonutChart(leaderLinePoints);
|
32021 | return {
|
32022 | isPreferred: !0,
|
32023 | text: "",
|
32024 | tooltip: tooltip,
|
32025 | textSize: textSize,
|
32026 | outsideFill: outsideFill,
|
32027 | fontSize: fontSize,
|
32028 | identity: d.data.identity,
|
32029 | parentShape: pointPosition,
|
32030 | insideFill: visuals.NewDataLabelUtils.defaultInsideLabelColor,
|
32031 | parentType: 0,
|
32032 | alternativeScale: alternativeScale,
|
32033 | donutArcDescriptor: d,
|
32034 | angle: (d.startAngle + d.endAngle) / 2 - Math.PI / 2,
|
32035 | dataLabel: dataLabel,
|
32036 | dataLabelSize: dataLabelSize,
|
32037 | categoryLabel: categoryLabel,
|
32038 | categoryLabelSize: categoryLabelSize,
|
32039 | leaderLinePoints: leaderLinePoints,
|
32040 | linesSize: leaderLinesSize
|
32041 | };
|
32042 | }, DonutChart.prototype.renderLegend = function() {
|
32043 | if (!this.isInteractive) {
|
32044 | var legendObjectProperties = this.data.legendObjectProperties;
|
32045 | if (legendObjectProperties) {
|
32046 | var legendData = this.data.legendData;
|
32047 | visuals.LegendData.update(legendData, legendObjectProperties);
|
32048 | var position = legendObjectProperties[visuals.legendProps.position];
|
32049 | position && this.legend.changeOrientation(visuals.LegendPosition[position]), this.legend.drawLegend(legendData, this.parentViewport);
|
32050 | } else this.legend.changeOrientation(visuals.LegendPosition.Top), this.legend.drawLegend({
|
32051 | dataPoints: []
|
32052 | }, this.parentViewport);
|
32053 | }
|
32054 | }, DonutChart.prototype.addInteractiveLegendArrow = function() {
|
32055 | if (this.data && this.data.dataPoints && 0 !== this.data.dataPoints.length) {
|
32056 | var arrowHeightOffset = 11, arrowWidthOffset = 16.5;
|
32057 | if (!this.interactiveLegendArrow) {
|
32058 | var interactiveLegendArrow = this.svg.append("g");
|
32059 | 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"),
|
32060 | this.interactiveLegendArrow = interactiveLegendArrow;
|
32061 | }
|
32062 | var viewport = this.currentViewport, scaleRatio = this.getScaleForLegendArrow(), distanceBetweenLegendAndArrow = (viewport.height - 2 * this.radius) / 2 + arrowHeightOffset * scaleRatio, middleOfChart = viewport.width / 2 - arrowWidthOffset * scaleRatio;
|
32063 | this.interactiveLegendArrow.attr("transform", visuals.SVGUtil.translateAndScale(middleOfChart, distanceBetweenLegendAndArrow, scaleRatio));
|
32064 | }
|
32065 | }, DonutChart.prototype.calculateSliceAngles = function() {
|
32066 | var angles = [], data = this.data.dataPoints;
|
32067 | if (0 === data.length) return this.interactivityState.valueToAngleFactor = 0, void (this.interactivityState.sliceAngles = []);
|
32068 | for (var sum = 0, i = 0, ilen = data.length; ilen > i; i++) sum += data[i].data.percentage;
|
32069 | this.interactivityState.valueToAngleFactor = 360 / sum;
|
32070 | for (var currentAngle = 0, i = 0, ilen = data.length; ilen > i; i++) {
|
32071 | var relativeAngle = data[i].data.percentage * this.interactivityState.valueToAngleFactor;
|
32072 | currentAngle += relativeAngle, angles.push(relativeAngle / 2 - currentAngle);
|
32073 | }
|
32074 | this.interactivityState.sliceAngles = angles;
|
32075 | }, DonutChart.prototype.assignInteractions = function(slices, highlightSlices, data) {
|
32076 | if (this.isInteractive) this.assignInteractiveChartInteractions(slices); else if (this.interactivityService) {
|
32077 | var dataPoints = data.dataPoints.map(function(value) {
|
32078 | return value.data;
|
32079 | }), behaviorOptions = {
|
32080 | clearCatcher: this.clearCatcher,
|
32081 | slices: slices,
|
32082 | highlightSlices: highlightSlices,
|
32083 | allowDrilldown: this.allowDrilldown,
|
32084 | visual: this,
|
32085 | hasHighlights: data.hasHighlights,
|
32086 | svg: this.svg
|
32087 | };
|
32088 | this.interactivityService.bind(dataPoints, this.behavior, behaviorOptions);
|
32089 | }
|
32090 | }, DonutChart.prototype.setDrilldown = function(selection) {
|
32091 | if (selection) {
|
32092 | var d3PieLayout = d3.layout.pie().sort(null).value(function(d) {
|
32093 | return d.percentage;
|
32094 | }), legendDataPoints = [ {
|
32095 | label: selection.label,
|
32096 | color: selection.color,
|
32097 | icon: visuals.LegendIcon.Box,
|
32098 | identity: selection.identity,
|
32099 | selected: selection.selected
|
32100 | } ], legendData = {
|
32101 | title: "",
|
32102 | dataPoints: legendDataPoints
|
32103 | }, drilledDataPoints = d3PieLayout(selection.internalDataPoints);
|
32104 | this.updateInternal({
|
32105 | dataPointsToDeprecate: selection.internalDataPoints,
|
32106 | dataPoints: drilledDataPoints,
|
32107 | unCulledDataPoints: drilledDataPoints.map(function(value) {
|
32108 | return value.data;
|
32109 | }),
|
32110 | legendData: legendData,
|
32111 | hasHighlights: !1,
|
32112 | dataLabelsSettings: this.data.dataLabelsSettings
|
32113 | }, !1, DonutChart.DrillDownAnimationDuration);
|
32114 | } else this.updateInternal(this.data, !1, DonutChart.DrillDownAnimationDuration);
|
32115 | }, DonutChart.prototype.assignInteractiveChartInteractions = function(slice) {
|
32116 | var _this = this, svg = this.svg;
|
32117 | this.interactivityState.interactiveChosenSliceFinishedSetting = !0;
|
32118 | var svgRect = svg.node().getBoundingClientRect();
|
32119 | this.interactivityState.donutCenter = {
|
32120 | x: svgRect.left + svgRect.width / 2,
|
32121 | y: svgRect.top + svgRect.height / 2
|
32122 | }, this.interactivityState.totalDragAngleDifference = 0, this.interactivityState.currentRotate = 0,
|
32123 | this.calculateSliceAngles(), slice.on("click", function(d, clickedIndex) {
|
32124 | d3.event.defaultPrevented || _this.setInteractiveChosenSlice(clickedIndex);
|
32125 | });
|
32126 | var drag = d3.behavior.drag().origin(Object).on("dragstart", function() {
|
32127 | return _this.interactiveDragStart();
|
32128 | }).on("drag", function() {
|
32129 | return _this.interactiveDragMove();
|
32130 | }).on("dragend", function() {
|
32131 | return _this.interactiveDragEnd();
|
32132 | });
|
32133 | svg.style("touch-action", "none").call(drag);
|
32134 | }, DonutChart.prototype.getAngleFromDragEvent = function() {
|
32135 | var pageX, pageY, interactivityState = this.interactivityState, sourceEvent = d3.event.sourceEvent;
|
32136 | if (-1 !== sourceEvent.type.toLowerCase().indexOf("touch")) {
|
32137 | if (1 !== sourceEvent.touches.length) return null;
|
32138 | var touch = sourceEvent.touches[0];
|
32139 | pageX = touch.pageX, pageY = touch.pageY;
|
32140 | } else pageX = sourceEvent.pageX, pageY = sourceEvent.pageY;
|
32141 | var adjustedCoordinates = {
|
32142 | x: pageX - interactivityState.donutCenter.x,
|
32143 | y: -pageY + interactivityState.donutCenter.y
|
32144 | }, angleToThePlane = 180 * Math.atan2(adjustedCoordinates.y, adjustedCoordinates.x) / Math.PI;
|
32145 | return angleToThePlane;
|
32146 | }, DonutChart.prototype.interactiveDragStart = function() {
|
32147 | this.interactivityState.totalDragAngleDifference = 0, this.interactivityState.previousDragAngle = this.getAngleFromDragEvent();
|
32148 | }, DonutChart.prototype.interactiveDragMove = function() {
|
32149 | var data = this.data.dataPoints, viewport = this.currentViewport, interactivityState = this.interactivityState;
|
32150 | if (interactivityState.interactiveChosenSliceFinishedSetting === !0) {
|
32151 | var currentDragAngle = this.getAngleFromDragEvent();
|
32152 | if (!currentDragAngle) return;
|
32153 | var angleDragDiff = interactivityState.previousDragAngle - currentDragAngle;
|
32154 | interactivityState.totalDragAngleDifference += angleDragDiff, interactivityState.previousDragAngle = currentDragAngle,
|
32155 | interactivityState.currentRotate += angleDragDiff, this.svg.select("g").attr("transform", visuals.SVGUtil.translateAndRotate(viewport.width / 2, viewport.height / 2, 0, 0, this.interactivityState.currentRotate));
|
32156 | var currentHigherLimit = data[0].data.percentage * interactivityState.valueToAngleFactor, currentAngle = interactivityState.currentRotate <= 0 ? -1 * interactivityState.currentRotate % 360 : 360 - interactivityState.currentRotate % 360;
|
32157 | interactivityState.currentIndexDrag = 0;
|
32158 | for (var dataLength = data.length; interactivityState.currentIndexDrag < dataLength && currentAngle > currentHigherLimit; ) interactivityState.currentIndexDrag < dataLength - 1 && (currentHigherLimit += data[interactivityState.currentIndexDrag + 1].data.percentage * interactivityState.valueToAngleFactor),
|
32159 | interactivityState.currentIndexDrag++;
|
32160 | interactivityState.currentIndexDrag !== interactivityState.previousIndexDrag && (interactivityState.interactiveLegend.updateLegend(interactivityState.currentIndexDrag),
|
32161 | this.svg.selectAll(".slice").attr("opacity", function(d, index) {
|
32162 | return index === interactivityState.currentIndexDrag ? DonutChart.OpaqueOpacity : DonutChart.SemiTransparentOpacity;
|
32163 | }), interactivityState.previousIndexDrag = interactivityState.currentIndexDrag);
|
32164 | }
|
32165 | }, DonutChart.prototype.interactiveDragEnd = function() {
|
32166 | 0 !== this.interactivityState.totalDragAngleDifference && (this.setInteractiveChosenSlice(this.interactivityState.currentIndexDrag),
|
32167 | d3.event.sourceEvent.stopPropagation());
|
32168 | }, DonutChart.prototype.updateInternalToMove = function(data, duration) {
|
32169 | void 0 === duration && (duration = 0);
|
32170 | 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) {
|
32171 | return d.data;
|
32172 | });
|
32173 | 0 === existingData.length && (existingData = data.dataPointsToDeprecate);
|
32174 | var is = this.mergeDatasets(existingData, data.dataPointsToDeprecate), slice = svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(pie(data.dataPointsToDeprecate), key);
|
32175 | slice.enter().insert("path").classed(DonutChart.sliceClass["class"], !0).each(function(d) {
|
32176 | this._current = d;
|
32177 | }), slice = svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(pie(is), key);
|
32178 | var innerRadius = radius * sliceWidthRatio;
|
32179 | if (DonutChart.isSingleColor(data.dataPoints), slice.style("fill", function(d) {
|
32180 | return d.data.color;
|
32181 | }).style("fill-opacity", function(d) {
|
32182 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, !1, data.hasHighlights);
|
32183 | }).style("stroke", "white").style("stroke-dasharray", function(d) {
|
32184 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio);
|
32185 | }).style("stroke-width", function(d) {
|
32186 | return d.data.strokeWidth;
|
32187 | }).transition().duration(duration).attrTween("d", function(d) {
|
32188 | var i = d3.interpolate(this._current, d), k = d3.interpolate(previousRadius * DonutChart.InnerArcRadiusRatio, radius * DonutChart.InnerArcRadiusRatio);
|
32189 | return this._current = i(0), function(t) {
|
32190 | return arc.innerRadius(innerRadius).outerRadius(k(t))(i(t));
|
32191 | };
|
32192 | }), slice = svg.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(pie(data.dataPointsToDeprecate), key),
|
32193 | slice.exit().transition().delay(duration).duration(0).remove(), !this.isInteractive) {
|
32194 | var labelSettings = data.dataLabelsSettings, labels = [];
|
32195 | labelSettings && labelSettings.show && (labels = this.createLabels()), visuals.NewDataLabelUtils.drawDefaultLabels(this.labelGraphicsContext, labels, !1, !0),
|
32196 | visuals.NewDataLabelUtils.drawLabelLeaderLines(this.labelGraphicsContext, labels);
|
32197 | }
|
32198 | var highlightSlices = void 0;
|
32199 | data.hasHighlights ? (highlightSlices = svg.select(".slices").selectAll("path" + DonutChart.sliceHighlightClass.selector).data(pie(data.dataPointsToDeprecate), key),
|
32200 | highlightSlices.enter().insert("path").classed(DonutChart.sliceHighlightClass["class"], !0).each(function(d) {
|
32201 | this._current = d;
|
32202 | }), DonutChart.isSingleColor(data.dataPoints), highlightSlices.style("fill", function(d) {
|
32203 | return d.data.color;
|
32204 | }).style("fill-opacity", 1).style("stroke", "white").style("stroke-dasharray", function(d) {
|
32205 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio, d.data.highlightRatio);
|
32206 | }).style("stroke-width", function(d) {
|
32207 | return 0 === d.data.highlightRatio ? 0 : d.data.strokeWidth;
|
32208 | }).transition().duration(duration).attrTween("d", function(d) {
|
32209 | var i = d3.interpolate(this._current, d), k = d3.interpolate(previousRadius * DonutChart.InnerArcRadiusRatio, DonutChart.getHighlightRadius(radius, sliceWidthRatio, d.data.highlightRatio));
|
32210 | return this._current = i(0), function(t) {
|
32211 | return arc.innerRadius(innerRadius).outerRadius(k(t))(i(t));
|
32212 | };
|
32213 | }), highlightSlices.exit().transition().delay(duration).duration(0).remove()) : svg.selectAll("path" + DonutChart.sliceHighlightClass.selector).transition().delay(duration).duration(0).remove(),
|
32214 | this.assignInteractions(slice, highlightSlices, data), this.tooltipsEnabled && (visuals.TooltipManager.addTooltip(slice, function(tooltipEvent) {
|
32215 | return tooltipEvent.data.data.tooltipInfo;
|
32216 | }), data.hasHighlights && visuals.TooltipManager.addTooltip(highlightSlices, function(tooltipEvent) {
|
32217 | return tooltipEvent.data.data.tooltipInfo;
|
32218 | })), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.options), this.isInteractive && (this.addInteractiveLegendArrow(),
|
32219 | this.interactivityState.interactiveLegend.drawLegend(this.data.dataPointsToDeprecate),
|
32220 | this.setInteractiveChosenSlice(this.interactivityState.lastChosenInteractiveSliceIndex ? this.interactivityState.lastChosenInteractiveSliceIndex : 0));
|
32221 | }, DonutChart.drawDefaultShapes = function(graphicsContext, donutData, layout, colors, radius, hasSelection, sliceWidthRatio, defaultColor) {
|
32222 | var shapes = graphicsContext.select(".slices").selectAll("path" + DonutChart.sliceClass.selector).data(donutData.dataPoints, function(d) {
|
32223 | return d.data.identity.getKey();
|
32224 | });
|
32225 | return shapes.enter().insert("path").classed(DonutChart.sliceClass["class"], !0),
|
32226 | DonutChart.isSingleColor(donutData.dataPoints), shapes.style("fill", function(d) {
|
32227 | return d.data.color;
|
32228 | }).style("fill-opacity", function(d) {
|
32229 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !1, hasSelection, donutData.hasHighlights);
|
32230 | }).style("stroke-dasharray", function(d) {
|
32231 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio);
|
32232 | }).style("stroke-width", function(d) {
|
32233 | return d.data.strokeWidth;
|
32234 | }).attr(layout.shapeLayout), shapes.exit().remove(), shapes;
|
32235 | }, DonutChart.drawDefaultHighlightShapes = function(graphicsContext, donutData, layout, colors, radius, sliceWidthRatio) {
|
32236 | var shapes = graphicsContext.select(".slices").selectAll("path" + DonutChart.sliceHighlightClass.selector).data(donutData.dataPoints.filter(function(value) {
|
32237 | return null != value.data.highlightRatio;
|
32238 | }), function(d) {
|
32239 | return d.data.identity.getKey();
|
32240 | });
|
32241 | return shapes.enter().insert("path").classed(DonutChart.sliceHighlightClass["class"], !0).each(function(d) {
|
32242 | this._current = d;
|
32243 | }), DonutChart.isSingleColor(donutData.dataPoints), shapes.style("fill", function(d) {
|
32244 | return d.data.color;
|
32245 | }).style("fill-opacity", function(d) {
|
32246 | return visuals.ColumnUtil.getFillOpacity(d.data.selected, !0, !1, donutData.hasHighlights);
|
32247 | }).style("stroke", "white").style("stroke-dasharray", function(d) {
|
32248 | return DonutChart.drawStrokeForDonutChart(radius, DonutChart.InnerArcRadiusRatio, d, sliceWidthRatio, d.data.highlightRatio);
|
32249 | }).style("stroke-width", function(d) {
|
32250 | return 0 === d.data.highlightRatio ? 0 : d.data.strokeWidth;
|
32251 | }).attr(layout.highlightShapeLayout), shapes.exit().remove(), shapes;
|
32252 | }, DonutChart.isSingleColor = function(dataPoints) {
|
32253 | if (dataPoints.length > 1) {
|
32254 | var lastPoint = dataPoints.length - 1;
|
32255 | dataPoints[lastPoint].data.isLastInDonut = dataPoints[lastPoint].data.color === dataPoints[0].data.color;
|
32256 | }
|
32257 | }, DonutChart.drawStrokeForDonutChart = function(radius, innerArcRadiusRatio, d, sliceWidthRatio, highlightRatio) {
|
32258 | void 0 === highlightRatio && (highlightRatio = 1);
|
32259 | var sectionWithoutStroke, sectionWithStroke, sliceRadius = radius * innerArcRadiusRatio * highlightRatio, sliceArc = (d.endAngle - d.startAngle) * sliceRadius;
|
32260 | if (sliceWidthRatio) {
|
32261 | var innerRadius = radius * sliceWidthRatio, outerRadius = highlightRatio * radius * (DonutChart.InnerArcRadiusRatio - sliceWidthRatio), innerSliceArc = (d.endAngle - d.startAngle) * innerRadius;
|
32262 | if (d.data.highlightRatio && (sliceArc = (d.endAngle - d.startAngle) * (outerRadius + innerRadius)),
|
32263 | d.data.isLastInDonut) return "0 " + sliceArc + " " + outerRadius + " " + innerSliceArc + " " + outerRadius;
|
32264 | sectionWithoutStroke = sliceArc + outerRadius + innerSliceArc, sectionWithStroke = outerRadius;
|
32265 | } else d.data.isLastInDonut ? (sectionWithoutStroke = sliceArc, sectionWithStroke = 2 * sliceRadius) : (sectionWithoutStroke = sliceArc + sliceRadius,
|
32266 | sectionWithStroke = sliceRadius);
|
32267 | return "0 " + sectionWithoutStroke + " " + sectionWithStroke;
|
32268 | }, DonutChart.prototype.onClearSelection = function() {
|
32269 | this.interactivityService && this.interactivityService.clearSelection();
|
32270 | }, DonutChart.getLayout = function(radius, sliceWidthRatio, viewport) {
|
32271 | var innerRadius = radius * sliceWidthRatio, arc = d3.svg.arc().innerRadius(innerRadius), arcWithRadius = arc.outerRadius(radius * DonutChart.InnerArcRadiusRatio);
|
32272 | return {
|
32273 | shapeLayout: {
|
32274 | d: function(d) {
|
32275 | return arcWithRadius(d);
|
32276 | }
|
32277 | },
|
32278 | highlightShapeLayout: {
|
32279 | d: function(d) {
|
32280 | var highlightArc = arc.outerRadius(DonutChart.getHighlightRadius(radius, sliceWidthRatio, d.data.highlightRatio));
|
32281 | return highlightArc(d);
|
32282 | }
|
32283 | },
|
32284 | zeroShapeLayout: {
|
32285 | d: function(d) {
|
32286 | var zeroWithZeroRadius = arc.outerRadius(innerRadius || DonutChart.EffectiveZeroValue);
|
32287 | return zeroWithZeroRadius(d);
|
32288 | }
|
32289 | }
|
32290 | };
|
32291 | }, DonutChart.getHighlightRadius = function(radius, sliceWidthRatio, highlightRatio) {
|
32292 | var innerRadius = radius * sliceWidthRatio;
|
32293 | return innerRadius + highlightRatio * radius * (DonutChart.InnerArcRadiusRatio - sliceWidthRatio);
|
32294 | }, DonutChart.cullDataByViewport = function(dataPoints, maxValue, viewport) {
|
32295 | for (var prevPointColor, estimatedRadius = Math.min(viewport.width, viewport.height) / 2, cullRatio = this.invisibleArcLengthInPixels / (estimatedRadius * DonutChart.twoPi), cullableValue = cullRatio * maxValue, culledDataPoints = [], _i = 0, dataPoints_6 = dataPoints; _i < dataPoints_6.length; _i++) {
|
32296 | var datapoint = dataPoints_6[_i];
|
32297 | datapoint.measure >= cullableValue && (datapoint.strokeWidth = prevPointColor === datapoint.color ? 1 : 0,
|
32298 | prevPointColor = datapoint.color, culledDataPoints.push(datapoint));
|
32299 | }
|
32300 | return culledDataPoints;
|
32301 | }, DonutChart.ClassName = "donutChart", DonutChart.InteractiveLegendClassName = "donutLegend",
|
32302 | DonutChart.InteractiveLegendArrowClassName = "donutLegendArrow", DonutChart.DrillDownAnimationDuration = 1e3,
|
32303 | DonutChart.OuterArcRadiusRatio = .9, DonutChart.InnerArcRadiusRatio = .8, DonutChart.OpaqueOpacity = 1,
|
32304 | DonutChart.SemiTransparentOpacity = .6, DonutChart.defaultSliceWidthRatio = .48,
|
32305 | DonutChart.invisibleArcLengthInPixels = 3, DonutChart.sliceClass = createClassAndSelector("slice"),
|
32306 | DonutChart.sliceHighlightClass = createClassAndSelector("slice-highlight"), DonutChart.twoPi = 2 * Math.PI,
|
32307 | DonutChart.InteractiveLegendContainerHeight = 70, DonutChart.EffectiveZeroValue = 1e-9,
|
32308 | DonutChart.PolylineOpacity = .5, DonutChart;
|
32309 | }();
|
32310 | visuals.DonutChart = DonutChart;
|
32311 | var DonutChartConversion, DonutChartInteractiveLegend = function() {
|
32312 | function DonutChartInteractiveLegend(donutChart, legendContainer, colors, visualInitOptions, settings) {
|
32313 | this.legendContainerParent = legendContainer, this.colors = colors, this.donutChart = donutChart,
|
32314 | this.visualInitOptions = visualInitOptions, this.legendItemsPositions = [], this.legendTransitionAnimationDuration = settings && settings.legendTransitionAnimationDuration ? settings.legendTransitionAnimationDuration : 0;
|
32315 | }
|
32316 | return DonutChartInteractiveLegend.prototype.drawLegend = function(data) {
|
32317 | var _this = this;
|
32318 | this.data = data, this.currentNumberOfLegendItems = data.length, this.currentIndex = 0,
|
32319 | this.leftMostIndex = 0, this.rightMostIndex = data.length - 1, this.legendContainerParent.select(DonutChartInteractiveLegend.LegendContainerSelector).empty() && (this.legendContainer = this.legendContainerParent.append("div").classed(DonutChartInteractiveLegend.LegendContainerClassName, !0));
|
32320 | 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;
|
32321 | this.currentXOffset = initialXOffset;
|
32322 | var createLegendItem = function(itemDiv, datum) {
|
32323 | itemDiv.attr("data-legend-index", datum.index).css({
|
32324 | position: "absolute",
|
32325 | left: currX
|
32326 | });
|
32327 | var itemCategory = visuals.valueFormatter.format(datum.label), itemValue = visuals.valueFormatter.format(datum.measure, 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);
|
32328 | itemDiv.css("width", currentLegendBoxWidth);
|
32329 | var getLeftValue = function(spanWidth) {
|
32330 | return currentLegendBoxWidth - spanWidth > 0 ? (currentLegendBoxWidth - spanWidth) / 2 : 0;
|
32331 | }, marginLeftValue = getLeftValue(valueSpanWidth), marginLeftCategory = getLeftValue(categorySpanWidth), marginLeftPrecentage = getLeftValue(precentageSpanWidth);
|
32332 | DonutChartInteractiveLegend.createLegendItemSpan(itemCategorySpan, marginLeftCategory),
|
32333 | DonutChartInteractiveLegend.createLegendItemSpan(itemValueSpan, marginLeftValue),
|
32334 | DonutChartInteractiveLegend.createLegendItemSpan(itemPercentageSpan, marginLeftPrecentage).css("color", itemColor),
|
32335 | itemDiv.append(itemCategorySpan), itemDiv.append(itemPercentageSpan), itemDiv.append(itemValueSpan),
|
32336 | _this.legendItemsPositions.push({
|
32337 | startX: currX,
|
32338 | boxWidth: currentLegendBoxWidth
|
32339 | }), currX += currentLegendBoxWidth + DonutChartInteractiveLegend.ItemMargin;
|
32340 | };
|
32341 | legendItems.enter().insert("div").classed(DonutChartInteractiveLegend.LegendItemClassName, !0).each(function(d) {
|
32342 | createLegendItem($(this), d);
|
32343 | }), legendItems.exit().remove(), this.assignInteractions();
|
32344 | }, DonutChartInteractiveLegend.prototype.updateLegend = function(sliceIndex) {
|
32345 | var _this = this, legendContainerWidth = this.legendContainerWidth;
|
32346 | this.currentIndex = sliceIndex, this.updateLabelBlocks(sliceIndex);
|
32347 | var legendTransitionAnimationDuration = this.legendTransitionAnimationDuration, nextXOffset = -1 * (this.legendItemsPositions[sliceIndex].startX + this.legendItemsPositions[sliceIndex].boxWidth / 2 - legendContainerWidth / 2);
|
32348 | this.legendContainer.transition().styleTween("-webkit-transform", function(d, i, a) {
|
32349 | return d3.interpolate(visuals.SVGUtil.translateWithPixels(_this.currentXOffset, 0), visuals.SVGUtil.translateWithPixels(nextXOffset, 0));
|
32350 | }).styleTween("transform", function(d, i, a) {
|
32351 | return d3.interpolate(visuals.SVGUtil.translateWithPixels(_this.currentXOffset, 0), visuals.SVGUtil.translateWithPixels(nextXOffset, 0));
|
32352 | }).duration(legendTransitionAnimationDuration).ease("bounce").each("end", function() {
|
32353 | _this.currentXOffset = nextXOffset;
|
32354 | }), visuals.SVGUtil.flushAllD3TransitionsIfNeeded(this.visualInitOptions);
|
32355 | }, DonutChartInteractiveLegend.prototype.assignInteractions = function() {
|
32356 | var _this = this, currentDX = 0, hasChanged = !1, dragStart = function() {
|
32357 | currentDX = 0, hasChanged = !1;
|
32358 | }, dragMove = function() {
|
32359 | if (currentDX += d3.event.dx, !(hasChanged || Math.abs(currentDX) < DonutChartInteractiveLegend.MinimumSwipeDX)) {
|
32360 | var dragDirectionLeft = 0 > currentDX;
|
32361 | _this.dragLegend(dragDirectionLeft), hasChanged = !0;
|
32362 | }
|
32363 | }, drag = d3.behavior.drag().origin(Object).on("drag", dragMove).on("dragstart", dragStart);
|
32364 | this.legendContainer.style({
|
32365 | "touch-action": "none",
|
32366 | cursor: "pointer"
|
32367 | }).call(drag);
|
32368 | }, DonutChartInteractiveLegend.prototype.dragLegend = function(dragDirectionLeft) {
|
32369 | this.currentNumberOfLegendItems > DonutChartInteractiveLegend.MinimumItemsInLegendForCycled - 1 ? this.currentIndex = this.getCyclingCurrentIndex(dragDirectionLeft) : this.shouldChangeIndexInNonCycling(dragDirectionLeft) && (dragDirectionLeft ? this.currentIndex++ : this.currentIndex--),
|
32370 | this.donutChart.setInteractiveChosenSlice(this.currentIndex);
|
32371 | }, DonutChartInteractiveLegend.prototype.shouldChangeIndexInNonCycling = function(dragDirectionLeft) {
|
32372 | return !(0 === this.currentIndex && !dragDirectionLeft || this.currentIndex === this.currentNumberOfLegendItems - 1 && dragDirectionLeft);
|
32373 | }, DonutChartInteractiveLegend.prototype.getCyclingCurrentIndex = function(dragDirectionLeft) {
|
32374 | var dataLen = this.data.length, delta = dragDirectionLeft ? 1 : -1, newIndex = (this.currentIndex + delta) % (dataLen || 1);
|
32375 | return 0 > newIndex ? newIndex + dataLen : newIndex;
|
32376 | }, DonutChartInteractiveLegend.prototype.updateLegendItemsBlocks = function(rightSidedShift, numberOfLegendItemsBlocksToShift) {
|
32377 | var legendContainer$ = $(this.legendContainer[0]);
|
32378 | if (rightSidedShift) {
|
32379 | var smallestItem = legendContainer$.find("[data-legend-index=" + this.leftMostIndex + "]");
|
32380 | smallestItem.remove().insertAfter(legendContainer$.find("[data-legend-index=" + this.rightMostIndex + "]"));
|
32381 | var newX = this.legendItemsPositions[this.rightMostIndex].startX + this.legendItemsPositions[this.rightMostIndex].boxWidth + DonutChartInteractiveLegend.ItemMargin;
|
32382 | this.legendItemsPositions[this.leftMostIndex].startX = newX, smallestItem.css("left", newX),
|
32383 | this.rightMostIndex = this.leftMostIndex, this.leftMostIndex = (this.leftMostIndex + 1) % this.data.length;
|
32384 | } else {
|
32385 | var highestItem = legendContainer$.find("[data-legend-index=" + this.rightMostIndex + "]");
|
32386 | highestItem.remove().insertBefore(legendContainer$.find("[data-legend-index=" + this.leftMostIndex + "]"));
|
32387 | var newX = this.legendItemsPositions[this.leftMostIndex].startX - this.legendItemsPositions[this.rightMostIndex].boxWidth - DonutChartInteractiveLegend.ItemMargin;
|
32388 | this.legendItemsPositions[this.rightMostIndex].startX = newX, highestItem.css("left", newX),
|
32389 | this.leftMostIndex = this.rightMostIndex, this.rightMostIndex = this.rightMostIndex - 1 === -1 ? this.legendItemsPositions.length - 1 : this.rightMostIndex - 1;
|
32390 | }
|
32391 | numberOfLegendItemsBlocksToShift - 1 !== 0 && this.updateLegendItemsBlocks(rightSidedShift, numberOfLegendItemsBlocksToShift - 1);
|
32392 | }, DonutChartInteractiveLegend.prototype.updateLabelBlocks = function(index) {
|
32393 | this.currentNumberOfLegendItems > DonutChartInteractiveLegend.MinimumItemsInLegendForCycled ? (this.rightMostIndex === index && this.updateLegendItemsBlocks(!0, 2),
|
32394 | this.leftMostIndex === index && this.updateLegendItemsBlocks(!1, 2), (this.rightMostIndex === index + 1 || 0 === this.rightMostIndex && index === this.currentNumberOfLegendItems - 1) && this.updateLegendItemsBlocks(!0, 1),
|
32395 | (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),
|
32396 | this.leftMostIndex === index && this.updateLegendItemsBlocks(!1, 1));
|
32397 | }, DonutChartInteractiveLegend.createBasicLegendItemSpan = function(spanClass, text, fontSize) {
|
32398 | return $("<span/>").addClass(spanClass).css({
|
32399 | "white-space": "nowrap",
|
32400 | "font-size": fontSize + "px"
|
32401 | }).text(text);
|
32402 | }, DonutChartInteractiveLegend.createLegendItemSpan = function(existingSpan, marginLeft) {
|
32403 | return existingSpan.css({
|
32404 | overflow: "hidden",
|
32405 | "text-overflow": "ellipsis",
|
32406 | display: "inline-block",
|
32407 | width: "100%",
|
32408 | "margin-left": marginLeft
|
32409 | }), existingSpan;
|
32410 | }, DonutChartInteractiveLegend.legendBoxSize = function(valueSpanWidth, categorySpanWidth, precentageSpanWidth) {
|
32411 | var boxSize = valueSpanWidth > categorySpanWidth ? valueSpanWidth : categorySpanWidth;
|
32412 | return boxSize = boxSize > precentageSpanWidth ? boxSize : precentageSpanWidth,
|
32413 | boxSize = boxSize > DonutChartInteractiveLegend.MaxLegendItemBoxSize ? DonutChartInteractiveLegend.MaxLegendItemBoxSize : boxSize + 2;
|
32414 | }, DonutChartInteractiveLegend.spanWidth = function(span) {
|
32415 | return this.FakeElementSpan || (this.FakeElementSpan = $("<span>").hide().appendTo(document.body)),
|
32416 | this.FakeElementSpan.empty(), this.FakeElementSpan.append(span), this.FakeElementSpan.width();
|
32417 | }, DonutChartInteractiveLegend.LegendContainerClassName = "legend-container", DonutChartInteractiveLegend.LegendContainerSelector = ".legend-container",
|
32418 | DonutChartInteractiveLegend.LegendItemClassName = "legend-item", DonutChartInteractiveLegend.LegendItemSelector = ".legend-item",
|
32419 | DonutChartInteractiveLegend.LegendItemCategoryClassName = "category", DonutChartInteractiveLegend.LegendItemPercentageClassName = "percentage",
|
32420 | DonutChartInteractiveLegend.LegendItemValueClassName = "value", DonutChartInteractiveLegend.MaxLegendItemBoxSize = 160,
|
32421 | DonutChartInteractiveLegend.ItemMargin = 30, DonutChartInteractiveLegend.MinimumSwipeDX = 15,
|
32422 | DonutChartInteractiveLegend.MinimumItemsInLegendForCycled = 3, DonutChartInteractiveLegend;
|
32423 | }();
|
32424 | !function(DonutChartConversion) {
|
32425 | var DonutChartConverter = function() {
|
32426 | function DonutChartConverter(dataView, colors, defaultDataPointColor, tooltipsEnabled) {
|
32427 | void 0 === tooltipsEnabled && (tooltipsEnabled = !0);
|
32428 | var reader = this.reader = powerbi.data.createIDataViewCategoricalReader(dataView), dataViewCategorical = dataView.categorical;
|
32429 | if (this.dataViewCategorical = dataViewCategorical, this.dataViewMetadata = dataView.metadata,
|
32430 | this.tooltipsEnabled = tooltipsEnabled, this.colorHelper = new visuals.ColorHelper(colors, visuals.donutChartProps.dataPoint.fill, defaultDataPointColor),
|
32431 | this.maxValue = 0, dataViewCategorical.categories && dataViewCategorical.categories.length > 0) {
|
32432 | var category = dataViewCategorical.categories[0];
|
32433 | this.categoryIdentities = category.identity, this.categoryValues = category.values,
|
32434 | this.allCategoryObjects = category.objects, this.categoryColumnRef = category.identityFields,
|
32435 | this.categoryFormatString = visuals.valueFormatter.getFormatString(category.source, visuals.donutChartProps.general.formatString);
|
32436 | }
|
32437 | var grouped = this.grouped = dataViewCategorical && dataViewCategorical.values ? dataViewCategorical.values.grouped() : void 0;
|
32438 | if (this.isMultiMeasure = grouped && grouped.length > 0 && grouped[0].values && grouped[0].values.length > 1,
|
32439 | this.isSingleMeasure = grouped && 1 === grouped.length && grouped[0].values && 1 === grouped[0].values.length,
|
32440 | this.isDynamicSeries = !(!dataViewCategorical.values || !dataViewCategorical.values.source),
|
32441 | this.highlightsOverflow = !1, this.total = 0, this.highlightTotal = 0, this.dataPoints = [],
|
32442 | this.legendDataPoints = [], this.dataLabelsSettings = null, reader.hasValues("Y")) {
|
32443 | var seriesCount = this.seriesCount = reader.getSeriesCount("Y");
|
32444 | this.hasHighlights = this.seriesCount > 0 && !_.isEmpty(dataViewCategorical.values) && !!dataViewCategorical.values[0].highlights;
|
32445 | for (var categoryIndex = 0, categoryCount = reader.getCategoryCount() || 1; categoryCount > categoryIndex; categoryIndex++) for (var seriesIndex = 0; seriesCount > seriesIndex; seriesIndex++) this.total += Math.abs(reader.getValue("Y", categoryIndex, seriesIndex)),
|
32446 | this.highlightTotal += this.hasHighlights ? Math.abs(reader.getHighlight("Y", categoryIndex, seriesIndex)) : 0;
|
32447 | }
|
32448 | this.total = visuals.AxisHelper.normalizeNonFiniteNumber(this.total), this.highlightTotal = visuals.AxisHelper.normalizeNonFiniteNumber(this.highlightTotal);
|
32449 | }
|
32450 | return DonutChartConverter.normalizedMeasureAndValue = function(measureAndValue) {
|
32451 | var normalized = $.extend(!0, {}, measureAndValue);
|
32452 | return normalized.measure = visuals.AxisHelper.normalizeNonFiniteNumber(normalized.measure),
|
32453 | normalized.value = visuals.AxisHelper.normalizeNonFiniteNumber(normalized.value),
|
32454 | normalized;
|
32455 | }, DonutChartConverter.prototype.convert = function() {
|
32456 | var convertedData, reader = this.reader;
|
32457 | convertedData = 0 !== this.total ? this.categoryValues ? this.convertCategoricalWithSlicing() : this.isDynamicSeries ? this.convertSeries() : this.convertMeasures() : [];
|
32458 | for (var highlightsOverflow = !1, i = 0, dataPointCount = convertedData.length; dataPointCount > i && !highlightsOverflow; i++) {
|
32459 | var point = convertedData[i];
|
32460 | Math.abs(point.highlightMeasureValue.measure) > Math.abs(point.measureValue.measure) && (highlightsOverflow = !0);
|
32461 | }
|
32462 | this.dataLabelsSettings = this.convertDataLabelSettings();
|
32463 | var dataViewMetadata = this.dataViewMetadata;
|
32464 | if (dataViewMetadata) {
|
32465 | var objects = dataViewMetadata.objects;
|
32466 | objects && (this.legendObjectProperties = objects.legend);
|
32467 | }
|
32468 | var category = _.isEmpty(this.dataViewCategorical.categories) ? null : this.dataViewCategorical.categories[0];
|
32469 | this.dataPoints = [];
|
32470 | for (var prevPointColor, formatStringProp = visuals.donutChartProps.general.formatString, pctFormatString = visuals.valueFormatter.getLocalizedString("Percentage"), i = 0, dataPointCount = convertedData.length; dataPointCount > i; i++) {
|
32471 | var point = convertedData[i], normalizedHighlight = DonutChartConverter.normalizedMeasureAndValue(point.highlightMeasureValue), normalizedNonHighlight = DonutChartConverter.normalizedMeasureAndValue(point.measureValue), measure = normalizedNonHighlight.measure, percentage = this.total > 0 ? normalizedNonHighlight.value / this.total : 0, highlightRatio = void 0, highlightPercentage = void 0;
|
32472 | normalizedNonHighlight.value > this.maxValue && (this.maxValue = normalizedNonHighlight.value),
|
32473 | normalizedHighlight.value > this.maxValue && (this.maxValue = normalizedHighlight.value),
|
32474 | this.hasHighlights && (highlightsOverflow ? (measure = normalizedHighlight.measure,
|
32475 | percentage = this.highlightTotal > 0 ? normalizedHighlight.value / this.highlightTotal : 0,
|
32476 | highlightRatio = 1) : highlightRatio = 0 !== normalizedNonHighlight.value ? normalizedHighlight.value / normalizedNonHighlight.value : 0,
|
32477 | highlightRatio || (highlightRatio = DonutChart.EffectiveZeroValue), highlightPercentage = percentage * highlightRatio);
|
32478 | var categoryValue = point.categoryLabel, categorical = this.dataViewCategorical, valueIndex = void 0;
|
32479 | valueIndex = null != point.seriesIndex ? point.seriesIndex : i;
|
32480 | var valuesMetadata = reader.getValueMetadataColumn("Y", valueIndex), value = this.hasHighlights && highlightsOverflow ? point.highlightMeasureValue.measure : point.measureValue.measure, highlightValue = this.hasHighlights && !highlightsOverflow ? point.highlightMeasureValue.measure : void 0, formatString = visuals.valueFormatter.getFormatString(valuesMetadata, formatStringProp), pct = visuals.valueFormatter.format(percentage, pctFormatString), valueAndPct = void 0;
|
32481 | valueAndPct = visuals.valueFormatter.format(value, formatString) + " (" + pct + ")";
|
32482 | var highlightValueAndPct = void 0;
|
32483 | if (this.hasHighlights && null != highlightValue && null != highlightPercentage) {
|
32484 | var highlightedPct = visuals.valueFormatter.format(highlightPercentage, pctFormatString);
|
32485 | highlightValueAndPct = visuals.valueFormatter.format(highlightValue, formatString) + " (" + highlightedPct + ")";
|
32486 | }
|
32487 | var tooltipInfo = void 0;
|
32488 | this.tooltipsEnabled && (tooltipInfo = [], category && tooltipInfo.push({
|
32489 | displayName: category.source.displayName,
|
32490 | value: categoryValue
|
32491 | }), this.isDynamicSeries && (category && category.source === categorical.values.source || tooltipInfo.push({
|
32492 | displayName: categorical.values.source.displayName,
|
32493 | value: point.label
|
32494 | })), null != valueAndPct && tooltipInfo.push({
|
32495 | displayName: valuesMetadata.displayName,
|
32496 | value: valueAndPct
|
32497 | }), null != highlightValueAndPct && tooltipInfo.push({
|
32498 | displayName: visuals.ToolTipComponent.localizationOptions.highlightedValueDisplayName,
|
32499 | value: highlightValueAndPct
|
32500 | }));
|
32501 | var strokeWidth = prevPointColor === point.color && value && value > 0 ? 1 : 0;
|
32502 | prevPointColor = value && value > 0 ? point.color : prevPointColor, this.dataPoints.push({
|
32503 | identity: point.identity,
|
32504 | measure: measure,
|
32505 | measureFormat: point.measureFormat,
|
32506 | percentage: percentage,
|
32507 | index: point.index,
|
32508 | label: point.label,
|
32509 | highlightRatio: highlightRatio,
|
32510 | highlightValue: highlightValue,
|
32511 | selected: !1,
|
32512 | tooltipInfo: tooltipInfo,
|
32513 | color: point.color,
|
32514 | strokeWidth: strokeWidth,
|
32515 | labelFormatString: valuesMetadata.format
|
32516 | });
|
32517 | }
|
32518 | this.legendData = this.convertLegendData();
|
32519 | }, DonutChartConverter.prototype.getLegendTitle = function() {
|
32520 | if (0 !== this.total) {
|
32521 | 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 : "";
|
32522 | return this.categoryValues ? dvCategorySourceName : dvValuesSourceName;
|
32523 | }
|
32524 | return "";
|
32525 | }, DonutChartConverter.prototype.convertCategoricalWithSlicing = function() {
|
32526 | for (var reader = this.reader, dataViewCategorical = this.dataViewCategorical, formatStringProp = visuals.donutChartProps.general.formatString, dataPoints = [], categoryIndex = 0, categoryCount = this.categoryValues.length; categoryCount > categoryIndex; categoryIndex++) {
|
32527 | 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++) {
|
32528 | var valueColumn = reader.getValueColumn("Y", seriesIndex), label = this.isSingleMeasure ? categoryLabel : visuals.converterHelper.getFormattedLegendLabel(valueColumn.source, dataViewCategorical.values, formatStringProp), nonHighlight = reader.getValue("Y", categoryIndex, seriesIndex) || 0, highlight = void 0;
|
32529 | this.hasHighlights && (highlight = reader.getHighlight("Y", categoryIndex, seriesIndex));
|
32530 | 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 = {
|
32531 | identity: identity,
|
32532 | measureFormat: visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp, !0),
|
32533 | measureValue: {
|
32534 | measure: nonHighlight,
|
32535 | value: Math.abs(nonHighlight)
|
32536 | },
|
32537 | highlightMeasureValue: {
|
32538 | measure: highlight,
|
32539 | value: null != highlight ? Math.abs(highlight) : null
|
32540 | },
|
32541 | index: categoryIndex * this.seriesCount + seriesIndex,
|
32542 | label: label,
|
32543 | categoryLabel: categoryLabel,
|
32544 | color: color,
|
32545 | seriesIndex: seriesIndex
|
32546 | };
|
32547 | dataPoints.push(dataPoint);
|
32548 | }
|
32549 | this.legendDataPoints.push({
|
32550 | label: categoryLabel,
|
32551 | color: color,
|
32552 | icon: visuals.LegendIcon.Box,
|
32553 | identity: legendIdentity,
|
32554 | selected: !1
|
32555 | });
|
32556 | }
|
32557 | return dataPoints;
|
32558 | }, DonutChartConverter.prototype.convertMeasures = function() {
|
32559 | for (var reader = this.reader, dataPoints = [], formatStringProp = visuals.donutChartProps.general.formatString, measureIndex = 0; measureIndex < this.seriesCount; measureIndex++) {
|
32560 | var valueColumn = reader.getValueColumn("Y", measureIndex), measureFormat = visuals.valueFormatter.getFormatString(valueColumn.source, formatStringProp, !0), measureLabel = valueColumn.source.displayName, identity = visuals.SelectionId.createWithMeasure(valueColumn.source.queryName), nonHighlight = reader.getValue("Y", 0, measureIndex) || 0, highlight = this.hasHighlights ? reader.getHighlight("Y", 0, measureIndex) : 0, color = this.colorHelper.getColorForMeasure(valueColumn.source.objects, valueColumn.source.queryName), dataPoint = {
|
32561 | identity: identity,
|
32562 | measureFormat: measureFormat,
|
32563 | measureValue: {
|
32564 | measure: nonHighlight,
|
32565 | value: Math.abs(nonHighlight)
|
32566 | },
|
32567 | highlightMeasureValue: {
|
32568 | measure: highlight,
|
32569 | value: Math.abs(highlight)
|
32570 | },
|
32571 | index: measureIndex,
|
32572 | label: measureLabel,
|
32573 | categoryLabel: measureLabel,
|
32574 | color: color
|
32575 | };
|
32576 | dataPoints.push(dataPoint), this.legendDataPoints.push({
|
32577 | label: dataPoint.label,
|
32578 | color: dataPoint.color,
|
32579 | icon: visuals.LegendIcon.Box,
|
32580 | identity: dataPoint.identity,
|
32581 | selected: !1
|
32582 | });
|
32583 | }
|
32584 | return dataPoints;
|
32585 | }, DonutChartConverter.prototype.convertSeries = function() {
|
32586 | for (var reader = this.reader, dataViewCategorical = this.dataViewCategorical, dataPoints = [], formatStringProp = visuals.donutChartProps.general.formatString, seriesIndex = 0; seriesIndex < this.seriesCount; seriesIndex++) {
|
32587 | var 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 = this.grouped && this.grouped[seriesIndex] && this.grouped[seriesIndex].objects, nonHighlight = reader.getValue("Y", 0, seriesIndex) || 0, highlight = this.hasHighlights ? reader.getHighlight("Y", 0, seriesIndex) || 0 : 0, color = this.colorHelper.getColorForSeriesValue(objects, dataViewCategorical.values.identityFields, seriesName), dataPoint = {
|
32588 | identity: identity,
|
32589 | measureFormat: seriesFormat,
|
32590 | measureValue: {
|
32591 | measure: nonHighlight,
|
32592 | value: Math.abs(nonHighlight)
|
32593 | },
|
32594 | highlightMeasureValue: {
|
32595 | measure: highlight,
|
32596 | value: Math.abs(highlight)
|
32597 | },
|
32598 | index: seriesIndex,
|
32599 | label: label,
|
32600 | categoryLabel: label,
|
32601 | color: color,
|
32602 | seriesIndex: seriesIndex
|
32603 | };
|
32604 | dataPoints.push(dataPoint), this.legendDataPoints.push({
|
32605 | label: dataPoint.label,
|
32606 | color: dataPoint.color,
|
32607 | icon: visuals.LegendIcon.Box,
|
32608 | identity: dataPoint.identity,
|
32609 | selected: !1
|
32610 | });
|
32611 | }
|
32612 | return dataPoints;
|
32613 | }, DonutChartConverter.prototype.convertDataLabelSettings = function() {
|
32614 | var dataViewMetadata = this.dataViewMetadata, dataLabelsSettings = visuals.dataLabelUtils.getDefaultDonutLabelSettings();
|
32615 | if (dataViewMetadata) {
|
32616 | var objects = dataViewMetadata.objects;
|
32617 | if (objects) {
|
32618 | var labelsObj = objects.labels;
|
32619 | labelsObj && visuals.dataLabelUtils.updateLabelSettingsFromLabelsObject(labelsObj, dataLabelsSettings);
|
32620 | }
|
32621 | }
|
32622 | return dataLabelsSettings;
|
32623 | }, DonutChartConverter.prototype.convertLegendData = function() {
|
32624 | return {
|
32625 | dataPoints: this.legendDataPoints,
|
32626 | labelColor: visuals.LegendData.DefaultLegendLabelFillColor,
|
32627 | title: this.getLegendTitle(),
|
32628 | fontSize: visuals.SVGLegend.DefaultFontSizeInPt
|
32629 | };
|
32630 | }, DonutChartConverter;
|
32631 | }();
|
32632 | DonutChartConversion.DonutChartConverter = DonutChartConverter;
|
32633 | }(DonutChartConversion || (DonutChartConversion = {}));
|
32634 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
32635 | }(powerbi || (powerbi = {}));
|
32636 |
|
32637 | var powerbi;
|
32638 |
|
32639 | !function(powerbi) {
|
32640 | var visuals;
|
32641 | !function(visuals) {
|
32642 | var Utility = jsCommon.Utility, ScriptVisual = function() {
|
32643 | function ScriptVisual(options) {
|
32644 | this.canRefresh = options.canRefresh;
|
32645 | }
|
32646 | return ScriptVisual.prototype.init = function(options) {
|
32647 | this.element = options.element, this.hostServices = options.host, this.canRefresh || this.hostServices.setWarnings([ new visuals.ScriptVisualRefreshWarning() ]);
|
32648 | }, ScriptVisual.prototype.update = function(options) {
|
32649 | var dataViews = options.dataViews;
|
32650 | if (dataViews && 0 !== dataViews.length) {
|
32651 | var dataView = dataViews[0];
|
32652 | if (dataView && dataView.metadata) {
|
32653 | var imageUrl = this.getImageUrl(dataView), div = this.ensureHtmlElement();
|
32654 | if (imageUrl && Utility.isValidImageDataUrl(imageUrl)) {
|
32655 | var viewport = options.viewport;
|
32656 | div.css({
|
32657 | height: viewport.height,
|
32658 | width: viewport.width,
|
32659 | backgroundImage: "url(" + imageUrl + ")"
|
32660 | });
|
32661 | } else div.css({
|
32662 | backgroundImage: "none"
|
32663 | });
|
32664 | }
|
32665 | }
|
32666 | }, ScriptVisual.prototype.onResizing = function(finalViewport) {
|
32667 | var div = this.ensureHtmlElement();
|
32668 | div.css({
|
32669 | height: finalViewport.height,
|
32670 | width: finalViewport.width
|
32671 | });
|
32672 | }, ScriptVisual.prototype.getImageUrl = function(dataView) {
|
32673 | return dataView.scriptResult && dataView.scriptResult.imageBase64 ? "data:image/png;base64," + dataView.scriptResult.imageBase64 : null;
|
32674 | }, ScriptVisual.prototype.ensureHtmlElement = function() {
|
32675 | var div = this.imageBackgroundElement;
|
32676 | return div || (div = $("<div class='imageBackground' />"), this.imageBackgroundElement = div,
|
32677 | this.imageBackgroundElement.appendTo(this.element)), div;
|
32678 | }, ScriptVisual;
|
32679 | }();
|
32680 | visuals.ScriptVisual = ScriptVisual;
|
32681 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
32682 | }(powerbi || (powerbi = {}));
|
32683 |
|
32684 | var powerbi;
|
32685 |
|
32686 | !function(powerbi) {
|
32687 | var visuals;
|
32688 | !function(visuals) {
|
32689 | var plugins;
|
32690 | !function(plugins) {
|
32691 | plugins.animatedNumber = {
|
32692 | name: "animatedNumber",
|
32693 | capabilities: visuals.capabilities.animatedNumber,
|
32694 | create: function() {
|
32695 | return new visuals.AnimatedNumber();
|
32696 | }
|
32697 | }, plugins.areaChart = {
|
32698 | name: "areaChart",
|
32699 | watermarkKey: "area",
|
32700 | capabilities: visuals.capabilities.lineChart,
|
32701 | create: function() {
|
32702 | return new visuals.CartesianChart({
|
32703 | chartType: 1
|
32704 | });
|
32705 | },
|
32706 | customizeQuery: visuals.LineChart.customizeQuery,
|
32707 | getSortableRoles: function(visualSortableOptions) {
|
32708 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32709 | },
|
32710 | getAdditionalTelemetry: function(dataView) {
|
32711 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32712 | }
|
32713 | }, plugins.barChart = {
|
32714 | name: "barChart",
|
32715 | watermarkKey: "bar",
|
32716 | capabilities: visuals.capabilities.barChart,
|
32717 | create: function() {
|
32718 | return new visuals.CartesianChart({
|
32719 | chartType: 6
|
32720 | });
|
32721 | },
|
32722 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
32723 | getSortableRoles: function(visualSortableOptions) {
|
32724 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32725 | },
|
32726 | getAdditionalTelemetry: function(dataView) {
|
32727 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32728 | }
|
32729 | }, plugins.basicShape = {
|
32730 | name: "basicShape",
|
32731 | capabilities: visuals.basicShapeCapabilities,
|
32732 | create: function() {
|
32733 | return new visuals.BasicShapeVisual();
|
32734 | }
|
32735 | }, plugins.card = {
|
32736 | name: "card",
|
32737 | watermarkKey: "card",
|
32738 | capabilities: visuals.capabilities.card,
|
32739 | create: function() {
|
32740 | return new visuals.Card();
|
32741 | }
|
32742 | }, plugins.multiRowCard = {
|
32743 | name: "multiRowCard",
|
32744 | watermarkKey: "multiRowCard",
|
32745 | capabilities: visuals.capabilities.multiRowCard,
|
32746 | create: function() {
|
32747 | return new visuals.MultiRowCard();
|
32748 | },
|
32749 | getSortableRoles: function(visualSortableOptions) {
|
32750 | return visuals.MultiRowCard.getSortableRoles(visualSortableOptions);
|
32751 | }
|
32752 | }, plugins.clusteredBarChart = {
|
32753 | name: "clusteredBarChart",
|
32754 | watermarkKey: "clusteredBar",
|
32755 | capabilities: visuals.capabilities.clusteredBarChart,
|
32756 | create: function() {
|
32757 | return new visuals.CartesianChart({
|
32758 | chartType: 5
|
32759 | });
|
32760 | },
|
32761 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
32762 | getSortableRoles: function(visualSortableOptions) {
|
32763 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32764 | },
|
32765 | getAdditionalTelemetry: function(dataView) {
|
32766 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32767 | }
|
32768 | }, plugins.clusteredColumnChart = {
|
32769 | name: "clusteredColumnChart",
|
32770 | watermarkKey: "clusteredColumn",
|
32771 | capabilities: visuals.capabilities.clusteredColumnChart,
|
32772 | create: function() {
|
32773 | return new visuals.CartesianChart({
|
32774 | chartType: 3
|
32775 | });
|
32776 | },
|
32777 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
32778 | getSortableRoles: function(visualSortableOptions) {
|
32779 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32780 | },
|
32781 | getAdditionalTelemetry: function(dataView) {
|
32782 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32783 | }
|
32784 | }, plugins.columnChart = {
|
32785 | name: "columnChart",
|
32786 | watermarkKey: "column",
|
32787 | capabilities: visuals.capabilities.columnChart,
|
32788 | create: function() {
|
32789 | return new visuals.CartesianChart({
|
32790 | chartType: 4
|
32791 | });
|
32792 | },
|
32793 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
32794 | getSortableRoles: function(visualSortableOptions) {
|
32795 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32796 | },
|
32797 | getAdditionalTelemetry: function(dataView) {
|
32798 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32799 | }
|
32800 | }, plugins.comboChart = {
|
32801 | name: "comboChart",
|
32802 | watermarkKey: "combo",
|
32803 | capabilities: visuals.capabilities.comboChart,
|
32804 | customizeQuery: visuals.ComboChart.customizeQuery,
|
32805 | create: function() {
|
32806 | return new visuals.CartesianChart({
|
32807 | chartType: 10
|
32808 | });
|
32809 | },
|
32810 | getSortableRoles: function(visualSortableOptions) {
|
32811 | return visuals.ComboChart.getSortableRoles(visualSortableOptions);
|
32812 | },
|
32813 | getAdditionalTelemetry: function(dataView) {
|
32814 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32815 | }
|
32816 | }, plugins.dataDotChart = {
|
32817 | name: "dataDotChart",
|
32818 | capabilities: visuals.capabilities.dataDotChart,
|
32819 | create: function() {
|
32820 | return new visuals.CartesianChart({
|
32821 | chartType: 11
|
32822 | });
|
32823 | },
|
32824 | getAdditionalTelemetry: function(dataView) {
|
32825 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32826 | }
|
32827 | }, plugins.dataDotClusteredColumnComboChart = {
|
32828 | name: "dataDotClusteredColumnComboChart",
|
32829 | watermarkKey: "combo",
|
32830 | capabilities: visuals.capabilities.dataDotClusteredColumnComboChart,
|
32831 | customizeQuery: visuals.ComboChart.customizeQuery,
|
32832 | create: function() {
|
32833 | return new visuals.CartesianChart({
|
32834 | chartType: 15
|
32835 | });
|
32836 | },
|
32837 | getAdditionalTelemetry: function(dataView) {
|
32838 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32839 | }
|
32840 | }, plugins.dataDotStackedColumnComboChart = {
|
32841 | name: "dataDotStackedColumnComboChart",
|
32842 | watermarkKey: "combo",
|
32843 | capabilities: visuals.capabilities.dataDotStackedColumnComboChart,
|
32844 | customizeQuery: visuals.ComboChart.customizeQuery,
|
32845 | create: function() {
|
32846 | return new visuals.CartesianChart({
|
32847 | chartType: 16
|
32848 | });
|
32849 | },
|
32850 | getAdditionalTelemetry: function(dataView) {
|
32851 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32852 | }
|
32853 | }, plugins.donutChart = {
|
32854 | name: "donutChart",
|
32855 | watermarkKey: "donut",
|
32856 | capabilities: visuals.capabilities.donutChart,
|
32857 | create: function() {
|
32858 | return new visuals.DonutChart();
|
32859 | }
|
32860 | }, plugins.funnel = {
|
32861 | name: "funnel",
|
32862 | watermarkKey: "funnel",
|
32863 | capabilities: visuals.capabilities.funnel,
|
32864 | create: function() {
|
32865 | return new visuals.FunnelChart();
|
32866 | }
|
32867 | }, plugins.gauge = {
|
32868 | name: "gauge",
|
32869 | watermarkKey: "gauge",
|
32870 | capabilities: visuals.capabilities.gauge,
|
32871 | create: function() {
|
32872 | return new visuals.Gauge();
|
32873 | }
|
32874 | }, plugins.hundredPercentStackedBarChart = {
|
32875 | name: "hundredPercentStackedBarChart",
|
32876 | watermarkKey: "100stackedbar",
|
32877 | capabilities: visuals.capabilities.hundredPercentStackedBarChart,
|
32878 | create: function() {
|
32879 | return new visuals.CartesianChart({
|
32880 | chartType: 7
|
32881 | });
|
32882 | },
|
32883 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
32884 | getSortableRoles: function(visualSortableOptions) {
|
32885 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32886 | },
|
32887 | getAdditionalTelemetry: function(dataView) {
|
32888 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32889 | }
|
32890 | }, plugins.hundredPercentStackedColumnChart = {
|
32891 | name: "hundredPercentStackedColumnChart",
|
32892 | watermarkKey: "100stackedcolumn",
|
32893 | capabilities: visuals.capabilities.hundredPercentStackedColumnChart,
|
32894 | create: function() {
|
32895 | return new visuals.CartesianChart({
|
32896 | chartType: 8
|
32897 | });
|
32898 | },
|
32899 | customizeQuery: visuals.ColumnChart.customizeQuery,
|
32900 | getSortableRoles: function(visualSortableOptions) {
|
32901 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
32902 | },
|
32903 | getAdditionalTelemetry: function(dataView) {
|
32904 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32905 | }
|
32906 | }, plugins.image = {
|
32907 | name: "image",
|
32908 | capabilities: visuals.capabilities.image,
|
32909 | create: function() {
|
32910 | return new visuals.ImageVisual();
|
32911 | }
|
32912 | }, plugins.lineChart = {
|
32913 | name: "lineChart",
|
32914 | watermarkKey: "line",
|
32915 | capabilities: visuals.capabilities.lineChart,
|
32916 | create: function() {
|
32917 | return new visuals.CartesianChart({
|
32918 | chartType: 0
|
32919 | });
|
32920 | },
|
32921 | customizeQuery: visuals.LineChart.customizeQuery,
|
32922 | getSortableRoles: function(visualSortableOptions) {
|
32923 | return visuals.LineChart.getSortableRoles(visualSortableOptions);
|
32924 | },
|
32925 | getAdditionalTelemetry: function(dataView) {
|
32926 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32927 | }
|
32928 | }, plugins.lineStackedColumnComboChart = {
|
32929 | name: "lineStackedColumnComboChart",
|
32930 | watermarkKey: "combo",
|
32931 | capabilities: visuals.capabilities.lineStackedColumnComboChart,
|
32932 | customizeQuery: visuals.ComboChart.customizeQuery,
|
32933 | create: function() {
|
32934 | return new visuals.CartesianChart({
|
32935 | chartType: 14
|
32936 | });
|
32937 | },
|
32938 | getSortableRoles: function(visualSortableOptions) {
|
32939 | return visuals.ComboChart.getSortableRoles(visualSortableOptions);
|
32940 | },
|
32941 | getAdditionalTelemetry: function(dataView) {
|
32942 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32943 | }
|
32944 | }, plugins.lineClusteredColumnComboChart = {
|
32945 | name: "lineClusteredColumnComboChart",
|
32946 | watermarkKey: "combo",
|
32947 | capabilities: visuals.capabilities.lineClusteredColumnComboChart,
|
32948 | customizeQuery: visuals.ComboChart.customizeQuery,
|
32949 | create: function() {
|
32950 | return new visuals.CartesianChart({
|
32951 | chartType: 13
|
32952 | });
|
32953 | },
|
32954 | getSortableRoles: function(visualSortableOptions) {
|
32955 | return visuals.ComboChart.getSortableRoles(visualSortableOptions);
|
32956 | },
|
32957 | getAdditionalTelemetry: function(dataView) {
|
32958 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
32959 | }
|
32960 | }, plugins.map = {
|
32961 | name: "map",
|
32962 | watermarkKey: "map",
|
32963 | capabilities: visuals.capabilities.map,
|
32964 | create: function() {
|
32965 | return new visuals.Map({
|
32966 | filledMap: !1
|
32967 | });
|
32968 | }
|
32969 | }, plugins.filledMap = {
|
32970 | name: "filledMap",
|
32971 | watermarkKey: "filledMap",
|
32972 | capabilities: visuals.capabilities.filledMap,
|
32973 | create: function() {
|
32974 | return new visuals.Map({
|
32975 | filledMap: !0
|
32976 | });
|
32977 | }
|
32978 | }, plugins.treemap = {
|
32979 | name: "treemap",
|
32980 | watermarkKey: "tree",
|
32981 | capabilities: visuals.capabilities.treemap,
|
32982 | create: function() {
|
32983 | return new visuals.Treemap();
|
32984 | }
|
32985 | }, plugins.pieChart = {
|
32986 | name: "pieChart",
|
32987 | watermarkKey: "pie",
|
32988 | capabilities: visuals.capabilities.donutChart,
|
32989 | create: function() {
|
32990 | return new visuals.DonutChart({
|
32991 | sliceWidthRatio: 0
|
32992 | });
|
32993 | }
|
32994 | }, plugins.scatterChart = {
|
32995 | name: "scatterChart",
|
32996 | watermarkKey: "scatterplot",
|
32997 | capabilities: visuals.capabilities.scatterChart,
|
32998 | create: function() {
|
32999 | return new visuals.CartesianChart({
|
33000 | chartType: 9
|
33001 | });
|
33002 | },
|
33003 | getAdditionalTelemetry: function(dataView) {
|
33004 | return visuals.ScatterChart.getAdditionalTelemetry(dataView);
|
33005 | }
|
33006 | }, plugins.stackedAreaChart = {
|
33007 | name: "stackedAreaChart",
|
33008 | watermarkKey: "stackedarea",
|
33009 | capabilities: visuals.capabilities.lineChart,
|
33010 | create: function() {
|
33011 | return new visuals.CartesianChart({
|
33012 | chartType: 2
|
33013 | });
|
33014 | },
|
33015 | customizeQuery: visuals.LineChart.customizeQuery,
|
33016 | getSortableRoles: function(visualSortableOptions) {
|
33017 | return visuals.ColumnChart.getSortableRoles(visualSortableOptions);
|
33018 | },
|
33019 | getAdditionalTelemetry: function(dataView) {
|
33020 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33021 | }
|
33022 | }, plugins.table = {
|
33023 | name: "table",
|
33024 | watermarkKey: "table",
|
33025 | capabilities: visuals.capabilities.table,
|
33026 | create: function() {
|
33027 | return new visuals.Table();
|
33028 | },
|
33029 | customizeQuery: visuals.Table.customizeQuery,
|
33030 | getSortableRoles: function(visualSortableOptions) {
|
33031 | return visuals.Table.getSortableRoles();
|
33032 | }
|
33033 | }, plugins.matrix = {
|
33034 | name: "matrix",
|
33035 | watermarkKey: "matrix",
|
33036 | capabilities: visuals.capabilities.matrix,
|
33037 | create: function() {
|
33038 | return new visuals.Matrix();
|
33039 | },
|
33040 | customizeQuery: visuals.Matrix.customizeQuery,
|
33041 | getSortableRoles: function(visualSortableOptions) {
|
33042 | return visuals.Matrix.getSortableRoles();
|
33043 | }
|
33044 | }, plugins.slicer = {
|
33045 | name: "slicer",
|
33046 | watermarkKey: "slicer",
|
33047 | capabilities: visuals.capabilities.slicer,
|
33048 | create: function() {
|
33049 | return new visuals.Slicer();
|
33050 | }
|
33051 | }, plugins.textbox = {
|
33052 | name: "textbox",
|
33053 | capabilities: visuals.capabilities.textbox,
|
33054 | create: function() {
|
33055 | return new visuals.Textbox();
|
33056 | }
|
33057 | }, plugins.waterfallChart = {
|
33058 | name: "waterfallChart",
|
33059 | watermarkKey: "waterfall",
|
33060 | capabilities: visuals.capabilities.waterfallChart,
|
33061 | create: function() {
|
33062 | return new visuals.CartesianChart({
|
33063 | chartType: 12
|
33064 | });
|
33065 | },
|
33066 | getAdditionalTelemetry: function(dataView) {
|
33067 | return visuals.CartesianChart.getAdditionalTelemetry(dataView);
|
33068 | }
|
33069 | }, plugins.cheerMeter = {
|
33070 | name: "cheerMeter",
|
33071 | capabilities: visuals.CheerMeter.capabilities,
|
33072 | create: function() {
|
33073 | return new visuals.CheerMeter();
|
33074 | }
|
33075 | }, plugins.consoleWriter = {
|
33076 | name: "consoleWriter",
|
33077 | capabilities: visuals.samples.consoleWriterCapabilities,
|
33078 | create: function() {
|
33079 | return new visuals.samples.ConsoleWriter();
|
33080 | }
|
33081 | }, plugins.helloIVisual = {
|
33082 | name: "helloIVisual",
|
33083 | capabilities: visuals.samples.HelloIVisual.capabilities,
|
33084 | create: function() {
|
33085 | return new visuals.samples.HelloIVisual();
|
33086 | }
|
33087 | }, plugins.owlGauge = {
|
33088 | name: "owlGauge",
|
33089 | watermarkKey: "gauge",
|
33090 | capabilities: visuals.OwlGauge.capabilities,
|
33091 | create: function() {
|
33092 | return new visuals.OwlGauge();
|
33093 | }
|
33094 | }, plugins.scriptVisual = {
|
33095 | name: "scriptVisual",
|
33096 | watermarkKey: "scriptvisual",
|
33097 | capabilities: visuals.capabilities.scriptVisual,
|
33098 | create: function() {
|
33099 | return new visuals.ScriptVisual({
|
33100 | canRefresh: !1
|
33101 | });
|
33102 | }
|
33103 | }, plugins.kpi = {
|
33104 | name: "kpi",
|
33105 | watermarkKey: "kpi",
|
33106 | capabilities: visuals.capabilities.kpi,
|
33107 | create: function() {
|
33108 | return new visuals.KPIStatusWithHistory();
|
33109 | }
|
33110 | };
|
33111 | }(plugins = visuals.plugins || (visuals.plugins = {}));
|
33112 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33113 | }(powerbi || (powerbi = {}));
|
33114 |
|
33115 | var powerbi;
|
33116 |
|
33117 | !function(powerbi) {
|
33118 | var visuals;
|
33119 | !function(visuals) {
|
33120 | var CanvasBackgroundHelper;
|
33121 | !function(CanvasBackgroundHelper) {
|
33122 | function getDefaultColor() {
|
33123 | return "#FFFFFF";
|
33124 | }
|
33125 | function getDefaultValues() {
|
33126 | return {
|
33127 | color: getDefaultColor()
|
33128 | };
|
33129 | }
|
33130 | CanvasBackgroundHelper.getDefaultColor = getDefaultColor, CanvasBackgroundHelper.getDefaultValues = getDefaultValues;
|
33131 | }(CanvasBackgroundHelper = visuals.CanvasBackgroundHelper || (visuals.CanvasBackgroundHelper = {}));
|
33132 | }(visuals = powerbi.visuals || (powerbi.visuals = {}));
|
33133 | }(powerbi || (powerbi = {})); |
\ | No newline at end of file |