UNPKG

435 kBTypeScriptView Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188declare module powerbi.visuals {
189 class Point implements IPoint {
190 x: number;
191 y: number;
192 constructor(x?: number, y?: number);
193 }
194}
195
196declare module powerbi.visuals {
197 class Rect implements IRect {
198 left: number;
199 top: number;
200 width: number;
201 height: number;
202 constructor(left?: number, top?: number, width?: number, height?: number);
203 }
204}
205
206declare module powerbi.visuals {
207 module Font {
208 class FamilyInfo {
209 families: string[];
210 constructor(families: string[]);
211 /**
212 * Gets the first font "wf_" font family since it will always be loaded.
213 */
214 family: string;
215 /**
216 * Gets the first font family that matches regex (if provided).
217 * Default regex looks for "wf_" fonts which are always loaded.
218 */
219 getFamily(regex?: RegExp): string;
220 /**
221 * Gets the CSS string for the "font-family" CSS attribute.
222 */
223 css: string;
224 /**
225 * Gets the CSS string for the "font-family" CSS attribute.
226 */
227 getCSS(): string;
228 }
229 var Family: {
230 light: FamilyInfo;
231 semilight: FamilyInfo;
232 regular: FamilyInfo;
233 semibold: FamilyInfo;
234 bold: FamilyInfo;
235 lightSecondary: FamilyInfo;
236 regularSecondary: FamilyInfo;
237 boldSecondary: FamilyInfo;
238 };
239 }
240}
241
242declare module powerbi.visuals {
243 enum LegendIcon {
244 Box = 0,
245 Circle = 1,
246 Line = 2,
247 }
248 enum LegendPosition {
249 Top = 0,
250 Bottom = 1,
251 Right = 2,
252 Left = 3,
253 None = 4,
254 TopCenter = 5,
255 BottomCenter = 6,
256 RightCenter = 7,
257 LeftCenter = 8,
258 }
259 interface LegendPosition2D {
260 textPosition?: Point;
261 glyphPosition?: Point;
262 }
263 interface LegendDataPoint extends SelectableDataPoint, LegendPosition2D {
264 label: string;
265 color: string;
266 icon: LegendIcon;
267 category?: string;
268 measure?: any;
269 iconOnlyOnLabel?: boolean;
270 tooltip?: string;
271 layerNumber?: number;
272 }
273 interface LegendData {
274 title?: string;
275 dataPoints: LegendDataPoint[];
276 grouped?: boolean;
277 labelColor?: string;
278 fontSize?: number;
279 }
280 const legendProps: {
281 show: string;
282 position: string;
283 titleText: string;
284 showTitle: string;
285 labelColor: string;
286 fontSize: string;
287 };
288 function createLegend(legendParentElement: JQuery, interactive: boolean, interactivityService: IInteractivityService, isScrollable?: boolean, legendPosition?: LegendPosition): ILegend;
289 interface ILegend {
290 getMargins(): IViewport;
291 isVisible(): boolean;
292 changeOrientation(orientation: LegendPosition): void;
293 getOrientation(): LegendPosition;
294 drawLegend(data: LegendData, viewport: IViewport): any;
295 /**
296 * Reset the legend by clearing it
297 */
298 reset(): void;
299 }
300 module Legend {
301 function isLeft(orientation: LegendPosition): boolean;
302 function isTop(orientation: LegendPosition): boolean;
303 function positionChartArea(chartArea: D3.Selection, legend: ILegend): void;
304 }
305 class SVGLegend implements ILegend {
306 private orientation;
307 private viewport;
308 private parentViewport;
309 private svg;
310 private group;
311 private clearCatcher;
312 private element;
313 private interactivityService;
314 private legendDataStartIndex;
315 private arrowPosWindow;
316 private data;
317 private isScrollable;
318 private lastCalculatedWidth;
319 private visibleLegendWidth;
320 private visibleLegendHeight;
321 private legendFontSizeMarginDifference;
322 private legendFontSizeMarginValue;
323 static DefaultFontSizeInPt: number;
324 private static LegendIconRadius;
325 private static LegendIconRadiusFactor;
326 private static MaxTextLength;
327 private static MaxTitleLength;
328 private static TextAndIconPadding;
329 private static TitlePadding;
330 private static LegendEdgeMariginWidth;
331 private static LegendMaxWidthFactor;
332 private static TopLegendHeight;
333 private static DefaultTextMargin;
334 private static DefaultMaxLegendFactor;
335 private static LegendIconYRatio;
336 private static LegendArrowOffset;
337 private static LegendArrowHeight;
338 private static LegendArrowWidth;
339 private static DefaultFontFamily;
340 private static DefaultTitleFontFamily;
341 private static LegendItem;
342 private static LegendText;
343 private static LegendIcon;
344 private static LegendTitle;
345 private static NavigationArrow;
346 constructor(element: JQuery, legendPosition: LegendPosition, interactivityService: IInteractivityService, isScrollable: boolean);
347 private updateLayout();
348 private calculateViewport();
349 getMargins(): IViewport;
350 isVisible(): boolean;
351 changeOrientation(orientation: LegendPosition): void;
352 getOrientation(): LegendPosition;
353 drawLegend(data: LegendData, viewport: IViewport): void;
354 drawLegendInternal(data: LegendData, viewport: IViewport, autoWidth: boolean): void;
355 private normalizePosition(points);
356 private calculateTitleLayout(title);
357 /** Performs layout offline for optimal perfomance */
358 private calculateLayout(data, autoWidth);
359 private updateNavigationArrowLayout(navigationArrows, remainingDataLength, visibleDataLength);
360 private calculateHorizontalNavigationArrowsLayout(title);
361 private calculateVerticalNavigationArrowsLayout(title);
362 /**
363 * Calculates the widths for each horizontal legend item.
364 */
365 private static calculateHorizontalLegendItemsWidths(dataPoints, availableWidth, iconPadding, fontSize);
366 private calculateHorizontalLayout(dataPoints, title, navigationArrows);
367 private calculateVerticalLayout(dataPoints, title, navigationArrows, autoWidth);
368 private drawNavigationArrows(layout);
369 private isTopOrBottom(orientation);
370 private isCentered(orientation);
371 reset(): void;
372 private static getTextProperties(isTitle, text?, fontSize?);
373 private setTooltipToLegendItems(data);
374 }
375 module LegendData {
376 var DefaultLegendLabelFillColor: string;
377 function update(legendData: LegendData, legendObject: DataViewObject): void;
378 }
379}
380
381declare module powerbi.visuals {
382 module axisScale {
383 const linear: string;
384 const log: string;
385 const type: IEnumType;
386 }
387}
388
389declare module powerbi.visuals {
390 module axisStyle {
391 const showBoth: string;
392 const showTitleOnly: string;
393 const showUnitOnly: string;
394 const type: IEnumType;
395 }
396}
397
398declare module powerbi.visuals {
399 module axisType {
400 const scalar: string;
401 const categorical: string;
402 const both: string;
403 const type: IEnumType;
404 }
405}
406
407declare module powerbi.visuals {
408 module basicShapeType {
409 const rectangle: string;
410 const oval: string;
411 const line: string;
412 const arrow: string;
413 const triangle: string;
414 const type: IEnumType;
415 }
416}
417
418declare module powerbi.visuals {
419 module imageScalingType {
420 const normal: string;
421 const fit: string;
422 const fill: string;
423 const type: IEnumType;
424 }
425}
426
427declare module powerbi.visuals {
428 module labelPosition {
429 const insideEnd: string;
430 const insideCenter: string;
431 const outsideEnd: string;
432 const insideBase: string;
433 const type: IEnumType;
434 }
435}
436
437declare module powerbi.visuals {
438 module labelStyle {
439 const category: string;
440 const data: string;
441 const both: string;
442 const type: IEnumType;
443 }
444}
445
446declare module powerbi.visuals {
447 module legendPosition {
448 const top: string;
449 const bottom: string;
450 const left: string;
451 const right: string;
452 const topCenter: string;
453 const bottomCenter: string;
454 const leftCenter: string;
455 const rightCenter: string;
456 const type: IEnumType;
457 }
458}
459
460declare module powerbi.visuals {
461 module kpiDirection {
462 const positive: string;
463 const negative: string;
464 const type: IEnumType;
465 }
466}
467
468declare module powerbi.visuals {
469 module lineStyle {
470 const dashed: string;
471 const solid: string;
472 const dotted: string;
473 const type: IEnumType;
474 }
475}
476
477declare module powerbi.visuals {
478 module outline {
479 const none: string;
480 const bottomOnly: string;
481 const topOnly: string;
482 const leftOnly: string;
483 const rightOnly: string;
484 const topBottom: string;
485 const leftRight: string;
486 const frame: string;
487 function showTop(outline: string): boolean;
488 function showRight(outline: string): boolean;
489 function showBottom(outline: string): boolean;
490 function showLeft(outline: string): boolean;
491 const type: IEnumType;
492 }
493}
494
495declare module powerbi.visuals {
496 module referenceLinePosition {
497 const back: string;
498 const front: string;
499 const type: IEnumType;
500 }
501 module referenceLineDataLabelHorizontalPosition {
502 const left: string;
503 const right: string;
504 const type: IEnumType;
505 }
506 module referenceLineDataLabelVerticalPosition {
507 const above: string;
508 const under: string;
509 const type: IEnumType;
510 }
511}
512
513declare module powerbi.visuals {
514 module slicerOrientation {
515 const enum Orientation {
516 Vertical = 0,
517 Horizontal = 1,
518 }
519 const type: IEnumType;
520 }
521}
522
523declare module powerbi.visuals {
524 module yAxisPosition {
525 const left: string;
526 const right: string;
527 const type: IEnumType;
528 }
529}
530
531declare module powerbi.visuals {
532 module sliderMode {
533 const before: string;
534 const after: string;
535 const between: string;
536 const type: IEnumType;
537 }
538}
539
540declare module powerbi.visuals {
541 module AnimatorCommon {
542 const MinervaAnimationDuration: number;
543 const MaxDataPointsToAnimate: number;
544 function GetAnimationDuration(animator: IGenericAnimator, suppressAnimations: boolean): number;
545 }
546 interface IAnimatorOptions {
547 duration?: number;
548 }
549 interface IAnimationOptions {
550 interactivityService: IInteractivityService;
551 }
552 interface IAnimationResult {
553 failed: boolean;
554 }
555 interface IAnimator<T extends IAnimatorOptions, U extends IAnimationOptions, V extends IAnimationResult> {
556 getDuration(): number;
557 getEasing(): string;
558 animate(options: U): V;
559 }
560 type IGenericAnimator = IAnimator<IAnimatorOptions, IAnimationOptions, IAnimationResult>;
561 /**
562 * We just need to have a non-null animator to allow axis animations in cartesianChart.
563 * Note: Use this temporarily for Line/Scatter until we add more animations (MinervaPlugins only).
564 */
565 class BaseAnimator<T extends IAnimatorOptions, U extends IAnimationOptions, V extends IAnimationResult> implements IAnimator<T, U, V> {
566 protected animationDuration: number;
567 constructor(options?: T);
568 getDuration(): number;
569 animate(options: U): V;
570 getEasing(): string;
571 }
572}
573
574declare module powerbi.visuals {
575 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
576 interface ColumnChartAnimationOptions extends IAnimationOptions {
577 viewModel: ColumnChartData;
578 series: D3.UpdateSelection;
579 layout: IColumnLayout;
580 itemCS: ClassAndSelector;
581 mainGraphicsContext: D3.Selection;
582 viewPort: IViewport;
583 }
584 interface ColumnChartAnimationResult extends IAnimationResult {
585 shapes: D3.UpdateSelection;
586 }
587 type IColumnChartAnimator = IAnimator<IAnimatorOptions, ColumnChartAnimationOptions, ColumnChartAnimationResult>;
588 class WebColumnChartAnimator extends BaseAnimator<IAnimatorOptions, ColumnChartAnimationOptions, ColumnChartAnimationResult> implements IColumnChartAnimator {
589 private previousViewModel;
590 constructor(options?: IAnimatorOptions);
591 animate(options: ColumnChartAnimationOptions): ColumnChartAnimationResult;
592 private animateNormalToHighlighted(options);
593 private animateHighlightedToHighlighted(options);
594 private animateHighlightedToNormal(options);
595 private animateDefaultShapes(data, series, layout, itemCS);
596 }
597}
598
599declare module powerbi.visuals {
600 interface DonutChartAnimationOptions extends IAnimationOptions {
601 viewModel: DonutData;
602 graphicsContext: D3.Selection;
603 labelGraphicsContext: D3.Selection;
604 colors: IDataColorPalette;
605 layout: DonutLayout;
606 sliceWidthRatio: number;
607 radius: number;
608 viewport: IViewport;
609 innerArcRadiusRatio: number;
610 labels: Label[];
611 }
612 interface DonutChartAnimationResult extends IAnimationResult {
613 shapes: D3.UpdateSelection;
614 highlightShapes: D3.UpdateSelection;
615 }
616 type IDonutChartAnimator = IAnimator<IAnimatorOptions, DonutChartAnimationOptions, DonutChartAnimationResult>;
617 class WebDonutChartAnimator extends BaseAnimator<IAnimatorOptions, DonutChartAnimationOptions, DonutChartAnimationResult> implements IDonutChartAnimator {
618 private previousViewModel;
619 constructor(options?: IAnimatorOptions);
620 animate(options: DonutChartAnimationOptions): DonutChartAnimationResult;
621 private animateNormalToHighlighted(options);
622 private animateHighlightedToHighlighted(options);
623 private animateHighlightedToNormal(options);
624 private animateDefaultShapes(options);
625 private animateDefaultHighlightShapes(options);
626 }
627}
628
629declare module powerbi.visuals {
630 interface FunnelAnimationOptions extends IAnimationOptions {
631 viewModel: FunnelData;
632 layout: IFunnelLayout;
633 axisGraphicsContext: D3.Selection;
634 shapeGraphicsContext: D3.Selection;
635 percentGraphicsContext: D3.Selection;
636 labelGraphicsContext: D3.Selection;
637 axisOptions: FunnelAxisOptions;
638 dataPointsWithoutHighlights: FunnelDataPoint[];
639 labelLayout: Label[];
640 isHidingPercentBars: boolean;
641 visualInitOptions: VisualInitOptions;
642 }
643 interface FunnelAnimationResult extends IAnimationResult {
644 shapes: D3.UpdateSelection;
645 dataLabels: D3.UpdateSelection;
646 }
647 type IFunnelAnimator = IAnimator<IAnimatorOptions, FunnelAnimationOptions, FunnelAnimationResult>;
648 class WebFunnelAnimator extends BaseAnimator<IAnimatorOptions, FunnelAnimationOptions, FunnelAnimationResult> implements IFunnelAnimator {
649 private previousViewModel;
650 constructor(options?: IAnimatorOptions);
651 animate(options: FunnelAnimationOptions): FunnelAnimationResult;
652 private animateNormalToHighlighted(options);
653 private animateHighlightedToHighlighted(options);
654 private animateHighlightedToNormal(options);
655 private animateDefaultAxis(graphicsContext, axisOptions, isHidingPercentBars);
656 private animateDefaultShapes(data, dataPoints, graphicsContext, layout);
657 private animatePercentBars(options);
658 private animateToFunnelPercent(context, targetData, layout);
659 private animatePercentBarComponents(data, options);
660 }
661}
662
663declare module powerbi.visuals {
664 interface TreemapAnimationOptions extends IAnimationOptions {
665 viewModel: TreemapData;
666 nodes: D3.Layout.GraphNode[];
667 highlightNodes: D3.Layout.GraphNode[];
668 majorLabeledNodes: D3.Layout.GraphNode[];
669 minorLabeledNodes: D3.Layout.GraphNode[];
670 shapeGraphicsContext: D3.Selection;
671 labelGraphicsContext: D3.Selection;
672 layout: ITreemapLayout;
673 labelSettings: VisualDataLabelsSettings;
674 }
675 interface TreemapAnimationResult extends IAnimationResult {
676 shapes: D3.UpdateSelection;
677 highlightShapes: D3.UpdateSelection;
678 majorLabels: D3.UpdateSelection;
679 minorLabels: D3.UpdateSelection;
680 }
681 type ITreemapAnimator = IAnimator<IAnimatorOptions, TreemapAnimationOptions, TreemapAnimationResult>;
682 class WebTreemapAnimator extends BaseAnimator<IAnimatorOptions, TreemapAnimationOptions, TreemapAnimationResult> implements ITreemapAnimator {
683 previousViewModel: TreemapData;
684 constructor(options?: IAnimatorOptions);
685 animate(options: TreemapAnimationOptions): TreemapAnimationResult;
686 private animateNormalToHighlighted(options);
687 private animateHighlightedToHighlighted(options);
688 private animateHighlightedToNormal(options);
689 private animateDefaultShapes(context, nodes, hasSelection, hasHighlights, layout);
690 private animateDefaultHighlightShapes(context, nodes, hasSelection, hasHighlights, layout);
691 private animateDefaultMajorLabels(context, nodes, labelSettings, layout);
692 private animateDefaultMinorLabels(context, nodes, labelSettings, layout);
693 }
694}
695
696declare module powerbi.visuals {
697 /**
698 * This is the baseline for some most common used object properties across visuals.
699 * When adding new properties, please try to reuse the existing ones.
700 */
701 const StandardObjectProperties: {
702 axisEnd: {
703 displayName: (IStringResourceProvider: any) => string;
704 description: (IStringResourceProvider: any) => string;
705 placeHolderText: (IStringResourceProvider: any) => string;
706 type: {
707 numeric: boolean;
708 };
709 suppressFormatPainterCopy: boolean;
710 };
711 axisScale: {
712 displayName: (IStringResourceProvider: any) => string;
713 type: {
714 enumeration: IEnumType;
715 };
716 };
717 axisStart: {
718 displayName: (IStringResourceProvider: any) => string;
719 description: (IStringResourceProvider: any) => string;
720 placeHolderText: (IStringResourceProvider: any) => string;
721 type: {
722 numeric: boolean;
723 };
724 suppressFormatPainterCopy: boolean;
725 };
726 axisStyle: {
727 displayName: (IStringResourceProvider: any) => string;
728 type: {
729 enumeration: IEnumType;
730 };
731 };
732 axisType: {
733 displayName: (IStringResourceProvider: any) => string;
734 type: {
735 enumeration: IEnumType;
736 };
737 };
738 backColor: {
739 displayName: (IStringResourceProvider: any) => string;
740 description: (IStringResourceProvider: any) => string;
741 type: {
742 fill: {
743 solid: {
744 color: boolean;
745 };
746 };
747 };
748 };
749 dataColor: {
750 displayName: (IStringResourceProvider: any) => string;
751 description: (IStringResourceProvider: any) => string;
752 type: {
753 fill: {
754 solid: {
755 color: boolean;
756 };
757 };
758 };
759 };
760 dataLabelColor: {
761 displayName: (IStringResourceProvider: any) => string;
762 description: (IStringResourceProvider: any) => string;
763 type: {
764 fill: {
765 solid: {
766 color: boolean;
767 };
768 };
769 };
770 };
771 dataLabelDecimalPoints: {
772 displayName: (IStringResourceProvider: any) => string;
773 placeHolderText: (IStringResourceProvider: any) => string;
774 type: {
775 numeric: boolean;
776 };
777 };
778 dataLabelDisplayUnits: {
779 displayName: (IStringResourceProvider: any) => string;
780 description: (IStringResourceProvider: any) => string;
781 type: {
782 formatting: {
783 labelDisplayUnits: boolean;
784 };
785 };
786 suppressFormatPainterCopy: boolean;
787 };
788 dataLabelHorizontalPosition: {
789 displayName: (IStringResourceProvider: any) => string;
790 description: (IStringResourceProvider: any) => string;
791 type: {
792 enumeration: IEnumType;
793 };
794 };
795 dataLabelShow: {
796 displayName: (IStringResourceProvider: any) => string;
797 description: (IStringResourceProvider: any) => string;
798 type: {
799 bool: boolean;
800 };
801 };
802 dataLabelVerticalPosition: {
803 displayName: (IStringResourceProvider: any) => string;
804 description: (IStringResourceProvider: any) => string;
805 type: {
806 enumeration: IEnumType;
807 };
808 };
809 defaultColor: {
810 displayName: (IStringResourceProvider: any) => string;
811 type: {
812 fill: {
813 solid: {
814 color: boolean;
815 };
816 };
817 };
818 };
819 fill: {
820 displayName: (IStringResourceProvider: any) => string;
821 type: {
822 fill: {
823 solid: {
824 color: boolean;
825 };
826 };
827 };
828 };
829 fontColor: {
830 displayName: (IStringResourceProvider: any) => string;
831 description: (IStringResourceProvider: any) => string;
832 type: {
833 fill: {
834 solid: {
835 color: boolean;
836 };
837 };
838 };
839 };
840 fontSize: {
841 displayName: (IStringResourceProvider: any) => string;
842 type: {
843 formatting: {
844 fontSize: boolean;
845 };
846 };
847 };
848 formatString: {
849 type: {
850 formatting: {
851 formatString: boolean;
852 };
853 };
854 };
855 image: {
856 type: {
857 image: {};
858 };
859 };
860 labelColor: {
861 displayName: (IStringResourceProvider: any) => string;
862 type: {
863 fill: {
864 solid: {
865 color: boolean;
866 };
867 };
868 };
869 };
870 labelDisplayUnits: {
871 displayName: (IStringResourceProvider: any) => string;
872 description: (IStringResourceProvider: any) => string;
873 type: {
874 formatting: {
875 labelDisplayUnits: boolean;
876 };
877 };
878 };
879 labelPrecision: {
880 displayName: (IStringResourceProvider: any) => string;
881 description: (IStringResourceProvider: any) => string;
882 placeHolderText: (IStringResourceProvider: any) => string;
883 type: {
884 numeric: boolean;
885 };
886 };
887 legendPosition: {
888 displayName: (IStringResourceProvider: any) => string;
889 description: (IStringResourceProvider: any) => string;
890 type: {
891 enumeration: IEnumType;
892 };
893 };
894 legendTitle: {
895 displayName: (IStringResourceProvider: any) => string;
896 description: (IStringResourceProvider: any) => string;
897 type: {
898 text: boolean;
899 };
900 };
901 lineColor: {
902 displayName: (IStringResourceProvider: any) => string;
903 description: (IStringResourceProvider: any) => string;
904 type: {
905 fill: {
906 solid: {
907 color: boolean;
908 };
909 };
910 };
911 };
912 outline: {
913 displayName: (IStringResourceProvider: any) => string;
914 type: {
915 enumeration: IEnumType;
916 };
917 };
918 outlineColor: {
919 displayName: (IStringResourceProvider: any) => string;
920 description: (IStringResourceProvider: any) => string;
921 type: {
922 fill: {
923 solid: {
924 color: boolean;
925 };
926 };
927 };
928 };
929 outlineWeight: {
930 displayName: (IStringResourceProvider: any) => string;
931 description: (IStringResourceProvider: any) => string;
932 type: {
933 numeric: boolean;
934 };
935 };
936 show: {
937 displayName: (IStringResourceProvider: any) => string;
938 type: {
939 bool: boolean;
940 };
941 };
942 showAllDataPoints: {
943 displayName: (IStringResourceProvider: any) => string;
944 type: {
945 bool: boolean;
946 };
947 };
948 showLegendTitle: {
949 displayName: (IStringResourceProvider: any) => string;
950 description: (IStringResourceProvider: any) => string;
951 type: {
952 bool: boolean;
953 };
954 };
955 referenceLinePosition: {
956 displayName: (IStringResourceProvider: any) => string;
957 description: (IStringResourceProvider: any) => string;
958 type: {
959 enumeration: IEnumType;
960 };
961 };
962 referenceLineStyle: {
963 displayName: (IStringResourceProvider: any) => string;
964 description: (IStringResourceProvider: any) => string;
965 type: {
966 enumeration: IEnumType;
967 };
968 };
969 transparency: {
970 displayName: (IStringResourceProvider: any) => string;
971 description: (IStringResourceProvider: any) => string;
972 type: {
973 numeric: boolean;
974 };
975 };
976 yAxisPosition: {
977 displayName: (IStringResourceProvider: any) => string;
978 description: (IStringResourceProvider: any) => string;
979 type: {
980 enumeration: IEnumType;
981 };
982 };
983 };
984}
985
986declare module powerbi.visuals {
987 const animatedTextObjectDescs: data.DataViewObjectDescriptors;
988 const animatedNumberCapabilities: VisualCapabilities;
989}
990
991declare module powerbi.visuals {
992 const basicShapeCapabilities: VisualCapabilities;
993 const basicShapeProps: {
994 general: {
995 shapeType: DataViewObjectPropertyIdentifier;
996 };
997 line: {
998 transparency: DataViewObjectPropertyIdentifier;
999 weight: DataViewObjectPropertyIdentifier;
1000 roundEdge: DataViewObjectPropertyIdentifier;
1001 lineColor: DataViewObjectPropertyIdentifier;
1002 };
1003 fill: {
1004 transparency: DataViewObjectPropertyIdentifier;
1005 fillColor: DataViewObjectPropertyIdentifier;
1006 show: DataViewObjectPropertyIdentifier;
1007 };
1008 rotation: {
1009 angle: DataViewObjectPropertyIdentifier;
1010 };
1011 };
1012}
1013
1014declare module powerbi.visuals {
1015 function getColumnChartCapabilities(transposeAxes?: boolean): VisualCapabilities;
1016 const columnChartProps: {
1017 dataPoint: {
1018 defaultColor: DataViewObjectPropertyIdentifier;
1019 fill: DataViewObjectPropertyIdentifier;
1020 showAllDataPoints: DataViewObjectPropertyIdentifier;
1021 };
1022 general: {
1023 formatString: DataViewObjectPropertyIdentifier;
1024 };
1025 categoryAxis: {
1026 axisType: DataViewObjectPropertyIdentifier;
1027 };
1028 legend: {
1029 labelColor: DataViewObjectPropertyIdentifier;
1030 };
1031 plotArea: {
1032 image: DataViewObjectPropertyIdentifier;
1033 transparency: DataViewObjectPropertyIdentifier;
1034 };
1035 };
1036}
1037
1038declare module powerbi.visuals {
1039 const comboChartCapabilities: VisualCapabilities;
1040 const comboChartProps: {
1041 general: {
1042 formatString: DataViewObjectPropertyIdentifier;
1043 };
1044 valueAxis: {
1045 secShow: DataViewObjectPropertyIdentifier;
1046 };
1047 legend: {
1048 labelColor: DataViewObjectPropertyIdentifier;
1049 };
1050 dataPoint: {
1051 showAllDataPoints: DataViewObjectPropertyIdentifier;
1052 };
1053 };
1054}
1055
1056declare module powerbi.visuals {
1057 const donutChartCapabilities: VisualCapabilities;
1058 const donutChartProps: {
1059 general: {
1060 formatString: DataViewObjectPropertyIdentifier;
1061 };
1062 dataPoint: {
1063 defaultColor: DataViewObjectPropertyIdentifier;
1064 fill: DataViewObjectPropertyIdentifier;
1065 };
1066 legend: {
1067 show: DataViewObjectPropertyIdentifier;
1068 position: DataViewObjectPropertyIdentifier;
1069 showTitle: DataViewObjectPropertyIdentifier;
1070 titleText: DataViewObjectPropertyIdentifier;
1071 labelColor: DataViewObjectPropertyIdentifier;
1072 };
1073 };
1074}
1075
1076declare module powerbi.visuals {
1077 const dataDotChartCapabilities: VisualCapabilities;
1078}
1079
1080declare module powerbi.visuals {
1081 const filledMapCapabilities: VisualCapabilities;
1082 const filledMapProps: {
1083 general: {
1084 formatString: DataViewObjectPropertyIdentifier;
1085 };
1086 dataPoint: {
1087 defaultColor: DataViewObjectPropertyIdentifier;
1088 fill: DataViewObjectPropertyIdentifier;
1089 showAllDataPoints: DataViewObjectPropertyIdentifier;
1090 };
1091 legend: {
1092 show: DataViewObjectPropertyIdentifier;
1093 position: DataViewObjectPropertyIdentifier;
1094 showTitle: DataViewObjectPropertyIdentifier;
1095 titleText: DataViewObjectPropertyIdentifier;
1096 };
1097 labels: {
1098 show: DataViewObjectPropertyIdentifier;
1099 color: DataViewObjectPropertyIdentifier;
1100 labelDisplayUnits: DataViewObjectPropertyIdentifier;
1101 labelPrecision: DataViewObjectPropertyIdentifier;
1102 };
1103 categoryLabels: {
1104 show: DataViewObjectPropertyIdentifier;
1105 };
1106 };
1107}
1108
1109declare module powerbi.visuals {
1110 const funnelChartCapabilities: VisualCapabilities;
1111 const funnelChartProps: {
1112 general: {
1113 formatString: DataViewObjectPropertyIdentifier;
1114 };
1115 dataPoint: {
1116 defaultColor: DataViewObjectPropertyIdentifier;
1117 fill: DataViewObjectPropertyIdentifier;
1118 };
1119 };
1120}
1121
1122declare module powerbi.visuals {
1123 const gaugeRoleNames: {
1124 y: string;
1125 minValue: string;
1126 maxValue: string;
1127 targetValue: string;
1128 };
1129 const gaugeCapabilities: VisualCapabilities;
1130 const gaugeProps: {
1131 dataPoint: {
1132 fill: DataViewObjectPropertyIdentifier;
1133 target: DataViewObjectPropertyIdentifier;
1134 };
1135 };
1136}
1137
1138declare module powerbi.visuals {
1139 const imageVisualCapabilities: VisualCapabilities;
1140}
1141
1142declare module powerbi.visuals {
1143 var scriptVisualCapabilities: VisualCapabilities;
1144}
1145
1146declare module powerbi.visuals.samples {
1147 var consoleWriterCapabilities: VisualCapabilities;
1148}
1149
1150declare module powerbi.visuals.samples {
1151 class ConsoleWriter implements IVisual {
1152 static converter(dataView: DataView): any;
1153 init(options: VisualInitOptions): void;
1154 onResizing(viewport: IViewport): void;
1155 update(options: VisualUpdateOptions): void;
1156 }
1157}
1158
1159declare module powerbi.visuals {
1160 const lineChartCapabilities: VisualCapabilities;
1161 const lineChartProps: {
1162 general: {
1163 formatString: DataViewObjectPropertyIdentifier;
1164 };
1165 dataPoint: {
1166 defaultColor: DataViewObjectPropertyIdentifier;
1167 fill: DataViewObjectPropertyIdentifier;
1168 };
1169 trend: {
1170 show: DataViewObjectPropertyIdentifier;
1171 };
1172 scalarKey: {
1173 scalarKeyMin: DataViewObjectPropertyIdentifier;
1174 };
1175 categoryAxis: {
1176 axisType: DataViewObjectPropertyIdentifier;
1177 };
1178 legend: {
1179 labelColor: DataViewObjectPropertyIdentifier;
1180 };
1181 labels: {
1182 labelDensity: DataViewObjectPropertyIdentifier;
1183 };
1184 plotArea: {
1185 image: DataViewObjectPropertyIdentifier;
1186 transparency: DataViewObjectPropertyIdentifier;
1187 };
1188 };
1189}
1190
1191declare module powerbi.visuals {
1192 const mapCapabilities: VisualCapabilities;
1193 const mapProps: {
1194 general: {
1195 formatString: DataViewObjectPropertyIdentifier;
1196 };
1197 dataPoint: {
1198 defaultColor: DataViewObjectPropertyIdentifier;
1199 fill: DataViewObjectPropertyIdentifier;
1200 showAllDataPoints: DataViewObjectPropertyIdentifier;
1201 };
1202 legend: {
1203 show: DataViewObjectPropertyIdentifier;
1204 position: DataViewObjectPropertyIdentifier;
1205 showTitle: DataViewObjectPropertyIdentifier;
1206 titleText: DataViewObjectPropertyIdentifier;
1207 };
1208 };
1209}
1210
1211declare module powerbi.visuals {
1212 const multiRowCardCapabilities: VisualCapabilities;
1213 const multiRowCardProps: {
1214 card: {
1215 outline: DataViewObjectPropertyIdentifier;
1216 outlineColor: DataViewObjectPropertyIdentifier;
1217 outlineWeight: DataViewObjectPropertyIdentifier;
1218 barShow: DataViewObjectPropertyIdentifier;
1219 barColor: DataViewObjectPropertyIdentifier;
1220 barWeight: DataViewObjectPropertyIdentifier;
1221 cardPadding: DataViewObjectPropertyIdentifier;
1222 cardBackground: DataViewObjectPropertyIdentifier;
1223 };
1224 };
1225}
1226
1227declare module powerbi.visuals {
1228 const textboxCapabilities: VisualCapabilities;
1229}
1230
1231declare module powerbi.visuals {
1232 const cheerMeterCapabilities: VisualCapabilities;
1233}
1234
1235declare module powerbi.visuals {
1236 const scatterChartCapabilities: VisualCapabilities;
1237 const scatterChartProps: {
1238 general: {
1239 formatString: DataViewObjectPropertyIdentifier;
1240 };
1241 dataPoint: {
1242 defaultColor: DataViewObjectPropertyIdentifier;
1243 fill: DataViewObjectPropertyIdentifier;
1244 };
1245 trend: {
1246 show: DataViewObjectPropertyIdentifier;
1247 };
1248 colorBorder: {
1249 show: DataViewObjectPropertyIdentifier;
1250 };
1251 fillPoint: {
1252 show: DataViewObjectPropertyIdentifier;
1253 };
1254 colorByCategory: {
1255 show: DataViewObjectPropertyIdentifier;
1256 };
1257 currentFrameIndex: {
1258 index: DataViewObjectPropertyIdentifier;
1259 };
1260 legend: {
1261 labelColor: DataViewObjectPropertyIdentifier;
1262 };
1263 plotArea: {
1264 image: DataViewObjectPropertyIdentifier;
1265 transparency: DataViewObjectPropertyIdentifier;
1266 };
1267 };
1268}
1269
1270declare module powerbi.visuals {
1271 const slicerCapabilities: VisualCapabilities;
1272 const slicerProps: {
1273 general: {
1274 outlineColor: DataViewObjectPropertyIdentifier;
1275 outlineWeight: DataViewObjectPropertyIdentifier;
1276 orientation: DataViewObjectPropertyIdentifier;
1277 count: DataViewObjectPropertyIdentifier;
1278 selfFilterEnabled: DataViewObjectPropertyIdentifier;
1279 };
1280 selection: {
1281 selectAllCheckboxEnabled: DataViewObjectPropertyIdentifier;
1282 singleSelect: DataViewObjectPropertyIdentifier;
1283 };
1284 header: {
1285 show: DataViewObjectPropertyIdentifier;
1286 fontColor: DataViewObjectPropertyIdentifier;
1287 background: DataViewObjectPropertyIdentifier;
1288 outline: DataViewObjectPropertyIdentifier;
1289 textSize: DataViewObjectPropertyIdentifier;
1290 };
1291 items: {
1292 fontColor: DataViewObjectPropertyIdentifier;
1293 background: DataViewObjectPropertyIdentifier;
1294 outline: DataViewObjectPropertyIdentifier;
1295 textSize: DataViewObjectPropertyIdentifier;
1296 };
1297 filterPropertyIdentifier: DataViewObjectPropertyIdentifier;
1298 selfFilterPropertyIdentifier: DataViewObjectPropertyIdentifier;
1299 formatString: DataViewObjectPropertyIdentifier;
1300 defaultValue: DataViewObjectPropertyIdentifier;
1301 };
1302}
1303
1304declare module powerbi.visuals {
1305 const tableCapabilities: VisualCapabilities;
1306}
1307
1308declare module powerbi.visuals {
1309 const matrixRoleNames: {
1310 rows: string;
1311 columns: string;
1312 values: string;
1313 };
1314 const matrixCapabilities: VisualCapabilities;
1315}
1316
1317declare module powerbi.visuals {
1318 const treemapRoles: {
1319 group: string;
1320 details: string;
1321 values: string;
1322 gradient: string;
1323 };
1324 const treemapCapabilities: VisualCapabilities;
1325 const treemapProps: {
1326 general: {
1327 formatString: DataViewObjectPropertyIdentifier;
1328 };
1329 dataPoint: {
1330 fill: DataViewObjectPropertyIdentifier;
1331 };
1332 legend: {
1333 show: DataViewObjectPropertyIdentifier;
1334 position: DataViewObjectPropertyIdentifier;
1335 showTitle: DataViewObjectPropertyIdentifier;
1336 titleText: DataViewObjectPropertyIdentifier;
1337 labelColor: DataViewObjectPropertyIdentifier;
1338 };
1339 labels: {
1340 show: DataViewObjectPropertyIdentifier;
1341 color: DataViewObjectPropertyIdentifier;
1342 labelDisplayUnits: DataViewObjectPropertyIdentifier;
1343 labelPrecision: DataViewObjectPropertyIdentifier;
1344 };
1345 categoryLabels: {
1346 show: DataViewObjectPropertyIdentifier;
1347 };
1348 };
1349}
1350
1351declare module powerbi.visuals {
1352 const cardCapabilities: VisualCapabilities;
1353 var cardProps: {
1354 categoryLabels: {
1355 show: DataViewObjectPropertyIdentifier;
1356 color: DataViewObjectPropertyIdentifier;
1357 fontSize: DataViewObjectPropertyIdentifier;
1358 };
1359 labels: {
1360 color: DataViewObjectPropertyIdentifier;
1361 labelPrecision: DataViewObjectPropertyIdentifier;
1362 labelDisplayUnits: DataViewObjectPropertyIdentifier;
1363 fontSize: DataViewObjectPropertyIdentifier;
1364 };
1365 wordWrap: {
1366 show: DataViewObjectPropertyIdentifier;
1367 };
1368 };
1369}
1370
1371declare module powerbi.visuals {
1372 const waterfallChartCapabilities: VisualCapabilities;
1373 const waterfallChartProps: {
1374 general: {
1375 formatString: DataViewObjectPropertyIdentifier;
1376 };
1377 sentimentColors: {
1378 increaseFill: DataViewObjectPropertyIdentifier;
1379 decreaseFill: DataViewObjectPropertyIdentifier;
1380 totalFill: DataViewObjectPropertyIdentifier;
1381 };
1382 legend: {
1383 labelColor: DataViewObjectPropertyIdentifier;
1384 };
1385 };
1386}
1387
1388declare module powerbi.visuals {
1389 const KPIStatusWithHistoryCapabilities: VisualCapabilities;
1390}
1391
1392declare module powerbi.visuals.capabilities {
1393 let animatedNumber: VisualCapabilities;
1394 let areaChart: VisualCapabilities;
1395 let barChart: VisualCapabilities;
1396 let card: VisualCapabilities;
1397 let multiRowCard: VisualCapabilities;
1398 let clusteredBarChart: VisualCapabilities;
1399 let clusteredColumnChart: VisualCapabilities;
1400 let columnChart: VisualCapabilities;
1401 let comboChart: VisualCapabilities;
1402 let dataDotChart: VisualCapabilities;
1403 let dataDotClusteredColumnComboChart: VisualCapabilities;
1404 let dataDotStackedColumnComboChart: VisualCapabilities;
1405 let donutChart: VisualCapabilities;
1406 let funnel: VisualCapabilities;
1407 let gauge: VisualCapabilities;
1408 let hundredPercentStackedBarChart: VisualCapabilities;
1409 let hundredPercentStackedColumnChart: VisualCapabilities;
1410 let image: VisualCapabilities;
1411 let lineChart: VisualCapabilities;
1412 let lineStackedColumnComboChart: VisualCapabilities;
1413 let lineClusteredColumnComboChart: VisualCapabilities;
1414 let map: VisualCapabilities;
1415 let filledMap: VisualCapabilities;
1416 let treemap: VisualCapabilities;
1417 let pieChart: VisualCapabilities;
1418 let scatterChart: VisualCapabilities;
1419 let table: VisualCapabilities;
1420 let matrix: VisualCapabilities;
1421 let slicer: VisualCapabilities;
1422 let textbox: VisualCapabilities;
1423 let waterfallChart: VisualCapabilities;
1424 let cheerMeter: VisualCapabilities;
1425 let scriptVisual: VisualCapabilities;
1426 let kpi: VisualCapabilities;
1427}
1428
1429declare module powerbi.visuals {
1430 interface ColumnBehaviorOptions {
1431 datapoints: SelectableDataPoint[];
1432 bars: D3.Selection;
1433 eventGroup: D3.Selection;
1434 mainGraphicsContext: D3.Selection;
1435 hasHighlights: boolean;
1436 viewport: IViewport;
1437 axisOptions: ColumnAxisOptions;
1438 showLabel: boolean;
1439 }
1440 class ColumnChartWebBehavior implements IInteractiveBehavior {
1441 private options;
1442 bindEvents(options: ColumnBehaviorOptions, selectionHandler: ISelectionHandler): void;
1443 renderSelection(hasSelection: boolean): void;
1444 private static getDatumForLastInputEvent();
1445 }
1446}
1447
1448declare module powerbi.visuals {
1449 interface DataDotChartBehaviorOptions {
1450 dots: D3.Selection;
1451 dotLabels: D3.Selection;
1452 isPartOfCombo?: boolean;
1453 datapoints?: DataDotChartDataPoint[];
1454 }
1455 class DataDotChartWebBehavior implements IInteractiveBehavior {
1456 private dots;
1457 bindEvents(options: DataDotChartBehaviorOptions, selectionHandler: ISelectionHandler): void;
1458 renderSelection(hasSelection: boolean): void;
1459 }
1460}
1461
1462declare module powerbi.visuals {
1463 interface DonutBehaviorOptions {
1464 slices: D3.Selection;
1465 highlightSlices: D3.Selection;
1466 clearCatcher: D3.Selection;
1467 hasHighlights: boolean;
1468 allowDrilldown: boolean;
1469 visual: IVisual;
1470 }
1471 class DonutChartWebBehavior implements IInteractiveBehavior {
1472 private slices;
1473 private highlightSlices;
1474 private hasHighlights;
1475 bindEvents(options: DonutBehaviorOptions, selectionHandler: ISelectionHandler): void;
1476 renderSelection(hasSelection: boolean): void;
1477 }
1478}
1479
1480declare module powerbi.visuals {
1481 interface FunnelBehaviorOptions {
1482 bars: D3.Selection;
1483 interactors: D3.Selection;
1484 clearCatcher: D3.Selection;
1485 hasHighlights: boolean;
1486 }
1487 class FunnelWebBehavior implements IInteractiveBehavior {
1488 private bars;
1489 private interactors;
1490 private hasHighlights;
1491 bindEvents(options: FunnelBehaviorOptions, selectionHandler: ISelectionHandler): void;
1492 renderSelection(hasSelection: boolean): void;
1493 }
1494}
1495
1496declare module powerbi.visuals {
1497 interface PlayBehaviorOptions {
1498 traceLineRenderer?: ITraceLineRenderer;
1499 }
1500}
1501
1502declare module powerbi.visuals {
1503 interface LineChartBehaviorOptions {
1504 lines: D3.Selection;
1505 interactivityLines: D3.Selection;
1506 dots: D3.Selection;
1507 areas: D3.Selection;
1508 isPartOfCombo?: boolean;
1509 tooltipOverlay: D3.Selection;
1510 }
1511 class LineChartWebBehavior implements IInteractiveBehavior {
1512 private lines;
1513 private dots;
1514 private areas;
1515 private tooltipOverlay;
1516 bindEvents(options: LineChartBehaviorOptions, selectionHandler: ISelectionHandler): void;
1517 renderSelection(hasSelection: boolean): void;
1518 }
1519}
1520
1521declare module powerbi.visuals {
1522 interface MapBehaviorOptions {
1523 dataPoints: SelectableDataPoint[];
1524 bubbles?: D3.Selection;
1525 slices?: D3.Selection;
1526 shapes?: D3.Selection;
1527 clearCatcher: D3.Selection;
1528 bubbleEventGroup?: D3.Selection;
1529 sliceEventGroup?: D3.Selection;
1530 shapeEventGroup?: D3.Selection;
1531 }
1532 class MapBehavior implements IInteractiveBehavior {
1533 private bubbles;
1534 private slices;
1535 private shapes;
1536 private mapPointerEventsDisabled;
1537 private mapPointerTimeoutSet;
1538 private viewChangedSinceLastClearMouseDown;
1539 private receivedZoomOrPanEvent;
1540 bindEvents(options: MapBehaviorOptions, selectionHandler: ISelectionHandler): void;
1541 renderSelection(hasSelection: boolean): void;
1542 viewChanged(): void;
1543 resetZoomPan(): void;
1544 hasReceivedZoomOrPanEvent(): boolean;
1545 }
1546}
1547
1548declare module powerbi.visuals {
1549 interface ScatterBehaviorChartData {
1550 xCol: DataViewMetadataColumn;
1551 yCol: DataViewMetadataColumn;
1552 dataPoints: ScatterChartDataPoint[];
1553 legendData: LegendData;
1554 axesLabels: ChartAxesLabels;
1555 size?: DataViewMetadataColumn;
1556 sizeRange: NumberRange;
1557 fillPoint?: boolean;
1558 colorBorder?: boolean;
1559 }
1560 interface ScatterBehaviorOptions {
1561 dataPointsSelection: D3.Selection;
1562 eventGroup?: D3.Selection;
1563 data: ScatterBehaviorChartData;
1564 plotContext: D3.Selection;
1565 playOptions?: PlayBehaviorOptions;
1566 }
1567 interface ScatterMobileBehaviorOptions extends ScatterBehaviorOptions {
1568 host: ICartesianVisualHost;
1569 root: D3.Selection;
1570 background: D3.Selection;
1571 visualInitOptions: VisualInitOptions;
1572 xAxisProperties: IAxisProperties;
1573 yAxisProperties: IAxisProperties;
1574 }
1575 class ScatterChartWebBehavior implements IInteractiveBehavior {
1576 private bubbles;
1577 private shouldEnableFill;
1578 private colorBorder;
1579 private playOptions;
1580 bindEvents(options: ScatterBehaviorOptions, selectionHandler: ISelectionHandler): void;
1581 renderSelection(hasSelection: boolean): void;
1582 }
1583 const enum DragType {
1584 Drag = 0,
1585 DragEnd = 1,
1586 }
1587 class ScatterChartMobileBehavior implements IInteractiveBehavior {
1588 private static CrosshairClassName;
1589 private static ScatterChartCircleTagName;
1590 private static DotClassName;
1591 private static DotClassSelector;
1592 private static Horizontal;
1593 private static Vertical;
1594 private host;
1595 private mainGraphicsContext;
1596 private data;
1597 private crosshair;
1598 private crosshairHorizontal;
1599 private crosshairVertical;
1600 private lastDotIndex;
1601 private xAxisProperties;
1602 private yAxisProperties;
1603 bindEvents(options: ScatterMobileBehaviorOptions, selectionHandler: ISelectionHandler): void;
1604 renderSelection(HasSelection: boolean): void;
1605 setSelectionHandler(selectionHandler: ISelectionHandler): void;
1606 private makeDataPointsSelectable(...selection);
1607 private makeRootSelectable(selection);
1608 private makeDragable(...selection);
1609 private disableDefaultTouchInteractions(selection);
1610 setOptions(options: ScatterMobileBehaviorOptions): void;
1611 private select(index);
1612 selectRoot(): void;
1613 drag(t: DragType): void;
1614 private onDrag();
1615 private onClick();
1616 private getMouseCoordinates();
1617 private selectDotByIndex(index);
1618 private selectDot(dotIndex);
1619 private moveCrosshairToIndexDot(index);
1620 private moveCrosshairToXY(x, y);
1621 private drawCrosshair(addTo, x, y, width, height);
1622 private findClosestDotIndex(x, y);
1623 private updateLegend(dotIndex);
1624 private createLegendDataPoints(dotIndex);
1625 }
1626}
1627
1628declare module powerbi.visuals {
1629 interface HorizontalSlicerBehaviorOptions extends SlicerBehaviorOptions {
1630 itemsContainer: D3.Selection;
1631 }
1632 class HorizontalSlicerWebBehavior implements IInteractiveBehavior {
1633 private itemLabels;
1634 private dataPoints;
1635 private interactivityService;
1636 private slicerSettings;
1637 bindEvents(options: HorizontalSlicerBehaviorOptions, selectionHandler: ISelectionHandler): void;
1638 renderSelection(hasSelection: boolean): void;
1639 }
1640}
1641
1642declare module powerbi.visuals {
1643 interface VerticalSlicerBehaviorOptions extends SlicerBehaviorOptions {
1644 itemContainers: D3.Selection;
1645 itemInputs: D3.Selection;
1646 searchInput: D3.Selection;
1647 }
1648 class VerticalSlicerWebBehavior implements IInteractiveBehavior {
1649 private itemLabels;
1650 private itemInputs;
1651 private dataPoints;
1652 private interactivityService;
1653 private settings;
1654 bindEvents(options: VerticalSlicerBehaviorOptions, selectionHandler: ISelectionHandler): void;
1655 renderSelection(hasSelection: boolean): void;
1656 }
1657}
1658
1659declare module powerbi.visuals {
1660 interface SlicerOrientationBehaviorOptions {
1661 behaviorOptions: SlicerBehaviorOptions;
1662 orientation: slicerOrientation.Orientation;
1663 }
1664 interface SlicerBehaviorOptions {
1665 slicerContainer: D3.Selection;
1666 itemLabels: D3.Selection;
1667 clear: D3.Selection;
1668 dataPoints: SlicerDataPoint[];
1669 interactivityService: IInteractivityService;
1670 settings: SlicerSettings;
1671 slicerValueHandler: SlicerValueHandler;
1672 }
1673 class SlicerWebBehavior implements IInteractiveBehavior {
1674 private behavior;
1675 private static searchInputTimeoutDuration;
1676 bindEvents(options: SlicerOrientationBehaviorOptions, selectionHandler: ISelectionHandler): void;
1677 renderSelection(hasSelection: boolean): void;
1678 static bindSlicerEvents(slicerContainer: D3.Selection, slicers: D3.Selection, slicerClear: D3.Selection, selectionHandler: ISelectionHandler, slicerSettings: SlicerSettings, interactivityService: IInteractivityService, slicerValueHandler: SlicerValueHandler, slicerSearch?: D3.Selection): void;
1679 static setSelectionOnSlicerItems(selectableItems: D3.Selection, itemLabel: D3.Selection, hasSelection: boolean, interactivityService: IInteractivityService, slicerSettings: SlicerSettings): void;
1680 static styleSlicerItems(slicerItems: D3.Selection, hasSelection: boolean, isSelectionInverted: boolean): void;
1681 private static bindSlicerItemSelectionEvent(slicers, selectionHandler, slicerSettings, interactivityService);
1682 private static bindSlicerClearEvent(slicerClear, selectionHandler);
1683 private static bindSlicerSearchEvent(slicerSearch, selectionHandler, slicerValueHandler);
1684 private static startSearch(slicerSearch, selectionHandler, slicerValueHandler);
1685 private static styleSlicerContainer(slicerContainer, interactivityService);
1686 private static isMultiSelect(event, settings, interactivityService);
1687 private createWebBehavior(options);
1688 }
1689}
1690
1691declare module powerbi.visuals {
1692 interface LegendBehaviorOptions {
1693 legendItems: D3.Selection;
1694 legendIcons: D3.Selection;
1695 clearCatcher: D3.Selection;
1696 }
1697 class LegendBehavior implements IInteractiveBehavior {
1698 static dimmedLegendColor: string;
1699 private legendIcons;
1700 bindEvents(options: LegendBehaviorOptions, selectionHandler: ISelectionHandler): void;
1701 renderSelection(hasSelection: boolean): void;
1702 }
1703}
1704
1705declare module powerbi.visuals {
1706 interface TreemapBehaviorOptions {
1707 shapes: D3.Selection;
1708 highlightShapes: D3.Selection;
1709 majorLabels: D3.Selection;
1710 minorLabels: D3.Selection;
1711 nodes: TreemapNode[];
1712 hasHighlights: boolean;
1713 }
1714 class TreemapWebBehavior implements IInteractiveBehavior {
1715 private shapes;
1716 private highlightShapes;
1717 private hasHighlights;
1718 bindEvents(options: TreemapBehaviorOptions, selectionHandler: ISelectionHandler): void;
1719 renderSelection(hasSelection: boolean): void;
1720 }
1721}
1722
1723declare module powerbi.visuals {
1724 interface WaterfallChartBehaviorOptions {
1725 bars: D3.Selection;
1726 }
1727 class WaterfallChartWebBehavior {
1728 private bars;
1729 bindEvents(options: WaterfallChartBehaviorOptions, selectionHandler: ISelectionHandler): void;
1730 renderSelection(hasSelection: boolean): void;
1731 }
1732}
1733
1734declare module powerbi.visuals {
1735 interface LabelsBehaviorOptions {
1736 labelItems: D3.Selection;
1737 }
1738 class LabelsBehavior implements IInteractiveBehavior {
1739 static DefaultLabelOpacity: number;
1740 static DimmedLabelOpacity: number;
1741 private labelItems;
1742 bindEvents(options: LabelsBehaviorOptions, selectionHandler: ISelectionHandler): void;
1743 renderSelection(hasSelection: boolean): void;
1744 }
1745}
1746
1747declare module powerbi.visuals {
1748 interface CartesianBehaviorOptions {
1749 layerOptions: any[];
1750 clearCatcher: D3.Selection;
1751 }
1752 class CartesianChartBehavior implements IInteractiveBehavior {
1753 private behaviors;
1754 constructor(behaviors: IInteractiveBehavior[]);
1755 bindEvents(options: CartesianBehaviorOptions, selectionHandler: ISelectionHandler): void;
1756 renderSelection(hasSelection: boolean): void;
1757 }
1758}
1759
1760declare module powerbi.visuals {
1761 interface VisualConfig {
1762 visualType: string;
1763 projections: data.QueryProjectionsByRole[];
1764 /**
1765 * This is the one that has info like Total, Combochart viz types, legend settings, etc...
1766 * Each IVisual implementation, should simply cast this to whatever object they expect.
1767 */
1768 config?: any;
1769 }
1770}
1771
1772declare module powerbi.visuals {
1773 import ITextAsSVGMeasurer = powerbi.ITextAsSVGMeasurer;
1774 /**
1775 * Default ranges are for when we have a field chosen for the axis,
1776 * but no values are returned by the query.
1777 */
1778 const emptyDomain: number[];
1779 interface IAxisProperties {
1780 /**
1781 * The D3 Scale object.
1782 */
1783 scale: D3.Scale.GenericScale<any>;
1784 /**
1785 * The D3 Axis object.
1786 */
1787 axis: D3.Svg.Axis;
1788 /**
1789 * An array of the tick values to display for this axis.
1790 */
1791 values: any[];
1792 /**
1793 * The ValueType of the column used for this axis.
1794 */
1795 axisType: ValueType;
1796 /**
1797 * A formatter with appropriate properties configured for this field.
1798 */
1799 formatter: IValueFormatter;
1800 /**
1801 * The axis title label.
1802 */
1803 axisLabel: string;
1804 /**
1805 * Cartesian axes are either a category or value axis.
1806 */
1807 isCategoryAxis: boolean;
1808 /**
1809 * (optional) The max width for category tick label values. used for ellipsis truncation / label rotation.
1810 */
1811 xLabelMaxWidth?: number;
1812 /**
1813 * (optional) The thickness of each category on the axis.
1814 */
1815 categoryThickness?: number;
1816 /**
1817 * (optional) The outer padding in pixels applied to the D3 scale.
1818 */
1819 outerPadding?: number;
1820 /**
1821 * (optional) Whether we are using a default domain.
1822 */
1823 usingDefaultDomain?: boolean;
1824 /**
1825 * (optional) do default d3 axis labels fit?
1826 */
1827 willLabelsFit?: boolean;
1828 /**
1829 * (optional) word break axis labels
1830 */
1831 willLabelsWordBreak?: boolean;
1832 /**
1833 * (optional) Whether log scale is possible on the current domain.
1834 */
1835 isLogScaleAllowed?: boolean;
1836 /**
1837 * (optional) Whether domain contains zero value and log scale is enabled.
1838 */
1839 hasDisallowedZeroInDomain?: boolean;
1840 /**
1841 *(optional) The original data domain. Linear scales use .nice() to round to cleaner edge values. Keep the original data domain for later.
1842 */
1843 dataDomain?: number[];
1844 /**
1845 * (optional) The D3 graphics context for this axis
1846 */
1847 graphicsContext?: D3.Selection;
1848 }
1849 interface IMargin {
1850 top: number;
1851 bottom: number;
1852 left: number;
1853 right: number;
1854 }
1855 interface CreateAxisOptions {
1856 /**
1857 * The dimension length for the axis, in pixels.
1858 */
1859 pixelSpan: number;
1860 /**
1861 * The data domain. [min, max] for a scalar axis, or [1...n] index array for ordinal.
1862 */
1863 dataDomain: number[];
1864 /**
1865 * The DataViewMetadataColumn will be used for dataType and tick value formatting.
1866 */
1867 metaDataColumn: DataViewMetadataColumn;
1868 /**
1869 * The format string.
1870 */
1871 formatString: string;
1872 /**
1873 * outerPadding to be applied to the axis.
1874 */
1875 outerPadding: number;
1876 /**
1877 * Indicates if this is the category axis.
1878 */
1879 isCategoryAxis?: boolean;
1880 /**
1881 * If true and the dataType is numeric or dateTime,
1882 * create a linear axis, else create an ordinal axis.
1883 */
1884 isScalar?: boolean;
1885 /**
1886 * (optional) The scale is inverted for a vertical axis,
1887 * and different optimizations are made for tick labels.
1888 */
1889 isVertical?: boolean;
1890 /**
1891 * (optional) For visuals that do not need zero (e.g. column/bar) use tickInterval.
1892 */
1893 useTickIntervalForDisplayUnits?: boolean;
1894 /**
1895 * (optional) Combo charts can override the tick count to
1896 * align y1 and y2 grid lines.
1897 */
1898 forcedTickCount?: number;
1899 /**
1900 * (optional) For scalar axis with scalar keys, the number of ticks should never exceed the number of scalar keys,
1901 * or labeling will look wierd (i.e. level of detail is Year, but month labels are shown between years)
1902 */
1903 maxTickCount?: number;
1904 /**
1905 * (optional) Callback for looking up actual values from indices,
1906 * used when formatting tick labels.
1907 */
1908 getValueFn?: (index: number, type: ValueType) => any;
1909 /**
1910 * (optional) The width/height of each category on the axis.
1911 */
1912 categoryThickness?: number;
1913 /** (optional) the scale type of the axis. e.g. log, linear */
1914 scaleType?: string;
1915 /** (optional) user selected display units */
1916 axisDisplayUnits?: number;
1917 /** (optional) user selected precision */
1918 axisPrecision?: number;
1919 /** (optional) for 100 percent stacked charts, causes formatString override and minTickInterval adjustments */
1920 is100Pct?: boolean;
1921 /** (optional) sets clamping on the D3 scale, useful for drawing column chart rectangles as it simplifies the math during layout */
1922 shouldClamp?: boolean;
1923 }
1924 interface CreateScaleResult {
1925 scale: D3.Scale.GenericScale<any>;
1926 bestTickCount: number;
1927 usingDefaultDomain?: boolean;
1928 }
1929 interface TickLabelMargins {
1930 xMax: number;
1931 yLeft: number;
1932 yRight: number;
1933 }
1934 module AxisHelper {
1935 function getRecommendedNumberOfTicksForXAxis(availableWidth: number): number;
1936 function getRecommendedNumberOfTicksForYAxis(availableWidth: number): number;
1937 /**
1938 * Get the best number of ticks based on minimum value, maximum value,
1939 * measure metadata and max tick count.
1940 *
1941 * @param min The minimum of the data domain.
1942 * @param max The maximum of the data domain.
1943 * @param valuesMetadata The measure metadata array.
1944 * @param maxTickCount The max count of intervals.
1945 * @param isDateTime - flag to show single tick when min is equal to max.
1946 */
1947 function getBestNumberOfTicks(min: number, max: number, valuesMetadata: DataViewMetadataColumn[], maxTickCount: number, isDateTime?: boolean): number;
1948 function hasNonIntegerData(valuesMetadata: DataViewMetadataColumn[]): boolean;
1949 function getRecommendedTickValues(maxTicks: number, scale: D3.Scale.GenericScale<any>, axisType: ValueType, isScalar: boolean, minTickInterval?: number): any[];
1950 function getRecommendedTickValuesForAnOrdinalRange(maxTicks: number, labels: string[]): string[];
1951 function getRecommendedTickValuesForAQuantitativeRange(maxTicks: number, scale: D3.Scale.GenericScale<any>, minInterval?: number): number[];
1952 function getMargin(availableWidth: number, availableHeight: number, xMargin: number, yMargin: number): IMargin;
1953 function getTickLabelMargins(viewport: IViewport, yMarginLimit: number, textWidthMeasurer: ITextAsSVGMeasurer, textHeightMeasurer: ITextAsSVGMeasurer, axes: CartesianAxisProperties, bottomMarginLimit: number, properties: TextProperties, scrollbarVisible?: boolean, showOnRight?: boolean, renderXAxis?: boolean, renderY1Axis?: boolean, renderY2Axis?: boolean): TickLabelMargins;
1954 function columnDataTypeHasValue(dataType: ValueTypeDescriptor): boolean;
1955 function createOrdinalType(): ValueType;
1956 function isOrdinal(type: ValueTypeDescriptor): boolean;
1957 function isOrdinalScale(scale: any): boolean;
1958 function isDateTime(type: ValueTypeDescriptor): boolean;
1959 function invertScale(scale: any, x: any): any;
1960 function extent(scale: any): number[];
1961 function invertOrdinalScale(scale: D3.Scale.OrdinalScale, x: number): any;
1962 function findClosestXAxisIndex(categoryValue: number, categoryAxisValues: CartesianDataPoint[]): number;
1963 function lookupOrdinalIndex(scale: D3.Scale.OrdinalScale, pixelValue: number): number;
1964 /** scale(value1) - scale(value2) with zero checking and min(+/-1, result) */
1965 function diffScaled(scale: D3.Scale.GenericScale<any>, value1: any, value2: any): number;
1966 function createDomain(data: CartesianSeries[], axisType: ValueTypeDescriptor, isScalar: boolean, forcedScalarDomain: any[], ensureDomain?: NumberRange): number[];
1967 function ensureValuesInRange(values: number[], min: number, max: number): number[];
1968 /**
1969 * Gets the ValueType of a category column, defaults to Text if the type is not present.
1970 */
1971 function getCategoryValueType(metadataColumn: DataViewMetadataColumn, isScalar?: boolean): ValueType;
1972 /**
1973 * Create a D3 axis including scale. Can be vertical or horizontal, and either datetime, numeric, or text.
1974 * @param options The properties used to create the axis.
1975 */
1976 function createAxis(options: CreateAxisOptions): IAxisProperties;
1977 function createScale(options: CreateAxisOptions): CreateScaleResult;
1978 function createFormatter(scaleDomain: any[], dataDomain: any[], dataType: any, isScalar: boolean, formatString: string, bestTickCount: number, tickValues: any[], getValueFn: any, useTickIntervalForDisplayUnits?: boolean, axisDisplayUnits?: number, axisPrecision?: number): IValueFormatter;
1979 function getMinTickValueInterval(formatString: string, columnType: ValueType, is100Pct?: boolean): number;
1980 /**
1981 * Creates a [min,max] from your Cartiesian data values.
1982 *
1983 * @param data The series array of CartesianDataPoints.
1984 * @param includeZero Columns and bars includeZero, line and scatter do not.
1985 */
1986 function createValueDomain(data: CartesianSeries[], includeZero: boolean): number[];
1987 module LabelLayoutStrategy {
1988 function willLabelsFit(axisProperties: IAxisProperties, availableWidth: number, textMeasurer: ITextAsSVGMeasurer, properties: TextProperties): boolean;
1989 function willLabelsWordBreak(axisProperties: IAxisProperties, margin: IMargin, availableWidth: number, textWidthMeasurer: ITextAsSVGMeasurer, textHeightMeasurer: ITextAsSVGMeasurer, textTruncator: (properties: TextProperties, maxWidth: number) => string, properties: TextProperties): boolean;
1990 const DefaultRotation: {
1991 sine: number;
1992 cosine: number;
1993 tangent: number;
1994 transform: string;
1995 dy: string;
1996 };
1997 const DefaultRotationWithScrollbar: {
1998 sine: number;
1999 cosine: number;
2000 tangent: number;
2001 transform: string;
2002 dy: string;
2003 };
2004 function rotate(labelSelection: D3.Selection, maxBottomMargin: number, textTruncator: (properties: TextProperties, maxWidth: number) => string, textProperties: TextProperties, needRotate: boolean, needEllipsis: boolean, axisProperties: IAxisProperties, margin: IMargin, scrollbarVisible: boolean): void;
2005 function wordBreak(text: D3.Selection, axisProperties: IAxisProperties, maxHeight: number): void;
2006 function clip(text: D3.Selection, availableWidth: number, svgEllipsis: (textElement: SVGTextElement, maxWidth: number) => void): void;
2007 }
2008 function createOrdinalScale(pixelSpan: number, dataDomain: any[], outerPaddingRatio?: number): D3.Scale.OrdinalScale;
2009 function isLogScalePossible(domain: any[], axisType?: ValueType): boolean;
2010 function createNumericalScale(axisScaleType: string, pixelSpan: number, dataDomain: any[], dataType: ValueType, outerPadding?: number, niceCount?: number, shouldClamp?: boolean): D3.Scale.GenericScale<any>;
2011 function createLinearScale(pixelSpan: number, dataDomain: any[], outerPadding?: number, niceCount?: number, shouldClamp?: boolean): D3.Scale.LinearScale;
2012 function getRangeForColumn(sizeColumn: DataViewValueColumn): NumberRange;
2013 /**
2014 * Set customized domain, but don't change when nothing is set
2015 */
2016 function applyCustomizedDomain(customizedDomain: any, forcedDomain: any[]): any[];
2017 /**
2018 * Combine the forced domain with the actual domain if one of the values was set.
2019 * The forcedDomain is in 1st priority. Extends the domain if the any reference point requires it.
2020 */
2021 function combineDomain(forcedDomain: any[], domain: any[], ensureDomain?: NumberRange): any[];
2022 function createAxisLabel(properties: DataViewObject, label: string, unitType: string, y2?: boolean): string;
2023 function scaleShouldClamp(combinedDomain: any[], domain: any[]): boolean;
2024 function normalizeNonFiniteNumber(value: number): number;
2025 /**
2026 * Indicates whether the number is power of 10.
2027 */
2028 function powerOfTen(d: any): boolean;
2029 }
2030}
2031
2032declare module powerbi.visuals {
2033 module ShapeFactory {
2034 module ShapeFactoryConsts {
2035 const PaddingConstRatio: number;
2036 const TrianglePaddingConstRatio: number;
2037 const TriangleEndPaddingConstRatio: number;
2038 const ShapeConstRatio: number;
2039 const SmallPaddingConstValue: number;
2040 const OvalRadiusConst: number;
2041 const OvalRadiusConstPadding: number;
2042 const ArrowLeftHeadPoint: Point;
2043 const ArrowMiddleHeadPoint: Point;
2044 const ArrowRightHeadPoint: Point;
2045 const ArrowRightMiddleHeadPoint: Point;
2046 const ArrowBottomRightPoint: Point;
2047 const ArrowBottomLeftPoint: Point;
2048 const ArrowLeftMiddleHeadPoint: Point;
2049 }
2050 /** this function creates a rectangle svg */
2051 function createRectangle(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
2052 /** this function creates a oval svg */
2053 function createOval(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
2054 /** this function creates a line svg */
2055 function createLine(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
2056 /** this function creates a arrow svg */
2057 function createUpArrow(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
2058 /** this function creates a triangle svg */
2059 function createTriangle(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
2060 }
2061}
2062
2063declare module powerbi.visuals {
2064 module CartesianHelper {
2065 function getCategoryAxisProperties(dataViewMetadata: DataViewMetadata, axisTitleOnByDefault?: boolean): DataViewObject;
2066 function getValueAxisProperties(dataViewMetadata: DataViewMetadata, axisTitleOnByDefault?: boolean): DataViewObject;
2067 function isScalar(isScalar: boolean, xAxisCardProperties: DataViewObject): boolean;
2068 function getPrecision(precision: DataViewPropertyValue): number;
2069 function lookupXValue(data: CartesianData, index: number, type: ValueType, isScalar: boolean): any;
2070 function findMaxCategoryIndex(series: CartesianSeries[]): number;
2071 }
2072}
2073
2074declare module powerbi.visuals {
2075 class ColorHelper {
2076 private fillProp;
2077 private defaultDataPointColor;
2078 private colors;
2079 private defaultColorScale;
2080 constructor(colors: IDataColorPalette, fillProp?: DataViewObjectPropertyIdentifier, defaultDataPointColor?: string);
2081 /**
2082 * Gets the color for the given series value.
2083 * If no explicit color or default color has been set then the color is
2084 * allocated from the color scale for this series.
2085 */
2086 getColorForSeriesValue(objects: DataViewObjects, fieldIds: powerbi.data.ISQExpr[], value: string): string;
2087 /**
2088 * Gets the color scale for the given series.
2089 */
2090 getColorScaleForSeries(fieldIds: powerbi.data.ISQExpr[]): IColorScale;
2091 /**
2092 * Gets the color for the given measure.
2093 */
2094 getColorForMeasure(objects: DataViewObjects, measureKey: any): string;
2095 static normalizeSelector(selector: data.Selector, isSingleSeries?: boolean): data.Selector;
2096 }
2097}
2098
2099declare module powerbi.visuals {
2100 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
2101 module ColumnUtil {
2102 const DimmedOpacity: number;
2103 const DefaultOpacity: number;
2104 function applyUserMinMax(isScalar: boolean, dataView: DataViewCategorical, xAxisCardProperties: DataViewObject): DataViewCategorical;
2105 function transformDomain(dataView: DataViewCategorical, min: DataViewPropertyValue, max: DataViewPropertyValue): DataViewCategorical;
2106 function getCategoryAxis(data: ColumnChartData, size: number, layout: CategoryLayout, isVertical: boolean, forcedXMin?: DataViewPropertyValue, forcedXMax?: DataViewPropertyValue, axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
2107 function applyInteractivity(columns: D3.Selection, onDragStart: any): void;
2108 function getFillOpacity(selected: boolean, highlight: boolean, hasSelection: boolean, hasPartialHighlights: boolean): number;
2109 function getClosestColumnIndex(coordinate: number, columnsCenters: number[]): number;
2110 function setChosenColumnOpacity(mainGraphicsContext: D3.Selection, columnGroupSelector: string, selectedColumnIndex: number, lastColumnIndex: number): void;
2111 function drawSeries(data: ColumnChartData, graphicsContext: D3.Selection, axisOptions: ColumnAxisOptions): D3.UpdateSelection;
2112 function drawDefaultShapes(data: ColumnChartData, series: D3.UpdateSelection, layout: IColumnLayout, itemCS: ClassAndSelector, filterZeros: boolean, hasSelection: boolean): D3.UpdateSelection;
2113 function drawDefaultLabels(series: D3.UpdateSelection, context: D3.Selection, layout: ILabelLayout, viewPort: IViewport, isAnimator?: boolean, animationDuration?: number): D3.UpdateSelection;
2114 function normalizeInfinityInScale(scale: D3.Scale.GenericScale<any>): void;
2115 function calculatePosition(d: ColumnChartDataPoint, axisOptions: ColumnAxisOptions): number;
2116 }
2117 module ClusteredUtil {
2118 function clearColumns(mainGraphicsContext: D3.Selection, itemCS: ClassAndSelector): void;
2119 }
2120 interface ValueMultiplers {
2121 pos: number;
2122 neg: number;
2123 }
2124 module StackedUtil {
2125 function getSize(scale: D3.Scale.GenericScale<any>, size: number, zeroVal?: number): number;
2126 function calcValueDomain(data: ColumnChartSeries[], is100pct: boolean): NumberRange;
2127 function getStackedMultiplier(dataView: DataViewCategorical, rowIdx: number, seriesCount: number, categoryCount: number, converterStrategy: IColumnChartConverterStrategy): ValueMultiplers;
2128 function clearColumns(mainGraphicsContext: D3.Selection, itemCS: ClassAndSelector): void;
2129 }
2130}
2131
2132declare module powerbi.visuals {
2133 interface PivotedCategoryInfo {
2134 categories?: any[];
2135 categoryFormatter?: IValueFormatter;
2136 categoryIdentities?: DataViewScopeIdentity[];
2137 categoryObjects?: DataViewObjects[];
2138 }
2139 module converterHelper {
2140 function categoryIsAlsoSeriesRole(dataView: DataViewCategorical, seriesRoleName: string, categoryRoleName: string): boolean;
2141 function getPivotedCategories(dataView: DataViewCategorical, formatStringProp: DataViewObjectPropertyIdentifier): PivotedCategoryInfo;
2142 function getSeriesName(source: DataViewMetadataColumn): string;
2143 function getFormattedLegendLabel(source: DataViewMetadataColumn, values: DataViewValueColumns, formatStringProp: DataViewObjectPropertyIdentifier): string;
2144 function createAxesLabels(categoryAxisProperties: DataViewObject, valueAxisProperties: DataViewObject, category: DataViewMetadataColumn, values: DataViewMetadataColumn[]): {
2145 xAxisLabel: any;
2146 yAxisLabel: any;
2147 };
2148 function isImageUrlColumn(column: DataViewMetadataColumn): boolean;
2149 function isWebUrlColumn(column: DataViewMetadataColumn): boolean;
2150 function hasImageUrlColumn(dataView: DataView): boolean;
2151 function formatFromMetadataColumn(value: any, column: DataViewMetadataColumn, formatStringProp: DataViewObjectPropertyIdentifier): string;
2152 }
2153}
2154
2155declare module powerbi.visuals {
2156 const enum PointLabelPosition {
2157 Above = 0,
2158 Below = 1,
2159 }
2160 interface PointDataLabelsSettings extends VisualDataLabelsSettings {
2161 position: PointLabelPosition;
2162 }
2163 interface LabelFormattedTextOptions {
2164 label: any;
2165 maxWidth?: number;
2166 format?: string;
2167 formatter?: IValueFormatter;
2168 fontSize?: number;
2169 }
2170 interface VisualDataLabelsSettings {
2171 show: boolean;
2172 showLabelPerSeries?: boolean;
2173 isSeriesExpanded?: boolean;
2174 displayUnits?: number;
2175 showCategory?: boolean;
2176 position?: any;
2177 precision?: number;
2178 labelColor: string;
2179 categoryLabelColor?: string;
2180 fontSize?: number;
2181 labelStyle?: any;
2182 }
2183 interface VisualDataLabelsSettingsOptions {
2184 show: boolean;
2185 enumeration: ObjectEnumerationBuilder;
2186 dataLabelsSettings: VisualDataLabelsSettings;
2187 displayUnits?: boolean;
2188 precision?: boolean;
2189 position?: boolean;
2190 positionObject?: string[];
2191 selector?: powerbi.data.Selector;
2192 fontSize?: boolean;
2193 showAll?: boolean;
2194 labelDensity?: boolean;
2195 labelStyle?: boolean;
2196 }
2197 interface LabelEnabledDataPoint {
2198 labelX?: number;
2199 labelY?: number;
2200 labelFill?: string;
2201 labeltext?: string;
2202 labelFormatString?: string;
2203 isLabelInside?: boolean;
2204 labelFontSize?: number;
2205 }
2206 interface IColumnFormatterCache {
2207 [column: string]: IValueFormatter;
2208 defaultFormatter?: IValueFormatter;
2209 }
2210 interface IColumnFormatterCacheManager {
2211 cache: IColumnFormatterCache;
2212 getOrCreate: (formatString: string, labelSetting: VisualDataLabelsSettings, value2?: number) => IValueFormatter;
2213 }
2214 interface LabelPosition {
2215 y: (d: any, i: number) => number;
2216 x: (d: any, i: number) => number;
2217 }
2218 interface ILabelLayout {
2219 labelText: (d: any) => string;
2220 labelLayout: LabelPosition;
2221 filter: (d: any) => boolean;
2222 style: {};
2223 }
2224 interface DataLabelObject extends DataViewObject {
2225 show: boolean;
2226 color: Fill;
2227 labelDisplayUnits: number;
2228 labelPrecision?: number;
2229 labelPosition: any;
2230 fontSize?: number;
2231 showAll?: boolean;
2232 showSeries?: boolean;
2233 labelDensity?: string;
2234 labelStyle?: any;
2235 }
2236 module dataLabelUtils {
2237 const minLabelFontSize: number;
2238 const labelMargin: number;
2239 const maxLabelWidth: number;
2240 const defaultColumnLabelMargin: number;
2241 const defaultColumnHalfLabelHeight: number;
2242 const defaultLabelDensity: string;
2243 const DefaultDy: string;
2244 const DefaultFontSizeInPt: number;
2245 const StandardFontFamily: string;
2246 const LabelTextProperties: TextProperties;
2247 const defaultLabelColor: string;
2248 const defaultInsideLabelColor: string;
2249 const hundredPercentFormat: string;
2250 const defaultLabelPrecision: number;
2251 function updateLabelSettingsFromLabelsObject(labelsObj: DataLabelObject, labelSettings: VisualDataLabelsSettings): void;
2252 function updateLineChartLabelSettingsFromLabelsObject(labelsObj: DataLabelObject, labelSettings: LineChartDataLabelsSettings): void;
2253 function getDefaultLabelSettings(show?: boolean, labelColor?: string, fontSize?: number): VisualDataLabelsSettings;
2254 function getDefaultCardLabelSettings(labelColor: string, categoryLabelColor: string, fontSize?: number): VisualDataLabelsSettings;
2255 function getDefaultTreemapLabelSettings(): VisualDataLabelsSettings;
2256 function getDefaultSunburstLabelSettings(): VisualDataLabelsSettings;
2257 function getDefaultColumnLabelSettings(isLabelPositionInside: boolean): VisualDataLabelsSettings;
2258 function getDefaultPointLabelSettings(): PointDataLabelsSettings;
2259 function getDefaultLineChartLabelSettings(isComboChart?: boolean): LineChartDataLabelsSettings;
2260 function getDefaultMapLabelSettings(): PointDataLabelsSettings;
2261 function getDefaultDonutLabelSettings(): VisualDataLabelsSettings;
2262 function getDefaultGaugeLabelSettings(): VisualDataLabelsSettings;
2263 function getDefaultKpiLabelSettings(): VisualDataLabelsSettings;
2264 function getLabelPrecision(precision: number, format: string): number;
2265 function drawDefaultLabelsForDataPointChart(data: any[], context: D3.Selection, layout: ILabelLayout, viewport: IViewport, isAnimator?: boolean, animationDuration?: number, hasSelection?: boolean): D3.UpdateSelection;
2266 function cleanDataLabels(context: D3.Selection, removeLines?: boolean): void;
2267 function setHighlightedLabelsOpacity(context: D3.Selection, hasSelection: boolean, hasHighlights: boolean): void;
2268 function getLabelFormattedText(options: LabelFormattedTextOptions): string;
2269 function getLabelLayoutXYForWaterfall(xAxisProperties: IAxisProperties, categoryWidth: number, yAxisProperties: IAxisProperties, dataDomain: number[]): LabelPosition;
2270 function doesDataLabelFitInShape(d: WaterfallChartDataPoint, yAxisProperties: IAxisProperties, layout: WaterfallLayout): boolean;
2271 function getMapLabelLayout(labelSettings: PointDataLabelsSettings): ILabelLayout;
2272 function getColumnChartLabelLayout(data: ColumnChartData, labelLayoutXY: any, isColumn: boolean, isHundredPercent: boolean, axisFormatter: IValueFormatter, axisOptions: ColumnAxisOptions, interactivityService: IInteractivityService, visualWidth?: number): ILabelLayout;
2273 function getColumnChartLabelFilter(d: ColumnChartDataPoint, hasSelection: boolean, hasHighlights: boolean, axisOptions: ColumnAxisOptions, visualWidth?: number): any;
2274 function getScatterChartLabelLayout(xScale: D3.Scale.GenericScale<any>, yScale: D3.Scale.GenericScale<any>, labelSettings: PointDataLabelsSettings, viewport: IViewport, sizeRange: NumberRange): ILabelLayout;
2275 function getLineChartLabelLayout(xScale: D3.Scale.GenericScale<any>, yScale: D3.Scale.GenericScale<any>, labelSettings: PointDataLabelsSettings, isScalar: boolean, axisFormatter: IValueFormatter): ILabelLayout;
2276 function enumerateDataLabels(options: VisualDataLabelsSettingsOptions): ObjectEnumerationBuilder;
2277 function enumerateCategoryLabels(enumeration: ObjectEnumerationBuilder, dataLabelsSettings: VisualDataLabelsSettings, withFill: boolean, isShowCategory?: boolean, fontSize?: number): void;
2278 function createColumnFormatterCacheManager(): IColumnFormatterCacheManager;
2279 function getOptionsForLabelFormatter(labelSetting: VisualDataLabelsSettings, formatString: string, value2?: number, precision?: number): ValueFormatterOptions;
2280 function isTextWidthOverflows(textWidth: any, maxTextWidth: any): boolean;
2281 function isTextHeightOverflows(textHeight: any, innerChordLength: any): boolean;
2282 }
2283}
2284
2285declare module powerbi.visuals {
2286 import ISize = shapes.ISize;
2287 module DonutLabelUtils {
2288 const LineStrokeWidth: number;
2289 const DiagonalLineIndex: number;
2290 const HorizontalLineIndex: number;
2291 function getLabelLeaderLineForDonutChart(donutArcDescriptor: DonutArcDescriptor, donutProperties: DonutChartProperties, parentPoint: IPoint, sliceArc?: number): number[][];
2292 /** We calculate the rectangles of the leader lines for collision detection
2293 *width: x2 - x1; height: y2 - y1 */
2294 function getLabelLeaderLinesSizeForDonutChart(leaderLinePoints: number[][]): ISize[];
2295 function getXPositionForDonutLabel(textPointX: number): number;
2296 function getSpaceAvailableForDonutLabels(labelXPos: number, viewport: IViewport): number;
2297 }
2298}
2299
2300declare module powerbi.visuals {
2301 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
2302 import ISize = shapes.ISize;
2303 module NewDataLabelUtils {
2304 const DefaultLabelFontSizeInPt: number;
2305 const MapPolylineOpacity: number;
2306 const LabelDensityBufferFactor: number;
2307 const LabelDensityPadding: number;
2308 let startingLabelOffset: number;
2309 let maxLabelOffset: number;
2310 let maxLabelWidth: number;
2311 let hundredPercentFormat: string;
2312 let LabelTextProperties: TextProperties;
2313 let defaultLabelColor: string;
2314 let defaultInsideLabelColor: string;
2315 const horizontalLabelBackgroundPadding: number;
2316 const verticalLabelBackgroundPadding: number;
2317 let labelGraphicsContextClass: ClassAndSelector;
2318 let labelBackgroundGraphicsContextClass: ClassAndSelector;
2319 function drawDefaultLabels(context: D3.Selection, dataLabels: Label[], numeric?: boolean, twoRows?: boolean, hasTooltip?: boolean): D3.UpdateSelection;
2320 function animateDefaultLabels(context: D3.Selection, dataLabels: Label[], duration: number, numeric?: boolean, easeType?: string): D3.UpdateSelection;
2321 /** Draws black rectangles based on the bounding bx of labels, to be used in debugging */
2322 function drawLabelBackground(context: D3.Selection, dataLabels: Label[], fill?: string, fillOpacity?: number): D3.UpdateSelection;
2323 function drawLabelLeaderLines(context: D3.Selection, filteredDataLabels: Label[], key?: (data: any, index?: number) => any, leaderLineColor?: string): void;
2324 function getLabelFormattedText(label: string | number, format?: string, formatter?: IValueFormatter): string;
2325 function getDisplayUnitValueFromAxisFormatter(axisFormatter: IValueFormatter, labelSettings: VisualDataLabelsSettings): number;
2326 function createColumnFormatterCacheManager(): IColumnFormatterCacheManager;
2327 function removeDuplicates(labelDataPoints: LabelDataPoint[]): LabelDataPoint[];
2328 function getDataLabelLayoutOptions(type: CartesianChartType): DataLabelLayoutOptions;
2329 function getTextSize(text: string, fontSize: number): ISize;
2330 }
2331}
2332
2333declare module powerbi.visuals {
2334 module KpiUtil {
2335 const enum KpiImageSize {
2336 Small = 0,
2337 Big = 1,
2338 }
2339 interface KpiImageMetadata {
2340 statusGraphic: string;
2341 caption: string;
2342 class: string;
2343 }
2344 interface KPIGraphicClass {
2345 kpiIconClass: string;
2346 statusValues: string[];
2347 }
2348 function getClassForKpi(kpi: DataViewKpiColumnMetadata, value: string, kpiImageSize?: KpiImageSize): string;
2349 function getKpiImageMetadata(metaDataColumn: DataViewMetadataColumn, value: string, kpiImageSize?: KpiImageSize): KpiImageMetadata;
2350 }
2351}
2352
2353declare module powerbi.visuals {
2354 module DateUtil {
2355 function isEqual(date1: Date, date2: Date): boolean;
2356 }
2357}
2358
2359declare module powerbi.visuals {
2360 interface MinMaxLabelDataPointSorterOptions {
2361 unsortedLabelDataPointGroups: LabelDataPointGroup[];
2362 series: CartesianSeries[];
2363 yAxisProperties: IAxisProperties;
2364 viewport: IViewport;
2365 }
2366 class MinMaxLabelDataPointSorter {
2367 private unsortedLabelDataPointGroups;
2368 private series;
2369 private yScale;
2370 private viewport;
2371 /** A rough estimate for how wide labels are for purposes of calculating density, window size, etc. */
2372 static estimatedLabelWidth: number;
2373 private static minimumWeightToConsiderMinMax;
2374 private static maxNumberToSortFactor;
2375 constructor(options: MinMaxLabelDataPointSorterOptions);
2376 getSortedDataLabels(): LabelDataPointGroup[];
2377 /**
2378 * The weight for each min/max is made up of four values, which are averaged into
2379 * a single weight. You have a weight based on the value difference for both the
2380 * left and right side and a weight for the index difference for both left and
2381 * right. These values are normalized as such:
2382 *
2383 * valueWeight = abs(scaledValueDifference / totalScaledValueDifference)
2384 * indexWeight = abs(indexDifference / categoryCount)
2385 *
2386 * Since we don't care about the direction of these change, we take the absolute
2387 * value for both. We use scaled coordinates for the valueWeight because this
2388 * will more accurately represent what the user sees (consider a log scale; small
2389 * visual changes at the top would otherwise trump large visual changes at the
2390 * bottom of the axis)
2391 *
2392 * In code, the averaging is done by averaging together the "current" value and
2393 * index weights and then assigning it to the current dataPoint. Then, when the
2394 * "next" data point's weight is calculated, that weight (with respect to "current")
2395 * is then averaged with the weight originally assigned. Data points next to nulls
2396 * or on the edge of the visual only have a weight associated with the one side that
2397 * is non-null.
2398 *
2399 * Also note that weights are only calculated for minimums and maximums.
2400 *
2401 * @param labelDataPoints The labelDataPoints to apply the weighting to
2402 */
2403 private calculateWeights(labelDataPoints, data, numberOfLabelsToSort, globalMinMax);
2404 private findMinMaxesBasedOnSmoothedValues(labelDataPoints, data);
2405 private static getMinMaxInRange(startIndex, endIndex, data);
2406 private getWindowSize(data);
2407 private calculateSmoothedValues(data, windowSize);
2408 private static getGaussianDistribution(windowSize);
2409 private getSmoothedValue(data, categoryIndex, windowSize, gaussianValues);
2410 private addFirstLastMaxMin(unsorted, sorted, maxIndex, minIndex);
2411 private addLocalMinMaxes(unsorted, sorted, maxIndex, minIndex, maxNumberOfLabels);
2412 private addNonMinMaxes(unsorted, sorted, maxNumberOfLabels);
2413 private getMinMaxType(index, scaledDataPoints);
2414 }
2415}
2416
2417declare module powerbi.visuals {
2418 module ReferenceLineHelper {
2419 const referenceLineProps: {
2420 show: string;
2421 lineColor: string;
2422 transparency: string;
2423 value: string;
2424 style: string;
2425 position: string;
2426 dataLabelShow: string;
2427 dataLabelColor: string;
2428 dataLabelDecimalPoints: string;
2429 dataLabelHorizontalPosition: string;
2430 dataLabelVerticalPosition: string;
2431 dataLabelDisplayUnits: string;
2432 };
2433 function enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, referenceLines: DataViewObjectMap, defaultColor: string, objectName: string): void;
2434 function render(options: ReferenceLineOptions): void;
2435 function createLabelDataPoint(options: ReferenceLineDataLabelOptions): LabelDataPoint;
2436 function extractReferenceLineValue(referenceLineProperties: DataViewObject): number;
2437 }
2438}
2439
2440declare module powerbi.visuals {
2441 module InteractivityUtils {
2442 function getPositionOfLastInputEvent(): IPoint;
2443 function registerStandardInteractivityHandlers(selection: D3.Selection, selectionHandler: ISelectionHandler): void;
2444 function registerStandardSelectionHandler(selection: D3.Selection, selectionHandler: ISelectionHandler): void;
2445 function registerStandardContextMenuHandler(selection: D3.Selection, selectionHandler: ISelectionHandler): void;
2446 function registerGroupInteractivityHandlers(group: D3.Selection, selectionHandler: ISelectionHandler): void;
2447 function registerGroupSelectionHandler(group: D3.Selection, selectionHandler: ISelectionHandler): void;
2448 function registerGroupContextMenuHandler(group: D3.Selection, selectionHandler: ISelectionHandler): void;
2449 }
2450}
2451
2452declare module powerbi.visuals {
2453 import DataView = powerbi.DataView;
2454 function getInvalidValueWarnings(dataViews: DataView[], supportsNaN: boolean, supportsNegativeInfinity: boolean, supportsPositiveInfinity: boolean): IVisualWarning[];
2455}
2456
2457declare module powerbi.visuals {
2458 interface IListView {
2459 data(data: any[], dataIdFunction: (d) => {}, dataAppended: boolean): IListView;
2460 rowHeight(rowHeight: number): IListView;
2461 viewport(viewport: IViewport): IListView;
2462 render(): void;
2463 empty(): void;
2464 }
2465 module ListViewFactory {
2466 function createListView(options: any): IListView;
2467 }
2468 interface ListViewOptions {
2469 enter: (selection: D3.Selection) => void;
2470 exit: (selection: D3.Selection) => void;
2471 update: (selection: D3.Selection) => void;
2472 loadMoreData: () => void;
2473 baseContainer: D3.Selection;
2474 rowHeight: number;
2475 viewport: IViewport;
2476 scrollEnabled: boolean;
2477 isReadMode: () => boolean;
2478 }
2479}
2480
2481declare module powerbi.visuals {
2482 module MapUtil {
2483 interface IPixelArrayResult {
2484 array: Float64Array;
2485 arrayString: string;
2486 }
2487 const Settings: {
2488 MaxBingRequest: number;
2489 MaxCacheSize: number;
2490 MaxCacheSizeOverflow: number;
2491 BingKey: string;
2492 BingUrl: string;
2493 BingUrlGeodata: string;
2494 UseDoubleArrayGeodataResult: boolean;
2495 UseDoubleArrayDequeueTimeout: number;
2496 };
2497 const MinAllowedLatitude: number;
2498 const MaxAllowedLatitude: number;
2499 const MinAllowedLongitude: number;
2500 const MaxAllowedLongitude: number;
2501 const TileSize: number;
2502 const MaxLevelOfDetail: number;
2503 const MinLevelOfDetail: number;
2504 const MaxAutoZoomLevel: number;
2505 const DefaultLevelOfDetail: number;
2506 const WorkerErrorName: string;
2507 const CategoryTypes: {
2508 Address: string;
2509 City: string;
2510 Continent: string;
2511 CountryRegion: string;
2512 County: string;
2513 Longitude: string;
2514 Latitude: string;
2515 Place: string;
2516 PostalCode: string;
2517 StateOrProvince: string;
2518 };
2519 function clip(n: number, minValue: number, maxValue: number): number;
2520 function getMapSize(levelOfDetail: number): number;
2521 /**
2522 * @param latLongArray - is a Float64Array as [lt0, lon0, lat1, long1, lat2, long2,....]
2523 * @param buildString - optional, if true returns also a string as "x0 y0 x1 y1 x2 y2 ...."
2524 * @returns IPixelArrayResult with Float64Array as [x0, y0, x1, y1, x2, y2,....]
2525 */
2526 function latLongToPixelXYArray(latLongArray: Float64Array, levelOfDetail: number, buildString?: boolean): IPixelArrayResult;
2527 function getLocationBoundaries(latLongArray: Float64Array): Microsoft.Maps.LocationRect;
2528 /**
2529 * Note: this code is taken from Bing.
2530 * see Point Compression Algorithm http://msdn.microsoft.com/en-us/library/jj158958.aspx
2531 * see Decompression Algorithm in http://msdn.microsoft.com/en-us/library/dn306801.aspx
2532 */
2533 function parseEncodedSpatialValueArray(value: any): Float64Array;
2534 function calcGeoData(data: IGeocodeBoundaryCoordinate): void;
2535 function locationToPixelXY(location: Microsoft.Maps.Location, levelOfDetail: number): powerbi.visuals.Point;
2536 function locationRectToRectXY(locationRect: Microsoft.Maps.LocationRect, levelOfDetail: number): powerbi.visuals.Rect;
2537 function latLongToPixelXY(latitude: number, longitude: number, levelOfDetail: number): powerbi.visuals.Point;
2538 function pixelXYToLocation(pixelX: number, pixelY: number, levelOfDetail: number): Microsoft.Maps.Location;
2539 module CurrentLocation {
2540 function createPushpin(location: Microsoft.Maps.Location): Microsoft.Maps.Pushpin;
2541 }
2542 }
2543 class MapPolygonInfo {
2544 private _locationRect;
2545 private _baseRect;
2546 private _currentRect;
2547 constructor();
2548 reCalc(mapControl: Microsoft.Maps.Map, width: number, height: number): void;
2549 scale: number;
2550 transform: Transform;
2551 outherTransform: Transform;
2552 setViewBox(svg: SVGSVGElement): void;
2553 innerTransform: Transform;
2554 transformToString(transform: Transform): string;
2555 }
2556}
2557
2558declare module powerbi.visuals.utility {
2559 interface SelectionManagerOptions {
2560 hostServices: IVisualHostServices;
2561 }
2562 class SelectionManager {
2563 private selectedIds;
2564 private hostServices;
2565 constructor(options: SelectionManagerOptions);
2566 select(selectionId: SelectionId, multiSelect?: boolean): JQueryDeferred<SelectionId[]>;
2567 showContextMenu(selectionId: SelectionId, position?: Point): JQueryDeferred<{}>;
2568 hasSelection(): boolean;
2569 clear(): JQueryDeferred<{}>;
2570 getSelectionIds(): SelectionId[];
2571 private sendSelectionToHost(ids);
2572 private sendContextMenuToHost(selectionId, position);
2573 private getSelectorsByColumn(selectionIds);
2574 private selectInternal(selectionId, multiSelect);
2575 static containsSelection(list: SelectionId[], id: SelectionId): boolean;
2576 }
2577}
2578
2579declare module powerbi.visuals {
2580 module shapes {
2581 class Polygon {
2582 private _absoluteCentroid;
2583 private _absoluteBoundingRect;
2584 polygonPoints: IPoint[];
2585 pixelBoundingRect: Rect;
2586 constructor(absolutePoints: Float64Array);
2587 absoluteCentroid(): IPoint;
2588 absoluteBoundingRect(): Rect;
2589 /**
2590 * Check if label text contain in polygon shape.
2591 *
2592 * @return true/false is the label fit in polygon.
2593 * measure if rects points are inside the polygon shape
2594 * return true if there is at least 3 point inside the polygon
2595 */
2596 contains(rect: IRect): boolean;
2597 /**
2598 * Check if label text is outside of polygon shape.
2599 * It checks 8 points in the label. TopLeft, TopCenter, TopRight, MiddleLeft, MiddleRight, BottomLeft, BottomMiddle, BottomRight
2600 * @return true/false is there is any conflict (at least one point inside the shape).
2601 */
2602 conflicts(rect: IRect): boolean;
2603 /**
2604 * returns intersection point of a line (depicted by two points) and a polygon.
2605 *
2606 * @return the point of intersection or null if there is no intersection.
2607 */
2608 lineIntersectionPoint(p0: IPoint, p1: IPoint): IPoint;
2609 /**
2610 * calculate Polygon Area.
2611 *
2612 * @return the area of the polygon (as number).
2613 */
2614 static calculateAbsolutePolygonArea(polygonPoints: IPoint[]): number;
2615 /**
2616 * Check if label text is outside of polygon bounding box.
2617 *
2618 * @return true/false is there is any conflict (at least one point inside the shape).
2619 */
2620 private isConflictWithBoundingBox(rect);
2621 /**
2622 * Calculate Polygon Centroid.
2623 *
2624 * @return 'center' point of the polygon.
2625 * calculate the polygon area
2626 * calculate the average points of the polygon by x & y axis.
2627 * divided the average point by the area
2628 */
2629 private calculatePolygonCentroid();
2630 private calculateBoundingRect();
2631 /**
2632 * Check if point exist inside polygon shape.
2633 *
2634 * @return true/false if point exist inside shape.
2635 * ray-casting algorithm based on:
2636 * http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
2637 */
2638 private inside(point);
2639 /**
2640 * Checks if a line (presented as two points) intersects with a another line
2641 */
2642 private getLineIntersection(line0p1, line0p2, line1p1, line1p2);
2643 private convertArrayPathToPoints(path);
2644 }
2645 module Point {
2646 function offset(point: IPoint, offsetX: number, offsetY: number): IPoint;
2647 function equals(point: IPoint, other: IPoint): boolean;
2648 function clone(point: IPoint): IPoint;
2649 function toString(point: IPoint): string;
2650 function serialize(point: IPoint): string;
2651 function getDistance(point: IPoint, other: IPoint): number;
2652 function equalWithPrecision(point1: IPoint, point2: IPoint): boolean;
2653 function parsePoint(value: any, defaultValue?: IPoint): IPoint;
2654 }
2655 module Size {
2656 function isEmpty(size: ISize): boolean;
2657 function equals(size: ISize, other: ISize): boolean;
2658 function clone(size: ISize): ISize;
2659 function inflate(size: ISize, padding: IThickness): ISize;
2660 function deflate(size: ISize, padding: IThickness): ISize;
2661 function combine(size: ISize, other: ISize): ISize;
2662 function toRect(size: ISize): IRect;
2663 function toString(size: ISize): string;
2664 function equal(size1: ISize, size2: ISize): boolean;
2665 function equalWithPrecision(size1: ISize, size2: ISize): boolean;
2666 function parseSize(value: any, defaultValue?: ISize): ISize;
2667 }
2668 module Rect {
2669 function getOffset(rect: IRect): IPoint;
2670 function getSize(rect: IRect): ISize;
2671 function setSize(rect: IRect, value: ISize): void;
2672 function right(rect: IRect): number;
2673 function bottom(rect: IRect): number;
2674 function topLeft(rect: IRect): IPoint;
2675 function topRight(rect: IRect): IPoint;
2676 function bottomLeft(rect: IRect): IPoint;
2677 function bottomRight(rect: IRect): IPoint;
2678 function equals(rect: IRect, other: IRect): boolean;
2679 function clone(rect: IRect): IRect;
2680 function toString(rect: IRect): string;
2681 function offset(rect: IRect, offsetX: number, offsetY: number): IRect;
2682 function inflate(rect: IRect, padding: IThickness): IRect;
2683 function deflate(rect: IRect, padding: IThickness): IRect;
2684 function inflateBy(rect: IRect, padding: number): IRect;
2685 function deflateBy(rect: IRect, padding: number): IRect;
2686 /**
2687 * Get closest point.
2688 *
2689 * @return the closest point on the rect to the (x,y) point given.
2690 * In case the (x,y) given is inside the rect, (x,y) will be returned.
2691 * Otherwise, a point on a border will be returned.
2692 */
2693 function getClosestPoint(rect: IRect, x: number, y: number): IPoint;
2694 function equal(rect1: IRect, rect2: IRect): boolean;
2695 function equalWithPrecision(rect1: IRect, rect2: IRect): boolean;
2696 function isEmpty(rect: IRect): boolean;
2697 function containsPoint(rect: IRect, point: IPoint): boolean;
2698 function isIntersecting(rect1: IRect, rect2: IRect): boolean;
2699 function intersect(rect1: IRect, rect2: IRect): IRect;
2700 function combine(rect1: IRect, rect2: IRect): IRect;
2701 function parseRect(value: any, defaultValue?: IRect): IRect;
2702 }
2703 module Thickness {
2704 function inflate(thickness: IThickness, other: IThickness): IThickness;
2705 function getWidth(thickness: IThickness): number;
2706 function getHeight(thickness: IThickness): number;
2707 function clone(thickness: IThickness): IThickness;
2708 function equals(thickness: IThickness, other: IThickness): boolean;
2709 function flipHorizontal(thickness: IThickness): void;
2710 function flipVertical(thickness: IThickness): void;
2711 function toString(thickness: IThickness): string;
2712 function toCssString(thickness: IThickness): string;
2713 function isEmpty(thickness: IThickness): boolean;
2714 function equal(thickness1: IThickness, thickness2: IThickness): boolean;
2715 function equalWithPrecision(thickness1: IThickness, thickness2: IThickness): boolean;
2716 function parseThickness(value: any, defaultValue?: IThickness, resetValue?: any): IThickness;
2717 }
2718 module Vector {
2719 function isEmpty(vector: IVector): boolean;
2720 function equals(vector: IVector, other: IPoint): boolean;
2721 function clone(vector: IVector): IVector;
2722 function toString(vector: IVector): string;
2723 function getLength(vector: IVector): number;
2724 function getLengthSqr(vector: IVector): number;
2725 function scale(vector: IVector, scalar: number): IVector;
2726 function normalize(vector: IVector): IVector;
2727 function rotate90DegCW(vector: IVector): IVector;
2728 function rotate90DegCCW(vector: IVector): IVector;
2729 function rotate(vector: IVector, angle: number): IVector;
2730 function equal(vector1: IVector, vector2: IVector): boolean;
2731 function equalWithPrecision(vector1: IVector, vector2: IVector): boolean;
2732 function add(vect1: IVector, vect2: IVector): IVector;
2733 function subtract(vect1: IVector, vect2: IVector): IVector;
2734 function dotProduct(vect1: IVector, vect2: IVector): number;
2735 function getDeltaVector(p0: IPoint, p1: IPoint): IVector;
2736 }
2737 }
2738}
2739
2740declare module powerbi.visuals {
2741 import SQExpr = powerbi.data.SQExpr;
2742 import SemanticFilter = powerbi.data.SemanticFilter;
2743 /** Utility class for slicer*/
2744 module SlicerUtil {
2745 /** CSS selectors for slicer elements. */
2746 module Selectors {
2747 const HeaderContainer: jsCommon.CssConstants.ClassAndSelector;
2748 const Header: jsCommon.CssConstants.ClassAndSelector;
2749 const TitleHeader: jsCommon.CssConstants.ClassAndSelector;
2750 const HeaderText: jsCommon.CssConstants.ClassAndSelector;
2751 const Body: jsCommon.CssConstants.ClassAndSelector;
2752 const Label: jsCommon.CssConstants.ClassAndSelector;
2753 const LabelText: jsCommon.CssConstants.ClassAndSelector;
2754 const LabelImage: jsCommon.CssConstants.ClassAndSelector;
2755 const CountText: jsCommon.CssConstants.ClassAndSelector;
2756 const Clear: jsCommon.CssConstants.ClassAndSelector;
2757 const SearchHeader: jsCommon.CssConstants.ClassAndSelector;
2758 const SearchInput: jsCommon.CssConstants.ClassAndSelector;
2759 const SearchHeaderCollapsed: jsCommon.CssConstants.ClassAndSelector;
2760 const SearchHeaderShow: jsCommon.CssConstants.ClassAndSelector;
2761 const MultiSelectEnabled: jsCommon.CssConstants.ClassAndSelector;
2762 }
2763 /** Const declarations*/
2764 module DisplayNameKeys {
2765 const Clear: string;
2766 const SelectAll: string;
2767 const Search: string;
2768 }
2769 /** Helper class for slicer settings */
2770 module SettingsHelper {
2771 function areSettingsDefined(data: SlicerData): boolean;
2772 }
2773 /** Helper class for handling slicer default value */
2774 module DefaultValueHandler {
2775 function getIdentityFields(dataView: DataView): SQExpr[];
2776 }
2777 function getContainsFilter(expr: SQExpr, containsText: string): SemanticFilter;
2778 function tryRemoveValueFromRetainedList(value: DataViewScopeIdentity, selectedScopeIds: DataViewScopeIdentity[], caseInsensitive?: boolean): boolean;
2779 /** Helper class for creating and measuring slicer DOM elements */
2780 class DOMHelper {
2781 private static SearchInputHeight;
2782 createSlicerHeader(hostServices: IVisualHostServices): HTMLElement;
2783 getHeaderTextProperties(settings: SlicerSettings): TextProperties;
2784 getSlicerBodyViewport(currentViewport: IViewport, settings: SlicerSettings, headerTextProperties: TextProperties): IViewport;
2785 updateSlicerBodyDimensions(currentViewport: IViewport, slicerBody: D3.Selection, settings: SlicerSettings): void;
2786 getHeaderHeight(settings: SlicerSettings, textProperties: TextProperties): number;
2787 getRowHeight(settings: SlicerSettings, textProperties: TextProperties): number;
2788 styleSlicerHeader(slicerHeader: D3.Selection, settings: SlicerSettings, headerText: string): void;
2789 setSlicerTextStyle(slicerText: D3.Selection, settings: SlicerSettings): void;
2790 getRowsOutlineWidth(outlineElement: string, outlineWeight: number): number;
2791 private setSlicerHeaderTextStyle(slicerHeader, headerTextElement, settings, searchEnabled);
2792 private getTextProperties(textSize, textProperties);
2793 }
2794 }
2795}
2796
2797declare module powerbi.visuals {
2798 /**
2799 * Contains functions/constants to aid in adding tooltips.
2800 */
2801 module tooltipUtils {
2802 function tooltipUpdate(selection: D3.Selection, tooltips: string[]): void;
2803 }
2804}
2805
2806declare module powerbi.visuals {
2807 /**
2808 * Contains functions/constants to aid in SVG manupilation.
2809 */
2810 module SVGUtil {
2811 /**
2812 * Very small values, when stringified, may be converted to scientific notation and cause a temporarily
2813 * invalid attribute or style property value.
2814 * For example, the number 0.0000001 is converted to the string "1e-7".
2815 * This is particularly noticeable when interpolating opacity values.
2816 * To avoid scientific notation, start or end the transition at 1e-6,
2817 * which is the smallest value that is not stringified in exponential notation.
2818 */
2819 const AlmostZero: number;
2820 /**
2821 * Creates a translate string for use with the SVG transform call.
2822 */
2823 function translate(x: number, y: number): string;
2824 /**
2825 * Creates a translateX string for use with the SVG transform call.
2826 */
2827 function translateXWithPixels(x: number): string;
2828 function translateWithPixels(x: number, y: number): string;
2829 /**
2830 * Creates a translate + rotate string for use with the SVG transform call.
2831 */
2832 function translateAndRotate(x: number, y: number, px: number, py: number, angle: number): string;
2833 /**
2834 * Creates a scale string for use in a CSS transform property.
2835 */
2836 function scale(scale: number): string;
2837 /**
2838 * Creates a translate + scale string for use with the SVG transform call.
2839 */
2840 function translateAndScale(x: number, y: number, ratio: number): string;
2841 /**
2842 * Creates a transform origin string for use in a CSS transform-origin property.
2843 */
2844 function transformOrigin(xOffset: string, yOffset: string): string;
2845 /**
2846 * Forces all D3 transitions to complete.
2847 * Normally, zero-delay transitions are executed after an instantaneous delay (<10ms).
2848 * This can cause a brief flicker if the browser renders the page twice: once at the end of the first event loop,
2849 * then again immediately on the first timer callback. By flushing the timer queue at the end of the first event loop,
2850 * you can run any zero-delay transitions immediately and avoid the flicker.
2851 *
2852 * These flickers are noticable on IE, and with a large number of webviews(not recommend you ever do this) on iOS.
2853 */
2854 function flushAllD3Transitions(): void;
2855 /**
2856 * Wrapper for flushAllD3Transitions.
2857 */
2858 function flushAllD3TransitionsIfNeeded(options: VisualInitOptions | AnimationOptions): void;
2859 /**
2860 * There is a known bug in IE10 that causes cryptic crashes for SVG elements with a null 'd' attribute:
2861 * https://github.com/mbostock/d3/issues/1737
2862 */
2863 function ensureDAttribute(pathElement: D3.D3Element): void;
2864 /**
2865 * In IE10, it is possible to return SVGPoints with NaN members.
2866 */
2867 function ensureValidSVGPoint(point: SVGPoint): void;
2868 /**
2869 * Parse the Transform string with value 'translate(x,y)'.
2870 * In Chrome for the translate(position) string the delimiter
2871 * is a comma and in IE it is a spaceso checking for both.
2872 */
2873 function parseTranslateTransform(input: string): {
2874 x: string;
2875 y: string;
2876 };
2877 /**
2878 * Create an arrow.
2879 */
2880 function createArrow(width: number, height: number, rotate: number): {
2881 path: string;
2882 transform: string;
2883 };
2884 /**
2885 * Use the ratio of the scaled bounding rect and the SVG DOM bounding box to get the x and y transform scale values
2886 * @deprecated This function is unreliable across browser implementations, prefer to use SVGScaleDetector if needed.
2887 */
2888 function getTransformScaleRatios(svgElement: SVGSVGElement): Point;
2889 }
2890 class SVGScaleDetector {
2891 private scaleDetectorElement;
2892 constructor(svgElement: D3.Selection);
2893 getScale(): Point;
2894 }
2895}
2896
2897declare module powerbi.visuals {
2898 /**
2899 * Contains functions/constants to aid in text manupilation.
2900 */
2901 module TextUtil {
2902 /**
2903 * Remove breaking spaces from given string and replace by none breaking space (&nbsp).
2904 */
2905 function removeBreakingSpaces(str: string): string;
2906 /**
2907 * Remove ellipses from a given string
2908 */
2909 function removeEllipses(str: string): string;
2910 /**
2911 * Replace every whitespace (0x20) with Non-Breaking Space (0xA0)
2912 * @param {string} txt String to replace White spaces
2913 * @returns Text after replcing white spaces
2914 */
2915 function replaceSpaceWithNBSP(txt: string): string;
2916 }
2917}
2918
2919declare module powerbi.visuals {
2920 interface GradientSettings {
2921 diverging: boolean;
2922 minColor: any;
2923 midColor?: any;
2924 maxColor: any;
2925 minValue?: number;
2926 midValue?: number;
2927 maxValue?: number;
2928 }
2929 module GradientUtils {
2930 import DataViewObjectPropertyDefinition = powerbi.data.DataViewObjectPropertyDefinition;
2931 function getFillRuleRole(objectDescs: powerbi.data.DataViewObjectDescriptors): string;
2932 function shouldShowGradient(visualConfig: any): boolean;
2933 function getUpdatedGradientSettings(gradientObject: data.DataViewObjectDefinitions): GradientSettings;
2934 function getGradientMeasureIndex(dataViewCategorical: DataViewCategorical): number;
2935 function getGradientValueColumn(dataViewCategorical: DataViewCategorical): DataViewValueColumn;
2936 function hasGradientRole(dataViewCategorical: DataViewCategorical): boolean;
2937 function getDefaultGradientSettings(): GradientSettings;
2938 function getDefaultFillRuleDefinition(): DataViewObjectPropertyDefinition;
2939 function updateFillRule(propertyName: string, propertyValue: any, definitions: powerbi.data.DataViewObjectDefinitions): void;
2940 function getGradientSettings(baseFillRule: FillRuleDefinition): GradientSettings;
2941 function getFillRule(objectDefinitions: data.DataViewObjectDefinitions): FillRuleDefinition;
2942 function getGradientSettingsFromRule(fillRule: FillRuleDefinition): GradientSettings;
2943 /** Returns a string representing the gradient to be used for the GradientBar directive. */
2944 function getGradientBarColors(gradientSettings: GradientSettings): string;
2945 }
2946}
2947
2948declare module powerbi.visuals {
2949 interface VisualBackground {
2950 image?: ImageValue;
2951 transparency?: number;
2952 }
2953 module visualBackgroundHelper {
2954 function getDefaultColor(): string;
2955 function getDefaultTransparency(): number;
2956 function getDefaultShow(): boolean;
2957 function getDefaultValues(): {
2958 color: string;
2959 transparency: number;
2960 show: boolean;
2961 };
2962 function enumeratePlot(enumeration: ObjectEnumerationBuilder, background: VisualBackground): void;
2963 function renderBackgroundImage(background: VisualBackground, visualElement: JQuery, layout: Rect): void;
2964 }
2965}
2966
2967declare module powerbi.visuals {
2968 /**
2969 * A helper class for building a VisualObjectInstanceEnumerationObject:
2970 * - Allows call chaining (e.g., builder.pushInstance({...}).pushInstance({...})
2971 * - Allows creating of containers (via pushContainer/popContainer)
2972 */
2973 class ObjectEnumerationBuilder {
2974 private instances;
2975 private containers;
2976 private containerIdx;
2977 pushInstance(instance: VisualObjectInstance): ObjectEnumerationBuilder;
2978 pushContainer(container: VisualObjectInstanceContainer): ObjectEnumerationBuilder;
2979 popContainer(): ObjectEnumerationBuilder;
2980 complete(): VisualObjectInstanceEnumerationObject;
2981 private canMerge(x, y);
2982 private extend(target, source, propertyName);
2983 static merge(x: VisualObjectInstanceEnumeration, y: VisualObjectInstanceEnumeration): VisualObjectInstanceEnumerationObject;
2984 static normalize(x: VisualObjectInstanceEnumeration): VisualObjectInstanceEnumerationObject;
2985 static getContainerForInstance(enumeration: VisualObjectInstanceEnumerationObject, instance: VisualObjectInstance): VisualObjectInstanceContainer;
2986 }
2987}
2988
2989declare module powerbi.visuals {
2990 /** Helper class for Visual border styles */
2991 module VisualBorderUtil {
2992 /**
2993 * Gets The Boder Width string (e.g. 0px 1px 2px 3px)
2994 * @param {OutlineType} string Type of the Outline, one of Visuals.outline.<XX> const strings
2995 * @param {number} outlineWeight Weight of the outline in pixels
2996 * @returns String representing the Border Width
2997 */
2998 function getBorderWidth(outlineType: string, outlineWeight: number): string;
2999 }
3000}
3001
3002declare module powerbi.visuals {
3003 interface I2DTransformMatrix {
3004 m00: number;
3005 m01: number;
3006 m02: number;
3007 m10: number;
3008 m11: number;
3009 m12: number;
3010 }
3011 /** Transformation matrix math wrapper */
3012 class Transform {
3013 private _inverse;
3014 matrix: I2DTransformMatrix;
3015 constructor(m?: I2DTransformMatrix);
3016 applyToPoint(point: IPoint): IPoint;
3017 applyToRect(rect: Rect): IRect;
3018 translate(xOffset: number, yOffset: number): void;
3019 scale(xScale: number, yScale: number): void;
3020 rotate(angleInRadians: number): void;
3021 add(other: Transform): void;
3022 getInverse(): Transform;
3023 }
3024 function createTranslateMatrix(xOffset: number, yOffset: number): I2DTransformMatrix;
3025 function createScaleMatrix(xScale: number, yScale: number): I2DTransformMatrix;
3026 function createRotationMatrix(angleInRads: number): I2DTransformMatrix;
3027 function createInverseMatrix(m: I2DTransformMatrix): I2DTransformMatrix;
3028}
3029
3030declare module powerbi.visuals {
3031 interface TrendLine {
3032 points: IPoint[];
3033 show: boolean;
3034 lineColor: Fill;
3035 transparency: number;
3036 style: string;
3037 combineSeries: boolean;
3038 useHighlightValues: boolean;
3039 y2Axis: boolean;
3040 }
3041 module TrendLineHelper {
3042 const defaults: {
3043 lineColor: Fill;
3044 lineStyle: string;
3045 transparency: number;
3046 combineSeries: boolean;
3047 useHighlightValues: boolean;
3048 };
3049 function enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, trendLines: TrendLine[]): void;
3050 function isDataViewForRegression(dataView: DataView): boolean;
3051 function readDataView(dataView: DataView, sourceDataView: DataView, y2: boolean, colors: IDataColorPalette): TrendLine[];
3052 function darkenTrendLineColor(color: string): string;
3053 function render(trendLines: TrendLine[], graphicsContext: D3.Selection, axes: CartesianAxisProperties, viewport: IViewport): void;
3054 }
3055}
3056
3057declare module powerbi.visuals {
3058 module visibilityHelper {
3059 /** Helper method that uses jQuery :visible selector to determine if visual is visible.
3060 Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.
3061 Elements with visibility: hidden or opacity: 0 are considered visible, since they still consume space in the layout.
3062 */
3063 function partiallyVisible(element: JQuery): boolean;
3064 }
3065}
3066
3067declare module powerbi {
3068 module VisualObjectRepetition {
3069 /** Determines whether two repetitions are equal. */
3070 function equals(x: VisualObjectRepetition, y: VisualObjectRepetition): boolean;
3071 }
3072}
3073
3074declare module powerbi.visuals {
3075 /** Helper module for converting a DataView into SlicerData. */
3076 module DataConversion {
3077 function convert(dataView: DataView, localizedSelectAllText: string, interactivityService: IInteractivityService | ISelectionHandler, hostServices: IVisualHostServices): SlicerData;
3078 }
3079}
3080
3081declare module powerbi {
3082 import shapes = powerbi.visuals.shapes;
3083 import IRect = powerbi.visuals.IRect;
3084 /** Defines possible content positions. */
3085 const enum ContentPositions {
3086 /** Content position is not defined. */
3087 None = 0,
3088 /** Content aligned top left. */
3089 TopLeft = 1,
3090 /** Content aligned top center. */
3091 TopCenter = 2,
3092 /** Content aligned top right. */
3093 TopRight = 4,
3094 /** Content aligned middle left. */
3095 MiddleLeft = 8,
3096 /** Content aligned middle center. */
3097 MiddleCenter = 16,
3098 /** Content aligned middle right. */
3099 MiddleRight = 32,
3100 /** Content aligned bottom left. */
3101 BottomLeft = 64,
3102 /** Content aligned bottom center. */
3103 BottomCenter = 128,
3104 /** Content aligned bottom right. */
3105 BottomRight = 256,
3106 /** Content is placed inside the bounding rectangle in the center. */
3107 InsideCenter = 512,
3108 /** Content is placed inside the bounding rectangle at the base. */
3109 InsideBase = 1024,
3110 /** Content is placed inside the bounding rectangle at the end. */
3111 InsideEnd = 2048,
3112 /** Content is placed outside the bounding rectangle at the base. */
3113 OutsideBase = 4096,
3114 /** Content is placed outside the bounding rectangle at the end. */
3115 OutsideEnd = 8192,
3116 /** Content supports all possible positions. */
3117 All = 16383,
3118 }
3119 /**
3120 * Rectangle orientation. Rectangle orientation is used to define vertical or horizontal orientation
3121 * and starting/ending side of the rectangle.
3122 */
3123 enum RectOrientation {
3124 /** Rectangle with no specific orientation. */
3125 None = 0,
3126 /** Vertical rectangle with base at the bottom. */
3127 VerticalBottomTop = 1,
3128 /** Vertical rectangle with base at the top. */
3129 VerticalTopBottom = 2,
3130 /** Horizontal rectangle with base at the left. */
3131 HorizontalLeftRight = 3,
3132 /** Horizontal rectangle with base at the right. */
3133 HorizontalRightLeft = 4,
3134 }
3135 /**
3136 * Defines if panel elements are allowed to be positioned
3137 * outside of the panel boundaries.
3138 */
3139 enum OutsidePlacement {
3140 /** Elements can be positioned outside of the panel. */
3141 Allowed = 0,
3142 /** Elements can not be positioned outside of the panel. */
3143 Disallowed = 1,
3144 /** Elements can be partially outside of the panel. */
3145 Partial = 2,
3146 }
3147 /**
3148 * Defines an interface for information needed for default label positioning. Used in DataLabelsPanel.
3149 * Note the question marks: none of the elements are mandatory.
3150 */
3151 interface IDataLabelSettings {
3152 /** Distance from the anchor point. */
3153 anchorMargin?: number;
3154 /** Orientation of the anchor rectangle. */
3155 anchorRectOrientation?: RectOrientation;
3156 /** Preferable position for the label. */
3157 contentPosition?: ContentPositions;
3158 /** Defines the rules if the elements can be positioned outside panel bounds. */
3159 outsidePlacement?: OutsidePlacement;
3160 /** Defines the valid positions if repositionOverlapped is true. */
3161 validContentPositions?: ContentPositions;
3162 /** Defines maximum moving distance to reposition an element. */
3163 minimumMovingDistance?: number;
3164 /** Defines minimum moving distance to reposition an element. */
3165 maximumMovingDistance?: number;
3166 /** Opacity effect of the label. Use it for dimming. */
3167 opacity?: number;
3168 }
3169 /**
3170 * Defines an interface for information needed for label positioning.
3171 * None of the elements are mandatory, but at least anchorPoint OR anchorRect is needed.
3172 */
3173 interface IDataLabelInfo extends IDataLabelSettings {
3174 /** The point to which label is anchored. */
3175 anchorPoint?: shapes.IPoint;
3176 /** The rectangle to which label is anchored. */
3177 anchorRect?: IRect;
3178 /** Disable label rendering and processing. */
3179 hideLabel?: boolean;
3180 /**
3181 * Defines the visibility rank. This will not be processed by arrange phase,
3182 * but can be used for preprocessing the hideLabel value.
3183 */
3184 visibilityRank?: number;
3185 /** Defines the starting offset from AnchorRect. */
3186 offset?: number;
3187 /** Defines the callout line data. It is calculated and used during processing. */
3188 callout?: {
3189 start: shapes.IPoint;
3190 end: shapes.IPoint;
3191 };
3192 /** Source of the label. */
3193 source?: any;
3194 size?: shapes.ISize;
3195 }
3196 /** Interface for label rendering. */
3197 interface IDataLabelRenderer {
3198 renderLabelArray(labels: IArrangeGridElementInfo[]): void;
3199 }
3200 /** Interface used in internal arrange structures. */
3201 interface IArrangeGridElementInfo {
3202 element: IDataLabelInfo;
3203 rect: IRect;
3204 }
3205 /**
3206 * Arranges label elements using the anchor point or rectangle. Collisions
3207 * between elements can be automatically detected and as a result elements
3208 * can be repositioned or get hidden.
3209 */
3210 class DataLabelManager {
3211 movingStep: number;
3212 hideOverlapped: boolean;
3213 static DefaultAnchorMargin: number;
3214 static DefaultMaximumMovingDistance: number;
3215 static DefaultMinimumMovingDistance: number;
3216 static InflateAmount: number;
3217 private defaultDataLabelSettings;
3218 defaultSettings: IDataLabelSettings;
3219 /** Arranges the lables position and visibility*/
3220 hideCollidedLabels(viewport: IViewport, data: any[], layout: any, addTransform?: boolean): powerbi.visuals.LabelEnabledDataPoint[];
3221 /**
3222 * Merges the label element info with the panel element info and returns correct label info.
3223 * @param source The label info.
3224 */
3225 getLabelInfo(source: IDataLabelInfo): IDataLabelInfo;
3226 /**
3227 * (Private) Calculates element position using anchor point..
3228 */
3229 private calculateContentPositionFromPoint(anchorPoint, contentPosition, contentSize, offset);
3230 /** (Private) Calculates element position using anchor rect. */
3231 private calculateContentPositionFromRect(anchorRect, anchorRectOrientation, contentPosition, contentSize, offset);
3232 /** (Private) Calculates element inside center position using anchor rect. */
3233 private handleInsideCenterPosition(anchorRectOrientation, contentSize, anchorRect, offset);
3234 /** (Private) Calculates element inside end position using anchor rect. */
3235 private handleInsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
3236 /** (Private) Calculates element inside base position using anchor rect. */
3237 private handleInsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
3238 /** (Private) Calculates element outside end position using anchor rect. */
3239 private handleOutsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
3240 /** (Private) Calculates element outside base position using anchor rect. */
3241 private handleOutsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
3242 /** (Private) Calculates element position. */
3243 private calculateContentPosition(anchoredElementInfo, contentPosition, contentSize, offset);
3244 /** (Private) Check for collisions. */
3245 private hasCollisions(arrangeGrid, info, position, size);
3246 static isValid(rect: IRect): boolean;
3247 }
3248 /**
3249 * Utility class to speed up the conflict detection by collecting the arranged items in the DataLabelsPanel.
3250 */
3251 class DataLabelArrangeGrid {
3252 private grid;
3253 private cellSize;
3254 private rowCount;
3255 private colCount;
3256 private static ARRANGEGRID_MIN_COUNT;
3257 private static ARRANGEGRID_MAX_COUNT;
3258 /**
3259 * Creates new ArrangeGrid.
3260 * @param size The available size
3261 */
3262 constructor(size: shapes.ISize, elements: any[], layout: powerbi.visuals.ILabelLayout);
3263 /**
3264 * Register a new label element.
3265 * @param element The label element to register.
3266 * @param rect The label element position rectangle.
3267 */
3268 add(element: IDataLabelInfo, rect: IRect): void;
3269 /**
3270 * Checks for conflict of given rectangle in registered elements.
3271 * @param rect The rectengle to check.
3272 * @return True if conflict is detected.
3273 */
3274 hasConflict(rect: IRect): boolean;
3275 /**
3276 * Calculates the number of rows or columns in a grid
3277 * @param step is the largest label size (width or height)
3278 * @param length is the grid size (width or height)
3279 * @param minCount is the minimum allowed size
3280 * @param maxCount is the maximum allowed size
3281 * @return the number of grid rows or columns
3282 */
3283 private getGridRowColCount(step, length, minCount, maxCount);
3284 /**
3285 * Returns the grid index of a given recangle
3286 * @param rect The rectengle to check.
3287 * @return grid index as a thickness object.
3288 */
3289 private getGridIndexRect(rect);
3290 }
3291}
3292
3293declare module powerbi {
3294 import shapes = powerbi.visuals.shapes;
3295 import ISize = shapes.ISize;
3296 import IRect = powerbi.visuals.IRect;
3297 import IPoint = shapes.IPoint;
3298 import SelectableDataPoint = powerbi.visuals.SelectableDataPoint;
3299 /**
3300 * Defines possible data label positions relative to rectangles
3301 */
3302 const enum RectLabelPosition {
3303 /** Position is not defined. */
3304 None = 0,
3305 /** Content is placed inside the parent rectangle in the center. */
3306 InsideCenter = 1,
3307 /** Content is placed inside the parent rectangle at the base. */
3308 InsideBase = 2,
3309 /** Content is placed inside the parent rectangle at the end. */
3310 InsideEnd = 4,
3311 /** Content is placed outside the parent rectangle at the base. */
3312 OutsideBase = 8,
3313 /** Content is placed outside the parent rectangle at the end. */
3314 OutsideEnd = 16,
3315 /** Content supports all possible positions. */
3316 All = 31,
3317 /** Content supports positions inside the rectangle */
3318 InsideAll = 7,
3319 }
3320 /**
3321 * Defines possible data label positions relative to points or circles
3322 */
3323 const enum NewPointLabelPosition {
3324 /** Position is not defined. */
3325 None = 0,
3326 Above = 1,
3327 Below = 2,
3328 Left = 4,
3329 Right = 8,
3330 BelowRight = 16,
3331 BelowLeft = 32,
3332 AboveRight = 64,
3333 AboveLeft = 128,
3334 Center = 256,
3335 All = 511,
3336 }
3337 /**
3338 * Rectangle orientation, defined by vertical vs horizontal and which direction
3339 * the "base" is at.
3340 */
3341 const enum NewRectOrientation {
3342 /** Rectangle with no specific orientation. */
3343 None = 0,
3344 /** Vertical rectangle with base at the bottom. */
3345 VerticalBottomBased = 1,
3346 /** Vertical rectangle with base at the top. */
3347 VerticalTopBased = 2,
3348 /** Horizontal rectangle with base at the left. */
3349 HorizontalLeftBased = 3,
3350 /** Horizontal rectangle with base at the right. */
3351 HorizontalRightBased = 4,
3352 }
3353 const enum LabelDataPointParentType {
3354 Point = 0,
3355 Rectangle = 1,
3356 Polygon = 2,
3357 }
3358 interface LabelParentRect {
3359 /** The rectangle this data label belongs to */
3360 rect: IRect;
3361 /** The orientation of the parent rectangle */
3362 orientation: NewRectOrientation;
3363 /** Valid positions to place the label ordered by preference */
3364 validPositions: RectLabelPosition[];
3365 }
3366 interface LabelParentPoint {
3367 /** The point this data label belongs to */
3368 point: IPoint;
3369 /** The radius of the point to be added to the offset (for circular geometry) */
3370 radius: number;
3371 /** Valid positions to place the label ordered by preference */
3372 validPositions: NewPointLabelPosition[];
3373 }
3374 interface LabelDataPoint {
3375 /** The measured size of the text */
3376 textSize: ISize;
3377 /** Is data label preferred? Preferred labels will be rendered first */
3378 isPreferred: boolean;
3379 /** Whether the parent type is a rectangle, point or polygon */
3380 parentType: LabelDataPointParentType;
3381 /** The parent geometry for the data label */
3382 parentShape: LabelParentRect | LabelParentPoint | LabelParentPolygon;
3383 /** Whether or not the label has a background */
3384 hasBackground?: boolean;
3385 /** Text to be displayed in the label */
3386 text: string;
3387 /** A text that represent the label tooltip */
3388 tooltip?: string;
3389 /** Color to use for the data label if drawn inside */
3390 insideFill: string;
3391 /** Color to use for the data label if drawn outside */
3392 outsideFill: string;
3393 /** The identity of the data point associated with the data label */
3394 identity: powerbi.visuals.SelectionId;
3395 /** The key of the data point associated with the data label (used if identity is not unique to each expected label) */
3396 key?: string;
3397 /** The font size of the data point associated with the data label */
3398 fontSize?: number;
3399 /** Second row of text to be displayed in the label, for additional information */
3400 secondRowText?: string;
3401 /** The calculated weight of the data point associated with the data label */
3402 weight?: number;
3403 /** Whether or not the data label has been rendered */
3404 hasBeenRendered?: boolean;
3405 /** Size of the label adjusted for the background, if necessary */
3406 labelSize?: ISize;
3407 }
3408 interface LabelDataPointGroup {
3409 labelDataPoints: LabelDataPoint[];
3410 maxNumberOfLabels: number;
3411 }
3412 interface Label extends SelectableDataPoint {
3413 /** Text to be displayed in the label */
3414 text: string;
3415 /** Second row of text to be displayed in the label */
3416 secondRowText?: string;
3417 /** The bounding box for the label */
3418 boundingBox: IRect;
3419 /** Whether or not the data label should be rendered */
3420 isVisible: boolean;
3421 /** The fill color of the data label */
3422 fill: string;
3423 /** A unique key for data points (used if key cannot be obtained from the identity) */
3424 key?: string;
3425 /** The text size of the data label */
3426 fontSize?: number;
3427 /** A text anchor used to override the default label text-anchor (middle) */
3428 textAnchor?: string;
3429 /** points for reference line rendering */
3430 leaderLinePoints?: number[][];
3431 /** Whether or not the label has a background (and text position needs to be adjusted to take that into account) */
3432 hasBackground: boolean;
3433 /** A text that represent the label tooltip */
3434 tooltip?: string;
3435 }
3436 interface GridSubsection {
3437 xMin: number;
3438 xMax: number;
3439 yMin: number;
3440 yMax: number;
3441 }
3442 class LabelArrangeGrid {
3443 private grid;
3444 private viewport;
3445 private cellSize;
3446 private columnCount;
3447 private rowCount;
3448 /**
3449 * A multiplier applied to the largest width height to attempt to balance # of
3450 * labels in each cell and number of cells each label belongs to
3451 */
3452 private static cellSizeMultiplier;
3453 constructor(labelDataPointsGroups: LabelDataPointGroup[], viewport: IViewport);
3454 /**
3455 * Add a rectangle to check collision against
3456 */
3457 add(rect: IRect): void;
3458 /**
3459 * Check whether the rect conflicts with the grid, either bleeding outside the
3460 * viewport or colliding with another rect added to the grid.
3461 */
3462 hasConflict(rect: IRect): boolean;
3463 /**
3464 * Attempt to position the given rect within the viewport. Returns
3465 * the adjusted rectangle or null if the rectangle couldn't fit,
3466 * conflicts with the viewport, or is too far outside the viewport
3467 */
3468 tryPositionInViewport(rect: IRect): IRect;
3469 /**
3470 * Checks for a collision between the given rect and others in the grid.
3471 * Returns true if there is a collision.
3472 */
3473 private hasCollision(rect);
3474 /**
3475 * Check to see if the given rect is inside the grid's viewport
3476 */
3477 private isWithinGridViewport(rect);
3478 /**
3479 * Checks to see if the rect is close enough to the viewport to be moved inside.
3480 * "Close" here is determined by the distance between the edge of the viewport
3481 * and the closest edge of the rect; if that distance is less than the appropriate
3482 * dimension of the rect, we will reposition the rect.
3483 */
3484 private isCloseToGridViewport(rect);
3485 /**
3486 * Attempt to move the rect inside the grid's viewport. Returns the resulting
3487 * rectangle with the same width/height adjusted to be inside the viewport or
3488 * null if it couldn't fit regardless.
3489 */
3490 private tryMoveInsideViewport(rect);
3491 private getContainingGridSubsection(rect);
3492 private static getCellCount(step, length, minCount, maxCount);
3493 private static bound(value, min, max);
3494 }
3495 interface DataLabelLayoutOptions {
3496 /** The amount of offset to start with when the data label is not centered */
3497 startingOffset: number;
3498 /** Maximum distance labels will be offset by */
3499 maximumOffset: number;
3500 /** The amount to increase the offset each attempt while laying out labels */
3501 offsetIterationDelta?: number;
3502 /** Horizontal padding used for checking whether a label is inside a parent shape */
3503 horizontalPadding?: number;
3504 /** Vertical padding used for checking whether a label is inside a parent shape */
3505 verticalPadding?: number;
3506 /** Should we draw reference lines in case the label offset is greater then the default */
3507 allowLeaderLines?: boolean;
3508 /** Should the layout system attempt to move the label inside the viewport when it outside, but close */
3509 attemptToMoveLabelsIntoViewport?: boolean;
3510 }
3511 class LabelLayout {
3512 /** Maximum distance labels will be offset by */
3513 private maximumOffset;
3514 /** The amount to increase the offset each attempt while laying out labels */
3515 private offsetIterationDelta;
3516 /** The amount of offset to start with when the data label is not centered */
3517 private startingOffset;
3518 /** Padding used for checking whether a label is inside a parent shape */
3519 private horizontalPadding;
3520 /** Padding used for checking whether a label is inside a parent shape */
3521 private verticalPadding;
3522 /** Should we draw leader lines in case the label offset is greater then the default */
3523 private allowLeaderLines;
3524 /** Should the layout system attempt to move the label inside the viewport when it outside, but close */
3525 private attemptToMoveLabelsIntoViewport;
3526 private static defaultOffsetIterationDelta;
3527 private static defaultHorizontalPadding;
3528 private static defaultVerticalPadding;
3529 constructor(options: DataLabelLayoutOptions);
3530 /**
3531 * Arrange takes a set of data labels and lays them out in order, assuming that
3532 * the given array has already been sorted with the most preferred labels at the
3533 * front, taking into considiration a maximum number of labels that are alowed
3534 * to display.
3535 *
3536 * Details:
3537 * - We iterate over offsets from the target position, increasing from 0 while
3538 * verifiying the maximum number of labels to display hasn't been reached
3539 * - For each offset, we iterate over each data label
3540 * - For each data label, we iterate over each position that is valid for
3541 * both the specific label and this layout
3542 * - When a valid position is found, we position the label there and no longer
3543 * reposition it.
3544 * - This prioritizes the earlier labels to be positioned closer to their
3545 * target points in the position they prefer.
3546 * - This prioritizes putting data labels close to a valid position over
3547 * placing them at their preferred position (it will place it at a less
3548 * preferred position if it will be a smaller offset)
3549 */
3550 layout(labelDataPointsGroups: LabelDataPointGroup[], viewport: IViewport): Label[];
3551 private positionDataLabels(labelDataPoints, viewport, grid, maxLabelsToRender);
3552 private tryPositionForRectPositions(labelPoint, grid, currentLabelOffset, currentCenteredLabelOffset);
3553 /**
3554 * Tests a particular position/offset combination for the given data label.
3555 * If the label can be placed, returns the resulting bounding box for the data
3556 * label. If not, returns null.
3557 */
3558 private static tryPositionRect(grid, position, labelDataPoint, offset, centerOffset, adjustForViewport);
3559 private tryPositionForPointPositions(labelPoint, grid, currentLabelOffset, drawLeaderLines);
3560 private static tryPositionPoint(grid, position, labelDataPoint, offset, adjustForViewport);
3561 }
3562 /**
3563 * (Private) Contains methods for calculating the bounding box of a data label
3564 */
3565 module DataLabelRectPositioner {
3566 function getLabelRect(labelDataPoint: LabelDataPoint, position: RectLabelPosition, offset: number): IRect;
3567 function canFitWithinParent(labelDataPoint: LabelDataPoint, horizontalPadding: number, verticalPadding: number): boolean;
3568 function isLabelWithinParent(labelRect: IRect, labelPoint: LabelDataPoint, horizontalPadding: number, verticalPadding: number): boolean;
3569 function topInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3570 function bottomInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3571 function rightInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3572 function leftInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3573 function topOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3574 function bottomOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3575 function rightOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3576 function leftOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3577 function middleHorizontal(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3578 function middleVertical(labelSize: ISize, parentRect: IRect, offset: number): IRect;
3579 }
3580 module DataLabelPointPositioner {
3581 const cos45: number;
3582 const sin45: number;
3583 function getLabelRect(labelSize: ISize, parentPoint: LabelParentPoint, position: NewPointLabelPosition, offset: number): IRect;
3584 function above(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3585 function below(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3586 function left(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3587 function right(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3588 function belowLeft(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3589 function belowRight(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3590 function aboveLeft(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3591 function aboveRight(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
3592 function center(labelSize: ISize, parentPoint: IPoint): IRect;
3593 function getLabelLeaderLineEndingPoint(boundingBox: IRect, position: NewPointLabelPosition, parentShape: LabelParentPoint): number[][];
3594 }
3595}
3596
3597declare module powerbi {
3598 import ISize = powerbi.visuals.shapes.ISize;
3599 import IRect = powerbi.visuals.IRect;
3600 import VisualDataLabelsSettings = powerbi.visuals.VisualDataLabelsSettings;
3601 import DonutArcDescriptor = powerbi.visuals.DonutArcDescriptor;
3602 interface DonutChartProperties {
3603 viewport: IViewport;
3604 dataLabelsSettings: VisualDataLabelsSettings;
3605 radius: number;
3606 arc: D3.Svg.Arc;
3607 outerArc: D3.Svg.Arc;
3608 outerArcRadiusRatio: number;
3609 innerArcRadiusRatio: number;
3610 }
3611 interface DonutLabelDataPoint extends LabelDataPoint {
3612 dataLabel: string;
3613 dataLabelSize: ISize;
3614 categoryLabel: string;
3615 categoryLabelSize: ISize;
3616 donutArcDescriptor: DonutArcDescriptor;
3617 alternativeScale: number;
3618 angle: number;
3619 linesSize: ISize[];
3620 leaderLinePoints: number[][];
3621 }
3622 interface DonutLabelRect {
3623 textRect: IRect;
3624 diagonalLineRect: IRect;
3625 horizontalLineRect: IRect;
3626 }
3627 class DonutLabelLayout {
3628 /** Maximum distance labels will be offset by */
3629 private maximumOffset;
3630 /** The amount to increase the offset each attempt while laying out labels */
3631 private offsetIterationDelta;
3632 /** The amount of offset to start with when the data label is not centered */
3633 private startingOffset;
3634 private donutChartProperties;
3635 private center;
3636 private outerRadius;
3637 private innerRadius;
3638 private additionalCharsWidth;
3639 constructor(options: DataLabelLayoutOptions, donutChartProperties: DonutChartProperties);
3640 /**
3641 * Arrange takes a set of data labels and lays them out them in order, assuming that
3642 * the given array has already been sorted with the most preferred labels at the
3643 * front.
3644 *
3645 * Details:
3646 * - We iterate over offsets from the target position, increasing from 0
3647 * - For each offset, we iterate over each data label
3648 * - For each data label, we iterate over each position that is valid for
3649 * both the specific label and this layout
3650 * - When a valid position is found, we position the label there and no longer
3651 * reposition it.
3652 * - This prioritizes the earlier labels to be positioned closer to their
3653 * target points in the position they prefer.
3654 * - This prioritizes putting data labels close to a valid position over
3655 * placing them at their preferred position (it will place it at a less
3656 * preferred position if it will be a smaller offset)
3657 */
3658 layout(labelDataPoints: DonutLabelDataPoint[]): Label[];
3659 private positionLabels(labelDataPoints, grid);
3660 /**
3661 * We try to move the label 25% up/down if the label is truncated or it collides with other labels.
3662 * after we moved it once we check that the new position doesn't failed (collides with other labels).
3663 */
3664 private tryPositionForDonut(labelPoint, grid, currentLabelOffset);
3665 private generateCandidate(labelDataPoint, candidatePosition, grid, currentLabelOffset);
3666 private tryAllPositions(labelDataPoint, grid, defaultPosition, currentLabelOffset);
3667 private buildLabel(labelLayout, grid);
3668 private static tryPositionPoint(grid, position, labelDataPoint, offset, center, viewport);
3669 /**
3670 * Returns an array of valid positions for hidden and truncated labels.
3671 * For truncated labels will return positions with more available space.
3672 * For hidden labels will return all possible positions by the order we draw labels (clockwise)
3673 */
3674 private getLabelPointPositions(labelPoint, isTruncated);
3675 /**
3676 * Returns a new DonutLabelDataPoint after splitting it into two lines
3677 */
3678 private splitDonutDataPoint(labelPoint);
3679 private generateCandidateAngleForPosition(d, position);
3680 private getPointPositionForAngle(angle);
3681 private score(labelPoint, point);
3682 }
3683}
3684
3685declare module powerbi {
3686 import IPoint = powerbi.visuals.IPoint;
3687 import IRect = powerbi.visuals.IRect;
3688 import Polygon = powerbi.visuals.shapes.Polygon;
3689 import Transform = powerbi.visuals.Transform;
3690 interface LabelParentPolygon {
3691 /** The point this data label belongs to */
3692 polygon: Polygon;
3693 /** Valid positions to place the label ordered by preference */
3694 validPositions: NewPointLabelPosition[];
3695 }
3696 interface FilledMapLabel extends Label {
3697 absoluteBoundingBoxCenter: IPoint;
3698 originalPixelOffset: number;
3699 originalPosition?: NewPointLabelPosition;
3700 originalAbsoluteCentroid?: IPoint;
3701 absoluteStemSource?: IPoint;
3702 isPlacedInsidePolygon: boolean;
3703 }
3704 class FilledMapLabelLayout {
3705 private labels;
3706 layout(labelDataPoints: LabelDataPoint[], viewport: IViewport, polygonInfoTransform: Transform, redrawDataLabels: boolean): Label[];
3707 getLabelPolygon(mapDataPoint: LabelDataPoint, position: NewPointLabelPosition, pointPosition: IPoint, offset: number): IRect;
3708 private getLabelBoundingBox(dataPointSize, position, pointPosition, offset);
3709 private getLabelByPolygonPositions(labelPoint, polygonInfoTransform, grid, shapesGrid);
3710 private setLeaderLinePoints(stemSource, stemDestination);
3711 private calculateStemSource(polygonInfoTransform, inverseTransorm, polygon, labelBoundingBox, position, pixelCentroid);
3712 private calculateStemDestination(labelBoundingBox, position);
3713 private tryPositionForPolygonPosition(position, labelDataPoint, polygonInfoTransform, offset, inverseTransorm);
3714 /**
3715 * Tests a particular position/offset combination for the given data label.
3716 * If the label can be placed, returns the resulting bounding box for the data
3717 * label. If not, returns null.
3718 */
3719 private tryPlaceLabelOutsidePolygon(grid, position, labelDataPoint, offset, pixelCentroid, shapesGrid, inverseTransform);
3720 private updateLabelOffsets(polygonInfoTransform);
3721 private getAbsoluteRectangle(inverseTransorm, rect);
3722 }
3723 class LabelPolygonArrangeGrid {
3724 private grid;
3725 private viewport;
3726 private cellSize;
3727 private columnCount;
3728 private rowCount;
3729 /**
3730 * A multiplier applied to the largest width height to attempt to balance # of
3731 * polygons in each cell and number of cells each polygon belongs to
3732 */
3733 private static cellSizeMultiplier;
3734 constructor(polygons: Polygon[], viewport: IViewport);
3735 hasConflict(absolutLabelRect: IRect, pixelLabelRect: IRect): boolean;
3736 private add(polygon);
3737 private getContainingGridSubsection(rect);
3738 private static getCellCount(step, length, minCount, maxCount);
3739 private static bound(value, min, max);
3740 }
3741}
3742
3743declare module powerbi.visuals {
3744 function createColorAllocatorFactory(): IColorAllocatorFactory;
3745}
3746
3747declare module powerbi.visuals {
3748 class DefaultVisualHostServices implements IVisualHostServices {
3749 static initialize(): void;
3750 /**
3751 * Create locale options.
3752 *
3753 * Note: Public for testability.
3754 */
3755 static createLocaleOptions(): visuals.ValueFormatterLocalizationOptions;
3756 static createTooltipLocaleOptions(): powerbi.visuals.TooltipLocalizationOptions;
3757 getLocalizedString(stringId: string): string;
3758 onDragStart(): void;
3759 canSelect(): boolean;
3760 onSelect(): void;
3761 onContextMenu(): void;
3762 loadMoreData(): void;
3763 persistProperties(changes: VisualObjectInstance[] | VisualObjectInstancesToPersist): void;
3764 onCustomSort(args: CustomSortEventArgs): void;
3765 getViewMode(): powerbi.ViewMode;
3766 setWarnings(warnings: IVisualWarning[]): void;
3767 setToolbar($toolbar: JQuery): void;
3768 shouldRetainSelection(): boolean;
3769 geocoder(): IGeocoder;
3770 geolocation(): IGeolocation;
3771 promiseFactory(): IPromiseFactory;
3772 visualCapabilitiesChanged(): void;
3773 analyzeFilter(options: FilterAnalyzerOptions): AnalyzedFilter;
3774 getIdentityDisplayNames(dentities: DataViewScopeIdentity[]): DisplayNameIdentityPair[];
3775 setIdentityDisplayNames(displayNamesIdentityPairs: DisplayNameIdentityPair[]): void;
3776 private static beautify(format);
3777 private static describeUnit(exponent);
3778 }
3779 const defaultVisualHostServices: IVisualHostServices;
3780}
3781
3782declare module powerbi.visuals {
3783 import SemanticFilter = powerbi.data.SemanticFilter;
3784 interface SelectableDataPoint {
3785 selected: boolean;
3786 identity: SelectionId;
3787 }
3788 /**
3789 * Factory method to create an IInteractivityService instance.
3790 */
3791 function createInteractivityService(hostServices: IVisualHostServices): IInteractivityService;
3792 /**
3793 * Creates a clear an svg rect to catch clear clicks.
3794 */
3795 function appendClearCatcher(selection: D3.Selection): D3.Selection;
3796 function isCategoryColumnSelected(propertyId: DataViewObjectPropertyIdentifier, categories: DataViewCategoricalColumn, idx: number): boolean;
3797 function dataHasSelection(data: SelectableDataPoint[]): boolean;
3798 interface IInteractiveBehavior {
3799 bindEvents(behaviorOptions: any, selectionHandler: ISelectionHandler): void;
3800 renderSelection(hasSelection: boolean): void;
3801 }
3802 /**
3803 * An optional options bag for binding to the interactivityService
3804 */
3805 interface InteractivityServiceOptions {
3806 isLegend?: boolean;
3807 isLabels?: boolean;
3808 overrideSelectionFromData?: boolean;
3809 hasSelectionOverride?: boolean;
3810 slicerValueHandler?: SlicerValueHandler;
3811 }
3812 /**
3813 * Responsible for managing interactivity between the hosting visual and its peers
3814 */
3815 interface IInteractivityService {
3816 /** Binds the visual to the interactivityService */
3817 bind(dataPoints: SelectableDataPoint[], behavior: IInteractiveBehavior, behaviorOptions: any, iteractivityServiceOptions?: InteractivityServiceOptions): any;
3818 /** Clears the selection */
3819 clearSelection(): void;
3820 /** Sets the selected state on the given data points. */
3821 applySelectionStateToData(dataPoints: SelectableDataPoint[]): boolean;
3822 /** Checks whether there is at least one item selected */
3823 hasSelection(): boolean;
3824 /** Checks whether there is at least one item selected within the legend */
3825 legendHasSelection(): boolean;
3826 /** Checks whether the selection mode is inverted or normal */
3827 isSelectionModeInverted(): boolean;
3828 /** Sets whether the selection mode is inverted or normal */
3829 setSelectionModeInverted(inverted: boolean): void;
3830 setDefaultValueMode(useDefaultValue: boolean): void;
3831 isDefaultValueEnabled(): boolean;
3832 }
3833 interface ISelectionHandler {
3834 /** Handles a selection event by selecting the given data point */
3835 handleSelection(dataPoint: SelectableDataPoint, multiSelect: boolean): void;
3836 /** Handles a request for a context menu. */
3837 handleContextMenu(dataPoint: SelectableDataPoint, position: IPoint): void;
3838 /** Handles a selection clear, clearing all selection state */
3839 handleClearSelection(): void;
3840 /** Toggles the selection mode between normal and inverted; returns true if the new mode is inverted */
3841 toggleSelectionModeInversion(): boolean;
3842 /** Sends the selection state to the host */
3843 persistSelectionFilter(filterPropertyIdentifier: DataViewObjectPropertyIdentifier): void;
3844 /** Sends selfFilter to the host */
3845 persistSelfFilter(filterPropertyIdentifier: DataViewObjectPropertyIdentifier, selfFilter: SemanticFilter): void;
3846 }
3847 class InteractivityService implements IInteractivityService, ISelectionHandler {
3848 private hostService;
3849 private renderSelectionInVisual;
3850 private renderSelectionInLegend;
3851 private renderSelectionInLabels;
3852 private selectedIds;
3853 private isInvertedSelectionMode;
3854 private hasSelectionOverride;
3855 private behavior;
3856 private slicerValueHandler;
3857 private useDefaultValue;
3858 selectableDataPoints: SelectableDataPoint[];
3859 selectableLegendDataPoints: SelectableDataPoint[];
3860 selectableLabelsDataPoints: SelectableDataPoint[];
3861 constructor(hostServices: IVisualHostServices);
3862 /** Binds the vsiual to the interactivityService */
3863 bind(dataPoints: SelectableDataPoint[], behavior: IInteractiveBehavior, behaviorOptions: any, options?: InteractivityServiceOptions): void;
3864 /**
3865 * Sets the selected state of all selectable data points to false and invokes the behavior's select command.
3866 */
3867 clearSelection(): void;
3868 applySelectionStateToData(dataPoints: SelectableDataPoint[]): boolean;
3869 /**
3870 * Checks whether there is at least one item selected.
3871 */
3872 hasSelection(): boolean;
3873 legendHasSelection(): boolean;
3874 labelsHasSelection(): boolean;
3875 isSelectionModeInverted(): boolean;
3876 setSelectionModeInverted(inverted: boolean): void;
3877 handleSelection(dataPoint: SelectableDataPoint, multiSelect: boolean): void;
3878 handleContextMenu(dataPoint: SelectableDataPoint, point: IPoint): void;
3879 handleClearSelection(): void;
3880 toggleSelectionModeInversion(): boolean;
3881 persistSelectionFilter(filterPropertyIdentifier: DataViewObjectPropertyIdentifier): void;
3882 persistSelfFilter(filterPropertyIdentifier: DataViewObjectPropertyIdentifier, selfFilter: SemanticFilter): void;
3883 setDefaultValueMode(useDefaultValue: boolean): void;
3884 isDefaultValueEnabled(): boolean;
3885 private renderAll();
3886 /** Marks a data point as selected and syncs selection with the host. */
3887 private select(d, multiSelect);
3888 private selectInverted(d, multiSelect);
3889 private removeId(toRemove);
3890 private getFilterFromSelectors();
3891 private static createChangeForFilterProperty(filterPropertyIdentifier, filter);
3892 private sendContextMenuToHost(dataPoint, position);
3893 private sendSelectionToHost();
3894 private getSelectorsByColumn(selectionIds);
3895 private takeSelectionStateFromDataPoints(dataPoints);
3896 /**
3897 * Syncs the selection state for all data points that have the same category. Returns
3898 * true if the selection state was out of sync and corrections were made; false if
3899 * the data is already in sync with the service.
3900 *
3901 * If the data is not compatible with the current service's current selection state,
3902 * the state is cleared and the cleared selection is sent to the host.
3903 *
3904 * Ignores series for now, since we don't support series selection at the moment.
3905 */
3906 private syncSelectionState();
3907 private syncSelectionStateInverted();
3908 private applyToAllSelectableDataPoints(action);
3909 private static updateSelectableDataPointsBySelectedIds(selectableDataPoints, selectedIds);
3910 private static checkDatapointAgainstSelectedIds(datapoint, selectedIds);
3911 private removeSelectionIdsWithOnlyMeasures();
3912 private removeSelectionIdsExceptOnlyMeasures();
3913 }
3914}
3915
3916declare module powerbi.visuals.services {
3917 function createGeocoder(): IGeocoder;
3918 interface BingAjaxService {
3919 (url: string, settings: JQueryAjaxSettings): any;
3920 }
3921 const safeCharacters: string;
3922 /** Note: Used for test mockup */
3923 let BingAjaxCall: BingAjaxService;
3924 const CategoryTypeArray: string[];
3925 function isCategoryType(value: string): boolean;
3926 const BingEntities: {
3927 Continent: string;
3928 Sovereign: string;
3929 CountryRegion: string;
3930 AdminDivision1: string;
3931 AdminDivision2: string;
3932 PopulatedPlace: string;
3933 Postcode: string;
3934 Postcode1: string;
3935 Neighborhood: string;
3936 Address: string;
3937 };
3938 interface ILocation {
3939 latitude: number;
3940 longitude: number;
3941 }
3942 interface ILocationRect {
3943 northWest: ILocation;
3944 southEast: ILocation;
3945 }
3946 interface GeocodeCallback {
3947 (error: Error, coordinate: IGeocodeCoordinate): void;
3948 }
3949 interface IGeocodeQuery {
3950 query: string;
3951 category: string;
3952 levelOfDetail?: number;
3953 longitude?: number;
3954 latitude?: number;
3955 }
3956 class GeocodeQuery implements IGeocodeQuery {
3957 query: string;
3958 category: string;
3959 key: string;
3960 constructor(query: string, category: string);
3961 getBingEntity(): string;
3962 getUrl(): string;
3963 }
3964 class GeocodePointQuery extends GeocodeQuery {
3965 latitude: number;
3966 longitude: number;
3967 entities: string[];
3968 constructor(latitude: number, longitude: number, entities: string[]);
3969 getUrl(): string;
3970 }
3971 class GeocodeBoundaryQuery extends GeocodeQuery {
3972 latitude: number;
3973 longitude: number;
3974 levelOfDetail: number;
3975 maxGeoData: number;
3976 constructor(latitude: number, longitude: number, category: any, levelOfDetail: any, maxGeoData?: number);
3977 getBingEntity(): string;
3978 getUrl(): string;
3979 }
3980 function geocodeCore(geocodeQuery: GeocodeQuery, options?: GeocodeOptions): any;
3981 function geocode(query: string, category?: string, options?: GeocodeOptions): any;
3982 function geocodeBoundary(latitude: number, longitude: number, category?: string, levelOfDetail?: number, maxGeoData?: number, options?: GeocodeOptions): any;
3983 function geocodePoint(latitude: number, longitude: number, entities: string[], options?: GeocodeOptions): any;
3984 function resetStaticGeocoderState(cache?: IGeocodingCache): void;
3985}
3986
3987declare module powerbi.visuals.services {
3988 interface IGeocodingCache {
3989 getCoordinates(key: string): IGeocodeCoordinate;
3990 registerCoordinates(key: string, coordinate: IGeocodeCoordinate): void;
3991 registerCoordinates(key: string, coordinate: IGeocodeBoundaryCoordinate): void;
3992 }
3993 function createGeocodingCache(maxCacheSize: number, maxCacheSizeOverflow: number, localStorageService?: IStorageService): IGeocodingCache;
3994}
3995
3996declare module powerbi.visuals.services {
3997 function createGeolocation(): IGeolocation;
3998}
3999
4000declare module powerbi.visuals.controls {
4001 function fire(eventHandlers: any, eventArgs: any): void;
4002 class ScrollbarButton {
4003 static MIN_WIDTH: number;
4004 static ARROW_COLOR: string;
4005 private _element;
4006 private _polygon;
4007 private _svg;
4008 private _owner;
4009 private _direction;
4010 private _timerHandle;
4011 private _mouseUpWrapper;
4012 constructor(owner: Scrollbar, direction: number);
4013 element: HTMLDivElement;
4014 private createView();
4015 private onMouseDown(event);
4016 private onMouseUp(event);
4017 arrange(width: number, height: number, angle: number): void;
4018 }
4019 /** Scrollbar base class */
4020 class Scrollbar {
4021 static DefaultScrollbarWidth: string;
4022 private static ScrollbarBackgroundFirstTimeMousedownHoldDelay;
4023 private static ScrollbarBackgroundMousedownHoldDelay;
4024 private static MouseWheelRange;
4025 static className: string;
4026 static barClassName: string;
4027 static arrowClassName: string;
4028 MIN_BAR_SIZE: number;
4029 min: number;
4030 max: number;
4031 viewMin: number;
4032 viewSize: number;
4033 smallIncrement: number;
4034 _onscroll: any[];
4035 private _actualWidth;
4036 private _actualHeight;
4037 private _actualButtonWidth;
4038 private _actualButtonHeight;
4039 private _width;
4040 private _height;
4041 private _visible;
4042 private _element;
4043 private _minButton;
4044 private _maxButton;
4045 private _middleBar;
4046 private _timerHandle;
4047 private _screenToOffsetScale;
4048 private _screenPrevMousePos;
4049 private _screenMinMousePos;
4050 private _screenMaxMousePos;
4051 private _backgroundMouseUpWrapper;
4052 private _middleBarMouseMoveWrapper;
4053 private _middleBarMouseUpWrapper;
4054 private _touchPanel;
4055 private _offsetTouchStartPos;
4056 private _offsetTouchPrevPos;
4057 private _touchStarted;
4058 private _allowMouseDrag;
4059 constructor(parentElement: HTMLElement, layoutKind: TablixLayoutKind);
4060 scrollBy(delta: number): void;
4061 scrollUp(): void;
4062 scrollDown(): void;
4063 scrollPageUp(): void;
4064 scrollPageDown(): void;
4065 width: string;
4066 height: string;
4067 refresh(): void;
4068 element: HTMLDivElement;
4069 maxButton: ScrollbarButton;
4070 middleBar: HTMLDivElement;
4071 _scrollSmallIncrement(direction: any): void;
4072 visible: boolean;
4073 isInMouseCapture: boolean;
4074 show(value: boolean): void;
4075 _getMouseOffset(event: MouseEvent): {
4076 x: number;
4077 y: number;
4078 };
4079 _getOffsetXDelta(event: MouseEvent): number;
4080 _getOffsetYDelta(event: MouseEvent): number;
4081 _getOffsetXTouchDelta(event: MouseEvent): number;
4082 _getOffsetYTouchDelta(event: MouseEvent): number;
4083 initTouch(panel: HTMLElement, allowMouseDrag?: boolean): void;
4084 onTouchStart(e: any): void;
4085 onTouchMove(e: any): void;
4086 onTouchEnd(e: any): void;
4087 onTouchMouseDown(e: MouseEvent): void;
4088 _getOffsetTouchDelta(e: MouseEvent): number;
4089 onTouchMouseMove(e: MouseEvent): void;
4090 onTouchMouseUp(e: MouseEvent, bubble?: boolean): void;
4091 private createView(parentElement, layoutKind);
4092 private scrollTo(pos);
4093 _scrollByPage(event: MouseEvent): void;
4094 _getRunningSize(net: boolean): number;
4095 _getOffsetDelta(event: MouseEvent): number;
4096 private scroll(event);
4097 actualWidth: number;
4098 actualHeight: number;
4099 actualButtonWidth: number;
4100 actualButtonHeight: number;
4101 arrange(): void;
4102 _calculateButtonWidth(): number;
4103 _calculateButtonHeight(): number;
4104 _getMinButtonAngle(): number;
4105 _getMaxButtonAngle(): number;
4106 _setMaxButtonPosition(): void;
4107 invalidateArrange(): void;
4108 private onHoldBackgroundMouseDown(event);
4109 private onBackgroundMouseDown(event);
4110 private onBackgroundMouseUp(event);
4111 private getPinchZoomY();
4112 private onMiddleBarMouseDown(event);
4113 private onMiddleBarMouseMove(event);
4114 private onMiddleBarMouseUp(event);
4115 _getScreenContextualLeft(element: HTMLElement): number;
4116 _getScreenContextualRight(element: HTMLElement): number;
4117 onMouseWheel(delta: number): void;
4118 private mouseWheel(delta);
4119 _getScreenMousePos(event: MouseEvent): any;
4120 static addDocumentMouseUpEvent(func: any): void;
4121 static removeDocumentMouseUpEvent(func: any): void;
4122 static addDocumentMouseMoveEvent(func: any): void;
4123 static removeDocumentMouseMoveEvent(func: any): void;
4124 }
4125 /** Horizontal Scrollbar */
4126 class HorizontalScrollbar extends Scrollbar {
4127 constructor(parentElement: HTMLElement, layoutKind: TablixLayoutKind);
4128 _calculateButtonWidth(): number;
4129 _calculateButtonHeight(): number;
4130 _getMinButtonAngle(): number;
4131 _getMaxButtonAngle(): number;
4132 _setMaxButtonPosition(): void;
4133 refresh(): void;
4134 show(visible: boolean): void;
4135 _scrollByPage(event: MouseEvent): void;
4136 _getRunningSize(net: boolean): number;
4137 _getOffsetDelta(event: MouseEvent): number;
4138 _getOffsetTouchDelta(e: MouseEvent): number;
4139 _getScreenContextualLeft(element: HTMLElement): number;
4140 _getScreenContextualRight(element: HTMLElement): number;
4141 _getScreenMousePos(event: MouseEvent): number;
4142 }
4143 /** Vertical Scrollbar */
4144 class VerticalScrollbar extends Scrollbar {
4145 constructor(parentElement: HTMLElement, layoutKind: TablixLayoutKind);
4146 _calculateButtonWidth(): number;
4147 _calculateButtonHeight(): number;
4148 _getMinButtonAngle(): number;
4149 _getMaxButtonAngle(): number;
4150 _setMaxButtonPosition(): void;
4151 refresh(): void;
4152 show(visible: boolean): void;
4153 _scrollByPage(event: MouseEvent): void;
4154 _getRunningSize(net: boolean): number;
4155 _getOffsetDelta(event: MouseEvent): number;
4156 _getOffsetTouchDelta(e: MouseEvent): number;
4157 _getScreenContextualLeft(element: HTMLElement): number;
4158 _getScreenContextualRight(element: HTMLElement): number;
4159 _getScreenMousePos(event: MouseEvent): number;
4160 }
4161}
4162
4163declare module powerbi.visuals.controls.internal {
4164 /** This class is responsible for tablix header resizing */
4165 class TablixResizer {
4166 private _element;
4167 private _handler;
4168 private _elementMouseDownWrapper;
4169 private _elementMouseMoveWrapper;
4170 private _elementMouseOutWrapper;
4171 private _elementMouseDoubleClickOutWrapper;
4172 private _documentMouseMoveWrapper;
4173 private _documentMouseUpWrapper;
4174 private _startMousePosition;
4175 private _originalCursor;
4176 static resizeHandleSize: number;
4177 static resizeCursor: string;
4178 constructor(element: HTMLElement, handler: ITablixResizeHandler);
4179 static addDocumentMouseUpEvent(listener: EventListener): void;
4180 static removeDocumentMouseUpEvent(listener: EventListener): void;
4181 static addDocumentMouseMoveEvent(listener: EventListener): void;
4182 static removeDocumentMouseMoveEvent(listener: EventListener): void;
4183 static getMouseCoordinates(event: MouseEvent): {
4184 x: number;
4185 y: number;
4186 };
4187 static getMouseCoordinateDelta(previous: {
4188 x: number;
4189 y: number;
4190 }, current: {
4191 x: number;
4192 y: number;
4193 }): {
4194 x: number;
4195 y: number;
4196 };
4197 initialize(): void;
4198 uninitialize(): void;
4199 cell: TablixCell;
4200 element: HTMLElement;
4201 _hotSpot(position: {
4202 x: number;
4203 y: number;
4204 }): boolean;
4205 private onElementMouseDown(event);
4206 private onElementMouseMove(event);
4207 private onElementMouseOut(event);
4208 private onElementMouseDoubleClick(event);
4209 private onDocumentMouseMove(event);
4210 private onDocumentMouseUp(event);
4211 }
4212 class TablixDomResizer extends TablixResizer {
4213 private _cell;
4214 constructor(cell: TablixCell, element: HTMLElement, handler: ITablixResizeHandler);
4215 cell: TablixCell;
4216 _hotSpot(position: {
4217 x: number;
4218 y: number;
4219 }): boolean;
4220 }
4221 class TablixCellPresenter {
4222 static _dragResizeDisabledAttributeName: string;
4223 private _owner;
4224 private _tableCell;
4225 /** Outer DIV */
4226 private _contentElement;
4227 /** Inner DIV */
4228 private _contentHost;
4229 private _resizer;
4230 layoutKind: TablixLayoutKind;
4231 constructor(fitProportionally: boolean, layoutKind: TablixLayoutKind);
4232 initialize(owner: TablixCell): void;
4233 owner: TablixCell;
4234 registerTableCell(tableCell: HTMLTableCellElement): void;
4235 tableCell: HTMLTableCellElement;
4236 /**
4237 * Outer DIV
4238 */
4239 contentElement: HTMLElement;
4240 /**
4241 * Inner DIV
4242 */
4243 contentHost: HTMLElement;
4244 registerClickHandler(handler: (e: MouseEvent) => any): void;
4245 unregisterClickHandler(): void;
4246 onContainerWidthChanged(value: number): void;
4247 onContinerHeightChanged(height: number): void;
4248 onColumnSpanChanged(value: number): void;
4249 onRowSpanChanged(value: number): void;
4250 onTextAlignChanged(value: string): void;
4251 onClear(): void;
4252 onHorizontalScroll(width: number, offset: number): void;
4253 onVerticalScroll(height: number, offset: number): void;
4254 onInitializeScrolling(): void;
4255 enableHorizontalResize(enable: boolean, handler: ITablixResizeHandler): void;
4256 /**
4257 * In order to allow dragging of the tableCell we need to
4258 * disable dragging of the container of the cell in IE.
4259 */
4260 disableDragResize(): void;
4261 }
4262 class TablixRowPresenter {
4263 private _row;
4264 private _tableRow;
4265 private _fitProportionally;
4266 constructor(fitProportionally: boolean);
4267 initialize(row: TablixRow): void;
4268 createCellPresenter(layoutKind: controls.TablixLayoutKind): TablixCellPresenter;
4269 registerRow(tableRow: HTMLTableRowElement): void;
4270 onAppendCell(cell: TablixCell): void;
4271 onInsertCellBefore(cell: TablixCell, refCell: TablixCell): void;
4272 onRemoveCell(cell: TablixCell): void;
4273 getHeight(): number;
4274 getCellHeight(cell: ITablixCell): number;
4275 getCellContentHeight(cell: ITablixCell): number;
4276 tableRow: HTMLTableRowElement;
4277 }
4278 class DashboardRowPresenter extends TablixRowPresenter {
4279 private _gridPresenter;
4280 constructor(gridPresenter: DashboardTablixGridPresenter, fitProportionally: boolean);
4281 getCellHeight(cell: ITablixCell): number;
4282 getCellContentHeight(cell: ITablixCell): number;
4283 }
4284 class CanvasRowPresenter extends TablixRowPresenter {
4285 getCellHeight(cell: ITablixCell): number;
4286 getCellContentHeight(cell: ITablixCell): number;
4287 }
4288 class TablixColumnPresenter {
4289 protected _column: TablixColumn;
4290 initialize(column: TablixColumn): void;
4291 getWidth(): number;
4292 getPersistedWidth(): number;
4293 getCellWidth(cell: ITablixCell): number;
4294 }
4295 class DashboardColumnPresenter extends TablixColumnPresenter {
4296 private _gridPresenter;
4297 constructor(gridPresenter: DashboardTablixGridPresenter);
4298 getPersistedWidth(): number;
4299 getCellWidth(cell: ITablixCell): number;
4300 }
4301 class CanvasColumnPresenter extends TablixColumnPresenter {
4302 private _gridPresenter;
4303 private _columnIndex;
4304 constructor(gridPresenter: CanvasTablixGridPresenter, index: number);
4305 getPersistedWidth(): number;
4306 getCellWidth(cell: ITablixCell): number;
4307 }
4308 class TablixGridPresenter {
4309 protected _table: HTMLTableElement;
4310 protected _owner: TablixGrid;
4311 private _footerTable;
4312 private _columnWidthManager;
4313 constructor(columnWidthManager?: TablixColumnWidthManager);
4314 initialize(owner: TablixGrid, gridHost: HTMLElement, footerHost: HTMLElement, control: TablixControl): void;
4315 getWidth(): number;
4316 getHeight(): number;
4317 getScreenToCssRatioX(): number;
4318 getScreenToCssRatioY(): number;
4319 createRowPresenter(): TablixRowPresenter;
4320 createColumnPresenter(index: number): TablixColumnPresenter;
4321 onAppendRow(row: TablixRow): void;
4322 onInsertRowBefore(row: TablixRow, refRow: TablixRow): void;
4323 onRemoveRow(row: TablixRow): void;
4324 onAddFooterRow(row: TablixRow): void;
4325 onClear(): void;
4326 onFillColumnsProportionallyChanged(value: boolean): void;
4327 invokeColumnResizeEndCallback(column: TablixColumn, width: number): void;
4328 getPersistedColumnWidth(column: TablixColumn): number;
4329 }
4330 class DashboardTablixGridPresenter extends TablixGridPresenter {
4331 private _sizeComputationManager;
4332 constructor(sizeComputationManager: SizeComputationManager);
4333 createRowPresenter(): TablixRowPresenter;
4334 createColumnPresenter(index: number): TablixColumnPresenter;
4335 sizeComputationManager: SizeComputationManager;
4336 getWidth(): number;
4337 getHeight(): number;
4338 }
4339 class CanvasTablixGridPresenter extends TablixGridPresenter {
4340 constructor(columnWidthManager: TablixColumnWidthManager);
4341 createRowPresenter(): TablixRowPresenter;
4342 createColumnPresenter(index: number): TablixColumnPresenter;
4343 getWidth(): number;
4344 getHeight(): number;
4345 }
4346}
4347
4348declare module powerbi.visuals.controls.internal {
4349 /**
4350 * Base class for Tablix realization manager.
4351 */
4352 class TablixDimensionRealizationManager {
4353 private _realizedLeavesCount;
4354 private _adjustmentFactor;
4355 private _itemsToRealizeCount;
4356 private _itemsEstimatedContextualWidth;
4357 private _binder;
4358 constructor(binder: ITablixBinder);
4359 _getOwner(): DimensionLayoutManager;
4360 binder: ITablixBinder;
4361 adjustmentFactor: number;
4362 itemsToRealizeCount: number;
4363 itemsEstimatedContextualWidth: number;
4364 onStartRenderingIteration(): void;
4365 onEndRenderingIteration(gridContextualWidth: number, filled: boolean): void;
4366 onEndRenderingSession(): void;
4367 onCornerCellRealized(item: any, cell: ITablixCell): void;
4368 onHeaderRealized(item: any, cell: ITablixCell, leaf: boolean): void;
4369 needsToRealize: boolean;
4370 _getEstimatedItemsToRealizeCount(): void;
4371 _getSizeAdjustment(gridContextualWidth: number): number;
4372 }
4373 /**
4374 * DOM implementation for Row Tablix realization manager.
4375 */
4376 class RowRealizationManager extends TablixDimensionRealizationManager {
4377 private _owner;
4378 owner: RowLayoutManager;
4379 _getOwner(): DimensionLayoutManager;
4380 _getEstimatedItemsToRealizeCount(): void;
4381 private estimateRowsToRealizeCount();
4382 getEstimatedRowHierarchyWidth(): number;
4383 private updateRowHiearchyEstimatedWidth(items, firstVisibleIndex, levels);
4384 _getSizeAdjustment(gridContextualWidth: number): number;
4385 }
4386 /**
4387 * DOM implementation for Column Tablix realization manager.
4388 */
4389 class ColumnRealizationManager extends TablixDimensionRealizationManager {
4390 private _owner;
4391 owner: ColumnLayoutManager;
4392 _getOwner(): DimensionLayoutManager;
4393 _getEstimatedItemsToRealizeCount(): void;
4394 private rowRealizationManager;
4395 private getEstimatedRowHierarchyWidth();
4396 private estimateColumnsToRealizeCount(rowHierarchyWidth);
4397 _getSizeAdjustment(gridContextualWidth: number): number;
4398 }
4399 class RowWidths {
4400 items: RowWidth[];
4401 leafCount: any;
4402 constructor();
4403 }
4404 class RowWidth {
4405 maxLeafWidth: number;
4406 maxNonLeafWidth: number;
4407 }
4408}
4409
4410declare module powerbi.visuals.controls.internal {
4411 interface ITablixResizeHandler {
4412 onStartResize(cell: TablixCell, currentX: number, currentY: number): void;
4413 onResize(cell: TablixCell, deltaX: number, deltaY: number): void;
4414 onEndResize(cell: TablixCell): any;
4415 onReset(cell: TablixCell): any;
4416 }
4417 /**
4418 * Internal interface to abstract the tablix row/column.
4419 */
4420 interface ITablixGridItem {
4421 calculateSize(): number;
4422 onResize(size: number): void;
4423 onResizeEnd(size: number): void;
4424 fixSize(): void;
4425 /**
4426 * In case the parent column/row header size is bigger than the sum of the children,
4427 * the size of the last item is adjusted to compensate the difference.
4428 */
4429 setAligningContextualWidth(size: number): void;
4430 getAligningContextualWidth(): number;
4431 getContextualWidth(): number;
4432 getContentContextualWidth(): number;
4433 getIndex(grid: TablixGrid): number;
4434 getHeaders(): TablixCell[];
4435 getOtherDimensionHeaders(): TablixCell[];
4436 getOtherDimensionOwner(cell: TablixCell): ITablixGridItem;
4437 getCellIContentContextualWidth(cell: TablixCell): number;
4438 getCellContextualSpan(cell: TablixCell): number;
4439 }
4440 class TablixCell implements ITablixCell {
4441 private _horizontalOffset;
4442 private _verticalOffset;
4443 private _colSpan;
4444 private _rowSpan;
4445 private _textAlign;
4446 private _containerWidth;
4447 private _containerHeight;
4448 private _scrollable;
4449 _column: TablixColumn;
4450 _row: TablixRow;
4451 type: TablixCellType;
4452 item: any;
4453 _presenter: TablixCellPresenter;
4454 extension: TablixCellPresenter;
4455 position: internal.TablixUtils.CellPosition;
4456 contentHeight: number;
4457 contentWidth: number;
4458 constructor(presenter: TablixCellPresenter, extension: TablixCellPresenter, row: TablixRow);
4459 unfixRowHeight(): void;
4460 colSpan: number;
4461 rowSpan: number;
4462 getCellSpanningHeight(): number;
4463 textAlign: string;
4464 horizontalOffset: number;
4465 verticalOffset: number;
4466 private isScrollable();
4467 clear(): void;
4468 private initializeScrolling();
4469 prepare(scrollable: boolean): void;
4470 scrollVertically(height: number, offset: number): void;
4471 scrollHorizontally(width: number, offset: number): void;
4472 setContainerWidth(value: number): void;
4473 containerWidth: number;
4474 setContainerHeight(value: number): void;
4475 containerHeight: number;
4476 applyStyle(style: TablixUtils.CellStyle): void;
4477 enableHorizontalResize(enable: boolean, handler: ITablixResizeHandler): void;
4478 }
4479 class TablixColumn implements ITablixGridItem {
4480 _realizedColumnHeaders: TablixCell[];
4481 _realizedCornerCells: TablixCell[];
4482 _realizedRowHeaders: TablixCell[];
4483 _realizedBodyCells: TablixCell[];
4484 private _items;
4485 private _itemType;
4486 private _footerCell;
4487 private _containerWidth;
4488 private _width;
4489 private _sizeFixed;
4490 private _aligningWidth;
4491 private _fixedToAligningWidth;
4492 private _presenter;
4493 private _owner;
4494 private _columnIndex;
4495 constructor(presenter: TablixColumnPresenter, columnIndex: number);
4496 initialize(owner: TablixGrid): void;
4497 owner: TablixGrid;
4498 private getType();
4499 private getColumnHeadersOrCorners();
4500 private columnHeadersOrCornersEqual(newType, headers, hierarchyNavigator);
4501 itemType: TablixCellType;
4502 getLeafItem(): any;
4503 columnHeaderOrCornerEquals(type1: TablixCellType, item1: any, type2: TablixCellType, item2: any, hierarchyNavigator: ITablixHierarchyNavigator): boolean;
4504 OnLeafRealized(hierarchyNavigator: ITablixHierarchyNavigator): void;
4505 private clearSpanningCellsWidth(cells);
4506 addCornerCell(cell: TablixCell): void;
4507 addRowHeader(cell: TablixCell): void;
4508 addColumnHeader(cell: TablixCell, isLeaf: boolean): void;
4509 addBodyCell(cell: TablixCell): void;
4510 footer: TablixCell;
4511 onResize(width: number): void;
4512 onResizeEnd(width: number): void;
4513 fixSize(): void;
4514 clearSize(): void;
4515 getContentContextualWidth(): number;
4516 getCellIContentContextualWidth(cell: TablixCell): number;
4517 getCellSpanningWidthWithScrolling(cell: ITablixCell, tablixGrid: TablixGrid): number;
4518 getScrollingOffset(): number;
4519 getContextualWidth(): number;
4520 calculateSize(): number;
4521 setAligningContextualWidth(size: number): void;
4522 getAligningContextualWidth(): number;
4523 private setContainerWidth(value);
4524 getTablixCell(): TablixCell;
4525 getIndex(grid: TablixGrid): number;
4526 getHeaders(): TablixCell[];
4527 getOtherDimensionHeaders(): TablixCell[];
4528 getCellContextualSpan(cell: TablixCell): number;
4529 getOtherDimensionOwner(cell: TablixCell): ITablixGridItem;
4530 }
4531 class TablixRow implements ITablixGridItem {
4532 private _allocatedCells;
4533 _realizedRowHeaders: TablixCell[];
4534 _realizedColumnHeaders: TablixCell[];
4535 _realizedBodyCells: TablixCell[];
4536 _realizedCornerCells: TablixCell[];
4537 private _realizedCellsCount;
4538 private _heightFixed;
4539 private _containerHeight;
4540 private _height;
4541 private _presenter;
4542 private _owner;
4543 constructor(presenter: TablixRowPresenter);
4544 initialize(owner: TablixGrid): void;
4545 presenter: TablixRowPresenter;
4546 owner: TablixGrid;
4547 releaseUnusedCells(owner: TablixControl): void;
4548 releaseAllCells(owner: TablixControl): void;
4549 private releaseCells(owner, startIndex);
4550 moveScrollableCellsToEnd(count: number): void;
4551 moveScrollableCellsToStart(count: number): void;
4552 getOrCreateCornerCell(column: TablixColumn): TablixCell;
4553 getOrCreateRowHeader(column: TablixColumn, scrollable: boolean, leaf: boolean): TablixCell;
4554 getOrCreateColumnHeader(column: TablixColumn, scrollable: boolean, leaf: boolean): TablixCell;
4555 getOrCreateBodyCell(column: TablixColumn, scrollable: boolean): TablixCell;
4556 getOrCreateFooterRowHeader(column: TablixColumn): TablixCell;
4557 getOrCreateFooterBodyCell(column: TablixColumn, scrollable: boolean): TablixCell;
4558 getRowHeaderLeafIndex(): number;
4559 getAllocatedCellAt(index: number): TablixCell;
4560 moveCellsBy(delta: number): void;
4561 getRealizedCellCount(): number;
4562 getRealizedHeadersCount(): number;
4563 getRealizedHeaderAt(index: number): TablixCell;
4564 getTablixCell(): TablixCell;
4565 getOrCreateEmptySpaceCell(): TablixCell;
4566 private createCell(row);
4567 private getOrCreateCell();
4568 onResize(height: number): void;
4569 onResizeEnd(height: number): void;
4570 fixSize(): void;
4571 unfixSize(): void;
4572 getContentContextualWidth(): number;
4573 getCellIContentContextualWidth(cell: TablixCell): number;
4574 getCellSpanningHeight(cell: ITablixCell): number;
4575 getContextualWidth(): number;
4576 sizeFixed(): boolean;
4577 calculateSize(): number;
4578 setAligningContextualWidth(size: number): void;
4579 getAligningContextualWidth(): number;
4580 private setContentHeight();
4581 getIndex(grid: TablixGrid): number;
4582 getHeaders(): TablixCell[];
4583 getOtherDimensionHeaders(): TablixCell[];
4584 getCellContextualSpan(cell: TablixCell): number;
4585 getOtherDimensionOwner(cell: TablixCell): ITablixGridItem;
4586 }
4587 class TablixGrid {
4588 private _owner;
4589 private _rows;
4590 private _realizedRows;
4591 private _columns;
4592 private _realizedColumns;
4593 private _footerRow;
4594 private _emptySpaceHeaderCell;
4595 private _emptyFooterSpaceCell;
4596 _presenter: TablixGridPresenter;
4597 private _fillColumnsProportionally;
4598 constructor(presenter: TablixGridPresenter);
4599 initialize(owner: TablixControl, gridHost: HTMLElement, footerHost: HTMLElement): void;
4600 owner: TablixControl;
4601 fillColumnsProportionally: boolean;
4602 realizedColumns: TablixColumn[];
4603 realizedRows: TablixRow[];
4604 footerRow: TablixRow;
4605 emptySpaceHeaderCell: TablixCell;
4606 emptySpaceFooterCell: TablixCell;
4607 ShowEmptySpaceCells(rowSpan: number, width: number): void;
4608 HideEmptySpaceCells(): void;
4609 onStartRenderingSession(clear: boolean): void;
4610 onStartRenderingIteration(): void;
4611 onEndRenderingIteration(): void;
4612 getOrCreateRow(rowIndex: number): TablixRow;
4613 getOrCreateFootersRow(): TablixRow;
4614 moveRowsToEnd(moveFromIndex: number, count: number): void;
4615 moveRowsToStart(moveToIndex: number, count: number): void;
4616 moveColumnsToEnd(moveFromIndex: number, count: number): void;
4617 moveColumnsToStart(moveToIndex: number, count: number): void;
4618 getOrCreateColumn(columnIndex: number): TablixColumn;
4619 private initializeColumns();
4620 private clearColumns();
4621 private initializeRows();
4622 private clearRows();
4623 getWidth(): number;
4624 getHeight(): number;
4625 }
4626}
4627
4628declare module powerbi.visuals.controls.internal {
4629 /**
4630 * This class is used for layouts that don't or cannot
4631 * rely on DOM measurements. Instead they compute all required
4632 * widths and heights and store it in this structure.
4633 */
4634 class SizeComputationManager {
4635 private static TablixMinimumColumnWidth;
4636 private _viewport;
4637 private _columnCount;
4638 private _cellWidth;
4639 private _cellHeight;
4640 private _scalingFactor;
4641 hasImageContent: boolean;
4642 visibleWidth: number;
4643 visibleHeight: number;
4644 gridWidth: number;
4645 gridHeight: number;
4646 rowHeight: number;
4647 cellWidth: number;
4648 cellHeight: number;
4649 contentWidth: number;
4650 contentHeight: number;
4651 updateColumnCount(columnCount: number): void;
4652 updateRowHeight(rowHeight: number): void;
4653 updateScalingFactor(scalingFactor: number): void;
4654 updateViewport(viewport: IViewport): void;
4655 private computeColumnWidth(totalColumnCount);
4656 private computeColumnHeight();
4657 private fitToColumnCount(maxAllowedColumnCount, totalColumnCount);
4658 }
4659 class DimensionLayoutManager implements IDimensionLayoutManager {
4660 static _pixelPrecision: number;
4661 static _scrollOffsetPrecision: number;
4662 _grid: TablixGrid;
4663 _gridOffset: number;
4664 protected _contextualWidthToFill: number;
4665 private _owner;
4666 private _realizationManager;
4667 private _alignToEnd;
4668 private _lastScrollOffset;
4669 private _isScrolling;
4670 private _fixedSizeEnabled;
4671 private _done;
4672 private _measureEnabled;
4673 constructor(owner: TablixLayoutManager, grid: TablixGrid, realizationManager: TablixDimensionRealizationManager);
4674 owner: TablixLayoutManager;
4675 realizationManager: TablixDimensionRealizationManager;
4676 fixedSizeEnabled: boolean;
4677 onCornerCellRealized(item: any, cell: ITablixCell, leaf: boolean): void;
4678 onHeaderRealized(item: any, cell: ITablixCell, leaf: any): void;
4679 needsToRealize: boolean;
4680 getVisibleSizeRatio(): number;
4681 alignToEnd: boolean;
4682 done: boolean;
4683 _requiresMeasure(): boolean;
4684 startScrollingSession(): void;
4685 endScrollingSession(): void;
4686 isScrolling(): boolean;
4687 isResizing(): boolean;
4688 getOtherHierarchyContextualHeight(): number;
4689 _isAutoSized(): boolean;
4690 onStartRenderingSession(): void;
4691 onEndRenderingSession(): void;
4692 /**
4693 * Implementing classes must override this to send dimentions to TablixControl.
4694 */
4695 _sendDimensionsToControl(): void;
4696 measureEnabled: boolean;
4697 getFooterContextualWidth(): number;
4698 onStartRenderingIteration(clear: boolean, contextualWidth: number): void;
4699 allItemsRealized: boolean;
4700 onEndRenderingIteration(): void;
4701 private getScrollDeltaWithinPage();
4702 private swapElements();
4703 _getRealizedItems(): ITablixGridItem[];
4704 getRealizedItemsCount(): number;
4705 _moveElementsToBottom(moveFromIndex: number, count: any): void;
4706 _moveElementsToTop(moveToIndex: number, count: any): void;
4707 isScrollingWithinPage(): boolean;
4708 getGridContextualWidth(): number;
4709 private updateScrollbar(gridContextualWidth);
4710 getViewSize(gridContextualWidth: number): number;
4711 isScrollableHeader(item: any, items: any, index: number): boolean;
4712 reachedEnd(): boolean;
4713 scrollBackwardToFill(gridContextualWidth: number): number;
4714 private getItemContextualWidth(index);
4715 private getItemContextualWidthWithScrolling(index);
4716 getSizeWithScrolling(size: number, index: number): number;
4717 getGridContextualWidthFromItems(): number;
4718 private getMeaurementError(gridContextualWidth);
4719 private scrollForwardToAlignEnd(gridContextualWidth);
4720 dimension: TablixDimension;
4721 otherLayoutManager: DimensionLayoutManager;
4722 contextualWidthToFill: number;
4723 getGridScale(): number;
4724 otherScrollbarContextualWidth: number;
4725 getActualContextualWidth(gridContextualWidth: number): number;
4726 protected canScroll(gridContextualWidth: number): boolean;
4727 calculateSizes(): void;
4728 protected _calculateSize(item: ITablixGridItem): number;
4729 calculateContextualWidths(): void;
4730 calculateSpans(): void;
4731 updateNonScrollableItemsSpans(): void;
4732 updateScrollableItemsSpans(): void;
4733 fixSizes(): void;
4734 private updateSpans(otherRealizedItem, cells, considerScrolling);
4735 private updateLastChildSize(spanningCell, item, totalSpanSize);
4736 }
4737 class ResizeState {
4738 item: any;
4739 itemType: TablixCellType;
4740 column: TablixColumn;
4741 startColumnWidth: number;
4742 resizingDelta: number;
4743 animationFrame: number;
4744 scale: number;
4745 constructor(column: TablixColumn, width: number, scale: number);
4746 getNewSize(): number;
4747 }
4748 class ColumnLayoutManager extends DimensionLayoutManager implements ITablixResizeHandler {
4749 static minColumnWidth: number;
4750 private _resizeState;
4751 constructor(owner: TablixLayoutManager, grid: TablixGrid, realizationManager: ColumnRealizationManager);
4752 dimension: TablixDimension;
4753 isResizing(): boolean;
4754 fillProportionally: boolean;
4755 getGridScale(): number;
4756 otherScrollbarContextualWidth: number;
4757 _getRealizedItems(): ITablixGridItem[];
4758 _moveElementsToBottom(moveFromIndex: number, count: any): void;
4759 _moveElementsToTop(moveToIndex: number, count: any): void;
4760 _requiresMeasure(): boolean;
4761 getGridContextualWidth(): number;
4762 private getFirstVisibleColumn();
4763 _isAutoSized(): boolean;
4764 applyScrolling(): void;
4765 private scroll(firstVisibleColumn, width, offset);
4766 private scrollCells(cells, width, offset);
4767 private scrollBodyCells(rows, width, offset);
4768 onStartResize(cell: TablixCell, currentX: number, currentY: number): void;
4769 onResize(cell: TablixCell, deltaX: number, deltaY: number): void;
4770 onEndResize(cell: TablixCell): void;
4771 onReset(cell: TablixCell): void;
4772 updateItemToResizeState(realizedColumns: TablixColumn[]): void;
4773 private performResizing();
4774 private endResizing();
4775 /**
4776 * Sends column related data (pixel size, column count, etc) to TablixControl.
4777 */
4778 _sendDimensionsToControl(): void;
4779 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
4780 getEstimatedBodyCellWidth(content: string): number;
4781 }
4782 class DashboardColumnLayoutManager extends ColumnLayoutManager {
4783 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
4784 getEstimatedBodyCellWidth(content: string): number;
4785 protected canScroll(gridContextualWidth: number): boolean;
4786 protected _calculateSize(item: ITablixGridItem): number;
4787 private ignoreColumn(headerIndex);
4788 }
4789 class CanvasColumnLayoutManager extends ColumnLayoutManager {
4790 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
4791 getEstimatedBodyCellWidth(content: string): number;
4792 calculateContextualWidths(): void;
4793 protected canScroll(gridContextualWidth: number): boolean;
4794 protected _calculateSize(item: ITablixGridItem): number;
4795 }
4796 class RowLayoutManager extends DimensionLayoutManager {
4797 constructor(owner: TablixLayoutManager, grid: TablixGrid, realizationManager: RowRealizationManager);
4798 dimension: TablixDimension;
4799 getGridScale(): number;
4800 otherScrollbarContextualWidth: number;
4801 startScrollingSession(): void;
4802 _getRealizedItems(): ITablixGridItem[];
4803 _moveElementsToBottom(moveFromIndex: number, count: any): void;
4804 _moveElementsToTop(moveToIndex: number, count: any): void;
4805 _requiresMeasure(): boolean;
4806 getGridContextualWidth(): number;
4807 private getFirstVisibleRow();
4808 _isAutoSized(): boolean;
4809 applyScrolling(): void;
4810 private scroll(firstVisibleRow, height, offset);
4811 private scrollCells(cells, height, offset);
4812 getFooterContextualWidth(): number;
4813 calculateContextualWidths(): void;
4814 fixSizes(): void;
4815 /**
4816 * Sends row related data (pixel size, column count, etc) to TablixControl.
4817 */
4818 _sendDimensionsToControl(): void;
4819 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
4820 }
4821 class DashboardRowLayoutManager extends RowLayoutManager {
4822 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
4823 protected canScroll(gridContextualWidth: number): boolean;
4824 protected _calculateSize(item: ITablixGridItem): number;
4825 private getHeaderWidth(headerIndex);
4826 }
4827 class CanvasRowLayoutManager extends RowLayoutManager {
4828 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
4829 protected canScroll(gridContextualWidth: number): boolean;
4830 protected _calculateSize(item: ITablixGridItem): number;
4831 }
4832 class TablixLayoutManager {
4833 protected _owner: TablixControl;
4834 protected _container: HTMLElement;
4835 protected _columnLayoutManager: ColumnLayoutManager;
4836 protected _rowLayoutManager: RowLayoutManager;
4837 private _binder;
4838 private _scrollingDimension;
4839 private _gridHost;
4840 private _footersHost;
4841 private _grid;
4842 private _allowHeaderResize;
4843 private _columnWidthsToPersist;
4844 constructor(binder: ITablixBinder, grid: TablixGrid, columnLayoutManager: ColumnLayoutManager, rowLayoutManager: RowLayoutManager);
4845 initialize(owner: TablixControl): void;
4846 owner: TablixControl;
4847 binder: ITablixBinder;
4848 columnWidthsToPersist: ColumnWidthObject[];
4849 getTablixClassName(): string;
4850 getLayoutKind(): TablixLayoutKind;
4851 getOrCreateColumnHeader(item: any, items: any, rowIndex: number, columnIndex: number): ITablixCell;
4852 getOrCreateRowHeader(item: any, items: any, rowIndex: number, columnIndex: number): ITablixCell;
4853 getOrCreateCornerCell(item: any, rowLevel: number, columnLevel: number): ITablixCell;
4854 getOrCreateBodyCell(cellItem: any, rowItem: any, rowItems: any, rowIndex: number, columnIndex: number): ITablixCell;
4855 getOrCreateFooterBodyCell(cellItem: any, columnIndex: number): ITablixCell;
4856 getOrCreateFooterRowHeader(item: any, items: any): ITablixCell;
4857 getVisibleWidth(): number;
4858 getVisibleHeight(): number;
4859 updateColumnCount(rowDimension: TablixRowDimension, columnDimension: TablixColumnDimension): void;
4860 updateViewport(viewport: IViewport): void;
4861 getEstimatedRowHeight(): number;
4862 getCellWidth(cell: ITablixCell): number;
4863 getContentWidth(cell: ITablixCell): number;
4864 adjustContentSize(hasImage: boolean): void;
4865 /**
4866 * This call makes room for parent header cells where neccessary.
4867 * Since HTML cells that span vertically displace other rows,
4868 * room has to be made for spanning headers that leave an exiting
4869 * row to enter the new row that it starts from and removed when
4870 * returning to an entering row.
4871 */
4872 private alignRowHeaderCells(item, currentRow);
4873 grid: TablixGrid;
4874 rowLayoutManager: DimensionLayoutManager;
4875 columnLayoutManager: DimensionLayoutManager;
4876 protected showEmptySpaceHeader(): boolean;
4877 onStartRenderingSession(scrollingDimension: TablixDimension, parentElement: HTMLElement, clear: boolean): void;
4878 onEndRenderingSession(): void;
4879 onStartRenderingIteration(clear: boolean): void;
4880 onEndRenderingIteration(): boolean;
4881 onCornerCellRealized(item: any, cell: ITablixCell): void;
4882 onRowHeaderRealized(item: any, cell: ITablixCell): void;
4883 onRowHeaderFooterRealized(item: any, cell: ITablixCell): void;
4884 onColumnHeaderRealized(item: any, cell: ITablixCell): void;
4885 onBodyCellRealized(item: any, cell: ITablixCell): void;
4886 onBodyCellFooterRealized(item: any, cell: ITablixCell): void;
4887 setAllowHeaderResize(value: boolean): void;
4888 enableCellHorizontalResize(isLeaf: boolean, cell: TablixCell): void;
4889 getEstimatedTextWidth(label: string): number;
4890 measureSampleText(parentElement: HTMLElement): void;
4891 }
4892 class DashboardTablixLayoutManager extends TablixLayoutManager {
4893 private _characterHeight;
4894 private _sizeComputationManager;
4895 constructor(binder: ITablixBinder, sizeComputationManager: SizeComputationManager, grid: TablixGrid, rowRealizationManager: RowRealizationManager, columnRealizationManager: ColumnRealizationManager);
4896 static createLayoutManager(binder: ITablixBinder): DashboardTablixLayoutManager;
4897 getTablixClassName(): string;
4898 getLayoutKind(): TablixLayoutKind;
4899 protected showEmptySpaceHeader(): boolean;
4900 measureSampleText(parentElement: HTMLElement): void;
4901 getVisibleWidth(): number;
4902 getVisibleHeight(): number;
4903 getCellWidth(cell: ITablixCell): number;
4904 getContentWidth(cell: ITablixCell): number;
4905 getEstimatedTextWidth(label: string): number;
4906 adjustContentSize(hasImage: boolean): void;
4907 updateColumnCount(rowDimension: TablixRowDimension, columnDimension: TablixColumnDimension): void;
4908 updateViewport(viewport: IViewport): void;
4909 getEstimatedRowHeight(): number;
4910 }
4911 class CanvasTablixLayoutManager extends TablixLayoutManager {
4912 private characterWidth;
4913 private characterHeight;
4914 constructor(binder: ITablixBinder, grid: TablixGrid, rowRealizationManager: RowRealizationManager, columnRealizationManager: ColumnRealizationManager);
4915 static createLayoutManager(binder: ITablixBinder, columnWidthManager: TablixColumnWidthManager): CanvasTablixLayoutManager;
4916 getTablixClassName(): string;
4917 getLayoutKind(): TablixLayoutKind;
4918 measureSampleText(parentElement: HTMLElement): void;
4919 protected showEmptySpaceHeader(): boolean;
4920 getVisibleWidth(): number;
4921 getVisibleHeight(): number;
4922 getCellWidth(cell: ITablixCell): number;
4923 getContentWidth(cell: ITablixCell): number;
4924 getEstimatedTextWidth(text: string): number;
4925 updateColumnCount(rowDimension: TablixRowDimension, columnDimension: TablixColumnDimension): void;
4926 updateViewport(viewport: IViewport): void;
4927 getEstimatedRowHeight(): number;
4928 }
4929}
4930
4931declare module powerbi.visuals.controls {
4932 module HTMLElementUtils {
4933 function clearChildren(element: HTMLElement): void;
4934 function setElementTop(element: HTMLElement, top: number): void;
4935 function setElementLeft(element: HTMLElement, left: number): void;
4936 function setElementHeight(element: HTMLElement, height: number): void;
4937 function setElementWidth(element: HTMLElement, width: number): void;
4938 function getElementWidth(element: HTMLElement): number;
4939 function getElementHeight(element: HTMLElement): number;
4940 function isAutoSize(size: number): boolean;
4941 function getAccumulatedScale(element: HTMLElement): number;
4942 /**
4943 * Get scale of element, return 1 when not scaled.
4944 */
4945 function getScale(element: any): number;
4946 }
4947}
4948declare module powerbi.visuals.controls.internal {
4949 module TablixObjects {
4950 const ObjectGeneral: string;
4951 const ObjectGrid: string;
4952 const ObjectColumnHeaders: string;
4953 const ObjectRowHeaders: string;
4954 const ObjectValues: string;
4955 const ObjectTotal: string;
4956 const ObjectSubTotals: string;
4957 interface ObjectValueGetterFunction {
4958 <T>(objects: DataViewObjects, propertyId: DataViewObjectPropertyIdentifier, defaultValue?: T): T;
4959 }
4960 /**
4961 * Represents a DataViewObjects property related to the Tablix
4962 */
4963 class TablixProperty {
4964 objectName: string;
4965 propertyName: string;
4966 defaultValue: any;
4967 private getterFuntion;
4968 /**
4969 * Creates a new TablixProperty
4970 * @param {string} objectName Object Name
4971 * @param {string} propertyName Property Name
4972 * @param {any} defaultValue Default value of the Property
4973 * @param {ObjectValueGetterFunction} getterFuntion Function used to get the Property value from the Objects
4974 */
4975 constructor(objectName: string, propertyName: string, defaultValue: any, getterFuntion: ObjectValueGetterFunction);
4976 /**
4977 * Gets the PropertyIdentifier for the Property
4978 * @returns PropertyIdentifier for the Property
4979 */
4980 getPropertyID(): DataViewObjectPropertyIdentifier;
4981 /**
4982 * Gets the value of the Property from the Objects
4983 * @param {DataViewObjects} objects DataView Objects to get the value from
4984 * @param {boolean} useDefault True to fall back to the Default value if the Property is missing from the objects. False to return undefined
4985 * @returns Value of the property
4986 */
4987 getValue<T>(objects: DataViewObjects): T;
4988 }
4989 const PropColumnFormatString: TablixProperty;
4990 const PropGeneralAutoSizeColumns: TablixProperty;
4991 const PropGeneralTextSize: TablixProperty;
4992 const PropGeneralTableTotals: TablixProperty;
4993 const PropGeneralMatrixRowSubtotals: TablixProperty;
4994 const PropGeneralMatrixColumnSubtotals: TablixProperty;
4995 const PropGridVertical: TablixProperty;
4996 const PropGridVerticalColor: TablixProperty;
4997 const PropGridVerticalWeight: TablixProperty;
4998 const PropGridHorizontalTable: TablixProperty;
4999 const PropGridHorizontalMatrix: TablixProperty;
5000 const PropGridHorizontalColor: TablixProperty;
5001 const PropGridHorizontalWeight: TablixProperty;
5002 const PropGridRowPadding: TablixProperty;
5003 const PropGridOutlineColor: TablixProperty;
5004 const PropGridOutlineWeight: TablixProperty;
5005 const PropGridImageHeight: TablixProperty;
5006 const PropColumnsFontColor: TablixProperty;
5007 const PropColumnsBackColor: TablixProperty;
5008 const PropColumnsOutline: TablixProperty;
5009 const PropRowsFontColor: TablixProperty;
5010 const PropRowsBackColor: TablixProperty;
5011 const PropRowsOutline: TablixProperty;
5012 const PropValuesBackColor: TablixProperty;
5013 const PropValuesFontColorPrimary: TablixProperty;
5014 const PropValuesBackColorPrimary: TablixProperty;
5015 const PropValuesFontColorSecondary: TablixProperty;
5016 const PropValuesBackColorSecondary: TablixProperty;
5017 const PropValuesOutline: TablixProperty;
5018 const PropValuesUrlIconProp: TablixProperty;
5019 const PropTotalFontColor: TablixProperty;
5020 const PropTotalBackColor: TablixProperty;
5021 const PropTotalOutline: TablixProperty;
5022 const PropSubTotalsFontColor: TablixProperty;
5023 const PropSubTotalsBackColor: TablixProperty;
5024 const PropSubTotalsOutline: TablixProperty;
5025 /**
5026 * Get the DataViewObject from the DataView
5027 * @param {DataView} dataview The DataView
5028 * @returns DataViewObjects (dataView.metadata.objects)
5029 */
5030 function getMetadadataObjects(dataview: DataView): DataViewObjects;
5031 function enumerateObjectRepetition(enumeration: VisualObjectRepetition[], dataView: DataView, tablixType: TablixType): void;
5032 function enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions, enumeration: ObjectEnumerationBuilder, dataView: DataView, tablixType: TablixType): void;
5033 function enumerateGeneralOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects, tablixType: TablixType, dataView: DataView): void;
5034 function enumerateGridOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects, tablixType: TablixType): void;
5035 function enumerateColumnHeadersOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
5036 function enumerateRowHeadersOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
5037 function enumerateValuesOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects, tablixType: TablixType): void;
5038 function enumerateTotalOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
5039 function enumerateSubTotalsOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
5040 function getTableObjects(dataView: DataView): TablixFormattingPropertiesTable;
5041 function getMatrixObjects(dataView: DataView): TablixFormattingPropertiesMatrix;
5042 /**
5043 * Generate default objects for the Table/Matrix to set default styling
5044 * @param {TablixType} tablixType Tablix Type: table | matrix
5045 * @returns DataViewObjects that can be attached to the DataViewMetadata
5046 */
5047 function generateTablixDefaultObjects(tablixType: TablixType): data.DataViewObjectDefinitions;
5048 function getTextSizeInPx(textSize: number): string;
5049 function shouldShowTableTotals(objects: DataViewObjects): boolean;
5050 function shouldShowRowSubtotals(objects: DataViewObjects): boolean;
5051 function shouldShowColumnSubtotals(objects: DataViewObjects): boolean;
5052 function shouldShowColumnSubtotalsOption(dataView: DataView): boolean;
5053 function isDiscourageAggregationAcrossGroups(levels: DataViewHierarchyLevel[]): boolean;
5054 }
5055 module TablixUtils {
5056 const CssClassTablixDiv: string;
5057 const CssClassContentElement: string;
5058 const CssClassContentHost: string;
5059 const CssClassTablixHeader: string;
5060 const CssClassTablixColumnHeaderLeaf: string;
5061 const CssClassTablixValueNumeric: string;
5062 const CssClassTablixValueTotal: string;
5063 const CssClassValueURLIcon: string;
5064 const CssClassValueURLIconContainer: string;
5065 const CssClassMatrixRowHeaderLeaf: string;
5066 const CssClassMatrixRowHeaderSubTotal: string;
5067 const CssClassTableFooter: string;
5068 const CssClassTableBodyCell: string;
5069 const CssClassTableBodyCellBottom: string;
5070 const StringNonBreakingSpace: string;
5071 const UnitOfMeasurement: string;
5072 const CellPaddingLeft: number;
5073 const CellPaddingRight: number;
5074 const CellPaddingLeftMatrixTotal: number;
5075 const SortIconPadding: number;
5076 const ImageDefaultAspectRatio: number;
5077 const FontFamilyCell: string;
5078 const FontFamilyHeader: string;
5079 const FontFamilyTotal: string;
5080 const FontColorCells: string;
5081 const FontColorHeaders: string;
5082 interface Surround<T> {
5083 top?: T;
5084 right?: T;
5085 bottom?: T;
5086 left?: T;
5087 }
5088 enum EdgeType {
5089 Outline = 0,
5090 Gridline = 1,
5091 }
5092 class EdgeSettings {
5093 /**
5094 * Weight in pixels. 0 to remove border. Undefined to fall back to CSS
5095 */
5096 weight: number;
5097 color: string;
5098 type: EdgeType;
5099 constructor(weight?: number, color?: string);
5100 applyParams(shown: boolean, weight: number, color?: string, type?: EdgeType): void;
5101 getCSS(): string;
5102 /**
5103 * Returns the priority of the current edge.
5104 * H. Grid = 0
5105 * V. Grid = 1
5106 * H. Outline = 2
5107 * V. Outline = 3
5108 * Uknown = -1
5109 * @param {Surround<EdgeSettings>} edges Edges. Used to determine the side of the current edge
5110 */
5111 getPriority(edges: Surround<EdgeSettings>): number;
5112 getShadowCss(edges: Surround<EdgeSettings>): string;
5113 }
5114 /**
5115 * Style parameters for each Cell
5116 */
5117 class CellStyle {
5118 /**
5119 * Font family of the cell. If undefined, it will be cleared to fall back to table font family
5120 */
5121 fontFamily: string;
5122 /**
5123 * Font color of the cell. If undefined, it will be cleared to fall back to table font color
5124 */
5125 fontColor: string;
5126 /**
5127 * Background color of the cell. If undefined, it will be cleared to fall back to default (transparent)
5128 */
5129 backColor: string;
5130 /**
5131 * Settings for Borders
5132 */
5133 borders: Surround<EdgeSettings>;
5134 /**
5135 * Settings for Padding
5136 */
5137 paddings: Surround<number>;
5138 constructor();
5139 /**
5140 * Sets the Inline style for the Cell
5141 * @param {ITablixCell} cell Cell to set style to
5142 */
5143 applyStyle(cell: ITablixCell): void;
5144 getExtraTop(): number;
5145 getExtraBottom(): number;
5146 getExtraRight(): number;
5147 getExtraLeft(): number;
5148 }
5149 /**
5150 * Index within a dimension (row/column)
5151 */
5152 class DimensionPosition {
5153 /**
5154 * Global index within all leaf nodes
5155 */
5156 index: number;
5157 /**
5158 * Index within siblings for same parent
5159 */
5160 indexInSiblings: number;
5161 /**
5162 * Is last globally
5163 */
5164 isLast: boolean;
5165 /**
5166 * Is first globally
5167 */
5168 isFirst: boolean;
5169 }
5170 /**
5171 * Poistion information about the cell
5172 */
5173 class CellPosition {
5174 row: DimensionPosition;
5175 column: DimensionPosition;
5176 constructor();
5177 isMatch(position: CellPosition): boolean;
5178 }
5179 class TablixVisualCell {
5180 dataPoint: any;
5181 position: TablixUtils.CellPosition;
5182 columnMetadata: DataViewMetadataColumn;
5183 isTotal: boolean;
5184 backColor: string;
5185 private formatter;
5186 private nullsAreBlank;
5187 constructor(dataPoint: any, isTotal: boolean, columnMetadata: DataViewMetadataColumn, formatter: ICustomValueColumnFormatter, nullsAreBlank: boolean);
5188 textContent: string;
5189 kpiContent: JQuery;
5190 isNumeric: boolean;
5191 isUrl: boolean;
5192 isImage: boolean;
5193 isValidUrl: boolean;
5194 isMatch(item: TablixVisualCell): boolean;
5195 }
5196 function createTable(): HTMLTableElement;
5197 function createDiv(): HTMLDivElement;
5198 function resetCellCssClass(cell: controls.ITablixCell): void;
5199 function addCellCssClass(cell: controls.ITablixCell, style: string): void;
5200 /**
5201 * Clears all inline styles (border, fontColor, background) and resets CSS classes
5202 * Performed with unbind-<Cell>
5203 */
5204 function clearCellStyle(cell: controls.ITablixCell): void;
5205 function clearCellTextAndTooltip(cell: controls.ITablixCell): void;
5206 /**
5207 * Sets text and tooltip for cell
5208 * @param {string} text Text to set
5209 * @param {HTMLElement} elementText Element to set text to
5210 * @param {HTMLElement} elementTooltip? Element to set tootltip to, if undefined, elementText will be used
5211 */
5212 function setCellTextAndTooltip(text: string, elementText: HTMLElement, elementTooltip?: HTMLElement): void;
5213 function isValidSortClick(e: MouseEvent): boolean;
5214 function appendATagToBodyCell(value: string, cellElement: HTMLElement, urlIcon?: boolean): void;
5215 function appendImgTagToBodyCell(value: string, cellElement: HTMLElement, imageHeight: number): void;
5216 function createKpiDom(kpi: DataViewKpiColumnMetadata, kpiValue: string): JQuery;
5217 function isValidStatusGraphic(kpi: DataViewKpiColumnMetadata, kpiValue: string): boolean;
5218 function getCustomSortEventArgs(queryName: string, sortDirection: SortDirection): CustomSortEventArgs;
5219 function reverseSort(sortDirection: SortDirection): SortDirection;
5220 /**
5221 * Add sort icon to a table cell and return the element that should contain the contents
5222 * @param {SortDirection} itemSort SortDirection
5223 * @param {HTMLElement} cellDiv The inner DIV of the cell
5224 */
5225 function addSortIconToColumnHeader(itemSort: SortDirection, cellDiv: HTMLElement): HTMLElement;
5226 function removeSortIcons(cell: controls.ITablixCell): void;
5227 }
5228}
5229
5230declare module powerbi.visuals.controls {
5231 interface ITablixHierarchyNavigator {
5232 /**
5233 * Returns the depth of the column hierarchy.
5234 */
5235 getColumnHierarchyDepth(): number;
5236 /**
5237 * Returns the depth of the Row hierarchy.
5238 */
5239 getRowHierarchyDepth(): number;
5240 /**
5241 * Returns the leaf count of a hierarchy.
5242 *
5243 * @param hierarchy Object representing the hierarchy.
5244 */
5245 getLeafCount(hierarchy: any): number;
5246 /**
5247 * Returns the leaf member of a hierarchy at the specified index.
5248 *
5249 * @param hierarchy Object representing the hierarchy.
5250 * @param index Index of leaf member.
5251 */
5252 getLeafAt(hierarchy: any, index: number): any;
5253 /**
5254 * Returns the specified hierarchy member parent.
5255 *
5256 * @param item Hierarchy member.
5257 */
5258 getParent(item: any): any;
5259 /**
5260 * Returns the index of the hierarchy member relative to its parent.
5261 *
5262 * @param item Hierarchy member.
5263 */
5264 getIndex(item: any): number;
5265 /**
5266 * Checks whether a hierarchy member is a leaf.
5267 *
5268 * @param item Hierarchy member.
5269 */
5270 isLeaf(item: any): boolean;
5271 isRowHierarchyLeaf(cornerItem: any): boolean;
5272 isColumnHierarchyLeaf(cornerItem: any): boolean;
5273 isFirstItem(item: any, items: any): boolean;
5274 /**
5275 * Checks whether a hierarchy member is the last item within its parent.
5276 *
5277 * @param item Hierarchy member.
5278 * @param items A collection of hierarchy members.
5279 */
5280 isLastItem(item: any, items: any): boolean;
5281 /**
5282 * Checks if the item and all its ancestors are the first items in their parent's children
5283 */
5284 areAllParentsFirst(item: any, items: any): boolean;
5285 /**
5286 * Checks if the item and all its ancestors are the last items in their parent's children
5287 */
5288 areAllParentsLast(item: any, items: any): boolean;
5289 /**
5290 * Gets the children members of a hierarchy member.
5291 *
5292 * @param item Hierarchy member.
5293 */
5294 getChildren(item: any): any;
5295 /**
5296 * Gets the difference between current level and min children level. Not necessarily 1
5297 *
5298 * @param item Hierarchy member.
5299 */
5300 getChildrenLevelDifference(item: any): number;
5301 /**
5302 * Gets the members count in a specified collection.
5303 *
5304 * @param items Hierarchy member.
5305 */
5306 getCount(items: any): number;
5307 /**
5308 * Gets the member at the specified index.
5309 *
5310 * @param items A collection of hierarchy members.
5311 * @param index Index of member to return.
5312 */
5313 getAt(items: any, index: number): any;
5314 /**
5315 * Gets the hierarchy member level.
5316 *
5317 * @param item Hierarchy member.
5318 */
5319 getLevel(item: any): number;
5320 /**
5321 * Returns the intersection between a row and a column item.
5322 *
5323 * @param rowItem A row member.
5324 * @param columnItem A column member.
5325 */
5326 getIntersection(rowItem: any, columnItem: any): any;
5327 /**
5328 * Returns the corner cell between a row and a column level.
5329 *
5330 * @param rowLevel A level in the row hierarchy.
5331 * @param columnLevel A level in the column hierarchy.
5332 */
5333 getCorner(rowLevel: number, columnLevel: number): any;
5334 headerItemEquals(item1: any, item2: any): boolean;
5335 bodyCellItemEquals(item1: any, item2: any): boolean;
5336 cornerCellItemEquals(item1: any, item2: any): boolean;
5337 }
5338}
5339
5340declare module powerbi.visuals.controls {
5341 interface ITablixBinder {
5342 onStartRenderingSession(): void;
5343 onEndRenderingSession(): void;
5344 /** Binds the row hierarchy member to the DOM element. */
5345 bindRowHeader(item: any, cell: ITablixCell): void;
5346 unbindRowHeader(item: any, cell: ITablixCell): void;
5347 /** Binds the column hierarchy member to the DOM element. */
5348 bindColumnHeader(item: any, cell: ITablixCell): void;
5349 unbindColumnHeader(item: any, cell: ITablixCell): void;
5350 /** Binds the intersection between a row and a column hierarchy member to the DOM element. */
5351 bindBodyCell(item: any, cell: ITablixCell): void;
5352 unbindBodyCell(item: any, cell: ITablixCell): void;
5353 /** Binds the corner cell to the DOM element. */
5354 bindCornerCell(item: any, cell: ITablixCell): void;
5355 unbindCornerCell(item: any, cell: ITablixCell): void;
5356 bindEmptySpaceHeaderCell(cell: ITablixCell): void;
5357 unbindEmptySpaceHeaderCell(cell: ITablixCell): void;
5358 bindEmptySpaceFooterCell(cell: ITablixCell): void;
5359 unbindEmptySpaceFooterCell(cell: ITablixCell): void;
5360 /** Measurement Helper */
5361 getHeaderLabel(item: any): string;
5362 getCellContent(item: any): string;
5363 hasRowGroups(): boolean;
5364 }
5365}
5366
5367declare module powerbi.visuals.controls {
5368 const enum TablixCellType {
5369 CornerCell = 0,
5370 RowHeader = 1,
5371 ColumnHeader = 2,
5372 BodyCell = 3,
5373 }
5374 interface ITablixCell {
5375 type: TablixCellType;
5376 item: any;
5377 colSpan: number;
5378 rowSpan: number;
5379 textAlign: string;
5380 extension: internal.TablixCellPresenter;
5381 position: internal.TablixUtils.CellPosition;
5382 contentHeight: number;
5383 contentWidth: number;
5384 containerHeight: number;
5385 containerWidth: number;
5386 unfixRowHeight(): any;
5387 applyStyle(style: internal.TablixUtils.CellStyle): void;
5388 }
5389 interface IDimensionLayoutManager {
5390 measureEnabled: boolean;
5391 getRealizedItemsCount(): number;
5392 needsToRealize: boolean;
5393 }
5394}
5395
5396declare module powerbi.visuals.controls {
5397 const TablixDefaultTextSize: number;
5398 interface TablixRenderArgs {
5399 rowScrollOffset?: number;
5400 columnScrollOffset?: number;
5401 scrollingDimension?: TablixDimension;
5402 }
5403 interface GridDimensions {
5404 rowCount?: number;
5405 columnCount?: number;
5406 rowHierarchyWidth?: number;
5407 rowHierarchyHeight?: number;
5408 rowHierarchyContentHeight?: number;
5409 columnHierarchyWidth?: number;
5410 columnHierarchyHeight?: number;
5411 footerHeight?: number;
5412 }
5413 const enum TablixLayoutKind {
5414 /**
5415 * The default layout is based on DOM measurements and used on the canvas.
5416 */
5417 Canvas = 0,
5418 /**
5419 * The DashboardTile layout must not rely on any kind of DOM measurements
5420 * since the tiles are created when the dashboard is not visible and the
5421 * visual is not rendered; thus no measurements are available.
5422 */
5423 DashboardTile = 1,
5424 }
5425 interface TablixOptions {
5426 interactive?: boolean;
5427 enableTouchSupport?: boolean;
5428 layoutKind?: TablixLayoutKind;
5429 fontSize?: string;
5430 }
5431 class TablixControl {
5432 private static UnitOfMeasurement;
5433 private static TablixContainerClassName;
5434 private static TablixTableAreaClassName;
5435 private static TablixFooterClassName;
5436 private static DefaultFontSize;
5437 private static MaxRenderIterationCount;
5438 private hierarchyTablixNavigator;
5439 private binder;
5440 private columnDim;
5441 private rowDim;
5442 private controlLayoutManager;
5443 private containerElement;
5444 private mainDiv;
5445 private footerDiv;
5446 private scrollBarElementWidth;
5447 private touchManager;
5448 private columnTouchDelegate;
5449 private rowTouchDelegate;
5450 private bodyTouchDelegate;
5451 private footerTouchDelegate;
5452 private touchInterpreter;
5453 private footerTouchInterpreter;
5454 private gridDimensions;
5455 private lastRenderingArgs;
5456 private _autoSizeWidth;
5457 private _autoSizeHeight;
5458 private viewPort;
5459 private maximumWidth;
5460 private maximumHeight;
5461 private minimumWidth;
5462 private minimumHeight;
5463 private textFontSize;
5464 private textFontFamily;
5465 private textFontColor;
5466 private options;
5467 private isTouchEnabled;
5468 private renderIterationCount;
5469 constructor(hierarchyNavigator: ITablixHierarchyNavigator, layoutManager: internal.TablixLayoutManager, binder: ITablixBinder, parentDomElement: HTMLElement, options: TablixOptions);
5470 private InitializeTouchSupport();
5471 private InitializeScrollbars();
5472 container: HTMLElement;
5473 contentHost: HTMLElement;
5474 footerHost: HTMLElement;
5475 className: string;
5476 hierarchyNavigator: ITablixHierarchyNavigator;
5477 getBinder(): ITablixBinder;
5478 autoSizeWidth: boolean;
5479 autoSizeHeight: boolean;
5480 maxWidth: number;
5481 viewport: IViewport;
5482 maxHeight: number;
5483 minWidth: number;
5484 minHeight: number;
5485 fontSize: string;
5486 fontFamily: string;
5487 fontColor: string;
5488 scrollbarWidth: number;
5489 updateModels(resetScrollOffsets: boolean, rowModel: any, columnModel: any): void;
5490 updateColumnDimensions(rowHierarchyWidth: number, columnHierarchyWidth: number, count: number): void;
5491 updateRowDimensions(columnHierarchyHeight: number, rowHierarchyHeight: number, rowHierarchyContentHeight: number, count: number, footerHeight: any): void;
5492 private updateTouchDimensions();
5493 private onMouseWheel(e);
5494 private onFireFoxMouseWheel(e);
5495 private determineDimensionToScroll(e, scrollCallback);
5496 private determineDimensionToScrollFirefox(e, scrollCallback);
5497 layoutManager: internal.TablixLayoutManager;
5498 columnDimension: TablixColumnDimension;
5499 rowDimension: TablixRowDimension;
5500 refresh(clear: boolean): void;
5501 _onScrollAsync(dimension: TablixDimension): void;
5502 private performPendingScroll(dimension);
5503 private updateHorizontalPosition();
5504 updateFooterVisibility(): void;
5505 private updateVerticalPosition();
5506 private alreadyRendered(scrollingDimension);
5507 private render(clear, scrollingDimension);
5508 private updateContainerDimensions();
5509 private cornerCellMatch(item, cell);
5510 private renderCorner();
5511 _unbindCell(cell: ITablixCell): void;
5512 private onTouchEvent(args);
5513 }
5514}
5515
5516declare module powerbi.visuals.controls {
5517 class TablixDimension {
5518 _hierarchyNavigator: ITablixHierarchyNavigator;
5519 _otherDimension: any;
5520 _owner: TablixControl;
5521 _binder: ITablixBinder;
5522 _tablixLayoutManager: internal.TablixLayoutManager;
5523 _layoutManager: IDimensionLayoutManager;
5524 model: any;
5525 modelDepth: number;
5526 scrollOffset: number;
5527 private _scrollStep;
5528 private _firstVisibleScrollIndex;
5529 private _scrollbar;
5530 _scrollItems: any[];
5531 constructor(tablixControl: TablixControl);
5532 _onStartRenderingIteration(): void;
5533 _onEndRenderingIteration(): void;
5534 getValidScrollOffset(scrollOffset: number): number;
5535 makeScrollOffsetValid(): void;
5536 getIntegerScrollOffset(): number;
5537 getFractionScrollOffset(): number;
5538 scrollbar: Scrollbar;
5539 getFirstVisibleItem(level: number): any;
5540 getFirstVisibleChild(item: any): any;
5541 getFirstVisibleChildIndex(item: any): number;
5542 _initializeScrollbar(parentElement: HTMLElement, touchDiv: HTMLDivElement, layoutKind: TablixLayoutKind): void;
5543 getItemsCount(): number;
5544 getDepth(): number;
5545 private onScroll();
5546 otherDimension: TablixDimension;
5547 layoutManager: IDimensionLayoutManager;
5548 _createScrollbar(parentElement: HTMLElement, layoutKind: TablixLayoutKind): Scrollbar;
5549 private updateScrollPosition();
5550 }
5551 class TablixRowDimension extends TablixDimension {
5552 private _footer;
5553 constructor(tablixControl: TablixControl);
5554 setFooter(footerHeader: any): void;
5555 hasFooter(): boolean;
5556 /**
5557 * This method first populates the footer followed by each row and their correlating body cells from top to bottom.
5558 */
5559 _render(): void;
5560 _createScrollbar(parentElement: HTMLElement, layoutKind: TablixLayoutKind): Scrollbar;
5561 /**
5562 * This function is a recursive call (with its recursive behavior in addNode()) that will navigate
5563 * through the row hierarchy in DFS (Depth First Search) order and continue into a single row
5564 * upto its estimated edge.
5565 */
5566 private addNodes(items, rowIndex, depth, firstVisibleIndex);
5567 getFirstVisibleChildLeaf(item: any): any;
5568 private bindRowHeader(item, cell);
5569 /**
5570 * This method can be thought of as the continuation of addNodes() as it continues the DFS (Depth First Search)
5571 * started from addNodes(). This function also handles ending the recursion with "_needsToRealize" being set to
5572 * false.
5573 *
5574 * Once the body cells are reached, populating is done linearly with addBodyCells().
5575 */
5576 private addNode(item, items, rowIndex, depth);
5577 private rowHeaderMatch(item, cell);
5578 private addBodyCells(item, items, rowIndex);
5579 private bindBodyCell(item, cell);
5580 private addFooterRowHeader(item);
5581 private addFooterBodyCells(rowItem);
5582 private bodyCelMatch(item, cell);
5583 }
5584 class TablixColumnDimension extends TablixDimension {
5585 constructor(tablixControl: TablixControl);
5586 _render(): void;
5587 _createScrollbar(parentElement: HTMLElement, layoutKind: TablixLayoutKind): Scrollbar;
5588 private addNodes(items, columnIndex, depth, firstVisibleIndex);
5589 private addNode(item, items, columnIndex, depth);
5590 columnHeaderMatch(item: any, cell: ITablixCell): boolean;
5591 }
5592}
5593
5594declare module powerbi.visuals.controls {
5595 /**
5596 * This class represents the touch region of the column headers (this can also apply to footer/total).
5597 * This class is reponsible for interpreting gestures in terms of pixels to changes in column position.
5598 *
5599 * Unlike the table body, this can only scroll in one direction.
5600 */
5601 class ColumnTouchDelegate implements TouchUtils.ITouchHandler, TouchUtils.IPixelToItem {
5602 /**
5603 * Used to termine if the touch event is within bounds.
5604 */
5605 private dim;
5606 /**
5607 * Average pixel width of columns in table.
5608 */
5609 private averageSize;
5610 /**
5611 * Used for 'firing' a scroll event following a received gesture.
5612 */
5613 private tablixControl;
5614 /**
5615 * Stores the event handler of TablixControl for scroll events.
5616 */
5617 private handlers;
5618 /**
5619 * @constructor
5620 * @param region Location and area of the touch region in respect to its HTML element.
5621 */
5622 constructor(region: TouchUtils.Rectangle);
5623 dimension: TouchUtils.Rectangle;
5624 /**
5625 * Sets the amount of columns to be shifted per delta in pixels.
5626 *
5627 * @param xRatio Column to pixel ratio (# columns / # pixels).
5628 */
5629 setScrollDensity(xRatio: number): void;
5630 /**
5631 * Resize element.
5632 *
5633 * @param x X location from upper left of listened HTML element.
5634 * @param y Y location from upper left of listened HTML element.
5635 * @param width Width of area to listen for events.
5636 * @param height Height of area to listen for events.
5637 */
5638 resize(x: number, y: number, width: number, height: number): void;
5639 /**
5640 * @see IPixelToItem.
5641 */
5642 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchUtils.TouchEvent;
5643 /**
5644 * Fires event to Tablix Control to scroll with the event passed from the TouchManager.
5645 *
5646 * @param e Event recieved from touch manager.
5647 */
5648 touchEvent(e: TouchUtils.TouchEvent): void;
5649 /**
5650 * Asigns handler for scrolling when scroll event is fired.
5651 *
5652 * @param tablixObj TablixControl that's handling the fired event.
5653 * @param handlerCall The call to be made (EXAMPLE: handlerCall = object.method;).
5654 */
5655 setHandler(tablixObj: TablixControl, handlerCall: (args: any[]) => void): void;
5656 }
5657 /**
5658 * This class represents the touch region of the row headers (left or right side aligned).
5659 * This class is reponsible for interpreting gestures in terms of pixels to changes in row position.
5660 *
5661 * Unlike the table body, this can only scroll in one direction.
5662 */
5663 class RowTouchDelegate implements TouchUtils.ITouchHandler, TouchUtils.IPixelToItem {
5664 /**
5665 * Used to termine if the touch event is within bounds.
5666 */
5667 private dim;
5668 /**
5669 * Average pixel height of rows in table.
5670 */
5671 private averageSize;
5672 /**
5673 * Used for 'firing' a scroll event following a recieved gesture.
5674 */
5675 private tablixControl;
5676 /**
5677 * Stores the event handler of TablixControl for scroll events.
5678 */
5679 private handlers;
5680 /**
5681 * @constructor
5682 * @param region Location and area of the touch region in respect to its HTML element.
5683 */
5684 constructor(region: TouchUtils.Rectangle);
5685 dimension: TouchUtils.Rectangle;
5686 /**
5687 * Sets the amount of rows to be shifted per delta in pixels.
5688 *
5689 * @param yRatio Row to pixel ratio (# rows / # pixels).
5690 */
5691 setScrollDensity(yRatio: number): void;
5692 /**
5693 * Resize element.
5694 * @param x X location from upper left of listened HTML element.
5695 * @param y Y location from upper left of listened HTML element.
5696 * @param width Width of area to listen for events.
5697 * @param height Height of area to listen for events.
5698 */
5699 resize(x: number, y: number, width: number, height: number): void;
5700 /**
5701 * @see: IPixelToItem
5702 */
5703 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchUtils.TouchEvent;
5704 /**
5705 * Fires event to Tablix Control to scroll with the event passed from the TouchManager.
5706 *
5707 * @param e Event recieved from touch manager.
5708 */
5709 touchEvent(e: TouchUtils.TouchEvent): void;
5710 /**
5711 * Asigns handler for scrolling when scroll event is fired.
5712 *
5713 * @param tablixObj TablixControl that's handling the fired event.
5714 * @param handlerCall The call to be made (EXAMPLE: handlerCall = object.method;).
5715 */
5716 setHandler(tablixObj: TablixControl, handlerCall: (args: any[]) => void): void;
5717 }
5718 /**
5719 * This class represents the touch region covering the body of the table.
5720 * This class is reponsible for interpreting gestures in terms of pixels to
5721 * changes in row and column position.
5722 */
5723 class BodyTouchDelegate implements TouchUtils.ITouchHandler, TouchUtils.IPixelToItem {
5724 private static DefaultAverageSizeX;
5725 private static DefaultAverageSizeY;
5726 /**
5727 * Used to termine if the touch event is within bounds.
5728 */
5729 private dim;
5730 /**
5731 * Average pixel width of columns in table.
5732 */
5733 private averageSizeX;
5734 /**
5735 * Average pixel height of rows in table.
5736 */
5737 private averageSizeY;
5738 /**
5739 * Used for 'firing' a scroll event following a recieved gesture.
5740 */
5741 private tablixControl;
5742 /**
5743 * Stores the event handler of TablixControl for scroll events.
5744 */
5745 private handlers;
5746 /**
5747 * @constructor
5748 * @param region Location and area of the touch region in respect to its HTML element.
5749 */
5750 constructor(region: TouchUtils.Rectangle);
5751 /**
5752 * Returns dimension.
5753 *
5754 * @return The dimentions of the region this delegate listens to.
5755 */
5756 dimension: TouchUtils.Rectangle;
5757 /**
5758 * Sets the amount of rows and columns to be shifted per delta in pixels.
5759 *
5760 * @param xRatio Column to pixel ratio (# columns / # pixels)
5761 * @param yRatio Row to pixel ratio (# rows / # pixels)
5762 */
5763 setScrollDensity(xRatio: number, yRatio: number): void;
5764 /**
5765 * Resize element.
5766 *
5767 * @param x X location from upper left of listened HTML element.
5768 * @param y Y location from upper left of listened HTML element.
5769 * @param width Width of area to listen for events.
5770 * @param height Height of area to listen for events.
5771 */
5772 resize(x: number, y: number, width: number, height: number): void;
5773 /**
5774 * @see: IPixelToItem.
5775 */
5776 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchUtils.TouchEvent;
5777 /**
5778 * Fires event to Tablix Control to scroll with the event passed from the TouchManager.
5779 *
5780 * @param e Event recieved from touch manager.
5781 */
5782 touchEvent(e: TouchUtils.TouchEvent): void;
5783 /**
5784 * Asigns handler for scrolling when scroll event is fired.
5785 *
5786 * @param tablixObj TablixControl that's handling the fired event.
5787 * @param handlerCall The call to be made (EXAMPLE: handlerCall = object.method;).
5788 */
5789 setHandler(tablixObj: TablixControl, handlerCall: (args: any[]) => void): void;
5790 }
5791}
5792
5793declare module powerbi.visuals.controls.TouchUtils {
5794 class Point {
5795 x: number;
5796 y: number;
5797 constructor(x?: number, y?: number);
5798 offset(offsetX: number, offsetY: number): void;
5799 }
5800 class Rectangle extends Point {
5801 width: number;
5802 height: number;
5803 constructor(x?: number, y?: number, width?: number, height?: number);
5804 point: Point;
5805 contains(p: Point): boolean;
5806 static contains(rect: Rectangle, p: Point): boolean;
5807 static isEmpty(rect: Rectangle): boolean;
5808 }
5809 const enum SwipeDirection {
5810 /**
5811 * Swipe gesture moves along the y-axis at an angle within an established threshold.
5812 */
5813 Vertical = 0,
5814 /**
5815 * Swipe gesture moves along the x-axis at an angle within an established threshold.
5816 */
5817 Horizontal = 1,
5818 /**
5819 * Swipe gesture does not stay within the thresholds of either x or y-axis.
5820 */
5821 FreeForm = 2,
5822 }
5823 enum MouseButton {
5824 NoClick = 0,
5825 LeftClick = 1,
5826 RightClick = 2,
5827 CenterClick = 3,
5828 }
5829 /**
5830 * Interface serves as a way to convert pixel point to any needed unit of
5831 * positioning over two axises such as row/column positioning.
5832 */
5833 interface IPixelToItem {
5834 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchEvent;
5835 }
5836 /**
5837 * Interface for listening to a simple touch event that's abstracted away
5838 * from any platform specific traits.
5839 */
5840 interface ITouchHandler {
5841 touchEvent(e: TouchEvent): void;
5842 }
5843 /**
5844 * A simple touch event class that's abstracted away from any platform specific traits.
5845 */
5846 class TouchEvent {
5847 /**
5848 * X-axis (not neccessarily in pixels (see IPixelToItem)).
5849 */
5850 private _x;
5851 /**
5852 * Y-axis (not neccessarily in pixels (see IPixelToItem)).
5853 */
5854 private _y;
5855 /**
5856 * Delta of x-axis (not neccessarily in pixels (see IPixelToItem)).
5857 */
5858 private _dx;
5859 /**
5860 * Delta of y-axis (not neccessarily in pixels (see IPixelToItem)).
5861 */
5862 private _dy;
5863 /**
5864 * Determines if the mouse button is pressed.
5865 */
5866 private isMouseButtonDown;
5867 /**
5868 * @constructor
5869 * @param x X Location of mouse.
5870 * @param y Y Location of mouse.
5871 * @param isMouseDown Indicates if the mouse button is held down or a finger press on screen.
5872 * @param dx (optional) The change in x of the gesture.
5873 * @param dy (optional) The change in y of the gesture.
5874 */
5875 constructor(x: number, y: number, isMouseDown: boolean, dx?: number, dy?: number);
5876 x: number;
5877 y: number;
5878 dx: number;
5879 dy: number;
5880 /**
5881 * Returns a boolean indicating if the mouse button is held down.
5882 *
5883 * @return: True if the the mouse button is held down,
5884 * otherwise false.
5885 */
5886 isMouseDown: boolean;
5887 }
5888 /**
5889 * This interface defines the datamembers stored for each touch region.
5890 */
5891 interface ITouchHandlerSet {
5892 handler: ITouchHandler;
5893 region: Rectangle;
5894 lastPoint: TouchEvent;
5895 converter: IPixelToItem;
5896 }
5897 /**
5898 * This class "listens" to the TouchEventInterpreter to recieve touch events and sends it to all
5899 * "Touch Delegates" with TouchRegions that contain the mouse event. Prior to sending off the
5900 * event, its position is put in respect to the delegate's TouchRegion and converted to the appropriate
5901 * unit (see IPixelToItem).
5902 */
5903 class TouchManager {
5904 /**
5905 * List of touch regions and their correlating data memebers.
5906 */
5907 private touchList;
5908 /**
5909 * Boolean to enable thresholds for fixing to an axis when scrolling.
5910 */
5911 private scrollThreshold;
5912 /**
5913 * Boolean to enable locking to an axis when gesture is fixed to an axis.
5914 */
5915 private lockThreshold;
5916 /**
5917 * The current direction of the swipe.
5918 */
5919 private swipeDirection;
5920 /**
5921 * The count of consecutive events match the current swipe direction.
5922 */
5923 private matchingDirectionCount;
5924 /**
5925 * The last recieved mouse event.
5926 */
5927 private lastTouchEvent;
5928 /**
5929 * Default constructor.
5930 *
5931 * The default behavior is to enable thresholds and lock to axis.
5932 */
5933 constructor();
5934 lastEvent: TouchEvent;
5935 /**
5936 * @param region Rectangle indicating the locations of the touch region.
5937 * @param handler Handler for recieved touch events.
5938 * @param converter Converts from pixels to the wanted item of measure (rows, columns, etc).
5939 *
5940 * EXAMPLE: dx -> from # of pixels to the right to # of columns moved to the right.
5941 */
5942 addTouchRegion(region: Rectangle, handler: ITouchHandler, converter: IPixelToItem): void;
5943 /**
5944 * Sends a mouse up event to all regions with their last event as a mouse down event.
5945 */
5946 upAllTouches(): void;
5947 touchEvent(e: TouchEvent): void;
5948 /**
5949 * @param e Position of event used to find touched regions
5950 * @return Array of regions that contain the event point.
5951 */
5952 private _findRegions(e);
5953 /**
5954 * @return Array of regions that contain a mouse down event. (see ITouchHandlerSet.lastPoint).
5955 */
5956 private _getActive();
5957 }
5958 /**
5959 * This class is responsible for establishing connections to handle touch events
5960 * and to interpret those events so they're compatible with the touch abstractions.
5961 *
5962 * Touch events with platform specific handles should be done here.
5963 */
5964 class TouchEventInterpreter {
5965 /**
5966 * HTML element that touch events are drawn from.
5967 */
5968 private touchPanel;
5969 /**
5970 * Boolean enabling mouse drag.
5971 */
5972 private allowMouseDrag;
5973 /**
5974 * Touch events are interpreted and passed on this manager.
5975 */
5976 private manager;
5977 /**
5978 * @see TablixLayoutManager.
5979 */
5980 private scale;
5981 /**
5982 * Used for mouse location when a secondary div is used along side the primary with this one being the primary.
5983 */
5984 private touchReferencePoint;
5985 /**
5986 * Rectangle containing the targeted Div.
5987 */
5988 private rect;
5989 private documentMouseMoveWrapper;
5990 private documentMouseUpWrapper;
5991 /**
5992 * Those setting related to swipe detection
5993 * touchStartTime - the time that the user touched down the screen.
5994 */
5995 private touchStartTime;
5996 /**
5997 * The page y value of the touch event when the user touched down.
5998 */
5999 private touchStartPageY;
6000 /**
6001 * The last page y value befoer the user raised up his finger.
6002 */
6003 private touchLastPageY;
6004 /**
6005 * The last page x value befoer the user raised up his finger.
6006 */
6007 private touchLastPageX;
6008 /**
6009 * An indicator whether we are now running the slide affect.
6010 */
6011 private sliding;
6012 constructor(manager: TouchManager);
6013 initTouch(panel: HTMLElement, touchReferencePoint?: HTMLElement, allowMouseDrag?: boolean): void;
6014 private getXYByClient(pageX, pageY, rect);
6015 onTouchStart(e: any): void;
6016 onTouchMove(e: any): void;
6017 onTouchEnd(e: any): void;
6018 onTouchMouseDown(e: MouseEvent): void;
6019 onTouchMouseMove(e: MouseEvent): void;
6020 onTouchMouseUp(e: MouseEvent, bubble?: boolean): void;
6021 private getSwipeInfo();
6022 private didUserSwipe(swipeInfo);
6023 /**
6024 * In case of swipe - auto advance to the swipe direction in 2 steps.
6025 */
6026 private startSlideAffect(swipeInfo);
6027 private didUserChangeDirection(swipeInfo);
6028 private slide(point, slideDist, swipeInfo);
6029 private clearSlide();
6030 private upAllTouches();
6031 private clearTouchEvents();
6032 }
6033}
6034
6035declare module powerbi.visuals.controls {
6036 enum TablixType {
6037 Matrix = 0,
6038 Table = 1,
6039 }
6040 /**
6041 * General section of Formatting Properties for Tablix
6042 */
6043 interface TablixFormattingPropertiesGeneral {
6044 /** Property that drives whether columns should use automatically calculated (based on content) sizes for width or use persisted sizes.
6045 Default is true i.e. automatically calculate width based on column content */
6046 autoSizeColumnWidth: boolean;
6047 /**
6048 * Font size for the whole tablix
6049 * Default is 8
6050 */
6051 textSize: number;
6052 }
6053 /**
6054 * General section of Formatting Properties for Table
6055 */
6056 interface TablixFormattingPropertiesGeneralTable extends TablixFormattingPropertiesGeneral {
6057 totals?: boolean;
6058 }
6059 /**
6060 * General section of Formatting Properties for Matrix
6061 */
6062 interface TablixFormattingPropertiesGeneralMatrix extends TablixFormattingPropertiesGeneral {
6063 /**
6064 * Show/Hide Subtotal Rows
6065 */
6066 rowSubtotals?: boolean;
6067 /**
6068 * Show/Hide Subtotal Columns
6069 */
6070 columnSubtotals?: boolean;
6071 }
6072 /**
6073 * Grid section of Formatting Properties for Tablix
6074 */
6075 interface TablixFormattingPropertiesGrid {
6076 /**
6077 * Show/Hide vertical gridlines
6078 */
6079 gridVertical?: boolean;
6080 /**
6081 * vertical gridlines color
6082 */
6083 gridVerticalColor?: string;
6084 /**
6085 * vertical gridlines Weight
6086 */
6087 gridVerticalWeight?: number;
6088 /**
6089 * Show/Hide horizontal gridlines
6090 */
6091 gridHorizontal?: boolean;
6092 /**
6093 * horizontal gridlines color
6094 */
6095 gridHorizontalColor?: string;
6096 /**
6097 * horizontal gridlines Weight
6098 */
6099 gridHorizontalWeight?: number;
6100 /**
6101 * Color of the outline. Shared across all regions
6102 */
6103 outlineColor?: string;
6104 /**
6105 * Weight outline. Shared across all regions
6106 */
6107 outlineWeight?: number;
6108 /**
6109 * Weight outline. Shared across all regions
6110 */
6111 rowPadding?: number;
6112 /**
6113 * Maximum height of images in pixels
6114 */
6115 imageHeight?: number;
6116 }
6117 /**
6118 * Common Formatting Properties for Tablix regions (Column Headers, Row Headers, Total, SubTotals)
6119 */
6120 interface TablixFormattingPropertiesRegion {
6121 fontColor?: string;
6122 backColor?: string;
6123 outline: string;
6124 }
6125 interface TablixFormattingPropertiesValues {
6126 fontColorPrimary?: string;
6127 backColorPrimary?: string;
6128 fontColorSecondary?: string;
6129 backColorSecondary?: string;
6130 outline: string;
6131 }
6132 /**
6133 * Formatting Properties for Table Values region
6134 */
6135 interface TablixFormattingPropertiesValuesTable extends TablixFormattingPropertiesValues {
6136 urlIcon?: boolean;
6137 }
6138 /**
6139 * Formatting Properties for Table Visual
6140 */
6141 interface TablixFormattingPropertiesTable {
6142 general?: TablixFormattingPropertiesGeneralTable;
6143 grid?: TablixFormattingPropertiesGrid;
6144 columnHeaders?: TablixFormattingPropertiesRegion;
6145 values?: TablixFormattingPropertiesValuesTable;
6146 total?: TablixFormattingPropertiesRegion;
6147 }
6148 /**
6149 * Formatting Properties for Matrix Visual
6150 */
6151 interface TablixFormattingPropertiesMatrix {
6152 general?: TablixFormattingPropertiesGeneralMatrix;
6153 grid?: TablixFormattingPropertiesGrid;
6154 columnHeaders?: TablixFormattingPropertiesRegion;
6155 rowHeaders?: TablixFormattingPropertiesRegion;
6156 values?: TablixFormattingPropertiesValues;
6157 subtotals?: TablixFormattingPropertiesRegion;
6158 }
6159}
6160
6161declare module powerbi.visuals.controls {
6162 /**
6163 * Column Width Object identifying a certain column and its width
6164 */
6165 interface ColumnWidthObject {
6166 /**
6167 * QueryName of the Column
6168 */
6169 queryName: string;
6170 /**
6171 * Flag indicating whether the Column should have a fixed size or fit its size to the contents
6172 */
6173 isFixed: boolean;
6174 /**
6175 * Width of the column in px.
6176 * If isFixed=False, undefined always
6177 * If isFixed=True, undefined if unknown
6178 */
6179 width?: number;
6180 }
6181 /**
6182 * Collection of Column Widths indexed by Column's queryName
6183 */
6184 interface ColumnWidthCollection {
6185 [queryName: string]: ColumnWidthObject;
6186 }
6187 /**
6188 * Handler for Column Width Changed event
6189 */
6190 interface ColumnWidthChangedCallback {
6191 (columnWidthChangedEventArgs: ColumnWidthObject): void;
6192 }
6193 /**
6194 * Handler for requesting host to persist Column Width Objects
6195 */
6196 interface HostPersistCallBack {
6197 (visualObjectInstances: VisualObjectInstancesToPersist): void;
6198 }
6199 class TablixColumnWidthManager {
6200 /**
6201 * PropertyID for Column Widths (General > columnWidth)
6202 */
6203 private static columnWidthProp;
6204 /**
6205 * Array holding widths for all columns. Index is the queryName of the column
6206 */
6207 private columnWidthObjects;
6208 /**
6209 * Visual Object Instances to be persisted. Containing autoSizeProperty and any width to remove/merge
6210 */
6211 private visualObjectInstancesToPersist;
6212 /**
6213 * True if the Tablix is a Matrix
6214 */
6215 private isMatrix;
6216 /**
6217 * Array of all leaf nodes (Row Groupings + Columns/Values instances)
6218 */
6219 private matrixLeafNodes;
6220 /**
6221 * Current DataView
6222 */
6223 private currentDataView;
6224 /**
6225 * Current value of AutoSizeColumns after last DataView Update
6226 */
6227 private currentAutoColumnSizePropertyValue;
6228 /**
6229 * Previous DataView
6230 */
6231 private previousDataView;
6232 /**
6233 * Previous value of AutoSizeColumns before last DataView Update
6234 */
6235 private previousAutoColumnSizePropertyValue;
6236 /**
6237 * Handler for requesting host to persist Column Width Objects
6238 */
6239 private hostPersistCallBack;
6240 constructor(dataView: DataView, isMatrix: boolean, hostPersistCallBack: HostPersistCallBack, matrixLeafNodes?: MatrixVisualNode[]);
6241 /**
6242 * Update the current DataView
6243 * @param {dataView} DataView new DataView
6244 * @param {MatrixVisualNode[]} matrixLeafNodes? (Optional)Matrix Leaf Nodes
6245 */
6246 updateDataView(dataView: DataView, matrixLeafNodes?: MatrixVisualNode[]): void;
6247 /**
6248 * Destroy columnWidthObjects and construct it again from the currently displayed Columns with initial width undefined
6249 */
6250 private updateColumnsMetadata();
6251 private updateTableColumnsMetadata();
6252 private updateMatrixColumnsMetadata();
6253 /**
6254 * Update the column widths after a dataViewChange
6255 */
6256 updateTablixColumnWidths(): void;
6257 /**
6258 * Remove all persisted columns widths and Update visualObjectInstancesToPersist
6259 */
6260 private autoSizeAllColumns();
6261 /**
6262 * Read the Column Widths from the Columns metadata
6263 * @param {DataViewMetadataColumn[]} columnMetadata Columns metadata
6264 */
6265 private deserializeColumnsWidth(columnsMetadata);
6266 /**
6267 * Returns a value indicating that autoSizeColumns was flipped from true to false
6268 */
6269 shouldPersistAllColumnWidths(): boolean;
6270 /**
6271 * Returns a value indicating that autoSizeColumns was flipped from false to true
6272 */
6273 shouldClearAllColumnWidths(): boolean;
6274 /**
6275 * Gets the QueryName associated with a Column (Column Header or Corner Item)
6276 * @param {internal.TablixColumn} column TablixColumn
6277 * @returns queryName
6278 */
6279 static getColumnQueryName(column: internal.TablixColumn): string;
6280 /**
6281 * Returns the current columnWidthObjects
6282 * @returns current columnWidthObjects including undefined widths for autosized or unknown columns
6283 */
6284 getColumnWidthObjects(): ColumnWidthCollection;
6285 /**
6286 * Returns the current columnWidthObjects for only the fixed-size columns
6287 * @returns Returns the current columnWidthObjects excluding auto-sized columns
6288 */
6289 getFixedColumnWidthObjects(): ColumnWidthCollection;
6290 /**
6291 * Get the persisted width of a certain column in px, or undefined if the columns is set to autosize or queryName is not found
6292 * @param {string} queryName queryName of the Column
6293 * @returns Column persisted width in pixel
6294 */
6295 getPersistedColumnWidth(queryName: string): number;
6296 /**
6297 * Call the host to persist the data
6298 * @param {boolean} generateInstances
6299 */
6300 private callHostToPersist();
6301 /**
6302 * Handler for a column width change by the user
6303 * @param {string} queryName queryName of the Column
6304 * @param {number} width new width
6305 */
6306 onColumnWidthChanged(queryName: string, width: number): void;
6307 /**
6308 * Event handler after rendering all columns. Setting any unknown column width.
6309 * Returns True if it calls persist
6310 * @param renderedColumns Rendered Columns
6311 */
6312 onColumnsRendered(renderedColumns: ColumnWidthObject[]): boolean;
6313 private generateColumnWidthObjectToPersist(queryName, width);
6314 }
6315}
6316
6317declare module powerbi.visuals {
6318 interface AnimatedTextConfigurationSettings {
6319 align?: string;
6320 maxFontSize?: number;
6321 }
6322 /**
6323 * Base class for values that are animated when resized.
6324 */
6325 class AnimatedText {
6326 /** Note: Public for testability */
6327 static formatStringProp: DataViewObjectPropertyIdentifier;
6328 protected animator: IGenericAnimator;
6329 private name;
6330 /** Note: Public for testability */
6331 svg: D3.Selection;
6332 currentViewport: IViewport;
6333 value: any;
6334 hostServices: IVisualHostServices;
6335 style: IVisualStyle;
6336 visualConfiguration: AnimatedTextConfigurationSettings;
6337 metaDataColumn: DataViewMetadataColumn;
6338 private mainText;
6339 constructor(name: string);
6340 getMetaDataColumn(dataView: DataView): void;
6341 getAdjustedFontHeight(availableWidth: number, textToMeasure: string, seedFontHeight: number): number;
6342 private getAdjustedFontHeightCore(textProperties, availableWidth, seedFontHeight, iteration);
6343 clear(): void;
6344 doValueTransition(startValue: any, endValue: any, displayUnitSystemType: DisplayUnitSystemType, animationOptions: AnimationOptions, duration: number, forceUpdate: boolean, formatter?: IValueFormatter): void;
6345 setTextColor(color: string): void;
6346 getSeedFontHeight(boundingWidth: number, boundingHeight: number): number;
6347 getTranslateX(width: number): number;
6348 getTranslateY(height: number): number;
6349 getTextAnchor(): string;
6350 protected getFormatString(column: DataViewMetadataColumn): string;
6351 }
6352}
6353
6354declare module powerbi.visuals {
6355 /**
6356 * Renders a number that can be animate change in value.
6357 */
6358 class AnimatedNumber extends AnimatedText implements IVisual {
6359 private options;
6360 private dataViews;
6361 private formatter;
6362 constructor(svg?: D3.Selection, animator?: IGenericAnimator);
6363 init(options: VisualInitOptions): void;
6364 updateViewportDependantProperties(): void;
6365 update(options: VisualUpdateOptions): void;
6366 setFormatter(formatter?: IValueFormatter): void;
6367 onDataChanged(options: VisualDataChangedOptions): void;
6368 onResizing(viewport: IViewport): void;
6369 canResizeTo(viewport: IViewport): boolean;
6370 private updateInternal(target, suppressAnimations, forceUpdate?, formatter?);
6371 }
6372}
6373
6374declare module powerbi.visuals {
6375 interface BasicShapeDataViewObjects extends DataViewObjects {
6376 general: BasicShapeDataViewObject;
6377 line: LineObject;
6378 fill: FillObject;
6379 rotation: RotationObject;
6380 }
6381 interface LineObject extends DataViewObject {
6382 lineColor: Fill;
6383 roundEdge: number;
6384 weight: number;
6385 transparency: number;
6386 }
6387 interface FillObject extends DataViewObject {
6388 transparency: number;
6389 fillColor: Fill;
6390 show: boolean;
6391 }
6392 interface RotationObject extends DataViewObject {
6393 angle: number;
6394 }
6395 interface BasicShapeDataViewObject extends DataViewObject {
6396 shapeType: string;
6397 shapeSvg: string;
6398 }
6399 interface BasicShapeData {
6400 shapeType: string;
6401 lineColor: string;
6402 lineTransparency: number;
6403 lineWeight: number;
6404 showFill: boolean;
6405 fillColor: string;
6406 shapeTransparency: number;
6407 roundEdge: number;
6408 angle: number;
6409 }
6410 class BasicShapeVisual implements IVisual {
6411 private currentViewport;
6412 private element;
6413 private data;
6414 private selection;
6415 static DefaultShape: string;
6416 static DefaultStrokeColor: string;
6417 static DefaultFillColor: string;
6418 static DefaultFillShowValue: boolean;
6419 static DefaultFillTransValue: number;
6420 static DefaultWeightValue: number;
6421 static DefaultLineTransValue: number;
6422 static DefaultRoundEdgeValue: number;
6423 static DefaultAngle: number;
6424 /**property for the shape line color */
6425 shapeType: string;
6426 /**property for the shape line color */
6427 lineColor: string;
6428 /**property for the shape line transparency */
6429 lineTransparency: number;
6430 /**property for the shape line weight */
6431 lineWeight: number;
6432 /**property for the shape round edge */
6433 roundEdge: number;
6434 /**property for showing the fill properties */
6435 showFill: boolean;
6436 /**property for the shape line color */
6437 fillColor: string;
6438 /**property for the shape fill transparency */
6439 shapeTransparency: number;
6440 /**property for the shape angle */
6441 angle: number;
6442 init(options: VisualInitOptions): void;
6443 constructor(options?: VisualInitOptions);
6444 update(options: VisualUpdateOptions): void;
6445 private getDataFromDataView(dataViewObject);
6446 private scaleTo360Deg(angle);
6447 private getValueFromColor(color);
6448 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
6449 render(): void;
6450 }
6451}
6452
6453declare module powerbi.visuals {
6454 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
6455 const DEFAULT_AXIS_COLOR: string;
6456 const enum CartesianChartType {
6457 Line = 0,
6458 Area = 1,
6459 StackedArea = 2,
6460 ClusteredColumn = 3,
6461 StackedColumn = 4,
6462 ClusteredBar = 5,
6463 StackedBar = 6,
6464 HundredPercentStackedBar = 7,
6465 HundredPercentStackedColumn = 8,
6466 Scatter = 9,
6467 ComboChart = 10,
6468 DataDot = 11,
6469 Waterfall = 12,
6470 LineClusteredColumnCombo = 13,
6471 LineStackedColumnCombo = 14,
6472 DataDotClusteredColumnCombo = 15,
6473 DataDotStackedColumnCombo = 16,
6474 }
6475 interface CalculateScaleAndDomainOptions {
6476 viewport: IViewport;
6477 margin: IMargin;
6478 showCategoryAxisLabel: boolean;
6479 showValueAxisLabel: boolean;
6480 forceMerge: boolean;
6481 categoryAxisScaleType: string;
6482 valueAxisScaleType: string;
6483 trimOrdinalDataOnOverflow: boolean;
6484 playAxisControlLayout?: IRect;
6485 forcedTickCount?: number;
6486 forcedYDomain?: any[];
6487 forcedXDomain?: any[];
6488 ensureXDomain?: NumberRange;
6489 ensureYDomain?: NumberRange;
6490 categoryAxisDisplayUnits?: number;
6491 categoryAxisPrecision?: number;
6492 valueAxisDisplayUnits?: number;
6493 valueAxisPrecision?: number;
6494 }
6495 interface MergedValueAxisResult {
6496 domain: number[];
6497 merged: boolean;
6498 tickCount: number;
6499 }
6500 interface CartesianSmallViewPortProperties {
6501 hideLegendOnSmallViewPort: boolean;
6502 hideAxesOnSmallViewPort: boolean;
6503 MinHeightLegendVisible: number;
6504 MinHeightAxesVisible: number;
6505 }
6506 interface AxisRenderingOptions {
6507 axisLabels: ChartAxesLabels;
6508 viewport: IViewport;
6509 margin: IMargin;
6510 hideXAxisTitle: boolean;
6511 hideYAxisTitle: boolean;
6512 hideY2AxisTitle?: boolean;
6513 xLabelColor?: Fill;
6514 yLabelColor?: Fill;
6515 y2LabelColor?: Fill;
6516 fontSize: number;
6517 }
6518 interface CartesianConstructorOptions {
6519 chartType: CartesianChartType;
6520 isScrollable?: boolean;
6521 animator?: IGenericAnimator;
6522 cartesianSmallViewPortProperties?: CartesianSmallViewPortProperties;
6523 behavior?: IInteractiveBehavior;
6524 isLabelInteractivityEnabled?: boolean;
6525 tooltipsEnabled?: boolean;
6526 tooltipBucketEnabled?: boolean;
6527 cartesianLoadMoreEnabled?: boolean;
6528 trimOrdinalDataOnOverflow?: boolean;
6529 advancedLineLabelsEnabled?: boolean;
6530 }
6531 interface ICartesianVisual {
6532 init(options: CartesianVisualInitOptions): void;
6533 setData(dataViews: DataView[]): void;
6534 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
6535 overrideXScale(xProperties: IAxisProperties): void;
6536 render(suppressAnimations: boolean, resizeMode?: ResizeMode): CartesianVisualRenderResult;
6537 calculateLegend(): LegendData;
6538 hasLegend(): boolean;
6539 onClearSelection(): void;
6540 enumerateObjectInstances?(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
6541 getVisualCategoryAxisIsScalar?(): boolean;
6542 getSupportedCategoryAxisType?(): string;
6543 getPreferredPlotArea?(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
6544 setFilteredData?(startIndex: number, endIndex: number): CartesianData;
6545 supportsTrendLine?(): boolean;
6546 shouldSuppressAnimation?(): boolean;
6547 }
6548 interface CartesianVisualConstructorOptions {
6549 isScrollable: boolean;
6550 interactivityService?: IInteractivityService;
6551 animator?: IGenericAnimator;
6552 isLabelInteractivityEnabled?: boolean;
6553 tooltipsEnabled?: boolean;
6554 tooltipBucketEnabled?: boolean;
6555 cartesianLoadMoreEnabled?: boolean;
6556 advancedLineLabelsEnabled?: boolean;
6557 }
6558 interface CartesianVisualRenderResult {
6559 dataPoints: SelectableDataPoint[];
6560 behaviorOptions: any;
6561 labelDataPoints: LabelDataPoint[];
6562 labelsAreNumeric: boolean;
6563 labelDataPointGroups?: LabelDataPointGroup[];
6564 }
6565 interface CartesianDataPoint {
6566 categoryValue: any;
6567 value: number;
6568 categoryIndex: number;
6569 seriesIndex: number;
6570 highlight?: boolean;
6571 }
6572 interface CartesianSeries {
6573 data: CartesianDataPoint[];
6574 }
6575 interface CartesianData {
6576 series: CartesianSeries[];
6577 categoryMetadata: DataViewMetadataColumn;
6578 categories: any[];
6579 hasHighlights?: boolean;
6580 }
6581 interface CartesianVisualInitOptions extends VisualInitOptions {
6582 svg: D3.Selection;
6583 cartesianHost: ICartesianVisualHost;
6584 chartType?: CartesianChartType;
6585 labelsContext?: D3.Selection;
6586 }
6587 interface ICartesianVisualHost {
6588 updateLegend(data: LegendData): void;
6589 getSharedColors(): IDataColorPalette;
6590 triggerRender(suppressAnimations: boolean): void;
6591 }
6592 interface ChartAxesLabels {
6593 x: string;
6594 y: string;
6595 y2?: string;
6596 }
6597 const enum AxisLinesVisibility {
6598 ShowLinesOnXAxis = 1,
6599 ShowLinesOnYAxis = 2,
6600 ShowLinesOnBothAxis = 3,
6601 }
6602 interface CategoryLayout {
6603 categoryCount: number;
6604 categoryThickness: number;
6605 outerPaddingRatio: number;
6606 isScalar?: boolean;
6607 }
6608 interface CategoryLayoutOptions {
6609 availableWidth: number;
6610 categoryCount: number;
6611 domain: any;
6612 trimOrdinalDataOnOverflow: boolean;
6613 isScalar?: boolean;
6614 isScrollable?: boolean;
6615 }
6616 interface CartesianAxisProperties {
6617 x: IAxisProperties;
6618 y1: IAxisProperties;
6619 y2?: IAxisProperties;
6620 }
6621 interface ReferenceLineOptions {
6622 graphicContext: D3.Selection;
6623 referenceLineProperties: DataViewObject;
6624 axes: CartesianAxisProperties;
6625 viewport: IViewport;
6626 classAndSelector: ClassAndSelector;
6627 defaultColor: string;
6628 isHorizontal: boolean;
6629 }
6630 interface ReferenceLineDataLabelOptions {
6631 referenceLineProperties: DataViewObject;
6632 axes: CartesianAxisProperties;
6633 viewport: IViewport;
6634 defaultColor: string;
6635 isHorizontal: boolean;
6636 key: string;
6637 }
6638 interface ViewportDataRange {
6639 startIndex: number;
6640 endIndex: number;
6641 }
6642 interface ScalarKeys {
6643 values: PrimitiveValueRange[];
6644 }
6645 /**
6646 * Renders a data series as a cartestian visual.
6647 */
6648 class CartesianChart implements IVisual {
6649 static MinOrdinalRectThickness: number;
6650 static MinScalarRectThickness: number;
6651 static OuterPaddingRatio: number;
6652 static InnerPaddingRatio: number;
6653 static TickLabelPadding: number;
6654 static LoadMoreThreshold: number;
6655 private static ClassName;
6656 private static PlayAxisBottomMargin;
6657 private static FontSize;
6658 private static FontSizeString;
6659 static AxisTextProperties: TextProperties;
6660 private element;
6661 private chartAreaSvg;
6662 private clearCatcher;
6663 private type;
6664 private hostServices;
6665 private layers;
6666 private legend;
6667 private legendMargins;
6668 private layerLegendData;
6669 private hasSetData;
6670 private visualInitOptions;
6671 private legendObjectProperties;
6672 private categoryAxisProperties;
6673 private valueAxisProperties;
6674 private xAxisReferenceLines;
6675 private y1AxisReferenceLines;
6676 private cartesianSmallViewPortProperties;
6677 private interactivityService;
6678 private behavior;
6679 private sharedColorPalette;
6680 private isLabelInteractivityEnabled;
6681 private tooltipsEnabled;
6682 private tooltipBucketEnabled;
6683 private cartesianLoadMoreEnabled;
6684 private trimOrdinalDataOnOverflow;
6685 private isMobileChart;
6686 private advancedLineLabelsEnabled;
6687 private trendLines;
6688 private xRefLine;
6689 private y1RefLine;
6690 animator: IGenericAnimator;
6691 private axes;
6692 private scrollableAxes;
6693 private svgAxes;
6694 private svgBrush;
6695 private renderedPlotArea;
6696 private dataViews;
6697 private currentViewport;
6698 private background;
6699 private loadMoreDataHandler;
6700 private static getAxisVisibility(type);
6701 constructor(options: CartesianConstructorOptions);
6702 init(options: VisualInitOptions): void;
6703 private isPlayAxis();
6704 static getIsScalar(objects: DataViewObjects, propertyId: DataViewObjectPropertyIdentifier, type: ValueTypeDescriptor, scalarKeys?: ScalarKeys): boolean;
6705 private static supportsScalar(type, scalarKeys?);
6706 static getAdditionalTelemetry(dataView: DataView): any;
6707 static detectScalarMapping(dataViewMapping: data.CompiledDataViewMapping): boolean;
6708 private populateObjectProperties(dataViews);
6709 private updateInternal(options, operationKind?);
6710 onDataChanged(options: VisualDataChangedOptions): void;
6711 onResizing(viewport: IViewport, resizeMode?: ResizeMode): void;
6712 scrollTo(position: number): void;
6713 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
6714 private supportsTrendLines(layerIndex?);
6715 private shouldShowLegendCard();
6716 private getAxisScaleOptions(axisType);
6717 private getCategoryAxisValues(enumeration);
6718 private getValueAxisValues(enumeration);
6719 onClearSelection(): void;
6720 private extractMetadataObjects(dataViews);
6721 private createAndInitLayers(objects);
6722 private renderLegend();
6723 private hideLegends();
6724 private render(suppressAnimations, resizeMode?, operationKind?);
6725 /**
6726 * Gets any minimum domain extents.
6727 * Reference lines and trend lines may enforce minimum extents on X and/or Y domains.
6728 */
6729 private getMinimumDomainExtents();
6730 private getPlotAreaRect(axesLayout, legendMargins);
6731 private renderBackgroundImage(layout);
6732 private hideAxisLabels(legendMargins);
6733 private calculateInteractivityRightMargin();
6734 private renderPlotArea(layers, axesLayout, suppressAnimations, legendMargins, resizeMode?);
6735 private renderTrendLines(axesLayout);
6736 private renderReferenceLines(axesLayout);
6737 private getReferenceLineLabels(axes, plotArea);
6738 private renderDataLabels(labelDataPointGroups, labelsAreNumeric, plotArea, suppressAnimations, isCombo);
6739 private renderLayers(layers, plotArea, axes, suppressAnimations, resizeMode?);
6740 /**
6741 * Returns the actual viewportWidth if visual is not scrollable.
6742 * @return If visual is scrollable, returns the plot area needed to draw all the datapoints.
6743 */
6744 static getPreferredPlotArea(categoryCount: number, categoryThickness: number, viewport: IViewport, isScrollable: boolean, isScalar: boolean, margin?: IMargin, noOuterPadding?: boolean): IViewport;
6745 /**
6746 * Returns preferred Category span if the visual is scrollable.
6747 */
6748 static getPreferredCategorySpan(categoryCount: number, categoryThickness: number, noOuterPadding?: boolean): number;
6749 /**
6750 * Note: Public for testing access.
6751 */
6752 static getLayout(data: ColumnChartData, options: CategoryLayoutOptions): CategoryLayout;
6753 /**
6754 * Returns the thickness for each category.
6755 * For clustered charts, you still need to divide by
6756 * the number of series to get column width after calling this method.
6757 * For linear or time scales, category thickness accomodates for
6758 * the minimum interval between consequtive points.
6759 * For all types, return value has accounted for outer padding,
6760 * but not inner padding.
6761 */
6762 static getCategoryThickness(seriesList: CartesianSeries[], numCategories: number, plotLength: number, domain: number[], isScalar: boolean, trimOrdinalDataOnOverflow: boolean): number;
6763 private static getMinInterval(seriesList);
6764 /**
6765 * Makes the necessary changes to the mapping if load more data is enabled for cartesian charts. Usually called during `customizeQuery`.
6766 */
6767 static applyLoadMoreEnabledToMapping(cartesianLoadMoreEnabled: boolean, mapping: powerbi.data.CompiledDataViewMapping): void;
6768 }
6769 const enum AxisLocation {
6770 X = 0,
6771 Y1 = 1,
6772 Y2 = 2,
6773 }
6774 interface CartesianAxesLayout {
6775 axes: CartesianAxisProperties;
6776 margin: IMargin;
6777 marginLimits: IMargin;
6778 axisLabels: ChartAxesLabels;
6779 viewport: IViewport;
6780 plotArea: IViewport;
6781 preferredPlotArea: IViewport;
6782 tickLabelMargins: any;
6783 tickPadding: IMargin;
6784 rotateXTickLabels90?: boolean;
6785 }
6786 class SvgCartesianAxes {
6787 private axes;
6788 static AxisPadding: IMargin;
6789 private axisGraphicsContext;
6790 private xAxisGraphicsContext;
6791 private y1AxisGraphicsContext;
6792 private y2AxisGraphicsContext;
6793 private svgScrollable;
6794 private axisGraphicsContextScrollable;
6795 private labelRegion;
6796 private labelBackgroundRegion;
6797 private categoryAxisProperties;
6798 private valueAxisProperties;
6799 private static AxisGraphicsContext;
6800 private static TickPaddingRotatedX;
6801 private static AxisLabelFontSize;
6802 private static Y2TickSize;
6803 constructor(axes: CartesianAxes);
6804 getScrollableRegion(): D3.Selection;
6805 getLabelsRegion(): D3.Selection;
6806 getLabelBackground(): D3.Selection;
6807 getXAxis(): D3.Selection;
6808 getY1Axis(): D3.Selection;
6809 getY2Axis(): D3.Selection;
6810 update(categoryAxisProperties: DataViewObject, valueAxisProperties: DataViewObject): void;
6811 init(svg: D3.Selection): void;
6812 private static updateAnimatedTickTooltips(axisSelection, values);
6813 private static updateTickTooltips(axisSelection, values);
6814 renderAxes(axesLayout: CartesianAxesLayout, duration: number, easing?: string): void;
6815 private renderAxesLabels(options);
6816 private translateAxes(viewport, margin);
6817 /**
6818 * Within the context of the given selection (g), find the offset of
6819 * the zero tick using the d3 attached datum of g.tick elements.
6820 * 'Classed' is undefined for transition selections
6821 */
6822 private static darkenZeroLine(g);
6823 private static setAxisLabelColor(g, fill);
6824 }
6825 class CartesianAxes {
6826 private static YAxisLabelPadding;
6827 private static XAxisLabelPadding;
6828 private static MaxMarginFactor;
6829 private static MinimumMargin;
6830 private categoryAxisProperties;
6831 private valueAxisProperties;
6832 private maxMarginFactor;
6833 private yAxisOrientation;
6834 private scrollbarWidth;
6835 private trimOrdinalDataOnOverflow;
6836 showLinesOnX: boolean;
6837 showLinesOnY: boolean;
6838 isScrollable: boolean;
6839 isXScrollBarVisible: boolean;
6840 isYScrollBarVisible: boolean;
6841 categoryAxisHasUnitType: boolean;
6842 valueAxisHasUnitType: boolean;
6843 secondaryValueAxisHasUnitType: boolean;
6844 private layout;
6845 constructor(isScrollable: boolean, scrollbarWidth: number, trimOrdinalDataOnOverflow: boolean);
6846 shouldShowY1OnRight(): boolean;
6847 isYAxisCategorical(): boolean;
6848 hasCategoryAxis(): boolean;
6849 hasY2Axis(): boolean;
6850 getYAxisOrientation(): string;
6851 setAxisLinesVisibility(axisLinesVisibility: AxisLinesVisibility): void;
6852 setMaxMarginFactor(factor: number): void;
6853 update(dataViews: DataView[]): void;
6854 addWarnings(warnings: IVisualWarning[]): void;
6855 /**
6856 * Computes the Cartesian Chart axes from the set of layers.
6857 */
6858 private calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, scrollbarVisible, existingAxisProperties, hideAxisTitles, ensureXDomain?, ensureYDomain?);
6859 /**
6860 * Negotiate the axes regions, the plot area, and determine if we need a scrollbar for ordinal categories.
6861 * @param layers an array of Cartesian layout layers (column, line, etc.)
6862 * @param parentViewport the full viewport for the visual
6863 * @param padding the D3 axis padding values
6864 * @param playAxisControlLayout if this is a playable Cartesian chart, includes the layout for the play controls (start/stop, time slider)
6865 * @param hideAxisLabels forces axis titles to be hidden
6866 * @param textProperties text properties to be used by text measurement
6867 * @param interactivityRightMargin extra right margin for the interactivity
6868 * @param ensureXDomain if non null, includes values that must be part of the axis domain
6869 * @param ensureYDomain if non null, includes values that must be part of the axis domain
6870 */
6871 negotiateAxes(layers: ICartesianVisual[], parentViewport: IViewport, padding: IMargin, playAxisControlLayout: IRect, hideAxisLabels: boolean, textProperties: TextProperties, interactivityRightMargin: number, ensureXDomain?: NumberRange, ensureYDomain?: NumberRange): CartesianAxesLayout;
6872 private getPreferredPlotArea(axes, layers, isScalar);
6873 private willAllCategoriesFitInPlotArea(plotArea, preferredPlotArea);
6874 private updateAxisMargins(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, interactivityRightMargin);
6875 isLogScaleAllowed(axisType: AxisLocation): boolean;
6876 axesHaveTicks(viewport: IViewport): boolean;
6877 shouldRenderAxisTitle(axisProperties: IAxisProperties, defaultValue: boolean, secondary: boolean): boolean;
6878 shouldRenderAxis(axisProperties: IAxisProperties, secondary?: boolean): boolean;
6879 private getAxisProperty(axisProperties, propertyName, defaultValue);
6880 private addUnitTypeToAxisLabels(axes);
6881 private static getUnitType(formatter);
6882 }
6883 class SharedColorPalette implements IDataColorPalette {
6884 private palette;
6885 private preferredScale;
6886 private rotated;
6887 constructor(palette: IDataColorPalette);
6888 getColorScaleByKey(scaleKey: string): IColorScale;
6889 getNewColorScale(): IColorScale;
6890 getColorByIndex(index: number): IColorInfo;
6891 getSentimentColors(): IColorInfo[];
6892 getBasePickerColors(): IColorInfo[];
6893 clearPreferredScale(): void;
6894 rotateScale(): void;
6895 private setPreferredScale(scaleKey);
6896 }
6897 class CartesianLoadMoreDataHandler {
6898 viewportDataRange: ViewportDataRange;
6899 private loadMoreThresholdIndex;
6900 private loadingMoreData;
6901 private loadMoreThreshold;
6902 private loadMoreCallback;
6903 /**
6904 * Constructs the handler.
6905 * @param scale - The scale for the loaded data.
6906 * @param loadMoreCallback - The callback to execute to load more data.
6907 * @param loadMoreThreshold - How many indexes before the last index loading more data will be triggered.
6908 * Ex: loadMoreThreshold = 2, dataLength = 10 (last index = 9) will trigger a load when item with index 9 - 2 = 7 or greater is displayed.
6909 */
6910 constructor(scale: D3.Scale.GenericScale<any>, loadMoreCallback: () => void, loadMoreThreshold?: number);
6911 setScale(scale: D3.Scale.GenericScale<any>): void;
6912 isLoadingMoreData(): boolean;
6913 onLoadMoreDataCompleted(): void;
6914 shouldLoadMoreData(): boolean;
6915 loadMoreData(): void;
6916 }
6917}
6918
6919declare module powerbi.visuals {
6920 interface ColumnChartConstructorOptions extends CartesianVisualConstructorOptions {
6921 chartType: ColumnChartType;
6922 animator: IColumnChartAnimator;
6923 }
6924 interface ColumnChartData extends CartesianData {
6925 categoryFormatter: IValueFormatter;
6926 series: ColumnChartSeries[];
6927 valuesMetadata: DataViewMetadataColumn[];
6928 legendData: LegendData;
6929 hasHighlights: boolean;
6930 categoryMetadata: DataViewMetadataColumn;
6931 scalarCategoryAxis: boolean;
6932 labelSettings: VisualDataLabelsSettings;
6933 axesLabels: ChartAxesLabels;
6934 hasDynamicSeries: boolean;
6935 isMultiMeasure: boolean;
6936 defaultDataPointColor?: string;
6937 showAllDataPoints?: boolean;
6938 }
6939 interface ColumnChartSeries extends CartesianSeries {
6940 displayName: string;
6941 key: string;
6942 index: number;
6943 data: ColumnChartDataPoint[];
6944 identity: SelectionId;
6945 color: string;
6946 labelSettings: VisualDataLabelsSettings;
6947 }
6948 interface ColumnChartDataPoint extends CartesianDataPoint, SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
6949 categoryValue: number;
6950 /** Adjusted for 100% stacked if applicable */
6951 value: number;
6952 /** The top (column) or right (bar) of the rectangle, used for positioning stacked rectangles */
6953 position: number;
6954 valueAbsolute: number;
6955 /** Not adjusted for 100% stacked */
6956 valueOriginal: number;
6957 seriesIndex: number;
6958 labelSettings: VisualDataLabelsSettings;
6959 categoryIndex: number;
6960 color: string;
6961 /** The original values from the highlighted rect, used in animations */
6962 originalValue: number;
6963 originalPosition: number;
6964 originalValueAbsolute: number;
6965 /**
6966 * True if this data point is a highlighted portion and overflows (whether due to the highlight
6967 * being greater than original or of a different sign), so it needs to be thinner to accomodate.
6968 */
6969 drawThinner?: boolean;
6970 key: string;
6971 lastSeries?: boolean;
6972 chartType: ColumnChartType;
6973 }
6974 enum ColumnChartType {
6975 clusteredBar,
6976 clusteredColumn,
6977 hundredPercentStackedBar,
6978 hundredPercentStackedColumn,
6979 stackedBar,
6980 stackedColumn,
6981 }
6982 interface ColumnAxisOptions {
6983 xScale: D3.Scale.Scale;
6984 yScale: D3.Scale.Scale;
6985 seriesOffsetScale?: D3.Scale.Scale;
6986 columnWidth: number;
6987 /** Used by clustered only since categoryWidth !== columnWidth */
6988 categoryWidth?: number;
6989 isScalar: boolean;
6990 margin: IMargin;
6991 }
6992 interface IColumnLayout {
6993 shapeLayout: {
6994 width: (d: ColumnChartDataPoint) => number;
6995 x: (d: ColumnChartDataPoint) => number;
6996 y: (d: ColumnChartDataPoint) => number;
6997 height: (d: ColumnChartDataPoint) => number;
6998 };
6999 shapeLayoutWithoutHighlights: {
7000 width: (d: ColumnChartDataPoint) => number;
7001 x: (d: ColumnChartDataPoint) => number;
7002 y: (d: ColumnChartDataPoint) => number;
7003 height: (d: ColumnChartDataPoint) => number;
7004 };
7005 zeroShapeLayout: {
7006 width: (d: ColumnChartDataPoint) => number;
7007 x: (d: ColumnChartDataPoint) => number;
7008 y: (d: ColumnChartDataPoint) => number;
7009 height: (d: ColumnChartDataPoint) => number;
7010 };
7011 }
7012 interface ColumnChartContext {
7013 height: number;
7014 width: number;
7015 duration: number;
7016 hostService: IVisualHostServices;
7017 margin: IMargin;
7018 /** A group for graphics can be placed that won't be clipped to the data area of the chart. */
7019 unclippedGraphicsContext: D3.Selection;
7020 /** A SVG for graphics that should be clipped to the data area, e.g. data bars, columns, lines */
7021 mainGraphicsContext: D3.Selection;
7022 layout: CategoryLayout;
7023 animator: IColumnChartAnimator;
7024 onDragStart?: (datum: ColumnChartDataPoint) => void;
7025 interactivityService: IInteractivityService;
7026 viewportHeight: number;
7027 viewportWidth: number;
7028 is100Pct: boolean;
7029 isComboChart: boolean;
7030 }
7031 interface IColumnChartStrategy {
7032 setData(data: ColumnChartData): void;
7033 setupVisualProps(columnChartProps: ColumnChartContext): void;
7034 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
7035 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
7036 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
7037 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
7038 getClosestColumnIndex(x: number, y: number): number;
7039 }
7040 interface IColumnChartConverterStrategy {
7041 getLegend(colors: IDataColorPalette, defaultLegendLabelColor: string, defaultColor?: string): LegendSeriesInfo;
7042 getValueBySeriesAndCategory(series: number, category: number): number;
7043 getMeasureNameByIndex(series: number, category: number): string;
7044 hasHighlightValues(series: number): boolean;
7045 getHighlightBySeriesAndCategory(series: number, category: number): number;
7046 }
7047 interface LegendSeriesInfo {
7048 legend: LegendData;
7049 seriesSources: DataViewMetadataColumn[];
7050 seriesObjects: DataViewObjects[][];
7051 }
7052 interface ColumnChartDrawInfo {
7053 eventGroup: D3.Selection;
7054 shapesSelection: D3.Selection;
7055 viewport: IViewport;
7056 axisOptions: ColumnAxisOptions;
7057 labelDataPoints: LabelDataPoint[];
7058 }
7059 /**
7060 * Renders a stacked and clustered column chart.
7061 */
7062 class ColumnChart implements ICartesianVisual {
7063 private static ColumnChartClassName;
7064 static clusteredValidLabelPositions: RectLabelPosition[];
7065 static stackedValidLabelPositions: RectLabelPosition[];
7066 static SeriesClasses: jsCommon.CssConstants.ClassAndSelector;
7067 private svg;
7068 private unclippedGraphicsContext;
7069 private mainGraphicsContext;
7070 private xAxisProperties;
7071 private yAxisProperties;
7072 private currentViewport;
7073 private data;
7074 private style;
7075 private colors;
7076 private chartType;
7077 private columnChart;
7078 private hostService;
7079 private cartesianVisualHost;
7080 private interactivity;
7081 private margin;
7082 private options;
7083 private lastInteractiveSelectedColumnIndex;
7084 private interactivityService;
7085 private dataView;
7086 private categoryAxisType;
7087 private animator;
7088 private isScrollable;
7089 private tooltipsEnabled;
7090 private tooltipBucketEnabled;
7091 private element;
7092 private isComboChart;
7093 constructor(options: ColumnChartConstructorOptions);
7094 static customizeQuery(options: CustomizeQueryOptions): void;
7095 static getSortableRoles(options: VisualSortableOptions): string[];
7096 updateVisualMetadata(x: IAxisProperties, y: IAxisProperties, margin: any): void;
7097 init(options: CartesianVisualInitOptions): void;
7098 private getCategoryLayout(numCategoryValues, options);
7099 static converter(dataView: DataView, colors: IDataColorPalette, is100PercentStacked?: boolean, isScalar?: boolean, dataViewMetadata?: DataViewMetadata, chartType?: ColumnChartType, interactivityService?: IInteractivityService, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): ColumnChartData;
7100 private static canSupportOverflow(chartType, seriesCount);
7101 private static createDataPoints(dataView, categories, categoryIdentities, legend, seriesObjectsList, converterStrategy, defaultLabelSettings, is100PercentStacked?, isScalar?, isCategoryAlsoSeries?, categoryObjectsList?, defaultDataPointColor?, chartType?, categoryMetadata?, tooltipsEnabled?, tooltipBucketEnabled?);
7102 private static getDataPointColor(legendItem, categoryIndex, dataPointObjects?);
7103 private static getStackedLabelColor(isNegative, seriesIndex, seriesCount, categoryIndex, rawValues);
7104 static sliceSeries(series: ColumnChartSeries[], endIndex: number, startIndex?: number): ColumnChartSeries[];
7105 static getInteractiveColumnChartDomElement(element: JQuery): HTMLElement;
7106 setData(dataViews: DataView[]): void;
7107 private setChartStrategy();
7108 calculateLegend(): LegendData;
7109 hasLegend(): boolean;
7110 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
7111 private enumerateDataLabels(enumeration);
7112 private getLabelSettingsOptions(enumeration, labelSettings, series?, showAll?);
7113 private enumerateDataPoints(enumeration);
7114 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
7115 getPreferredPlotArea(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
7116 private ApplyInteractivity(chartContext);
7117 private selectColumn(indexOfColumnSelected, force?);
7118 private createInteractiveLegendDataPoints(columnIndex);
7119 overrideXScale(xProperties: IAxisProperties): void;
7120 render(suppressAnimations: boolean): CartesianVisualRenderResult;
7121 onClearSelection(): void;
7122 getVisualCategoryAxisIsScalar(): boolean;
7123 getSupportedCategoryAxisType(): string;
7124 setFilteredData(startIndex: number, endIndex: number): CartesianData;
7125 static getLabelFill(labelColor: string, isInside: boolean, isCombo: boolean): string;
7126 supportsTrendLine(): boolean;
7127 static isBar(chartType: ColumnChartType): boolean;
7128 static isColumn(chartType: ColumnChartType): boolean;
7129 static isClustered(chartType: ColumnChartType): boolean;
7130 static isStacked(chartType: ColumnChartType): boolean;
7131 static isStacked100(chartType: ColumnChartType): boolean;
7132 }
7133}
7134
7135declare module powerbi.visuals {
7136 class ClusteredColumnChartStrategy implements IColumnChartStrategy {
7137 private static classes;
7138 private data;
7139 private graphicsContext;
7140 private seriesOffsetScale;
7141 private width;
7142 private height;
7143 private margin;
7144 private xProps;
7145 private yProps;
7146 private categoryLayout;
7147 private viewportHeight;
7148 private viewportWidth;
7149 private columnsCenters;
7150 private columnSelectionLineHandle;
7151 private animator;
7152 private interactivityService;
7153 private layout;
7154 private isComboChart;
7155 setupVisualProps(columnChartProps: ColumnChartContext): void;
7156 setData(data: ColumnChartData): void;
7157 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
7158 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
7159 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
7160 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
7161 getClosestColumnIndex(x: number, y: number): number;
7162 /**
7163 * Get the chart's columns centers (x value).
7164 */
7165 private getColumnsCenters();
7166 private moveHandle(selectedColumnIndex);
7167 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
7168 private createLabelDataPoints();
7169 }
7170 class ClusteredBarChartStrategy implements IColumnChartStrategy {
7171 private static classes;
7172 private data;
7173 private graphicsContext;
7174 private seriesOffsetScale;
7175 private width;
7176 private height;
7177 private margin;
7178 private xProps;
7179 private yProps;
7180 private categoryLayout;
7181 private viewportHeight;
7182 private viewportWidth;
7183 private barsCenters;
7184 private columnSelectionLineHandle;
7185 private animator;
7186 private interactivityService;
7187 private layout;
7188 private isComboChart;
7189 setupVisualProps(barChartProps: ColumnChartContext): void;
7190 setData(data: ColumnChartData): void;
7191 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
7192 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
7193 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
7194 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
7195 getClosestColumnIndex(x: number, y: number): number;
7196 /**
7197 * Get the chart's columns centers (y value).
7198 */
7199 private getBarsCenters();
7200 private moveHandle(selectedColumnIndex);
7201 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
7202 private createLabelDataPoints();
7203 }
7204}
7205
7206declare module powerbi.visuals {
7207 class StackedColumnChartStrategy implements IColumnChartStrategy {
7208 private static classes;
7209 private data;
7210 private graphicsContext;
7211 private width;
7212 private height;
7213 private margin;
7214 private xProps;
7215 private yProps;
7216 private categoryLayout;
7217 private columnsCenters;
7218 private columnSelectionLineHandle;
7219 private animator;
7220 private interactivityService;
7221 private viewportHeight;
7222 private viewportWidth;
7223 private layout;
7224 private isComboChart;
7225 setupVisualProps(columnChartProps: ColumnChartContext): void;
7226 setData(data: ColumnChartData): void;
7227 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, xReferenceLineValue?: number): IAxisProperties;
7228 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, y1ReferenceLineValue?: number): IAxisProperties;
7229 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
7230 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
7231 getClosestColumnIndex(x: number, y: number): number;
7232 /**
7233 * Get the chart's columns centers (x value).
7234 */
7235 private getColumnsCenters();
7236 private moveHandle(selectedColumnIndex);
7237 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
7238 private createLabelDataPoints();
7239 }
7240 class StackedBarChartStrategy implements IColumnChartStrategy {
7241 private static classes;
7242 private data;
7243 private graphicsContext;
7244 private width;
7245 height: number;
7246 private margin;
7247 private xProps;
7248 private yProps;
7249 private categoryLayout;
7250 private barsCenters;
7251 private columnSelectionLineHandle;
7252 private animator;
7253 private interactivityService;
7254 private viewportHeight;
7255 private viewportWidth;
7256 private layout;
7257 private isComboChart;
7258 setupVisualProps(barChartProps: ColumnChartContext): void;
7259 setData(data: ColumnChartData): void;
7260 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
7261 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
7262 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
7263 selectColumn(selectedColumnIndex: number, lastInteractiveSelectedColumnIndex: number): void;
7264 getClosestColumnIndex(x: number, y: number): number;
7265 /**
7266 * Get the chart's columns centers (y value).
7267 */
7268 private getBarsCenters();
7269 private moveHandle(selectedColumnIndex);
7270 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
7271 private createLabelDataPoints();
7272 }
7273}
7274
7275declare module powerbi.visuals.samples {
7276 interface HelloViewModel {
7277 text: string;
7278 color: string;
7279 size: number;
7280 selector: SelectionId;
7281 toolTipInfo: TooltipDataItem[];
7282 }
7283 class HelloIVisual implements IVisual {
7284 static capabilities: VisualCapabilities;
7285 private static DefaultText;
7286 private root;
7287 private svgText;
7288 private dataView;
7289 private selectiionManager;
7290 static converter(dataView: DataView): HelloViewModel;
7291 init(options: VisualInitOptions): void;
7292 update(options: VisualUpdateOptions): void;
7293 private static getFill(dataView);
7294 private static getSize(dataView);
7295 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
7296 destroy(): void;
7297 }
7298}
7299
7300declare module powerbi.visuals {
7301 interface ComboChartDataViewObjects extends DataViewObjects {
7302 general: ComboChartDataViewObject;
7303 }
7304 interface ComboChartDataViewObject extends DataViewObject {
7305 visualType1: string;
7306 visualType2: string;
7307 }
7308 /**
7309 * This module only supplies the capabilities for comboCharts.
7310 * Implementation is in cartesianChart and the various ICartesianVisual implementations.
7311 */
7312 module ComboChart {
7313 const capabilities: VisualCapabilities;
7314 /**
7315 * Handles the case of a column layer in a combo chart. In this case, the column layer is enumearated last.
7316 */
7317 function enumerateDataPoints(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions, layers: ICartesianVisual[]): void;
7318 function customizeQuery(options: CustomizeQueryOptions): void;
7319 function getSortableRoles(options: VisualSortableOptions): string[];
7320 function isComboChart(chartType: CartesianChartType): boolean;
7321 }
7322}
7323
7324declare module powerbi.visuals {
7325 class DataColorPalette implements IDataColorPalette {
7326 private scales;
7327 private colors;
7328 private sentimentColors;
7329 private basePickerColors;
7330 /**
7331 * Creates a DataColorPalette using the given theme, or the default theme.
7332 */
7333 constructor(colors?: IColorInfo[], sentimentcolors?: IColorInfo[]);
7334 getColorScaleByKey(key: string): IColorScale;
7335 getNewColorScale(): IColorScale;
7336 getColorByIndex(index: number): IColorInfo;
7337 getSentimentColors(): IColorInfo[];
7338 getBasePickerColors(): IColorInfo[];
7339 getAllColors(): IColorInfo[];
7340 private createScale();
7341 }
7342 class D3ColorScale implements IColorScale {
7343 private scale;
7344 constructor(scale: D3.Scale.OrdinalScale);
7345 getColor(key: any): IColorInfo;
7346 clearAndRotateScale(): void;
7347 clone(): IColorScale;
7348 getDomain(): any[];
7349 static createFromColors(colors: IColorInfo[]): D3ColorScale;
7350 }
7351 class ThemeManager {
7352 private static colorSectorCount;
7353 private static defaultBaseColors;
7354 private static defaultTheme;
7355 static defaultSentimentColors: IColorInfo[];
7356 static getDefaultTheme(): IColorInfo[];
7357 }
7358}
7359
7360/**
7361 * IMPORTANT: This chart is not currently enabled in the PBI system and is under development.
7362 */
7363declare module powerbi.visuals {
7364 interface IDataDotChartConfiguration {
7365 xAxisProperties: IAxisProperties;
7366 yAxisProperties: IAxisProperties;
7367 margin: any;
7368 }
7369 interface DataDotChartData {
7370 series: DataDotChartSeries;
7371 hasHighlights: boolean;
7372 hasDynamicSeries: boolean;
7373 }
7374 interface DataDotChartSeries extends CartesianSeries {
7375 xCol: DataViewMetadataColumn;
7376 yCol: DataViewMetadataColumn;
7377 data: DataDotChartDataPoint[];
7378 }
7379 interface DataDotChartDataPoint extends CartesianDataPoint, SelectableDataPoint {
7380 highlight: boolean;
7381 }
7382 interface DataDotChartConstructorOptions extends CartesianVisualConstructorOptions {
7383 }
7384 /**
7385 * The data dot chart shows a set of circles with the data value inside them.
7386 * The circles are regularly spaced similar to column charts.
7387 * The radius of all dots is the same across the chart.
7388 * This is most often combined with a column chart to create the 'chicken pox' chart.
7389 * If any of the data values do not fit within the circles, then the data values are hidden
7390 * and the y axis for the dots is displayed instead.
7391 * This chart only supports a single series of data.
7392 * This chart does not display a legend.
7393 */
7394 class DataDotChart implements ICartesianVisual {
7395 static formatStringProp: DataViewObjectPropertyIdentifier;
7396 private static ClassName;
7397 private static DotClassName;
7398 private static DotClassSelector;
7399 private static DotColorKey;
7400 private static DotLabelClassName;
7401 private static DotLabelClassSelector;
7402 private static DotLabelVerticalOffset;
7403 private static DotLabelTextAnchor;
7404 private options;
7405 private svg;
7406 private element;
7407 private mainGraphicsG;
7408 private mainGraphicsContext;
7409 private currentViewport;
7410 private hostService;
7411 private cartesianVisualHost;
7412 private style;
7413 private colors;
7414 private isScrollable;
7415 private xAxisProperties;
7416 private yAxisProperties;
7417 private margin;
7418 private data;
7419 private dataViewCategorical;
7420 private clippedData;
7421 private interactivityService;
7422 private interactivity;
7423 constructor(options: DataDotChartConstructorOptions);
7424 init(options: CartesianVisualInitOptions): void;
7425 setData(dataViews: DataView[]): void;
7426 setFilteredData(startIndex: number, endIndex: number): any;
7427 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
7428 private static createClippedDataIfOverflowed(data, categoryCount);
7429 private static hasDataPoint(series);
7430 private lookupXValue(index, type);
7431 overrideXScale(xProperties: IAxisProperties): void;
7432 render(suppressAnimations: boolean): CartesianVisualRenderResult;
7433 calculateLegend(): LegendData;
7434 hasLegend(): boolean;
7435 private createLegendDataPoints(columnIndex);
7436 onClearSelection(): void;
7437 static converter(dataView: DataView, blankCategoryValue: string, interactivityService: IInteractivityService): DataDotChartData;
7438 }
7439}
7440
7441declare module powerbi.visuals {
7442 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
7443 interface FunnelChartConstructorOptions {
7444 animator?: IFunnelAnimator;
7445 funnelSmallViewPortProperties?: FunnelSmallViewPortProperties;
7446 behavior?: FunnelWebBehavior;
7447 tooltipsEnabled?: boolean;
7448 tooltipBucketEnabled?: boolean;
7449 }
7450 interface FunnelPercent {
7451 value: number;
7452 percent: number;
7453 isTop: boolean;
7454 }
7455 /**
7456 * value and highlightValue may be modified in the converter to
7457 * allow rendering non-standard values, such as negatives.
7458 * Store the original values for non-rendering, user-facing elements
7459 * e.g. data labels
7460 */
7461 interface FunnelDataPoint extends SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
7462 value: number;
7463 originalValue: number;
7464 label: string;
7465 key: string;
7466 categoryOrMeasureIndex: number;
7467 highlight?: boolean;
7468 highlightValue?: number;
7469 originalHighlightValue?: number;
7470 color: string;
7471 }
7472 interface FunnelData {
7473 dataPoints: FunnelDataPoint[];
7474 categoryLabels: string[];
7475 valuesMetadata: DataViewMetadataColumn[];
7476 hasHighlights: boolean;
7477 highlightsOverflow: boolean;
7478 dataLabelsSettings: VisualDataLabelsSettings;
7479 percentBarLabelSettings: VisualDataLabelsSettings;
7480 canShowDataLabels: boolean;
7481 hasNegativeValues: boolean;
7482 allValuesAreNegative: boolean;
7483 }
7484 interface FunnelAxisOptions {
7485 maxScore: number;
7486 valueScale: D3.Scale.LinearScale;
7487 categoryScale: D3.Scale.OrdinalScale;
7488 maxWidth: number;
7489 margin: IMargin;
7490 rangeStart: number;
7491 rangeEnd: number;
7492 barToSpaceRatio: number;
7493 categoryLabels: string[];
7494 }
7495 interface IFunnelRect {
7496 width: (d: FunnelDataPoint) => number;
7497 x: (d: FunnelDataPoint) => number;
7498 y: (d: FunnelDataPoint) => number;
7499 height: (d: FunnelDataPoint) => number;
7500 }
7501 interface IFunnelLayout {
7502 percentBarLayout: {
7503 mainLine: {
7504 x2: (d: FunnelPercent) => number;
7505 transform: (d: FunnelPercent) => string;
7506 };
7507 leftTick: {
7508 y2: (d: FunnelPercent) => number;
7509 transform: (d: FunnelPercent) => string;
7510 };
7511 rightTick: {
7512 y2: (d: FunnelPercent) => number;
7513 transform: (d: FunnelPercent) => string;
7514 };
7515 text: {
7516 x: (d: FunnelPercent) => number;
7517 y: (d: FunnelPercent) => number;
7518 style: () => string;
7519 transform: (d: FunnelPercent) => string;
7520 fill: string;
7521 maxWidth: number;
7522 };
7523 };
7524 shapeLayout: IFunnelRect;
7525 shapeLayoutWithoutHighlights: IFunnelRect;
7526 zeroShapeLayout: IFunnelRect;
7527 interactorLayout: IFunnelRect;
7528 }
7529 interface IFunnelChartSelectors {
7530 funnel: {
7531 bars: ClassAndSelector;
7532 highlights: ClassAndSelector;
7533 interactors: ClassAndSelector;
7534 };
7535 percentBar: {
7536 root: ClassAndSelector;
7537 mainLine: ClassAndSelector;
7538 leftTick: ClassAndSelector;
7539 rightTick: ClassAndSelector;
7540 text: ClassAndSelector;
7541 };
7542 }
7543 interface FunnelSmallViewPortProperties {
7544 hideFunnelCategoryLabelsOnSmallViewPort: boolean;
7545 minHeightFunnelCategoryLabelsVisible: number;
7546 }
7547 /**
7548 * Renders a funnel chart.
7549 */
7550 class FunnelChart implements IVisual {
7551 private static LabelInsidePosition;
7552 private static LabelOutsidePosition;
7553 private static LabelOrientation;
7554 static DefaultBarOpacity: number;
7555 static DimmedBarOpacity: number;
7556 static PercentBarToBarRatio: number;
7557 static TickPadding: number;
7558 static InnerTickSize: number;
7559 static MinimumInteractorSize: number;
7560 static InnerTextClassName: string;
7561 static Selectors: IFunnelChartSelectors;
7562 static FunnelBarHighlightClass: string;
7563 static YAxisPadding: number;
7564 private static VisualClassName;
7565 private static DefaultFontFamily;
7566 private static BarToSpaceRatio;
7567 private static MaxBarHeight;
7568 private static MinBarThickness;
7569 private static LabelFunnelPadding;
7570 private static OverflowingHighlightWidthRatio;
7571 private static MaxMarginFactor;
7572 private svg;
7573 private funnelGraphicsContext;
7574 private percentGraphicsContext;
7575 private clearCatcher;
7576 private axisGraphicsContext;
7577 private labelGraphicsContext;
7578 private currentViewport;
7579 private colors;
7580 private data;
7581 private hostServices;
7582 private margin;
7583 private options;
7584 private interactivityService;
7585 private behavior;
7586 private defaultDataPointColor;
7587 private labelPositionObjects;
7588 private dataViews;
7589 private funnelSmallViewPortProperties;
7590 private tooltipsEnabled;
7591 private tooltipBucketEnabled;
7592 /**
7593 * Note: Public for testing.
7594 */
7595 animator: IFunnelAnimator;
7596 constructor(options?: FunnelChartConstructorOptions);
7597 static converter(dataView: DataView, colors: IDataColorPalette, hostServices: IVisualHostServices, defaultDataPointColor?: string, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): FunnelData;
7598 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
7599 private static getLabelSettingsOptions(enumeration, labelSettings, isDataLabels, positionObject?);
7600 private enumerateDataPoints(enumeration);
7601 init(options: VisualInitOptions): void;
7602 private updateViewportProperties();
7603 update(options: VisualUpdateOptions): void;
7604 onDataChanged(options: VisualDataChangedOptions): void;
7605 onResizing(viewport: IViewport): void;
7606 private getMaxLabelLength(labels, properties);
7607 private updateInternal(suppressAnimations);
7608 private getUsableVerticalSpace();
7609 private isHidingPercentBars();
7610 private isSparklines();
7611 private setUpAxis();
7612 private getPercentBarTextHeight();
7613 onClearSelection(): void;
7614 static getLayout(data: FunnelData, axisOptions: FunnelAxisOptions): IFunnelLayout;
7615 static drawDefaultAxis(graphicsContext: D3.Selection, axisOptions: FunnelAxisOptions, isHidingPercentBars: boolean): void;
7616 static drawDefaultShapes(data: FunnelData, dataPoints: FunnelDataPoint[], graphicsContext: D3.Selection, layout: IFunnelLayout, hasSelection: boolean): D3.UpdateSelection;
7617 static getValueFromDataPoint(dataPoint: FunnelDataPoint, asOriginal?: boolean): number;
7618 static drawInteractorShapes(dataPoints: FunnelDataPoint[], graphicsContext: D3.Selection, layout: IFunnelLayout): D3.UpdateSelection;
7619 private static drawPercentBarComponents(graphicsContext, data, layout, percentLabelSettings);
7620 static drawPercentBars(data: FunnelData, graphicsContext: D3.Selection, layout: IFunnelLayout, isHidingPercentBars: boolean): void;
7621 private showCategoryLabels();
7622 private static addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, percentOfFirst?, percentOfPrevious?, highlight?);
7623 private static getTextProperties(fontSize?);
7624 private static getDefaultLabelSettings();
7625 private static getDefaultPercentLabelSettings();
7626 /**
7627 * Creates labels layout.
7628 */
7629 private getLabels(layout);
7630 /**
7631 * Creates labelDataPoints for rendering labels
7632 */
7633 private createLabelDataPoints(shapeLayout, visualSettings);
7634 }
7635}
7636
7637declare module powerbi.visuals {
7638 interface GaugeData extends TooltipEnabledDataPoint {
7639 total: number;
7640 metadataColumn: DataViewMetadataColumn;
7641 minColumnMetadata: DataViewMetadataColumn;
7642 maxColumnMetadata: DataViewMetadataColumn;
7643 targetColumnMetadata: DataViewMetadataColumn;
7644 targetSettings: GaugeTargetSettings;
7645 dataLabelsSettings: VisualDataLabelsSettings;
7646 calloutValueLabelsSettings: VisualDataLabelsSettings;
7647 dataPointSettings: GaugeDataPointSettings;
7648 }
7649 interface GaugeTargetSettings {
7650 min: number;
7651 max: number;
7652 target: number;
7653 }
7654 interface GaugeTargetData extends GaugeTargetSettings {
7655 value: number;
7656 tooltipItems: TooltipDataItem[];
7657 }
7658 interface GaugeDataPointSettings {
7659 fillColor: string;
7660 targetColor: string;
7661 }
7662 interface GaugeSmallViewPortProperties {
7663 hideGaugeSideNumbersOnSmallViewPort: boolean;
7664 smallGaugeMarginsOnSmallViewPort: boolean;
7665 MinHeightGaugeSideNumbersVisible: number;
7666 GaugeMarginsOnSmallViewPort: number;
7667 }
7668 interface GaugeVisualProperties {
7669 radius: number;
7670 innerRadiusOfArc: number;
7671 innerRadiusFactor: number;
7672 left: number;
7673 top: number;
7674 height: number;
7675 width: number;
7676 margin: IMargin;
7677 transformString: string;
7678 }
7679 interface AnimatedNumberProperties {
7680 transformString: string;
7681 viewport: IViewport;
7682 }
7683 interface GaugeConstructorOptions {
7684 gaugeSmallViewPortProperties?: GaugeSmallViewPortProperties;
7685 animator?: IGenericAnimator;
7686 tooltipsEnabled?: boolean;
7687 tooltipBucketEnabled?: boolean;
7688 }
7689 interface GaugeDataViewObjects extends DataViewObjects {
7690 axis: GaugeDataViewObject;
7691 }
7692 interface GaugeDataViewObject extends DataViewObject {
7693 min?: number;
7694 max?: number;
7695 target?: number;
7696 }
7697 /**
7698 * Renders a number that can be animate change in value.
7699 */
7700 class Gauge implements IVisual {
7701 private static MinDistanceFromBottom;
7702 private static MinWidthForTargetLabel;
7703 private static DefaultTopBottomMargin;
7704 private static DefaultLeftRightMargin;
7705 private static ReducedLeftRightMargin;
7706 private static DEFAULT_MAX;
7707 private static DEFAULT_MIN;
7708 private static VisualClassName;
7709 private static DefaultStyleProperties;
7710 private static DefaultTargetSettings;
7711 private static DefaultDataPointSettings;
7712 private static InnerRadiusFactor;
7713 private static KpiBandDistanceFromMainArc;
7714 private static MainGaugeGroupClassName;
7715 private static LabelText;
7716 private static TargetConnector;
7717 private static TargetText;
7718 /** Note: Public for testability */
7719 static formatStringProp: DataViewObjectPropertyIdentifier;
7720 private svg;
7721 private mainGraphicsContext;
7722 private currentViewport;
7723 private element;
7724 private style;
7725 private data;
7726 private color;
7727 private backgroundArc;
7728 private foregroundArc;
7729 private kpiArcs;
7730 private kpiArcPaths;
7731 private foregroundArcPath;
7732 private backgroundArcPath;
7733 private targetLine;
7734 private targetConnector;
7735 private targetText;
7736 private options;
7737 private lastAngle;
7738 private margin;
7739 private animatedNumberGrapicsContext;
7740 private animatedNumber;
7741 private settings;
7742 private targetSettings;
7743 private gaugeVisualProperties;
7744 private gaugeSmallViewPortProperties;
7745 private showTargetLabel;
7746 private tooltipsEnabled;
7747 private tooltipBucketEnabled;
7748 private hostService;
7749 private dataView;
7750 animator: IGenericAnimator;
7751 constructor(options?: GaugeConstructorOptions);
7752 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
7753 private getDataLabelSettingsOptions(enumeration, labelSettings);
7754 private enumerateAxis(enumeration);
7755 private enumerateDataPoint(enumeration);
7756 private static getGaugeObjectsProperties(dataView);
7757 init(options: VisualInitOptions): void;
7758 update(options: VisualUpdateOptions): void;
7759 private updateCalloutValue(suppressAnimations);
7760 onDataChanged(options: VisualDataChangedOptions): void;
7761 onResizing(viewport: IViewport): void;
7762 /**
7763 * Populates Gauge data based on roles or axis settings.
7764 */
7765 private static parseGaugeData(reader, tooltipBucketEnabled?);
7766 /** Note: Made public for testability */
7767 static converter(reader: data.IDataViewCategoricalReader, tooltipBucketEnabled?: boolean): GaugeData;
7768 private static convertDataLabelSettings(objects, objectName);
7769 private static convertDataPointSettings(objects, targetSettings);
7770 private initKpiBands();
7771 /**
7772 * Indicates whether gauge arc is valid.
7773 */
7774 private isValid();
7775 private updateKpiBands(radius, innerRadiusFactor, tString, kpiAngleAttr);
7776 private removeTargetElements();
7777 private getTargetRatio();
7778 private updateTargetLine(radius, innerRadius, left, top);
7779 /** Note: public for testability */
7780 getAnimatedNumberProperties(radius: number, innerRadiusFactor: number, top: number, left: number): AnimatedNumberProperties;
7781 /** Note: public for testability */
7782 getGaugeVisualProperties(): GaugeVisualProperties;
7783 /** Note: public for testability */
7784 drawViewPort(drawOptions: GaugeVisualProperties): void;
7785 getValueAngle(): number;
7786 private createTicks();
7787 private updateInternal(suppressAnimations);
7788 private updateVisualStyles();
7789 private updateVisualConfigurations();
7790 private renderMinMaxLabels(ticks, radius, height, width, margin);
7791 private truncateTextIfNeeded(text, positionX, onRight);
7792 private getFormatter(dataLabelSettings, metadataColumn, maxValue?);
7793 private renderTarget(radius, height, width, margin);
7794 private arcTween(transition, arr);
7795 private showMinMaxLabelsOnBottom();
7796 private setMargins();
7797 private showSideNumbersLabelText();
7798 }
7799}
7800
7801declare module powerbi.visuals {
7802 interface ImageDataViewObjects extends DataViewObjects {
7803 general: ImageDataViewObject;
7804 imageScaling: ImageScalingDataViewObject;
7805 }
7806 interface ImageDataViewObject extends DataViewObject {
7807 imageUrl: string;
7808 }
7809 interface ImageScalingDataViewObject extends DataViewObject {
7810 imageScalingType: string;
7811 }
7812 class ImageVisual implements IVisual {
7813 private element;
7814 private imageBackgroundElement;
7815 private scalingType;
7816 init(options: VisualInitOptions): void;
7817 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
7818 private enumerateImageScaling();
7819 update(options: VisualUpdateOptions): void;
7820 }
7821}
7822
7823declare module powerbi.visuals {
7824 interface KPIStatusWithHistoryData {
7825 dataPoints: KPIStatusWithHistoryDataPoint[];
7826 directionType: string;
7827 goals: number[];
7828 formattedGoalString: string;
7829 actual: number;
7830 targetExists: boolean;
7831 historyExists: boolean;
7832 indicatorExists: boolean;
7833 trendExists: boolean;
7834 formattedValue: string;
7835 showGoal: boolean;
7836 showDistanceFromGoal: boolean;
7837 showTrendLine: boolean;
7838 }
7839 interface KPIStatusWithHistoryDataPoint {
7840 x: number;
7841 y: number;
7842 actual: number;
7843 goals: number[];
7844 }
7845 class KPIStatusWithHistory implements IVisual {
7846 static directionTypeStringProp: DataViewObjectPropertyIdentifier;
7847 static showKPIGoal: DataViewObjectPropertyIdentifier;
7848 static showKPIDistance: DataViewObjectPropertyIdentifier;
7849 static showKPITrendLine: DataViewObjectPropertyIdentifier;
7850 static indicatorDisplayUnitsProp: DataViewObjectPropertyIdentifier;
7851 static indicatorPrecisionProp: DataViewObjectPropertyIdentifier;
7852 static status: {
7853 INCREASE: string;
7854 DROP: string;
7855 IN_BETWEEN: string;
7856 NOGOAL: string;
7857 };
7858 static statusBandingType: {
7859 Below: string;
7860 Above: string;
7861 };
7862 static actualTextConsts: {
7863 VERTICAL_OFFSET_FROM_HALF_HEIGHT: number;
7864 FONT_WIDTH_FACTOR: number;
7865 RIGHT_MARGIN: number;
7866 };
7867 static kpiRedClass: string;
7868 static kpiYellowClass: string;
7869 static kpiGreenClass: string;
7870 static kpiTextGreyClass: string;
7871 static kpiGraphGreyClass: string;
7872 static allColorClasses: string;
7873 static trendAreaFilePercentage: number;
7874 static estimatedIconHeightInPx: number;
7875 static indicatorTextSizeInPx: number;
7876 private svg;
7877 private dataView;
7878 private mainGroupElement;
7879 private kpiActualText;
7880 private absoluteGoalDistanceText;
7881 private areaFill;
7882 private host;
7883 private exclamationMarkIcon;
7884 private successMarkIcon;
7885 private betweenIcon;
7886 private rootElement;
7887 private indicatorTextContainer;
7888 private textContainer;
7889 private static getLocalizedString;
7890 private static defaultCardFormatSetting;
7891 private static defaultLabelSettings;
7892 init(options: VisualInitOptions): void;
7893 update(options: VisualUpdateOptions): void;
7894 private initIcons();
7895 private render(kpiViewModel, viewport);
7896 private setShowDataMissingWarning(show);
7897 private static getDefaultFormatSettings();
7898 private static getFormatString(column);
7899 private static getProp_Show_KPIGoal(dataView);
7900 private static getProp_Show_KPITrendLine(dataView);
7901 private static getProp_Show_KPIDistance(dataView);
7902 private static getProp_KPIDirection(dataView);
7903 private static getProp_Indicator_DisplayUnits(dataView);
7904 private static getProp_Indicator_Precision(dataView);
7905 private static initDefaultLabelSettings();
7906 private static getFormattedValue(metaDataColumn, theValue, precision, displayUnits, displayUnitSystemType?);
7907 private static getFormattedGoalString(metaDataColumn, goals, precision, displayUnits);
7908 static converter(dataView: DataView, viewPort: powerbi.IViewport, directionType: string): KPIStatusWithHistoryData;
7909 static getColumnsByRole(values: DataViewValueColumns, roleString: string): DataViewValueColumn[];
7910 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
7911 destroy(): void;
7912 }
7913}
7914
7915declare module powerbi.visuals {
7916 interface LineChartConstructorOptions extends CartesianVisualConstructorOptions {
7917 chartType?: LineChartType;
7918 tooltipBucketEnabled?: boolean;
7919 advancedLineLabelsEnabled?: boolean;
7920 }
7921 interface LineChartDataLabelsSettings extends PointDataLabelsSettings {
7922 labelDensity: string;
7923 }
7924 interface ILineChartConfiguration {
7925 xAxisProperties: IAxisProperties;
7926 yAxisProperties: IAxisProperties;
7927 margin: any;
7928 }
7929 interface LineChartCategoriesData extends LineChartDataPoint {
7930 }
7931 interface LineChartData extends CartesianData {
7932 series: LineChartSeries[];
7933 isScalar?: boolean;
7934 scalarMetadata?: DataViewMetadataColumn;
7935 scalarKeyCount?: number;
7936 dataLabelsSettings: LineChartDataLabelsSettings;
7937 axesLabels: ChartAxesLabels;
7938 hasDynamicSeries?: boolean;
7939 defaultSeriesColor?: string;
7940 categoryData?: LineChartCategoriesData[];
7941 seriesDisplayName?: string;
7942 hasValues?: boolean;
7943 }
7944 interface LineChartSeries extends CartesianSeries, SelectableDataPoint {
7945 displayName: string;
7946 dynamicDisplayName?: string;
7947 key: string;
7948 lineIndex: number;
7949 color: string;
7950 xCol: DataViewMetadataColumn;
7951 yCol: DataViewMetadataColumn;
7952 data: LineChartDataPoint[];
7953 labelSettings: LineChartDataLabelsSettings;
7954 }
7955 interface LineChartDataPoint extends CartesianDataPoint, TooltipEnabledDataPoint, SelectableDataPoint, LabelEnabledDataPoint {
7956 value: number;
7957 categoryIndex: number;
7958 seriesIndex: number;
7959 key: string;
7960 labelSettings: LineChartDataLabelsSettings;
7961 pointColor?: string;
7962 stackedValue?: number;
7963 extraTooltipInfo?: TooltipDataItem[];
7964 }
7965 interface HoverLineDataPoint {
7966 color: string;
7967 seriesDisplayName?: string;
7968 seriesName?: string;
7969 category: string;
7970 measureDisplayName: string;
7971 measure: any;
7972 value: number;
7973 stackedValue: number;
7974 extraTooltipInfo: TooltipDataItem[];
7975 }
7976 const enum LineChartType {
7977 default = 1,
7978 area = 2,
7979 smooth = 4,
7980 lineShadow = 8,
7981 stackedArea = 16,
7982 }
7983 /**
7984 * Renders a data series as a line visual.
7985 */
7986 class LineChart implements ICartesianVisual {
7987 private static ClassName;
7988 private static MainGraphicsContextClassName;
7989 private static CategorySelector;
7990 private static CategoryValuePoint;
7991 private static CategoryPointSelector;
7992 private static CategoryAreaSelector;
7993 private static HoverLineCircleDot;
7994 private static LineClassSelector;
7995 private static PointRadius;
7996 private static CircleRadius;
7997 private static PathElementName;
7998 private static CircleElementName;
7999 private static CircleClassName;
8000 private static LineElementName;
8001 private static RectOverlayName;
8002 private static ScalarOuterPadding;
8003 private static interactivityStrokeWidth;
8004 private static minimumLabelsToRender;
8005 static AreaFillOpacity: number;
8006 static DimmedAreaFillOpacity: number;
8007 private isInteractiveChart;
8008 private isScrollable;
8009 private tooltipsEnabled;
8010 private lineClassAndSelector;
8011 private element;
8012 private cartesainSVG;
8013 private mainGraphicsContext;
8014 private mainGraphicsSVG;
8015 private hoverLineContext;
8016 private options;
8017 private dataViewCat;
8018 private colors;
8019 private host;
8020 private data;
8021 private clippedData;
8022 private lineType;
8023 private cartesianVisualHost;
8024 private xAxisProperties;
8025 private yAxisProperties;
8026 private margin;
8027 private currentViewport;
8028 private selectionCircles;
8029 private dragHandle;
8030 private hoverLine;
8031 private lastInteractiveSelectedColumnIndex;
8032 private scaleDetector;
8033 private interactivityService;
8034 private animator;
8035 private previousCategoryCount;
8036 private pathXAdjustment;
8037 private tooltipBucketEnabled;
8038 private advancedLineLabelsEnabled;
8039 private static validStackedLabelPositions;
8040 private overlayRect;
8041 private isComboChart;
8042 private lastDragMoveXPosition;
8043 private deferDragMoveOperation;
8044 static customizeQuery(options: CustomizeQueryOptions): void;
8045 static getSortableRoles(options: VisualSortableOptions): string[];
8046 static converter(dataView: DataView, blankCategoryValue: string, colors: IDataColorPalette, isScalar: boolean, interactivityService?: IInteractivityService, shouldCalculateStacked?: boolean, isComboChart?: boolean, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): LineChartData;
8047 static getInteractiveLineChartDomElement(element: JQuery): HTMLElement;
8048 private static getColor(colorHelper, hasDynamicSeries, values, grouped, seriesIndex, groupedIdentity);
8049 private static createStackedValueDomain(data);
8050 constructor(options: LineChartConstructorOptions);
8051 init(options: CartesianVisualInitOptions): void;
8052 setData(dataViews: DataView[]): void;
8053 calculateLegend(): LegendData;
8054 hasLegend(): boolean;
8055 setFilteredData(startIndex: number, endIndex: number): CartesianData;
8056 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
8057 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
8058 private enumerateDataPoints(enumeration);
8059 private enumerateDataLabels(enumeration);
8060 supportsTrendLine(): boolean;
8061 private showLabelPerSeries();
8062 private getLabelSettingsOptions(enumeration, labelSettings, series?, showAll?);
8063 overrideXScale(xProperties: IAxisProperties): void;
8064 onClearSelection(): void;
8065 render(suppressAnimations: boolean): CartesianVisualRenderResult;
8066 private renderNew(duration);
8067 private renderOld(duration);
8068 /**
8069 * Note: Public for tests.
8070 */
8071 getSeriesTooltipInfo(pointData: HoverLineDataPoint[]): TooltipDataItem[];
8072 /**
8073 * Note: Public for tests.
8074 */
8075 getTooltipInfoForCombo(tooltipEvent: TooltipEvent, pointX: number): TooltipDataItem[];
8076 /**
8077 * Note: Public for tests.
8078 */
8079 getCategoryIndexFromTooltipEvent(tooltipEvent: TooltipEvent, pointX: number): number;
8080 getVisualCategoryAxisIsScalar(): boolean;
8081 getSupportedCategoryAxisType(): string;
8082 getPreferredPlotArea(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
8083 private getCategoryCount(origCatgSize);
8084 private getAvailableWidth();
8085 private getAvailableHeight();
8086 private static sliceSeries(series, newLength, startIndex?);
8087 private static getScalarKeys(dataViewCategoryColumn);
8088 private getXOfFirstCategory();
8089 private hasDataPoint(series);
8090 private getXValue(d);
8091 /**
8092 * This checks to see if a data point is isolated, which means
8093 * the previous and next data point are both null.
8094 */
8095 private shouldDrawCircle(d, i);
8096 selectColumnForTooltip(columnIndex: number, force?: boolean): HoverLineDataPoint[];
8097 private setHoverLineForTooltip(chartX);
8098 private setDotsForTooltip(chartX, dataPoints);
8099 /**
8100 * Updates the hover line and the legend with the selected colums (given by columnIndex).
8101 * This is for the Mobile renderer with InteractiveLegend
8102 */
8103 selectColumn(columnIndex: number, force?: boolean): void;
8104 private setHoverLine(chartX, columnIndex);
8105 private getChartX(columnIndex);
8106 /**
8107 * Finds the index of the category of the given x coordinate given.
8108 * pointX is in non-scaled screen-space, and offsetX is in render-space.
8109 * offsetX does not need any scaling adjustment.
8110 * @param {number} pointX The mouse coordinate in screen-space, without scaling applied
8111 * @param {number} offsetX Any left offset in d3.scale render-space
8112 * @return {number}
8113 */
8114 private findIndex(pointX, offsetX?);
8115 private getPosition(x, pathElement);
8116 private createTooltipDataPoints(columnIndex);
8117 private createLegendDataPoints(columnIndex);
8118 private createLabelDataPoints();
8119 private static getNumberOfLabelsToRender(viewPortWidth, labelDensity);
8120 /**
8121 * Adjust a mouse coordinate originating from a path; used to fix
8122 * an inconsistency between Internet Explorer and other browsers.
8123 *
8124 * Internet explorer places the origin for the coordinate system of
8125 * mouse events based on the stroke, so that the very edge of the stroke
8126 * is zero. Chrome places the 0 on the edge of the path so that the
8127 * edge of the stroke is -(strokeWidth / 2). We adjust coordinates
8128 * to match Chrome.
8129 *
8130 * @param value The x coordinate to be adjusted
8131 */
8132 private adjustPathXCoordinate(x);
8133 /**
8134 * Obtains the pointLabelPosition for the category index within the given series
8135 *
8136 * Rules for line chart data labels:
8137 * 1. Top and bottom > left and right
8138 * 2. Top > bottom unless we're at a local minimum
8139 * 3. Right > left unless:
8140 * a. There is no data point to the left and there is one to the right
8141 * b. There is an equal data point to the right, but not to the left
8142 */
8143 private getValidLabelPositions(series, categoryIndex);
8144 }
8145}
8146
8147declare module powerbi.visuals {
8148 interface MapConstructionOptions {
8149 filledMap?: boolean;
8150 geocoder?: IGeocoder;
8151 mapControlFactory?: IMapControlFactory;
8152 behavior?: MapBehavior;
8153 tooltipsEnabled?: boolean;
8154 tooltipBucketEnabled?: boolean;
8155 filledMapDataLabelsEnabled?: boolean;
8156 disableZooming?: boolean;
8157 disablePanning?: boolean;
8158 isLegendScrollable?: boolean;
8159 viewChangeThrottleInterval?: number;
8160 enableCurrentLocation?: boolean;
8161 }
8162 interface IMapControlFactory {
8163 createMapControl(element: HTMLElement, options?: Microsoft.Maps.MapOptions): Microsoft.Maps.Map;
8164 ensureMap(locale: string, action: () => void): void;
8165 }
8166 interface MapData {
8167 dataPoints: MapDataPoint[];
8168 geocodingCategory: string;
8169 hasDynamicSeries: boolean;
8170 hasSize: boolean;
8171 }
8172 /**
8173 * The main map data point, which exists for each category
8174 */
8175 interface MapDataPoint {
8176 geocodingQuery: string;
8177 value: number;
8178 categoryValue: string;
8179 subDataPoints: MapSubDataPoint[];
8180 location?: IGeocodeCoordinate;
8181 paths?: IGeocodeBoundaryPolygon[];
8182 radius?: number;
8183 }
8184 /**
8185 * SubDataPoint that carries series-based data. For category only maps
8186 * there will only be one of these on each MapDataPoint; for dynamic series,
8187 * there will be one per series for each MapDataPoint.
8188 */
8189 interface MapSubDataPoint {
8190 value: number;
8191 fill: string;
8192 stroke: string;
8193 identity: SelectionId;
8194 tooltipInfo: TooltipDataItem[];
8195 }
8196 interface MapRendererData {
8197 bubbleData?: MapBubble[];
8198 sliceData?: MapSlice[][];
8199 shapeData?: MapShape[];
8200 }
8201 interface MapVisualDataPoint extends TooltipEnabledDataPoint, SelectableDataPoint {
8202 x: number;
8203 y: number;
8204 radius: number;
8205 fill: string;
8206 stroke: string;
8207 strokeWidth: number;
8208 labeltext: string;
8209 labelFill: string;
8210 }
8211 interface MapBubble extends MapVisualDataPoint {
8212 }
8213 interface MapSlice extends MapVisualDataPoint {
8214 value: number;
8215 startAngle?: number;
8216 endAngle?: number;
8217 }
8218 interface MapShape extends TooltipEnabledDataPoint, SelectableDataPoint {
8219 absolutePointArray: Float64Array;
8220 path: string;
8221 fill: string;
8222 stroke: string;
8223 strokeWidth: number;
8224 key: string;
8225 labeltext: string;
8226 displayLabel: boolean;
8227 catagoryLabeltext?: string;
8228 labelFormatString: string;
8229 }
8230 /**
8231 * Used because data points used in D3 pie layouts are placed within a container with pie information.
8232 */
8233 interface MapSliceContainer {
8234 data: MapSlice;
8235 }
8236 /** Note: public for UnitTest */
8237 interface IMapDataPointRenderer {
8238 init(mapControl: Microsoft.Maps.Map, mapDiv: JQuery, addClearCatcher: boolean): void;
8239 setData(data: MapData): void;
8240 getDataPointCount(): number;
8241 converter(viewPort: IViewport, dataView: DataView, labelSettings: PointDataLabelsSettings, interactivityService: IInteractivityService, tooltipsEnabled: boolean): MapRendererData;
8242 updateInternal(data: MapRendererData, viewport: IViewport, dataChanged: boolean, interactivityService: IInteractivityService, redrawDataLabels: boolean): MapBehaviorOptions;
8243 updateInternalDataLabels(viewport: IViewport, redrawDataLabels: boolean): void;
8244 getDataPointPadding(): number;
8245 clearDataPoints(): void;
8246 }
8247 interface DataViewMetadataAutoGeneratedColumn extends DataViewMetadataColumn {
8248 /**
8249 * Indicates that the column was added manually.
8250 */
8251 isAutoGeneratedColumn?: boolean;
8252 }
8253 const MaxLevelOfDetail: number;
8254 const MinLevelOfDetail: number;
8255 const DefaultFillOpacity: number;
8256 const DefaultBackgroundColor: string;
8257 const LeaderLineColor: string;
8258 class MapBubbleDataPointRenderer implements IMapDataPointRenderer {
8259 private mapControl;
8260 private mapData;
8261 private maxDataPointRadius;
8262 private svg;
8263 private clearSvg;
8264 private clearCatcher;
8265 private bubbleGraphicsContext;
8266 private sliceGraphicsContext;
8267 private labelGraphicsContext;
8268 private labelBackgroundGraphicsContext;
8269 private sliceLayout;
8270 private arc;
8271 private dataLabelsSettings;
8272 private tooltipsEnabled;
8273 private static validLabelPositions;
8274 private mapRendererData;
8275 private root;
8276 constructor(tooltipsEnabled: boolean);
8277 init(mapControl: Microsoft.Maps.Map, mapDiv: JQuery, addClearCatcher: boolean): void;
8278 setData(data: MapData): void;
8279 clearDataPoints(): void;
8280 getDataPointCount(): number;
8281 getDataPointPadding(): number;
8282 private clearMaxDataPointRadius();
8283 private setMaxDataPointRadius(dataPointRadius);
8284 getDefaultMap(geocodingCategory: string, dataPointCount: number): void;
8285 converter(viewport: IViewport, dataView: DataView, labelSettings: PointDataLabelsSettings, interactivityService: IInteractivityService, tooltipsEnabled?: boolean): MapRendererData;
8286 updateInternal(data: MapRendererData, viewport: IViewport, dataChanged: boolean, interactivityService: IInteractivityService, redrawDataLabels: boolean): MapBehaviorOptions;
8287 updateInternalDataLabels(viewport: IViewport, redrawDataLabels: boolean): void;
8288 private createLabelDataPoints();
8289 }
8290 interface FilledMapParams {
8291 level: number;
8292 maxPolygons: number;
8293 strokeWidth: number;
8294 }
8295 class MapShapeDataPointRenderer implements IMapDataPointRenderer {
8296 private mapControl;
8297 private svg;
8298 private clearSvg;
8299 private clearCatcher;
8300 private polygonInfo;
8301 private mapData;
8302 private shapeGraphicsContext;
8303 private labelGraphicsContext;
8304 private labelBackgroundGraphicsContext;
8305 private maxShapeDimension;
8306 private mapRendererData;
8307 private dataLabelsSettings;
8308 private filledMapDataLabelsEnabled;
8309 private tooltipsEnabled;
8310 private labelLayout;
8311 private static validLabelPolygonPositions;
8312 private root;
8313 static getFilledMapParams(category: string, dataCount: number): FilledMapParams;
8314 static buildPaths(locations: IGeocodeBoundaryPolygon[]): IGeocodeBoundaryPolygon[];
8315 constructor(fillMapDataLabelsEnabled: boolean, tooltipsEnabled: boolean);
8316 init(mapControl: Microsoft.Maps.Map, mapDiv: JQuery, addClearCatcher: boolean): void;
8317 setData(data: MapData): void;
8318 clearDataPoints(): void;
8319 getDataPointCount(): number;
8320 converter(viewport: IViewport, dataView: DataView, labelSettings: PointDataLabelsSettings, interactivityService?: IInteractivityService): MapRendererData;
8321 updateInternal(data: MapRendererData, viewport: IViewport, dataChanged: boolean, interactivityService: IInteractivityService, redrawDataLabels: boolean): MapBehaviorOptions;
8322 getDataPointPadding(): number;
8323 static getIndexOfLargestShape(paths: IGeocodeBoundaryPolygon[]): number;
8324 updateInternalDataLabels(viewport: IViewport, redrawDataLabels: boolean): void;
8325 private clearMaxShapeDimension();
8326 private setMaxShapeDimension(width, height);
8327 private createLabelDataPoints();
8328 private drawLabelStems(labelsContext, dataLabels, showText, showCategory);
8329 }
8330 /** Note: public for UnitTest */
8331 interface SimpleRange {
8332 min: number;
8333 max: number;
8334 }
8335 class Map implements IVisual {
8336 currentViewport: IViewport;
8337 private pendingGeocodingRender;
8338 private mapControl;
8339 private minLongitude;
8340 private maxLongitude;
8341 private minLatitude;
8342 private maxLatitude;
8343 private style;
8344 private colors;
8345 private dataPointRenderer;
8346 private geocodingCategory;
8347 private legend;
8348 private legendHeight;
8349 private legendData;
8350 private element;
8351 private dataView;
8352 private dataLabelsSettings;
8353 private static MapContainer;
8354 static StrokeDarkenColorValue: number;
8355 static ScheduleRedrawInterval: number;
8356 private interactivityService;
8357 private behavior;
8358 private defaultDataPointColor;
8359 private showAllDataPoints;
8360 private dataPointsToEnumerate;
8361 private hasDynamicSeries;
8362 private geoTaggingAnalyzerService;
8363 private isFilledMap;
8364 private host;
8365 private geocoder;
8366 private promiseFactory;
8367 private mapControlFactory;
8368 private tooltipsEnabled;
8369 private tooltipBucketEnabled;
8370 private filledMapDataLabelsEnabled;
8371 private disableZooming;
8372 private disablePanning;
8373 private locale;
8374 private isLegendScrollable;
8375 private viewChangeThrottleInterval;
8376 private root;
8377 private enableCurrentLocation;
8378 private isCurrentLocation;
8379 private boundsHaveBeenUpdated;
8380 private geocodingContext;
8381 private isDestroyed;
8382 constructor(options: MapConstructionOptions);
8383 init(options: VisualInitOptions): void;
8384 destroy(): void;
8385 private createCurrentLocation(element);
8386 private addDataPoint(dataPoint);
8387 private scheduleRedraw();
8388 private enqueueGeoCode(dataPoint);
8389 private completeGeoCode(dataPoint, location);
8390 private enqueueGeoCodeAndGeoShape(dataPoint, params);
8391 private completeGeoCodeAndGeoShape(dataPoint, params, location);
8392 private enqueueGeoShape(dataPoint, params);
8393 private completeGeoShape(dataPoint, params, result);
8394 private getOptimumLevelOfDetail(width, height);
8395 private getViewCenter(levelOfDetail);
8396 private resetBounds();
8397 private updateBounds(latitude, longitude);
8398 static legendObject(dataView: DataView): DataViewObject;
8399 static isLegendHidden(dataView: DataView): boolean;
8400 static legendPosition(dataView: DataView): LegendPosition;
8401 static getLegendFontSize(dataView: DataView): number;
8402 static isShowLegendTitle(dataView: DataView): boolean;
8403 private legendTitle();
8404 private renderLegend(legendData);
8405 /** Note: public for UnitTest */
8406 static calculateGroupSizes(categorical: DataViewCategorical, grouped: DataViewValueColumnGroup[], groupSizeTotals: number[], sizeMeasureIndex: number, currentValueScale: SimpleRange): SimpleRange;
8407 /** Note: public for UnitTest */
8408 static calculateRadius(range: SimpleRange, value?: number): number;
8409 /** Note: public for UnitTest */
8410 static getGeocodingCategory(categorical: DataViewCategorical, geoTaggingAnalyzerService: IGeoTaggingAnalyzerService): string;
8411 /** Note: public for UnitTest */
8412 static hasSizeField(values: DataViewValueColumns, defaultIndexIfNoRole?: number): boolean;
8413 static shouldEnumerateDataPoints(dataView: DataView, usesSizeForGradient: boolean): boolean;
8414 static shouldEnumerateCategoryLabels(isFilledMap: boolean, filledMapDataLabelsEnabled: boolean): boolean;
8415 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
8416 static enumerateDataPoints(enumeration: ObjectEnumerationBuilder, dataPoints: LegendDataPoint[], colors: IDataColorPalette, hasDynamicSeries: boolean, defaultDataPointColor: string, showAllDataPoints: boolean, bubbleData: MapBubble[]): void;
8417 static enumerateLegend(enumeration: ObjectEnumerationBuilder, dataView: DataView, legend: ILegend, legendTitle: string): void;
8418 onDataChanged(options: VisualDataChangedOptions): void;
8419 static converter(dataView: DataView, colorHelper: ColorHelper, geoTaggingAnalyzerService: IGeoTaggingAnalyzerService, isFilledMap: boolean, tooltipBucketEnabled?: boolean): MapData;
8420 static createLegendData(dataView: DataView, colorHelper: ColorHelper): LegendData;
8421 private swapLogoContainerChildElement();
8422 onResizing(viewport: IViewport): void;
8423 private initialize(container);
8424 private onViewChanged();
8425 private onViewChangeEnded();
8426 private getMapViewPort();
8427 static removeTransform3d(mapRoot: JQuery): void;
8428 private updateInternal(dataChanged, redrawDataLabels);
8429 private updateMapView(center, levelOfDetail);
8430 private updateOffsets(dataChanged, redrawDataLabels);
8431 onClearSelection(): void;
8432 private clearDataPoints();
8433 private getDefaultMapControlFactory();
8434 private static removeHillShading();
8435 }
8436}
8437
8438declare module powerbi.visuals {
8439 interface CardItemData {
8440 caption: string;
8441 details: string;
8442 showURL: boolean;
8443 showImage: boolean;
8444 showKPI: boolean;
8445 columnIndex: number;
8446 }
8447 interface CardSettings {
8448 outlineSettings: OutlineSettings;
8449 barSettings: OutlineSettings;
8450 cardPadding: number;
8451 cardBackground: string;
8452 }
8453 interface OutlineSettings {
8454 outline: string;
8455 color: string;
8456 weight: number;
8457 }
8458 interface MultiRowCardData {
8459 dataModel: CardData[];
8460 dataColumnCount: number;
8461 cardTitleSettings: VisualDataLabelsSettings;
8462 dataLabelsSettings: VisualDataLabelsSettings;
8463 categoryLabelsSettings: VisualDataLabelsSettings;
8464 cardSettings: CardSettings;
8465 }
8466 interface CardData {
8467 title?: string;
8468 showTitleAsURL?: boolean;
8469 showTitleAsImage?: boolean;
8470 showTitleAsKPI?: boolean;
8471 cardItemsData: CardItemData[];
8472 }
8473 class MultiRowCard implements IVisual {
8474 private currentViewport;
8475 private options;
8476 private dataView;
8477 private style;
8478 private element;
8479 private listView;
8480 /**
8481 * This includes card height with margin that will be passed to list view.
8482 */
8483 private interactivity;
8484 private isInteractivityOverflowHidden;
8485 private waitingForData;
8486 private cardHasTitle;
8487 private isSingleRowCard;
8488 private maxColPerRow;
8489 private data;
8490 /**
8491 * Note: Public for testability.
8492 */
8493 static formatStringProp: DataViewObjectPropertyIdentifier;
8494 private static MultiRowCardRoot;
8495 private static Card;
8496 private static Title;
8497 private static CardItemContainer;
8498 private static Caption;
8499 private static Details;
8500 private static TitleUrlSelector;
8501 private static CaptionUrlSelector;
8502 private static TitleImageSelector;
8503 private static CaptionImageSelector;
8504 private static KPITitle;
8505 private static ValuesRole;
8506 /**
8507 * Cards have specific styling so defined inline styles and also to support theming and improve performance.
8508 */
8509 private static DefaultStyle;
8510 private static tileMediaQueries;
8511 init(options: VisualInitOptions): void;
8512 onDataChanged(options: VisualDataChangedOptions): void;
8513 private static getCardSettings(dataView);
8514 onResizing(viewport: IViewport): void;
8515 static converter(dataView: DataView, columnCount: number, maxCards: number, isDashboardVisual?: boolean): MultiRowCardData;
8516 static getSortableRoles(options: VisualSortableOptions): string[];
8517 private initializeCardRowSelection();
8518 private getBorderStyles(border, padding?);
8519 private getMaxColPerRow();
8520 private getRowIndex(fieldIndex);
8521 private getStyle();
8522 private getSurroundSettings(outlineSettings);
8523 private getCustomStyles();
8524 private static getTextProperties(isTitle, fontSizeInPt);
8525 private getColumnWidth(fieldIndex, columnCount);
8526 private isLastRowItem(fieldIndex, columnCount);
8527 private isInFirstRow(fieldIndex);
8528 /**
8529 * This contains the card column wrapping logic.
8530 * Determines how many columns can be shown per each row inside a Card.
8531 * To place the fields evenly along the card,
8532 * the width of each card item is calculated based on the available viewport width.
8533 */
8534 private setCardDimensions();
8535 private onLoadMoreData();
8536 private static getDataLabelSettingsOptions(enumeration, labelSettings, show?);
8537 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
8538 private enumerateCard(enumeration);
8539 }
8540}
8541
8542declare module powerbi.visuals {
8543 interface TextboxDataViewObjects extends DataViewObjects {
8544 general: TextboxDataViewObject;
8545 }
8546 interface TextboxDataViewObject extends DataViewObject {
8547 paragraphs: Paragraphs;
8548 }
8549 /** Represents a rich text box that supports view & edit mode. */
8550 class Textbox implements IVisual {
8551 private static ClassName;
8552 private editor;
8553 private element;
8554 private host;
8555 private viewport;
8556 private readOnly;
8557 private paragraphs;
8558 init(options: VisualInitOptions): void;
8559 onResizing(viewport: IViewport): void;
8560 onDataChanged(options: VisualDataChangedOptions): void;
8561 destroy(): void;
8562 focus(): boolean;
8563 onViewModeChanged(viewMode: ViewMode): void;
8564 setSelection(start: number, end: number): void;
8565 private refreshView();
8566 private saveContents();
8567 private updateSize();
8568 }
8569 module RichText {
8570 let defaultFont: string;
8571 const defaultFontSize: string;
8572 /**
8573 * Given a font family returns the value we should use for the font-family css property.
8574 */
8575 function getCssFontFamily(font: string): string;
8576 /**
8577 * Convert built-in font families back into their proper font families (e.g. wf_segoe-ui_normal -> Segoe UI)
8578 */
8579 function getFontFamilyForBuiltInFont(font: string): string;
8580 class QuillWrapper {
8581 private editor;
8582 private $editorDiv;
8583 private $toolbarDiv;
8584 private $container;
8585 private dependenciesLoaded;
8586 private localizationProvider;
8587 private host;
8588 private static textChangeThrottle;
8589 static loadQuillResources: boolean;
8590 private static quillJsFiles;
8591 private static quillCssFiles;
8592 private QuillPackage;
8593 initialized: boolean;
8594 readOnly: boolean;
8595 textChanged: (delta, source) => void;
8596 /**
8597 * JavaScript and CSS resources are typically resolved asynchronously.
8598 * This means we potentially defer certain events which typically occur
8599 * synchronously until resources are loaded.
8600 * Setting the global loadQuillResources flag to true will override
8601 * this behavior and cause the wrapper to assume these resources are already loaded
8602 * and not try to load them asynchronously (e.g. for use in unit tests).
8603 */
8604 constructor(readOnly: boolean, host: IVisualHostServices);
8605 addModule(name: any, options: any): any;
8606 getElement(): JQuery;
8607 getContents(): quill.Delta;
8608 setContents(contents: quill.Delta | quill.Op[]): void;
8609 resize(viewport: IViewport): void;
8610 setReadOnly(readOnly: boolean): void;
8611 setSelection(start: number, end: number): void;
8612 getSelection(): quill.Range;
8613 focus(): void;
8614 destroy(): void;
8615 getSelectionAtCursor(): quill.Range;
8616 getWord(): string;
8617 insertLinkAtCursor(link: string, index: number): number;
8618 getEditorContainer(): JQuery;
8619 private getTextWithoutTrailingBreak();
8620 private rebuildQuillEditor();
8621 private onTextChanged(delta, source);
8622 }
8623 }
8624}
8625
8626declare module powerbi.visuals {
8627 const cheerMeterProps: {
8628 dataPoint: {
8629 defaultColor: DataViewObjectPropertyIdentifier;
8630 fill: DataViewObjectPropertyIdentifier;
8631 };
8632 };
8633 interface TeamData {
8634 name: string;
8635 value: number;
8636 color: string;
8637 identity: SelectionId;
8638 }
8639 interface CheerData {
8640 teamA: TeamData;
8641 teamB: TeamData;
8642 background: string;
8643 }
8644 class CheerMeter implements IVisual {
8645 static capabilities: VisualCapabilities;
8646 private static DefaultFontFamily;
8647 private static DefaultFontColor;
8648 private static DefaultBackgroundColor;
8649 private static PaddingBetweenText;
8650 private textOne;
8651 private textTwo;
8652 private svg;
8653 private isFirstTime;
8654 private data;
8655 private selectionManager;
8656 static converter(dataView: DataView): CheerData;
8657 init(options: VisualInitOptions): void;
8658 update(options: VisualUpdateOptions): void;
8659 private getRecomendedFontProperties(text1, text2, parentViewport);
8660 private calculateLayout(data, viewport);
8661 private ensureStartState(layout, viewport);
8662 private clearSelection();
8663 private clearSelectionUI();
8664 private updateSelectionUI(ids);
8665 private draw(data, duration, viewport);
8666 destroy(): void;
8667 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
8668 }
8669}
8670
8671declare module powerbi.visuals {
8672 interface ScatterChartConstructorOptions extends CartesianVisualConstructorOptions {
8673 }
8674 interface ScatterChartDataPoint extends SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
8675 x: any;
8676 y: any;
8677 size: any;
8678 radius: RadiusData;
8679 fill: string;
8680 formattedCategory: jsCommon.Lazy<string>;
8681 fontSize?: number;
8682 }
8683 interface ScatterChartDataPointSeries {
8684 identityKey: string;
8685 dataPoints?: ScatterChartDataPoint[];
8686 hasSize?: boolean;
8687 fill?: string;
8688 }
8689 interface RadiusData {
8690 sizeMeasure: DataViewValueColumn;
8691 index: number;
8692 }
8693 interface DataRange {
8694 minRange: number;
8695 maxRange: number;
8696 delta: number;
8697 }
8698 interface ScatterChartData extends PlayableChartData, ScatterBehaviorChartData {
8699 xCol: DataViewMetadataColumn;
8700 yCol: DataViewMetadataColumn;
8701 dataPoints: ScatterChartDataPoint[];
8702 dataPointSeries: ScatterChartDataPointSeries[];
8703 legendData: LegendData;
8704 axesLabels: ChartAxesLabels;
8705 size?: DataViewMetadataColumn;
8706 sizeRange: NumberRange;
8707 dataLabelsSettings: PointDataLabelsSettings;
8708 defaultDataPointColor?: string;
8709 showAllDataPoints?: boolean;
8710 hasDynamicSeries?: boolean;
8711 fillPoint?: boolean;
8712 colorBorder?: boolean;
8713 colorByCategory?: boolean;
8714 }
8715 interface ScatterChartViewModel {
8716 xAxisProperties: IAxisProperties;
8717 yAxisProperties: IAxisProperties;
8718 viewport: IViewport;
8719 data: ScatterChartData;
8720 drawBubbles: boolean;
8721 isPlay: boolean;
8722 fillMarkers: boolean;
8723 hasSelection: boolean;
8724 animationDuration: number;
8725 animationOptions: AnimationOptions;
8726 easeType: string;
8727 suppressDataPointRendering: boolean;
8728 }
8729 interface ScatterConverterOptions {
8730 viewport: IViewport;
8731 colors: any;
8732 interactivityService?: any;
8733 categoryAxisProperties?: any;
8734 valueAxisProperties?: any;
8735 }
8736 /** Styles to apply to scatter chart data point marker */
8737 interface ScatterMarkerStyle {
8738 'stroke-opacity': number;
8739 stroke: string;
8740 fill: string;
8741 'fill-opacity': number;
8742 }
8743 interface CartesianExtents {
8744 minX: number;
8745 maxX: number;
8746 minY: number;
8747 maxY: number;
8748 }
8749 class ScatterChart implements ICartesianVisual {
8750 private static BubbleRadius;
8751 static DefaultBubbleOpacity: number;
8752 static DimmedBubbleOpacity: number;
8753 static StrokeDarkenColorValue: number;
8754 static dataLabelLayoutStartingOffset: number;
8755 static dataLabelLayoutOffsetIterationDelta: number;
8756 static dataLabelLayoutMaximumOffset: number;
8757 private static AreaOf300By300Chart;
8758 private static MinSizeRange;
8759 private static MaxSizeRange;
8760 private static ClassName;
8761 static NoAnimationThreshold: number;
8762 static NoRenderResizeThreshold: number;
8763 private svg;
8764 private element;
8765 private currentViewport;
8766 private style;
8767 private data;
8768 private dataView;
8769 private host;
8770 private margin;
8771 private colors;
8772 private options;
8773 private interactivity;
8774 private cartesianVisualHost;
8775 private isMobileChart;
8776 private interactivityService;
8777 private categoryAxisProperties;
8778 private valueAxisProperties;
8779 private animator;
8780 private tooltipsEnabled;
8781 private tooltipBucketEnabled;
8782 private xAxisProperties;
8783 private yAxisProperties;
8784 private renderer;
8785 private playAxis;
8786 constructor(options: ScatterChartConstructorOptions);
8787 init(options: CartesianVisualInitOptions): void;
8788 static getAdditionalTelemetry(dataView: DataView): any;
8789 private static getObjectProperties(dataView, dataLabelsSettings?);
8790 static converter(dataView: DataView, options: ScatterConverterOptions, playFrameInfo?: PlayFrameInfo, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): ScatterChartData;
8791 private static getSizeRangeForGroups(dataViewValueGroups, sizeColumnIndex);
8792 private static createDataPointSeries(reader, dataValues, metadata, categories, categoryValues, categoryFormatter, categoryIdentities, categoryObjects, colorPalette, viewport, hasDynamicSeries, labelSettings, gradientValueColumn, defaultDataPointColor, categoryQueryName, colorByCategory, playFrameInfo, tooltipsEnabled, tooltipBucketEnabled?);
8793 static createLazyFormattedCategory(formatter: IValueFormatter, value: string): jsCommon.Lazy<string>;
8794 private static createSeriesLegend(dataValues, colorPalette, categorical, formatString, defaultDataPointColor);
8795 static getBubbleRadius(radiusData: RadiusData, sizeRange: NumberRange, viewport: IViewport): number;
8796 static getMeasureValue(measureIndex: number, seriesValues: DataViewValueColumn[]): DataViewValueColumn;
8797 private static getMetadata(grouped, source);
8798 /** Create a new viewmodel with default data. */
8799 static getDefaultData(): ScatterChartData;
8800 private renderAtFrame(data);
8801 setData(dataViews: DataView[]): void;
8802 private mergeSizeRanges(playData);
8803 calculateLegend(): LegendData;
8804 hasLegend(): boolean;
8805 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
8806 private hasSizeMeasure();
8807 private enumerateDataPoints(enumeration);
8808 supportsTrendLine(): boolean;
8809 private static getExtents(data);
8810 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
8811 overrideXScale(xProperties: IAxisProperties): void;
8812 shouldSuppressAnimation(): boolean;
8813 render(suppressAnimations: boolean, resizeMode?: ResizeMode): CartesianVisualRenderResult;
8814 static getStrokeFill(d: ScatterChartDataPoint, colorBorder: boolean): string;
8815 static getBubblePixelAreaSizeRange(viewPort: IViewport, minSizeRange: number, maxSizeRange: number): DataRange;
8816 static project(value: number, actualSizeDataRange: DataRange, bubblePixelAreaSizeRange: DataRange): number;
8817 static projectSizeToPixels(size: number, actualSizeDataRange: DataRange, bubblePixelAreaSizeRange: DataRange): number;
8818 static rangeContains(range: DataRange, value: number): boolean;
8819 static getMarkerFillOpacity(hasSize: boolean, shouldEnableFill: boolean, hasSelection: boolean, isSelected: boolean): number;
8820 static getMarkerStrokeOpacity(hasSize: boolean, colorBorder: boolean, hasSelection: boolean, isSelected: boolean): number;
8821 static getMarkerStrokeFill(hasSize: boolean, colorBorder: boolean, fill: string): string;
8822 static getMarkerStyle(d: ScatterChartDataPoint, colorBorder: boolean, hasSelection: boolean, fillMarkers: boolean): ScatterMarkerStyle;
8823 static getSeriesStyle(hasSize: boolean, colorBorder: boolean, hasSelection: boolean, fillMarkers: boolean, fill: string): ScatterMarkerStyle;
8824 static getBubbleOpacity(d: ScatterChartDataPoint, hasSelection: boolean): number;
8825 onClearSelection(): void;
8826 getSupportedCategoryAxisType(): string;
8827 static sortBubbles(a: ScatterChartDataPoint, b: ScatterChartDataPoint): number;
8828 }
8829}
8830
8831declare module powerbi.visuals {
8832 interface PlayConstructorOptions extends CartesianVisualConstructorOptions {
8833 }
8834 interface PlayInitOptions extends CartesianVisualInitOptions {
8835 }
8836 interface PlayChartDataPoint {
8837 frameIndex?: number;
8838 }
8839 interface PlayChartData<T extends PlayableChartData> {
8840 frameData: PlayChartFrameData[];
8841 allViewModels: T[];
8842 currentViewModel: T;
8843 currentFrameIndex: number;
8844 labelData: PlayAxisTickLabelData;
8845 }
8846 interface PlayChartFrameData {
8847 escapedText: string;
8848 text: string;
8849 }
8850 interface PlayChartViewModel<TData extends PlayableChartData, TViewModel> {
8851 data: PlayChartData<TData>;
8852 viewModel: TViewModel;
8853 viewport: IViewport;
8854 }
8855 interface PlayableChartData {
8856 dataPoints: any[];
8857 }
8858 interface PlayAxisTickLabelInfo {
8859 label: string;
8860 labelWidth: number;
8861 }
8862 interface PlayAxisTickLabelData {
8863 labelInfo: PlayAxisTickLabelInfo[];
8864 anyWordBreaks: boolean;
8865 labelFieldName?: string;
8866 }
8867 interface PlayChartRenderResult<TData extends PlayableChartData, TViewModel> {
8868 allDataPoints: SelectableDataPoint[];
8869 viewModel: PlayChartViewModel<TData, TViewModel>;
8870 }
8871 interface PlayChartRenderFrameDelegate<T> {
8872 (data: T): void;
8873 }
8874 interface PlayFrameInfo {
8875 label: string;
8876 column: DataViewMetadataColumn;
8877 }
8878 interface VisualDataConverterDelegate<T> {
8879 (dataView: DataView, playFrameInfo?: PlayFrameInfo): T;
8880 }
8881 interface ITraceLineRenderer {
8882 render(selectedPoints: SelectableDataPoint[], shouldAnimate: boolean): void;
8883 remove(): void;
8884 }
8885 class PlayAxis<T extends PlayableChartData> {
8886 private element;
8887 private svg;
8888 private playData;
8889 private renderDelegate;
8890 private isPlaying;
8891 private lastViewport;
8892 private ridiculousFlagForPersistProperties;
8893 private playControl;
8894 private host;
8895 private interactivityService;
8896 private isMobileChart;
8897 private static PlayCallout;
8898 private static calloutOffsetMultiplier;
8899 constructor(options: PlayConstructorOptions);
8900 init(options: PlayInitOptions): void;
8901 setData(dataView: DataView, visualConverter: VisualDataConverterDelegate<T>): PlayChartData<T>;
8902 render<TViewModel>(suppressAnimations: boolean, viewModel: TViewModel, viewport: IViewport, margin: IMargin): PlayChartRenderResult<T, TViewModel>;
8903 private updateCallout(viewport, margin);
8904 play(): void;
8905 private playNextFrame(playData, startFrame?, endFrame?);
8906 stop(): void;
8907 remove(): void;
8908 setRenderFunction(fn: PlayChartRenderFrameDelegate<T>): void;
8909 getCartesianExtents(existingExtents: CartesianExtents, getExtents: (T) => CartesianExtents): CartesianExtents;
8910 setPlayControlPosition(playControlLayout: IRect): void;
8911 private moveToFrameAndRender(frameIndex);
8912 isCurrentlyPlaying(): boolean;
8913 }
8914 module PlayChart {
8915 const FrameStepDuration: number;
8916 const FrameAnimationDuration: number;
8917 const ClassName: string;
8918 function convertMatrixToCategorical(sourceDataView: DataView, frame: number): DataView;
8919 function converter<T extends PlayableChartData>(dataView: DataView, visualConverter: VisualDataConverterDelegate<T>): PlayChartData<T>;
8920 function getDefaultPlayData<T extends PlayableChartData>(): PlayChartData<T>;
8921 function getMinMaxForAllFrames<T extends PlayableChartData>(playData: PlayChartData<T>, getExtents: (T) => CartesianExtents): CartesianExtents;
8922 function isDataViewPlayable(dataView: DataView, playRole?: string): boolean;
8923 /** Render trace-lines for selected data points. */
8924 function renderTraceLines(allDataPoints: SelectableDataPoint[], traceLineRenderer: ITraceLineRenderer, shouldAnimate: boolean): void;
8925 }
8926}
8927
8928declare module powerbi.visuals {
8929 import SemanticFilter = powerbi.data.SemanticFilter;
8930 import SQExpr = powerbi.data.SQExpr;
8931 interface CheckboxStyle {
8932 transform: string;
8933 'transform-origin': string;
8934 'font-size': string;
8935 }
8936 class VerticalSlicerRenderer implements ISlicerRenderer, SlicerValueHandler {
8937 private element;
8938 private currentViewport;
8939 private dataView;
8940 private header;
8941 private body;
8942 private container;
8943 private listView;
8944 private data;
8945 private settings;
8946 private behavior;
8947 private hostServices;
8948 private textProperties;
8949 private domHelper;
8950 constructor(options?: SlicerConstructorOptions);
8951 getDefaultValue(): data.SQConstantExpr;
8952 getIdentityFields(): SQExpr[];
8953 getUpdatedSelfFilter(searchKey: string): SemanticFilter;
8954 init(slicerInitOptions: SlicerInitOptions): IInteractivityService;
8955 render(options: SlicerRenderOptions): void;
8956 private updateSelectionStyle();
8957 private onEnterSelection(rowSelection);
8958 private onUpdateSelection(rowSelection, interactivityService);
8959 }
8960}
8961
8962declare module powerbi.visuals {
8963 class HorizontalSlicerRenderer implements ISlicerRenderer, SlicerValueHandler {
8964 private element;
8965 private currentViewport;
8966 private data;
8967 private interactivityService;
8968 private behavior;
8969 private hostServices;
8970 private dataView;
8971 private container;
8972 private header;
8973 private body;
8974 private bodyViewport;
8975 private itemsContainer;
8976 private rightNavigationArrow;
8977 private leftNavigationArrow;
8978 private dataStartIndex;
8979 private itemsToDisplay;
8980 private textProperties;
8981 private maxItemWidth;
8982 private totalItemWidth;
8983 private loadMoreData;
8984 private domHelper;
8985 constructor(options?: SlicerConstructorOptions);
8986 getDefaultValue(): data.SQConstantExpr;
8987 getIdentityFields(): data.SQExpr[];
8988 getUpdatedSelfFilter(searchKey: string): data.SemanticFilter;
8989 init(slicerInitOptions: SlicerInitOptions): IInteractivityService;
8990 render(options: SlicerRenderOptions): void;
8991 private renderCore();
8992 private updateStyle();
8993 private renderItems(defaultSettings);
8994 private bindInteractivityService();
8995 private normalizePosition(points);
8996 private bindNavigationEvents();
8997 private registerMouseClickEvents();
8998 private registerMouseWheelScrollEvents();
8999 private onMouseWheel(wheelDelta);
9000 private scrollRight();
9001 private scrollLeft();
9002 private isLastRowItem(fieldIndex, columnsToDisplay);
9003 private getScaledTextWidth(textSize);
9004 private isMaxWidthCalculated();
9005 private calculateAndSetMaxItemWidth();
9006 private calculateAndSetTotalItemWidth();
9007 private getNumberOfItemsToDisplay(widthAvailable);
9008 private getDataPointsCount();
9009 }
9010}
9011
9012declare module powerbi.visuals {
9013 import DOMHelper = SlicerUtil.DOMHelper;
9014 import SlicerOrientation = slicerOrientation.Orientation;
9015 interface SlicerValueHandler {
9016 getDefaultValue(): data.SQConstantExpr;
9017 getIdentityFields(): data.SQExpr[];
9018 /** gets updated self filter based on the searchKey.
9019 * If the searchKey didn't change, then the updated filter will be undefined. */
9020 getUpdatedSelfFilter(searchKey: string): data.SemanticFilter;
9021 }
9022 interface SlicerConstructorOptions {
9023 domHelper?: DOMHelper;
9024 behavior?: IInteractiveBehavior;
9025 }
9026 interface ISlicerRenderer {
9027 init(options: SlicerInitOptions): IInteractivityService;
9028 render(options: SlicerRenderOptions): void;
9029 }
9030 interface SlicerRenderOptions {
9031 dataView: DataView;
9032 data: SlicerData;
9033 viewport: IViewport;
9034 resetScrollbarPosition?: boolean;
9035 }
9036 interface SlicerData {
9037 categorySourceName: string;
9038 slicerDataPoints: SlicerDataPoint[];
9039 slicerSettings: SlicerSettings;
9040 hasSelectionOverride?: boolean;
9041 defaultValue?: DefaultValueDefinition;
9042 searchKey?: string;
9043 }
9044 interface SlicerDataPoint extends SelectableDataPoint {
9045 value: string;
9046 tooltip: string;
9047 isSelectAllDataPoint?: boolean;
9048 count: number;
9049 isImage?: boolean;
9050 }
9051 interface SlicerSettings {
9052 general: {
9053 outlineColor: string;
9054 outlineWeight: number;
9055 orientation: SlicerOrientation;
9056 };
9057 header: {
9058 borderBottomWidth: number;
9059 show: boolean;
9060 outline: string;
9061 fontColor: string;
9062 background?: string;
9063 textSize: number;
9064 };
9065 slicerText: {
9066 color: string;
9067 outline: string;
9068 background?: string;
9069 textSize: number;
9070 };
9071 selection: {
9072 selectAllCheckboxEnabled: boolean;
9073 singleSelect: boolean;
9074 };
9075 search: {
9076 enabled: boolean;
9077 };
9078 }
9079 interface SlicerInitOptions {
9080 visualInitOptions: VisualInitOptions;
9081 loadMoreData: () => void;
9082 }
9083 class Slicer implements IVisual {
9084 private element;
9085 private currentViewport;
9086 private dataView;
9087 private slicerData;
9088 private settings;
9089 private interactivityService;
9090 private behavior;
9091 private hostServices;
9092 private slicerRenderer;
9093 private slicerOrientation;
9094 private waitingForData;
9095 private domHelper;
9096 private initOptions;
9097 static DefaultStyleProperties(): SlicerSettings;
9098 constructor(options?: SlicerConstructorOptions);
9099 init(options: VisualInitOptions): void;
9100 onDataChanged(options: VisualDataChangedOptions): void;
9101 onResizing(finalViewport: IViewport): void;
9102 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
9103 loadMoreData(): void;
9104 onClearSelection(): void;
9105 private render(resetScrollbarPosition, stopWaitingForData?);
9106 private orientationHasChanged(slicerOrientation);
9107 private initializeSlicerRenderer(slicerOrientation);
9108 private initializeVerticalSlicer();
9109 private initializeHorizontalSlicer();
9110 private createInitOptions();
9111 }
9112}
9113
9114declare module powerbi.visuals {
9115 import TablixFormattingProperties = powerbi.visuals.controls.TablixFormattingPropertiesTable;
9116 import TablixUtils = controls.internal.TablixUtils;
9117 interface DataViewVisualTable extends DataViewTable {
9118 visualRows?: DataViewVisualTableRow[];
9119 formattingProperties?: TablixFormattingProperties;
9120 }
9121 interface DataViewVisualTableRow {
9122 index: number;
9123 values: DataViewTableRow;
9124 }
9125 interface TableDataAdapter {
9126 update(table: DataViewTable, isDataComplete: boolean): void;
9127 }
9128 interface TableTotal {
9129 totalCells: any[];
9130 }
9131 class TableHierarchyNavigator implements controls.ITablixHierarchyNavigator, TableDataAdapter {
9132 private tableDataView;
9133 private formatter;
9134 /**
9135 * True if the model is not expecting more data
9136 */
9137 private isDataComplete;
9138 constructor(tableDataView: DataViewVisualTable, isDataComplete: boolean, formatter: ICustomValueColumnFormatter);
9139 /**
9140 * Returns the depth of the Columnm hierarchy.
9141 */
9142 getColumnHierarchyDepth(): number;
9143 /**
9144 * Returns the depth of the Row hierarchy.
9145 */
9146 getRowHierarchyDepth(): number;
9147 /**
9148 * Returns the leaf count of a hierarchy.
9149 */
9150 getLeafCount(hierarchy: any): number;
9151 /**
9152 * Returns the leaf member of a hierarchy at a specified index.
9153 */
9154 getLeafAt(hierarchy: any, index: number): any;
9155 /**
9156 * Returns the specified hierarchy member parent.
9157 */
9158 getParent(item: any): any;
9159 /**
9160 * Returns the index of the hierarchy member relative to its parent.
9161 */
9162 getIndex(item: any): number;
9163 private isRow(item);
9164 private getColumnIndex(item);
9165 /**
9166 * Checks whether a hierarchy member is a leaf.
9167 */
9168 isLeaf(item: any): boolean;
9169 isRowHierarchyLeaf(cornerItem: any): boolean;
9170 isColumnHierarchyLeaf(cornerItem: any): boolean;
9171 isFirstItem(item: MatrixVisualNode, items: MatrixVisualNode[]): boolean;
9172 areAllParentsFirst(item: any, items: any): boolean;
9173 /**
9174 * Checks whether a hierarchy member is the last item within its parent.
9175 */
9176 isLastItem(item: any, items: any[]): boolean;
9177 areAllParentsLast(item: any, items: any[]): boolean;
9178 /**
9179 * Gets the children members of a hierarchy member.
9180 */
9181 getChildren(item: any): any;
9182 getChildrenLevelDifference(item: any): number;
9183 /**
9184 * Gets the members count in a specified collection.
9185 */
9186 getCount(items: any): number;
9187 /**
9188 * Gets the member at the specified index.
9189 */
9190 getAt(items: any, index: number): any;
9191 /**
9192 * Gets the hierarchy member level.
9193 */
9194 getLevel(item: any): number;
9195 /**
9196 * Returns the intersection between a row and a column item.
9197 */
9198 getIntersection(rowItem: any, columnItem: DataViewMetadataColumn): TablixUtils.TablixVisualCell;
9199 /**
9200 * Returns the corner cell between a row and a column level.
9201 */
9202 getCorner(rowLevel: number, columnLevel: number): TablixUtils.TablixVisualCell;
9203 headerItemEquals(item1: any, item2: any): boolean;
9204 bodyCellItemEquals(item1: TablixUtils.TablixVisualCell, item2: TablixUtils.TablixVisualCell): boolean;
9205 cornerCellItemEquals(item1: any, item2: any): boolean;
9206 update(table: DataViewVisualTable, isDataComplete: boolean): void;
9207 static getIndex(items: any[], item: any): number;
9208 }
9209 interface TableBinderOptions {
9210 onBindRowHeader?(item: any): void;
9211 onColumnHeaderClick?(queryName: string, sortDirection: SortDirection): void;
9212 layoutKind?: controls.TablixLayoutKind;
9213 }
9214 /**
9215 * Note: Public for testability.
9216 */
9217 class TableBinder implements controls.ITablixBinder {
9218 private options;
9219 private formattingProperties;
9220 private tableDataView;
9221 private fontSizeHeader;
9222 private textPropsHeader;
9223 private textHeightHeader;
9224 private fontSizeValue;
9225 private textPropsValue;
9226 private textHeightValue;
9227 private fontSizeTotal;
9228 private textPropsTotal;
9229 private textHeightTotal;
9230 private rowHeight;
9231 constructor(options: TableBinderOptions, dataView?: DataViewVisualTable);
9232 updateDataView(dataView: DataViewVisualTable): void;
9233 private updateTextHeights();
9234 private hasImage();
9235 onStartRenderingSession(): void;
9236 onEndRenderingSession(): void;
9237 /**
9238 * Row Header.
9239 */
9240 bindRowHeader(item: any, cell: controls.ITablixCell): void;
9241 unbindRowHeader(item: any, cell: controls.ITablixCell): void;
9242 /**
9243 * Column Header.
9244 */
9245 bindColumnHeader(item: DataViewMetadataColumn, cell: controls.ITablixCell): void;
9246 private setColumnHeaderStyle(cell, style);
9247 unbindColumnHeader(item: any, cell: controls.ITablixCell): void;
9248 /**
9249 * Body Cell.
9250 */
9251 bindBodyCell(item: TablixUtils.TablixVisualCell, cell: controls.ITablixCell): void;
9252 setBodyContent(item: TablixUtils.TablixVisualCell, cell: controls.ITablixCell): void;
9253 private setBodyStyle(item, cell, style);
9254 private setFooterStyle(cell, style);
9255 unbindBodyCell(item: TablixUtils.TablixVisualCell, cell: controls.ITablixCell): void;
9256 /**
9257 * Corner Cell.
9258 */
9259 bindCornerCell(item: any, cell: controls.ITablixCell): void;
9260 unbindCornerCell(item: any, cell: controls.ITablixCell): void;
9261 bindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
9262 unbindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
9263 bindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
9264 unbindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
9265 /**
9266 * Measurement Helper.
9267 */
9268 getHeaderLabel(item: DataViewMetadataColumn): string;
9269 getCellContent(item: any): string;
9270 hasRowGroups(): boolean;
9271 private sortIconsEnabled();
9272 }
9273 class Table implements IVisual {
9274 private static preferredLoadMoreThreshold;
9275 private element;
9276 private currentViewport;
9277 private style;
9278 private formatter;
9279 private isInteractive;
9280 private getLocalizedString;
9281 private hostServices;
9282 private tablixControl;
9283 private hierarchyNavigator;
9284 private waitingForData;
9285 private lastAllowHeaderResize;
9286 private waitingForSort;
9287 private columnWidthManager;
9288 private dataView;
9289 /**
9290 * Flag indicating that we are persisting objects, so that next onDataChanged can be safely ignored.
9291 */
9292 persistingObjects: boolean;
9293 constructor();
9294 static customizeQuery(options: CustomizeQueryOptions): void;
9295 static getSortableRoles(): string[];
9296 init(options: VisualInitOptions): void;
9297 /**
9298 * Note: Public for testability.
9299 */
9300 static converter(dataView: DataView): DataViewVisualTable;
9301 onResizing(finalViewport: IViewport): void;
9302 getColumnWidthManager(): controls.TablixColumnWidthManager;
9303 onDataChanged(options: VisualDataChangedOptions): void;
9304 private createColumnWidthManager();
9305 private persistColumnWidths(objectInstances);
9306 private updateViewport(newViewport);
9307 private refreshControl(clear);
9308 private getLayoutKind();
9309 private createOrUpdateHierarchyNavigator(visualTable);
9310 private createTablixControl(visualTable);
9311 private createControl(dataNavigator, visualTable);
9312 private updateInternal(previousDataView, visualTable);
9313 private shouldClearControl(previousDataView, newDataView);
9314 private createTotalsRow(dataView);
9315 private onBindRowHeader(item);
9316 private onColumnHeaderClick(queryName, sortDirection);
9317 /**
9318 * Note: Public for testability.
9319 */
9320 needsMoreData(item: any): boolean;
9321 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
9322 enumerateObjectRepetition(): VisualObjectRepetition[];
9323 private shouldAllowHeaderResize();
9324 onViewModeChanged(viewMode: ViewMode): void;
9325 private verifyHeaderResize();
9326 }
9327}
9328
9329declare module powerbi.visuals {
9330 import TablixFormattingPropertiesMatrix = powerbi.visuals.controls.TablixFormattingPropertiesMatrix;
9331 import TablixUtils = controls.internal.TablixUtils;
9332 /**
9333 * Extension of the Matrix node for Matrix visual.
9334 */
9335 interface MatrixVisualNode extends DataViewMatrixNode {
9336 /**
9337 * Index of the node in its parent's children collection.
9338 *
9339 * Note: For size optimization, we could also look this item up in the parent's
9340 * children collection, but we may need to pay the perf penalty.
9341 */
9342 index?: number;
9343 /**
9344 * Global index of the node as a leaf node.
9345 * If the node is not a leaf, the value is undefined.
9346 */
9347 leafIndex?: number;
9348 /**
9349 * Parent of the node.
9350 * Undefined for outermost nodes (children of the one root node).
9351 */
9352 parent?: MatrixVisualNode;
9353 /**
9354 * Children of the same parent
9355 */
9356 siblings?: MatrixVisualNode[];
9357 /**
9358 * queryName of the node.
9359 * If the node is not a leaf, the value is undefined.
9360 */
9361 queryName?: string;
9362 /**
9363 * Formatted text to show for the Node
9364 */
9365 valueFormatted?: string;
9366 }
9367 interface MatrixCornerItem {
9368 metadata: DataViewMetadataColumn;
9369 displayName: string;
9370 isColumnHeaderLeaf: boolean;
9371 isRowHeaderLeaf: boolean;
9372 }
9373 class MatrixVisualBodyItem extends TablixUtils.TablixVisualCell {
9374 isMeasure: boolean;
9375 isValidUrl: boolean;
9376 isValidImage: boolean;
9377 }
9378 /**
9379 * Interface for refreshing Matrix Data View.
9380 */
9381 interface MatrixDataAdapter {
9382 update(dataViewMatrix?: DataViewMatrix, isDataComplete?: boolean, updateColumns?: boolean): void;
9383 }
9384 interface IMatrixHierarchyNavigator extends controls.ITablixHierarchyNavigator, MatrixDataAdapter {
9385 getDataViewMatrix(): DataViewMatrix;
9386 getLeafCount(hierarchy: MatrixVisualNode[]): number;
9387 getLeafAt(hierarchy: MatrixVisualNode[], index: number): any;
9388 getLeafIndex(item: MatrixVisualNode): number;
9389 getParent(item: MatrixVisualNode): MatrixVisualNode;
9390 getIndex(item: MatrixVisualNode): number;
9391 isLeaf(item: MatrixVisualNode): boolean;
9392 isRowHierarchyLeaf(item: any): boolean;
9393 isColumnHierarchyLeaf(item: any): boolean;
9394 isLastItem(item: MatrixVisualNode, items: MatrixVisualNode[]): boolean;
9395 getChildren(item: MatrixVisualNode): MatrixVisualNode[];
9396 getCount(items: MatrixVisualNode[]): number;
9397 getAt(items: MatrixVisualNode[], index: number): MatrixVisualNode;
9398 getLevel(item: MatrixVisualNode): number;
9399 getIntersection(rowItem: MatrixVisualNode, columnItem: MatrixVisualNode): MatrixVisualBodyItem;
9400 getCorner(rowLevel: number, columnLevel: number): MatrixCornerItem;
9401 headerItemEquals(item1: MatrixVisualNode, item2: MatrixVisualNode): boolean;
9402 }
9403 /**
9404 * Factory method used by unit tests.
9405 */
9406 function createMatrixHierarchyNavigator(matrix: DataViewMatrix, isDataComplete: boolean, formatter: ICustomValueColumnFormatter, compositeGroupSeparator: string): IMatrixHierarchyNavigator;
9407 interface MatrixBinderOptions {
9408 onBindRowHeader?(item: MatrixVisualNode): void;
9409 totalLabel?: string;
9410 onColumnHeaderClick?(queryName: string, sortDirection: SortDirection): void;
9411 showSortIcons?: boolean;
9412 }
9413 class MatrixBinder implements controls.ITablixBinder {
9414 private formattingProperties;
9415 private hierarchyNavigator;
9416 private options;
9417 private fontSizeHeader;
9418 private textPropsHeader;
9419 private textHeightHeader;
9420 private fontSizeValue;
9421 private textPropsValue;
9422 private textHeightValue;
9423 private fontSizeTotal;
9424 private textPropsTotal;
9425 private textHeightTotal;
9426 constructor(hierarchyNavigator: IMatrixHierarchyNavigator, options: MatrixBinderOptions);
9427 onDataViewChanged(formattingProperties: TablixFormattingPropertiesMatrix): void;
9428 private updateTextHeights();
9429 onStartRenderingSession(): void;
9430 onEndRenderingSession(): void;
9431 /**
9432 * Row Header.
9433 */
9434 bindRowHeader(item: MatrixVisualNode, cell: controls.ITablixCell): void;
9435 private setRowHeaderStyle(cell, style);
9436 unbindRowHeader(item: any, cell: controls.ITablixCell): void;
9437 /**
9438 * Column Header.
9439 */
9440 bindColumnHeader(item: MatrixVisualNode, cell: controls.ITablixCell): void;
9441 private setColumnHeaderStyle(cell, style);
9442 unbindColumnHeader(item: MatrixVisualNode, cell: controls.ITablixCell): void;
9443 private bindHeader(item, cell, cellElement, metadata, style, overwriteSubtotalLabel?);
9444 private registerColumnHeaderClickHandler(columnMetadata, cell);
9445 private unregisterColumnHeaderClickHandler(cell);
9446 /**
9447 * Body Cell.
9448 */
9449 bindBodyCell(item: MatrixVisualBodyItem, cell: controls.ITablixCell): void;
9450 private setBodyCellStyle(cell, item, style);
9451 unbindBodyCell(item: MatrixVisualBodyItem, cell: controls.ITablixCell): void;
9452 /**
9453 * Corner Cell.
9454 */
9455 bindCornerCell(item: MatrixCornerItem, cell: controls.ITablixCell): void;
9456 private setCornerCellsStyle(cell, style);
9457 unbindCornerCell(item: MatrixCornerItem, cell: controls.ITablixCell): void;
9458 bindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
9459 unbindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
9460 bindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
9461 unbindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
9462 /**
9463 * Measurement Helper.
9464 */
9465 getHeaderLabel(item: MatrixVisualNode): string;
9466 getCellContent(item: MatrixVisualBodyItem): string;
9467 hasRowGroups(): boolean;
9468 /**
9469 * Returns the column metadata of the column that needs to be sorted for the specified matrix corner node.
9470 *
9471 * @return Column metadata or null if the specified corner node does not represent a sortable header.
9472 */
9473 private getSortableCornerColumnMetadata(item);
9474 private getRowHeaderMetadata(item);
9475 private getColumnHeaderMetadata(item);
9476 private getHierarchyMetadata(hierarchy, level);
9477 /**
9478 * Returns the column metadata of the column that needs to be sorted for the specified header node.
9479 *
9480 * @return Column metadata or null if the specified header node does not represent a sortable header.
9481 */
9482 private getSortableHeaderColumnMetadata(item);
9483 }
9484 class Matrix implements IVisual {
9485 private static preferredLoadMoreThreshold;
9486 /**
9487 * Note: Public only for testing.
9488 */
9489 static TotalLabel: string;
9490 private element;
9491 private currentViewport;
9492 private style;
9493 private dataView;
9494 private formatter;
9495 private isInteractive;
9496 private hostServices;
9497 private hierarchyNavigator;
9498 private waitingForData;
9499 private tablixControl;
9500 private lastAllowHeaderResize;
9501 private waitingForSort;
9502 private columnWidthManager;
9503 /**
9504 * Flag indicating that we are persisting objects, so that next onDataChanged can be safely ignored.
9505 */
9506 persistingObjects: boolean;
9507 constructor();
9508 static customizeQuery(options: CustomizeQueryOptions): void;
9509 static getSortableRoles(): string[];
9510 init(options: VisualInitOptions): void;
9511 static converter(dataView: DataView): TablixFormattingPropertiesMatrix;
9512 onResizing(finalViewport: IViewport): void;
9513 getColumnWidthManager(): controls.TablixColumnWidthManager;
9514 onDataChanged(options: VisualDataChangedOptions): void;
9515 private createColumnWidthManager();
9516 private persistColumnWidths(objectInstances);
9517 private updateViewport(newViewport);
9518 private refreshControl(clear);
9519 private getLayoutKind();
9520 private createOrUpdateHierarchyNavigator(rootChanged);
9521 private createTablixControl(textSize);
9522 private createControl(matrixNavigator, textSize);
9523 private updateInternal(textSize, previousDataView);
9524 private shouldClearControl(previousDataView, newDataView);
9525 private onBindRowHeader(item);
9526 private onColumnHeaderClick(queryName, sortDirection);
9527 /**
9528 * Note: Public for testability.
9529 */
9530 needsMoreData(item: MatrixVisualNode): boolean;
9531 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
9532 private shouldAllowHeaderResize();
9533 onViewModeChanged(viewMode: ViewMode): void;
9534 private verifyHeaderResize();
9535 }
9536}
9537
9538declare module powerbi.visuals {
9539 interface TreemapConstructorOptions {
9540 animator?: ITreemapAnimator;
9541 isScrollable: boolean;
9542 behavior?: TreemapWebBehavior;
9543 tooltipsEnabled?: boolean;
9544 tooltipBucketEnabled?: boolean;
9545 }
9546 interface TreemapData {
9547 root: TreemapNode;
9548 hasHighlights: boolean;
9549 legendData: LegendData;
9550 dataLabelsSettings: VisualDataLabelsSettings;
9551 legendObjectProperties?: DataViewObject;
9552 dataWasCulled: boolean;
9553 hasNegativeValues?: boolean;
9554 allValuesAreNegative?: boolean;
9555 }
9556 /**
9557 * Treemap node (we extend D3 node (GraphNode) because treemap layout methods rely on the type).
9558 */
9559 interface TreemapNode extends D3.Layout.GraphNode, SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
9560 key: any;
9561 originalValue: number;
9562 highlightMultiplier?: number;
9563 highlightValue?: number;
9564 originalHighlightValue?: number;
9565 color: string;
9566 highlightedTooltipInfo?: TooltipDataItem[];
9567 }
9568 interface ITreemapLayout {
9569 shapeClass: (d: TreemapNode) => string;
9570 shapeLayout: {
9571 x: (d: TreemapNode) => number;
9572 y: (d: TreemapNode) => number;
9573 width: (d: TreemapNode) => number;
9574 height: (d: TreemapNode) => number;
9575 };
9576 highlightShapeClass: (d: TreemapNode) => string;
9577 highlightShapeLayout: {
9578 x: (d: TreemapNode) => number;
9579 y: (d: TreemapNode) => number;
9580 width: (d: TreemapNode) => number;
9581 height: (d: TreemapNode) => number;
9582 };
9583 zeroShapeLayout: {
9584 x: (d: TreemapNode) => number;
9585 y: (d: TreemapNode) => number;
9586 width: (d: TreemapNode) => number;
9587 height: (d: TreemapNode) => number;
9588 };
9589 majorLabelClass: (d: TreemapNode) => string;
9590 majorLabelLayout: {
9591 x: (d: TreemapNode) => number;
9592 y: (d: TreemapNode) => number;
9593 };
9594 majorLabelText: (d: TreemapNode) => string;
9595 minorLabelClass: (d: TreemapNode) => string;
9596 minorLabelLayout: {
9597 x: (d: TreemapNode) => number;
9598 y: (d: TreemapNode) => number;
9599 };
9600 minorLabelText: (d: TreemapNode) => string;
9601 areMajorLabelsEnabled: () => boolean;
9602 areMinorLabelsEnabled: () => boolean;
9603 }
9604 interface ValueShape {
9605 validShape: boolean;
9606 dataWasCulled: boolean;
9607 }
9608 /**
9609 * Renders an interactive treemap visual from categorical data.
9610 */
9611 class Treemap implements IVisual {
9612 static DimmedShapeOpacity: number;
9613 private static ClassName;
9614 static LabelsGroupClassName: string;
9615 static MajorLabelClassName: string;
9616 static MinorLabelClassName: string;
9617 static ShapesClassName: string;
9618 static TreemapNodeClassName: string;
9619 static RootNodeClassName: string;
9620 static ParentGroupClassName: string;
9621 static NodeGroupClassName: string;
9622 static HighlightNodeClassName: string;
9623 private static TextMargin;
9624 private static MinorLabelTextSize;
9625 private static MinTextWidthForMinorLabel;
9626 private static MajorLabelTextSize;
9627 private static MinTextWidthForMajorLabel;
9628 private static MajorLabelTextProperties;
9629 /**
9630 * A rect with an area of 9 is a treemap rectangle of only
9631 * a single pixel in the middle with a 1 pixel stroke on each edge.
9632 */
9633 private static CullableArea;
9634 private svg;
9635 private treemap;
9636 private shapeGraphicsContext;
9637 private labelGraphicsContext;
9638 private currentViewport;
9639 private legend;
9640 private data;
9641 private style;
9642 private colors;
9643 private element;
9644 private options;
9645 private isScrollable;
9646 private hostService;
9647 private tooltipsEnabled;
9648 private tooltipBucketEnabled;
9649 /**
9650 * Note: Public for testing.
9651 */
9652 animator: ITreemapAnimator;
9653 private interactivityService;
9654 private behavior;
9655 private dataViews;
9656 static getLayout(labelsSettings: VisualDataLabelsSettings, alternativeScale: number): ITreemapLayout;
9657 constructor(options?: TreemapConstructorOptions);
9658 init(options: VisualInitOptions): void;
9659 /**
9660 * Note: Public for testing purposes.
9661 */
9662 static converter(dataView: DataView, colors: IDataColorPalette, labelSettings: VisualDataLabelsSettings, interactivityService: IInteractivityService, viewport: IViewport, legendObjectProperties?: DataViewObject, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): TreemapData;
9663 private static normalizedValue(value, allValuesAreNegative);
9664 private static getValuesFromCategoricalDataView(dataView, hasHighlights, valueColumnRoleName);
9665 private static getCullableValue(totalValue, viewport);
9666 update(options: VisualUpdateOptions): void;
9667 onDataChanged(options: VisualDataChangedOptions): void;
9668 onResizing(viewport: IViewport): void;
9669 onClearSelection(): void;
9670 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
9671 private enumerateDataPoints(enumeration, data);
9672 private enumerateLegend(data);
9673 static checkValueForShape(value: any, cullableValue: number, allValuesAreNegative: boolean, dataWasCulled: boolean): ValueShape;
9674 private calculateTreemapSize();
9675 private initViewportDependantProperties(duration?);
9676 private static hasChildrenWithIdentity(node);
9677 private static canDisplayMajorLabel(node);
9678 private static canDisplayMinorLabel(node, labelSettings);
9679 private static createMajorLabelText(node, labelsSettings, alternativeScale, formattersCache);
9680 private static createMinorLabelText(node, labelsSettings, alternativeScale, formattersCache);
9681 static getFill(d: TreemapNode, isHighlightRect: boolean): string;
9682 static getFillOpacity(d: TreemapNode, hasSelection: boolean, hasHighlights: boolean, isHighlightRect: boolean): string;
9683 private updateInternal(suppressAnimations);
9684 private renderLegend();
9685 private static getNodeClass(d, highlight?);
9686 private static createTreemapShapeLayout(isHighlightRect?);
9687 private static createTreemapZeroShapeLayout();
9688 static drawDefaultShapes(context: D3.Selection, nodes: D3.Layout.GraphNode[], hasSelection: boolean, hasHighlights: boolean, layout: ITreemapLayout): D3.UpdateSelection;
9689 static drawDefaultHighlightShapes(context: D3.Selection, nodes: D3.Layout.GraphNode[], hasSelection: boolean, hasHighlights: boolean, layout: ITreemapLayout): D3.UpdateSelection;
9690 static drawDefaultMajorLabels(context: D3.Selection, nodes: D3.Layout.GraphNode[], labelSettings: VisualDataLabelsSettings, layout: ITreemapLayout): D3.UpdateSelection;
9691 static drawDefaultMinorLabels(context: D3.Selection, nodes: D3.Layout.GraphNode[], labelSettings: VisualDataLabelsSettings, layout: ITreemapLayout): D3.UpdateSelection;
9692 static cleanMinorLabels(context: D3.Selection): void;
9693 }
9694}
9695
9696declare module powerbi.visuals {
9697 interface CardStyleText {
9698 textSize: number;
9699 color: string;
9700 paddingTop?: number;
9701 }
9702 interface CardStyleValue extends CardStyleText {
9703 fontFamily: string;
9704 }
9705 interface CardStyle {
9706 card: {
9707 maxFontSize: number;
9708 };
9709 label: CardStyleText;
9710 value: CardStyleValue;
9711 }
9712 interface CardSmallViewportProperties {
9713 cardSmallViewportWidth: number;
9714 }
9715 interface CardConstructorOptions {
9716 isScrollable?: boolean;
9717 displayUnitSystemType?: DisplayUnitSystemType;
9718 animator?: IGenericAnimator;
9719 cardSmallViewportProperties?: CardSmallViewportProperties;
9720 }
9721 interface CardFormatSetting {
9722 textSize: number;
9723 labelSettings: VisualDataLabelsSettings;
9724 wordWrap: boolean;
9725 }
9726 class Card extends AnimatedText implements IVisual {
9727 private static cardClassName;
9728 private static Label;
9729 private static Value;
9730 private static KPIImage;
9731 private static cardTextProperties;
9732 static DefaultStyle: CardStyle;
9733 private animationOptions;
9734 private displayUnitSystemType;
9735 private isScrollable;
9736 private graphicsContext;
9737 private labelContext;
9738 private cardFormatSetting;
9739 private kpiImage;
9740 private cardSmallViewportProperties;
9741 constructor(options?: CardConstructorOptions);
9742 init(options: VisualInitOptions): void;
9743 onDataChanged(options: VisualDataChangedOptions): void;
9744 onResizing(viewport: IViewport): void;
9745 private updateViewportProperties();
9746 private setTextProperties(text, fontSize);
9747 private getCardFormatTextSize();
9748 private isSmallViewport();
9749 private getCardPrecision(isSmallViewport?);
9750 private getCardDisplayUnits(isSmallViewport?);
9751 getAdjustedFontHeight(availableWidth: number, textToMeasure: string, seedFontHeight: number): number;
9752 clear(valueOnly?: boolean): void;
9753 private updateInternal(target, suppressAnimations, forceUpdate?);
9754 private displayStatusGraphic(statusGraphicInfo, translateX, translateY, labelTextSizeInPx);
9755 private getDefaultFormatSettings();
9756 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
9757 }
9758}
9759
9760declare module powerbi.visuals {
9761 class OwlGauge implements IVisual {
9762 private static owlBodySvg;
9763 private static owlTailSvg;
9764 private static visualBgSvg;
9765 private static owlBodyHeightMultiplier;
9766 private static owlTailHeightMultiplier;
9767 private static visualBgHeightMultiplier;
9768 private static OwlDemoMode;
9769 static capabilities: VisualCapabilities;
9770 static converter(dataView: DataView): any;
9771 private static getGaugeData(dataView);
9772 private rootElem;
9773 private svgBgElem;
9774 private svgBodyElem;
9775 private svgTailElem;
9776 init(options: VisualInitOptions): void;
9777 update(options: VisualUpdateOptions): void;
9778 private updateGauge(percentage);
9779 private happinessLevel;
9780 private updateViewportSize(width, height);
9781 }
9782}
9783
9784declare module powerbi.visuals {
9785 import IStringResourceProvider = jsCommon.IStringResourceProvider;
9786 class NoMapLocationWarning implements IVisualWarning {
9787 code: string;
9788 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9789 }
9790 class FilledMapWithoutValidGeotagCategoryWarning implements IVisualWarning {
9791 code: string;
9792 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9793 }
9794 class GeometryCulledWarning implements IVisualWarning {
9795 code: string;
9796 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9797 }
9798 class NegativeValuesNotSupportedWarning implements IVisualWarning {
9799 code: string;
9800 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9801 }
9802 class AllNegativeValuesWarning implements IVisualWarning {
9803 code: string;
9804 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9805 }
9806 class NaNNotSupportedWarning implements IVisualWarning {
9807 code: string;
9808 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9809 }
9810 class InfinityValuesNotSupportedWarning implements IVisualWarning {
9811 code: string;
9812 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9813 }
9814 class ValuesOutOfRangeWarning implements IVisualWarning {
9815 code: string;
9816 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9817 }
9818 class ZeroValueWarning implements IVisualWarning {
9819 code: string;
9820 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9821 }
9822 class VisualKPIDataMissingWarning implements IVisualWarning {
9823 code: string;
9824 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9825 }
9826 class ScriptVisualRefreshWarning implements IVisualWarning {
9827 code: string;
9828 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
9829 }
9830}
9831
9832declare module powerbi.visuals {
9833 interface WaterfallChartData extends CartesianData {
9834 series: WaterfallChartSeries[];
9835 categories: any[];
9836 valuesMetadata: DataViewMetadataColumn;
9837 legend: LegendData;
9838 hasHighlights: boolean;
9839 categoryMetadata: DataViewMetadataColumn;
9840 positionMax: number;
9841 positionMin: number;
9842 sentimentColors: WaterfallChartSentimentColors;
9843 dataLabelsSettings: VisualDataLabelsSettings;
9844 axesLabels: ChartAxesLabels;
9845 }
9846 interface WaterfallChartSeries extends CartesianSeries {
9847 data: WaterfallChartDataPoint[];
9848 }
9849 interface WaterfallChartDataPoint extends CartesianDataPoint, SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
9850 position: number;
9851 color: string;
9852 highlight: boolean;
9853 key: string;
9854 isTotal?: boolean;
9855 }
9856 interface WaterfallChartConstructorOptions extends CartesianVisualConstructorOptions {
9857 }
9858 interface WaterfallChartSentimentColors {
9859 increaseFill: Fill;
9860 decreaseFill: Fill;
9861 totalFill: Fill;
9862 }
9863 interface WaterfallLayout extends CategoryLayout, ILabelLayout {
9864 categoryWidth: number;
9865 }
9866 class WaterfallChart implements ICartesianVisual {
9867 static formatStringProp: DataViewObjectPropertyIdentifier;
9868 private static WaterfallClassName;
9869 private static MainGraphicsContextClassName;
9870 private static IncreaseLabel;
9871 private static DecreaseLabel;
9872 private static TotalLabel;
9873 private static CategoryValueClasses;
9874 private static WaterfallConnectorClasses;
9875 private static defaultTotalColor;
9876 private static validLabelPositions;
9877 private static validZeroLabelPosition;
9878 private svg;
9879 private mainGraphicsContext;
9880 private labelGraphicsContext;
9881 private mainGraphicsSVG;
9882 private xAxisProperties;
9883 private yAxisProperties;
9884 private currentViewport;
9885 private margin;
9886 private data;
9887 private element;
9888 private isScrollable;
9889 private tooltipsEnabled;
9890 private tooltipBucketEnabled;
9891 /**
9892 * Note: If we overflowed horizontally then this holds the subset of data we should render.
9893 */
9894 private clippedData;
9895 private style;
9896 private colors;
9897 private hostServices;
9898 private cartesianVisualHost;
9899 private interactivity;
9900 private options;
9901 private interactivityService;
9902 private layout;
9903 constructor(options: WaterfallChartConstructorOptions);
9904 init(options: CartesianVisualInitOptions): void;
9905 static converter(dataView: DataView, palette: IDataColorPalette, hostServices: IVisualHostServices, dataLabelSettings: VisualDataLabelsSettings, sentimentColors: WaterfallChartSentimentColors, interactivityService: IInteractivityService, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): WaterfallChartData;
9906 setData(dataViews: DataView[]): void;
9907 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
9908 private enumerateSentimentColors(enumeration);
9909 calculateLegend(): LegendData;
9910 hasLegend(): boolean;
9911 private static createClippedDataIfOverflowed(data, renderableDataCount);
9912 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
9913 private static getDisplayUnitValueFromAxisFormatter(yAxisProperties, labelSettings);
9914 private static lookupXValue(data, index, type);
9915 static getXAxisCreationOptions(data: WaterfallChartData, width: number, layout: CategoryLayout, options: CalculateScaleAndDomainOptions): CreateAxisOptions;
9916 static getYAxisCreationOptions(data: WaterfallChartData, height: number, options: CalculateScaleAndDomainOptions): CreateAxisOptions;
9917 getPreferredPlotArea(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
9918 getVisualCategoryAxisIsScalar(): boolean;
9919 overrideXScale(xProperties: IAxisProperties): void;
9920 setFilteredData(startIndex: number, endIndex: number): any;
9921 private createRects(data);
9922 private createConnectors(data);
9923 render(suppressAnimations: boolean): CartesianVisualRenderResult;
9924 onClearSelection(): void;
9925 getSupportedCategoryAxisType(): string;
9926 static getRectTop(scale: D3.Scale.GenericScale<any>, pos: number, value: number): number;
9927 private getAvailableWidth();
9928 private getAvailableHeight();
9929 private getSentimentColorsFromObjects(objects);
9930 createLabelDataPoints(): LabelDataPoint[];
9931 }
9932}
9933
9934declare module powerbi.visuals {
9935 import TouchUtils = powerbi.visuals.controls.TouchUtils;
9936 interface TooltipDataItem {
9937 displayName: string;
9938 value: string;
9939 color?: string;
9940 header?: string;
9941 opacity?: string;
9942 }
9943 interface TooltipOptions {
9944 opacity: number;
9945 animationDuration: number;
9946 offsetX: number;
9947 offsetY: number;
9948 }
9949 interface TooltipEnabledDataPoint {
9950 tooltipInfo?: TooltipDataItem[];
9951 }
9952 interface TooltipCategoryDataItem {
9953 value?: any;
9954 metadata: DataViewMetadataColumn[];
9955 }
9956 interface TooltipSeriesDataItem {
9957 value?: any;
9958 highlightedValue?: any;
9959 metadata: DataViewValueColumn;
9960 }
9961 interface TooltipLocalizationOptions {
9962 highlightedValueDisplayName: string;
9963 }
9964 interface TooltipEvent {
9965 data: any;
9966 coordinates: number[];
9967 elementCoordinates: number[];
9968 context: HTMLElement;
9969 isTouchEvent: boolean;
9970 }
9971 class ToolTipComponent {
9972 tooltipOptions: TooltipOptions;
9973 private static DefaultTooltipOptions;
9974 private tooltipContainer;
9975 private isTooltipVisible;
9976 private currentTooltipData;
9977 private customScreenWidth;
9978 private customScreenHeight;
9979 static parentContainerSelector: string;
9980 static highlightedValueDisplayNameResorceKey: string;
9981 static localizationOptions: TooltipLocalizationOptions;
9982 constructor(tooltipOptions?: TooltipOptions);
9983 isTooltipComponentVisible(): boolean;
9984 /** Note: For tests only */
9985 setTestScreenSize(width: number, height: number): void;
9986 show(tooltipData: TooltipDataItem[], clickedArea: TouchUtils.Rectangle): void;
9987 move(tooltipData: TooltipDataItem[], clickedArea: TouchUtils.Rectangle): void;
9988 hide(): void;
9989 private createTooltipContainer();
9990 private setTooltipContent(tooltipData);
9991 private getTooltipPosition(clickedArea, clickedScreenArea);
9992 private setPosition(clickedArea);
9993 private setTooltipContainerClass(clickedScreenArea);
9994 private setArrowPosition(clickedScreenArea);
9995 private getArrowElement();
9996 private getClickedScreenArea(clickedArea);
9997 }
9998 module TooltipManager {
9999 let ShowTooltips: boolean;
10000 let ToolTipInstance: ToolTipComponent;
10001 function addTooltip(selection: D3.Selection, getTooltipInfoDelegate: (tooltipEvent: TooltipEvent) => TooltipDataItem[], reloadTooltipDataOnMouseMove?: boolean, onMouseOutDelegate?: () => void): void;
10002 function showDelayedTooltip(tooltipEvent: TooltipEvent, getTooltipInfoDelegate: (tooltipEvent: TooltipEvent) => TooltipDataItem[], delayInMs: number): number;
10003 function hideDelayedTooltip(): number;
10004 function setLocalizedStrings(localizationOptions: TooltipLocalizationOptions): void;
10005 }
10006 module TooltipBuilder {
10007 function createTooltipInfo(formatStringProp: DataViewObjectPropertyIdentifier, dataViewCat: DataViewCategorical, categoryValue: any, value?: any, categories?: DataViewCategoryColumn[], seriesData?: TooltipSeriesDataItem[], seriesIndex?: number, categoryIndex?: number, highlightedValue?: any, gradientValueColumn?: DataViewValueColumn): TooltipDataItem[];
10008 function createGradientToolTipData(gradientValueColumn: DataViewValueColumn, categoryIndex: number): TooltipSeriesDataItem;
10009 function addTooltipBucketItem(reader: data.IDataViewCategoricalReader, tooltipInfo: TooltipDataItem[], categoryIndex: number, seriesIndex?: number): void;
10010 }
10011}
10012
10013declare module powerbi.visuals {
10014 module visualStyles {
10015 function create(dataColors?: IDataColorPalette): IVisualStyle;
10016 }
10017}
10018
10019declare module powerbi.visuals {
10020 interface DonutSmallViewPortProperties {
10021 maxHeightToScaleDonutLegend: number;
10022 }
10023 interface DonutConstructorOptions {
10024 sliceWidthRatio?: number;
10025 animator?: IDonutChartAnimator;
10026 isScrollable?: boolean;
10027 disableGeometricCulling?: boolean;
10028 behavior?: IInteractiveBehavior;
10029 tooltipsEnabled?: boolean;
10030 tooltipBucketEnabled?: boolean;
10031 smallViewPortProperties?: DonutSmallViewPortProperties;
10032 }
10033 /**
10034 * Used because data points used in D3 pie layouts are placed within a container with pie information.
10035 */
10036 interface DonutArcDescriptor extends D3.Layout.ArcDescriptor {
10037 data: DonutDataPoint;
10038 }
10039 interface DonutDataPoint extends SelectableDataPoint, TooltipEnabledDataPoint {
10040 measure: number;
10041 originalMeasure: number;
10042 measureFormat?: string;
10043 percentage: number;
10044 highlightRatio?: number;
10045 highlightValue?: number;
10046 originalHighlightValue?: number;
10047 label: string;
10048 index: number;
10049 /** Data points that may be drilled into */
10050 internalDataPoints?: DonutDataPoint[];
10051 color: string;
10052 strokeWidth: number;
10053 labelFormatString: string;
10054 /** This is set to true only when it's the last slice and all slices have the same color*/
10055 isLastInDonut?: boolean;
10056 }
10057 interface DonutData {
10058 dataPointsToDeprecate: DonutDataPoint[];
10059 dataPoints: DonutArcDescriptor[];
10060 unCulledDataPoints: DonutDataPoint[];
10061 dataPointsToEnumerate?: LegendDataPoint[];
10062 legendData: LegendData;
10063 hasHighlights: boolean;
10064 highlightsOverflow: boolean;
10065 dataLabelsSettings: VisualDataLabelsSettings;
10066 legendObjectProperties?: DataViewObject;
10067 maxValue?: number;
10068 visibleGeometryCulled?: boolean;
10069 defaultDataPointColor?: string;
10070 hasNegativeValues?: boolean;
10071 allValuesAreNegative?: boolean;
10072 }
10073 interface DonutLayout {
10074 shapeLayout: {
10075 d: (d: DonutArcDescriptor) => string;
10076 };
10077 highlightShapeLayout: {
10078 d: (d: DonutArcDescriptor) => string;
10079 };
10080 zeroShapeLayout: {
10081 d: (d: DonutArcDescriptor) => string;
10082 };
10083 }
10084 /**
10085 * Renders a donut chart.
10086 */
10087 class DonutChart implements IVisual {
10088 private static ClassName;
10089 private static InteractiveLegendClassName;
10090 private static InteractiveLegendArrowClassName;
10091 private static OuterArcRadiusRatio;
10092 private static InnerArcRadiusRatio;
10093 private static OpaqueOpacity;
10094 private static SemiTransparentOpacity;
10095 private static defaultSliceWidthRatio;
10096 private static invisibleArcLengthInPixels;
10097 private static sliceClass;
10098 private static sliceHighlightClass;
10099 private static twoPi;
10100 static InteractiveLegendContainerHeight: number;
10101 static EffectiveZeroValue: number;
10102 static PolylineOpacity: number;
10103 private dataViews;
10104 private sliceWidthRatio;
10105 private svg;
10106 private mainGraphicsContext;
10107 private labelGraphicsContext;
10108 private clearCatcher;
10109 private legendContainer;
10110 private interactiveLegendArrow;
10111 private parentViewport;
10112 private currentViewport;
10113 private formatter;
10114 private data;
10115 private pie;
10116 private arc;
10117 private outerArc;
10118 private radius;
10119 private previousRadius;
10120 private key;
10121 private colors;
10122 private style;
10123 private drilled;
10124 private allowDrilldown;
10125 private options;
10126 private isInteractive;
10127 private interactivityState;
10128 private chartRotationAnimationDuration;
10129 private interactivityService;
10130 private behavior;
10131 private legend;
10132 private hasSetData;
10133 private isScrollable;
10134 private disableGeometricCulling;
10135 private hostService;
10136 private settings;
10137 private tooltipsEnabled;
10138 private tooltipBucketEnabled;
10139 private donutProperties;
10140 private maxHeightToScaleDonutLegend;
10141 /**
10142 * Note: Public for testing.
10143 */
10144 animator: IDonutChartAnimator;
10145 constructor(options?: DonutConstructorOptions);
10146 static converter(dataView: DataView, colors: IDataColorPalette, defaultDataPointColor?: string, viewport?: IViewport, disableGeometricCulling?: boolean, interactivityService?: IInteractivityService, tooltipsEnabled?: boolean, tooltipBucketEnabled?: boolean): DonutData;
10147 init(options: VisualInitOptions): void;
10148 update(options: VisualUpdateOptions): void;
10149 onDataChanged(options: VisualDataChangedOptions): void;
10150 onResizing(viewport: IViewport): void;
10151 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
10152 private enumerateDataPoints(enumeration);
10153 private enumerateLegend(enumeration);
10154 setInteractiveChosenSlice(sliceIndex: number): void;
10155 private calculateRadius();
10156 private getScaleForLegendArrow();
10157 private initViewportDependantProperties(duration?);
10158 private initDonutProperties();
10159 private mergeDatasets(first, second);
10160 private updateInternal(data, suppressAnimations, duration?);
10161 private createLabels();
10162 private createLabelDataPoints();
10163 private createLabelDataPoint(d, alternativeScale, measureFormatterCache);
10164 private renderLegend();
10165 private addInteractiveLegendArrow();
10166 private calculateSliceAngles();
10167 private assignInteractions(slices, highlightSlices, data);
10168 private assignInteractiveChartInteractions(slice);
10169 /**
10170 * Get the angle (in degrees) of the drag event coordinates.
10171 * The angle is calculated against the plane of the center of the donut
10172 * (meaning, when the center of the donut is at (0,0) coordinates).
10173 */
10174 private getAngleFromDragEvent();
10175 private interactiveDragStart();
10176 private interactiveDragMove();
10177 private interactiveDragEnd();
10178 private updateInternalToMove(data, duration?);
10179 static drawDefaultShapes(graphicsContext: D3.Selection, donutData: DonutData, layout: DonutLayout, colors: IDataColorPalette, radius: number, hasSelection: boolean, sliceWidthRatio: number, defaultColor?: string): D3.UpdateSelection;
10180 static drawDefaultHighlightShapes(graphicsContext: D3.Selection, donutData: DonutData, layout: DonutLayout, colors: IDataColorPalette, radius: number, sliceWidthRatio: number): D3.UpdateSelection;
10181 /**
10182 Set true to the last data point when all slices have the same color
10183 */
10184 static isSingleColor(dataPoints: DonutArcDescriptor[]): void;
10185 static drawStrokeForDonutChart(radius: number, innerArcRadiusRatio: number, d: DonutArcDescriptor, sliceWidthRatio: number, highlightRatio?: number): string;
10186 onClearSelection(): void;
10187 static getLayout(radius: number, sliceWidthRatio: number, viewport: IViewport): DonutLayout;
10188 private static getHighlightRadius(radius, sliceWidthRatio, highlightRatio);
10189 static cullDataByViewport(dataPoints: DonutDataPoint[], maxValue: number, viewport: IViewport): DonutDataPoint[];
10190 }
10191}
10192
10193declare module powerbi.visuals {
10194 interface ScriptVisualDataViewObjects extends DataViewObjects {
10195 script: ScriptObject;
10196 }
10197 interface ScriptObject extends DataViewObject {
10198 provider: string;
10199 source: string;
10200 }
10201 interface ScriptVisualOptions {
10202 canRefresh: boolean;
10203 }
10204 class ScriptVisual implements IVisual {
10205 private element;
10206 private imageBackgroundElement;
10207 private hostServices;
10208 private canRefresh;
10209 constructor(options: ScriptVisualOptions);
10210 init(options: VisualInitOptions): void;
10211 update(options: VisualUpdateOptions): void;
10212 onResizing(finalViewport: IViewport): void;
10213 private getImageUrl(dataView);
10214 private ensureHtmlElement();
10215 }
10216}
10217
10218declare module powerbi.visuals.system {
10219 class DebugVisual implements IVisual {
10220 static capabilities: VisualCapabilities;
10221 private static autoReloadPollTime;
10222 private static errorMessageTemplate;
10223 private adapter;
10224 private container;
10225 private visualContainer;
10226 private optionsForVisual;
10227 private host;
10228 private autoRefreshBtn;
10229 private refreshBtn;
10230 private dataBtn;
10231 private lastUpdateOptions;
10232 private lastUpdateStatus;
10233 private visualGuid;
10234 private autoReloadInterval;
10235 private statusLoading;
10236 private dataViewShowing;
10237 private reloadAdapter(auto?);
10238 private loadVisual(guid);
10239 /**
10240 * Toggles auto reload
10241 * if value is set it sets it to true = on / false = off
10242 */
10243 private toggleAutoReload(value?);
10244 /**
10245 * Toggles dataViewer
10246 * if value is set it sets it to true = on / false = off
10247 */
10248 private toggleDataview(value?);
10249 private createRefreshBtn();
10250 private createAutoRefreshBtn();
10251 private createDataBtn();
10252 private createHelpBtn();
10253 private createSmilyBtn();
10254 private buildControls();
10255 private buildErrorMessage(options);
10256 private setCapabilities(capabilities);
10257 init(options: VisualInitOptions): void;
10258 update(options: VisualUpdateOptions): void;
10259 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
10260 destroy(): void;
10261 }
10262}
10263
10264declare module powerbi.visuals.plugins {
10265 const animatedNumber: IVisualPlugin;
10266 let areaChart: IVisualPlugin;
10267 let barChart: IVisualPlugin;
10268 let basicShape: IVisualPlugin;
10269 let card: IVisualPlugin;
10270 let multiRowCard: IVisualPlugin;
10271 let clusteredBarChart: IVisualPlugin;
10272 let clusteredColumnChart: IVisualPlugin;
10273 let columnChart: IVisualPlugin;
10274 let comboChart: IVisualPlugin;
10275 let dataDotChart: IVisualPlugin;
10276 let dataDotClusteredColumnComboChart: IVisualPlugin;
10277 let dataDotStackedColumnComboChart: IVisualPlugin;
10278 let donutChart: IVisualPlugin;
10279 let funnel: IVisualPlugin;
10280 let gauge: IVisualPlugin;
10281 let hundredPercentStackedBarChart: IVisualPlugin;
10282 let hundredPercentStackedColumnChart: IVisualPlugin;
10283 let image: IVisualPlugin;
10284 let lineChart: IVisualPlugin;
10285 let lineStackedColumnComboChart: IVisualPlugin;
10286 let lineClusteredColumnComboChart: IVisualPlugin;
10287 let map: IVisualPlugin;
10288 let filledMap: IVisualPlugin;
10289 let treemap: IVisualPlugin;
10290 let pieChart: IVisualPlugin;
10291 let scatterChart: IVisualPlugin;
10292 let stackedAreaChart: IVisualPlugin;
10293 let table: IVisualPlugin;
10294 let matrix: IVisualPlugin;
10295 let slicer: IVisualPlugin;
10296 let textbox: IVisualPlugin;
10297 let waterfallChart: IVisualPlugin;
10298 let cheerMeter: IVisualPlugin;
10299 let consoleWriter: IVisualPlugin;
10300 let helloIVisual: IVisualPlugin;
10301 let owlGauge: IVisualPlugin;
10302 let scriptVisual: IVisualPlugin;
10303 let kpi: IVisualPlugin;
10304 let debugVisual: IVisualPlugin;
10305}
10306
10307declare module powerbi.visuals {
10308 module CanvasBackgroundHelper {
10309 function getDefaultColor(): string;
10310 function getDefaultValues(): {
10311 color: string;
10312 };
10313 }
10314}
10315
10316declare module powerbi.visuals {
10317 interface IScaledRange<T> {
10318 getValue(): ValueRange<T>;
10319 setValue(value: ValueRange<T>): any;
10320 setScaledValue(value: ValueRange<number>): any;
10321 getScaledValue(): ValueRange<number>;
10322 }
10323 /**
10324 * Implements IRange interface for the Date type.
10325 */
10326 class DateRange implements IScaledRange<Date> {
10327 private value;
10328 private scaledValue;
10329 private scale;
10330 constructor(min: Date, max: Date, start?: Date, end?: Date);
10331 getScaledValue(): ValueRange<number>;
10332 setValue(original: ValueRange<Date>): void;
10333 getValue(): ValueRange<Date>;
10334 /**
10335 * Updates scaled value.
10336 * Value should in range [0 .. 100].
10337 */
10338 setScaledValue(value: ValueRange<number>): void;
10339 }
10340}
10341
10342declare module powerbi.visuals {
10343 const tableStylePresets: VisualStylePresets;
10344}