UNPKG

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