UNPKG

727 kBTypeScriptView Raw
1/*
2 * Power BI Visualizations
3 *
4 * Copyright (c) Microsoft Corporation
5 * All rights reserved.
6 * MIT License
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the ""Software""), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 */
26
27
28declare module powerbi {
29 enum VisualDataRoleKind {
30 /** Indicates that the role should be bound to something that evaluates to a grouping of values. */
31 Grouping = 0,
32 /** Indicates that the role should be bound to something that evaluates to a single value in a scope. */
33 Measure = 1,
34 /** Indicates that the role can be bound to either Grouping or Measure. */
35 GroupingOrMeasure = 2,
36 }
37 enum VisualDataChangeOperationKind {
38 Create = 0,
39 Append = 1,
40 }
41 enum VisualUpdateType {
42 Data = 2,
43 Resize = 4,
44 ViewMode = 8,
45 Style = 16,
46 ResizeEnd = 32,
47 }
48 enum VisualPermissions {
49 }
50 const enum CartesianRoleKind {
51 X = 0,
52 Y = 1,
53 }
54 const enum ViewMode {
55 View = 0,
56 Edit = 1,
57 }
58 const enum ResizeMode {
59 Resizing = 1,
60 Resized = 2,
61 }
62 module visuals.telemetry {
63 const enum TelemetryCategory {
64 Verbose = 0,
65 CustomerAction = 1,
66 CriticalError = 2,
67 Trace = 3,
68 }
69 enum ErrorSource {
70 PowerBI = 0,
71 External = 1,
72 User = 2,
73 }
74 }
75 const enum JoinPredicateBehavior {
76 /** Prevent items in this role from acting as join predicates. */
77 None = 0,
78 }
79}
80
81
82declare module powerbi {
83 export interface DragPayload {
84 }
85}
86
87
88declare module jsCommon {
89 export interface IStringResourceProvider {
90 get(id: string): string;
91 getOptional(id: string): string;
92 }
93}
94
95
96declare module powerbi.visuals {
97 export interface IPoint {
98 x: number;
99 y: number;
100 }
101}
102
103
104declare module powerbi {
105 /**
106 * An interface to promise/deferred,
107 * which abstracts away the underlying mechanism (e.g., Angular, jQuery, etc.).
108 */
109 export interface IPromiseFactory {
110 /**
111 * Creates a Deferred object which represents a task which will finish in the future.
112 */
113 defer<T>(): IDeferred<T>;
114
115 /**
116 * Creates a Deferred object which represents a task which will finish in the future.
117 */
118 defer<TSuccess, TError>(): IDeferred2<TSuccess, TError>;
119
120 /**
121 * Creates a promise that is resolved as rejected with the specified reason.
122 * This api should be used to forward rejection in a chain of promises.
123 * If you are dealing with the last promise in a promise chain, you don't need to worry about it.
124 * When comparing deferreds/promises to the familiar behavior of try/catch/throw,
125 * think of reject as the throw keyword in JavaScript.
126 * This also means that if you "catch" an error via a promise error callback and you want
127 * to forward the error to the promise derived from the current promise,
128 * you have to "rethrow" the error by returning a rejection constructed via reject.
129 *
130 * @param reason Constant, message, exception or an object representing the rejection reason.
131 */
132 reject<TError>(reason?: TError): IPromise2<any, TError>;
133
134 /**
135 * Creates a promise that is resolved with the specified value.
136 * This api should be used to forward rejection in a chain of promises.
137 * If you are dealing with the last promise in a promise chain, you don't need to worry about it.
138 *
139 * @param value Object representing the promise result.
140 */
141 resolve<TSuccess>(value?: TSuccess): IPromise2<TSuccess, any>;
142
143 /**
144 * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
145 */
146 all(promises: IPromise2<any, any>[]): IPromise<any[]>;
147
148 /**
149 * Wraps an object that might be a value or a then-able promise into a promise.
150 * This is useful when you are dealing with an object that might or might not be a promise
151 */
152 when<T>(value: T | IPromise<T>): IPromise<T>;
153 }
154
155 /**
156 * Represents an operation, to be completed (resolve/rejected) in the future.
157 */
158 export interface IPromise<T> extends IPromise2<T, T> {
159 }
160
161 /**
162 * Represents an operation, to be completed (resolve/rejected) in the future.
163 * Success and failure types can be set independently.
164 */
165 export interface IPromise2<TSuccess, TError> {
166 /**
167 * Regardless of when the promise was or will be resolved or rejected,
168 * then calls one of the success or error callbacks asynchronously as soon as the result is available.
169 * The callbacks are called with a single argument: the result or rejection reason.
170 * Additionally, the notify callback may be called zero or more times to provide a progress indication,
171 * before the promise is resolved or rejected.
172 * This method returns a new promise which is resolved or rejected via
173 * the return value of the successCallback, errorCallback.
174 */
175 then<TSuccessResult, TErrorResult>(successCallback: (promiseValue: TSuccess) => IPromise2<TSuccessResult, TErrorResult>, errorCallback?: (reason: TError) => TErrorResult): IPromise2<TSuccessResult, TErrorResult>;
176
177 /**
178 * Regardless of when the promise was or will be resolved or rejected,
179 * then calls one of the success or error callbacks asynchronously as soon as the result is available.
180 * The callbacks are called with a single argument: the result or rejection reason.
181 * Additionally, the notify callback may be called zero or more times to provide a progress indication,
182 * before the promise is resolved or rejected.
183 * This method returns a new promise which is resolved or rejected via
184 * the return value of the successCallback, errorCallback.
185 */
186 then<TSuccessResult, TErrorResult>(successCallback: (promiseValue: TSuccess) => TSuccessResult, errorCallback?: (reason: TError) => TErrorResult): IPromise2<TSuccessResult, TErrorResult>;
187
188 /**
189 * Shorthand for promise.then(null, errorCallback).
190 */
191 catch<TErrorResult>(onRejected: (reason: any) => IPromise2<TSuccess, TErrorResult>): IPromise2<TSuccess, TErrorResult>;
192
193 /**
194 * Shorthand for promise.then(null, errorCallback).
195 */
196 catch<TErrorResult>(onRejected: (reason: any) => TErrorResult): IPromise2<TSuccess, TErrorResult>;
197
198 /**
199 * Allows you to observe either the fulfillment or rejection of a promise,
200 * but to do so without modifying the final value.
201 * This is useful to release resources or do some clean-up that needs to be done
202 * whether the promise was rejected or resolved.
203 * See the full specification for more information.
204 * Because finally is a reserved word in JavaScript and reserved keywords
205 * are not supported as property names by ES3, you'll need to invoke
206 * the method like promise['finally'](callback) to make your code IE8 and Android 2.x compatible.
207 */
208 finally<T, U>(finallyCallback: () => any): IPromise2<T, U>;
209 }
210
211 export interface IDeferred<T> extends IDeferred2<T, T> {
212 }
213
214 export interface IDeferred2<TSuccess, TError> {
215 resolve(value: TSuccess): void;
216 reject(reason?: TError): void;
217 promise: IPromise2<TSuccess, TError>;
218 }
219
220 export interface RejectablePromise2<T, E> extends IPromise2<T, E> {
221 reject(reason?: E): void;
222 resolved(): boolean;
223 rejected(): boolean;
224 pending(): boolean;
225 }
226
227 export interface RejectablePromise<T> extends RejectablePromise2<T, T> {
228 }
229
230 export interface IResultCallback<T> {
231 (result: T, done: boolean): void;
232 }
233}
234
235
236declare module powerbi.visuals {
237 export interface IRect {
238 left: number;
239 top: number;
240 width: number;
241 height: number;
242 }
243}
244
245
246declare module powerbi.visuals {
247 import Selector = data.Selector;
248
249 export interface ISelectionIdBuilder {
250 withCategory(categoryColumn: DataViewCategoryColumn, index: number): this;
251 withSeries(seriesColumn: DataViewValueColumns, valueColumn: DataViewValueColumn | DataViewValueColumnGroup): this;
252 withMeasure(measureId: string): this;
253 createSelectionId(): ISelectionId;
254 }
255
256 export interface ISelectionId {
257 equals(other: ISelectionId): boolean;
258 includes(other: ISelectionId, ignoreHighlight?: boolean): boolean;
259 getKey(): string;
260 getSelector(): Selector;
261 getSelectorsByColumn(): Selector;
262 hasIdentity(): boolean;
263 }
264}
265
266
267declare module powerbi.data {
268 export interface CompiledDataViewMapping {
269 metadata: CompiledDataViewMappingMetadata;
270 categorical?: CompiledDataViewCategoricalMapping;
271 table?: CompiledDataViewTableMapping;
272 single?: CompiledDataViewSingleMapping;
273 tree?: CompiledDataViewTreeMapping;
274 matrix?: CompiledDataViewMatrixMapping;
275 scriptResult?: CompiledDataViewScriptResultMapping;
276 usage?: DataViewMappingUsage;
277 }
278
279 export interface CompiledDataViewMappingScriptDefinition {
280 source: DataViewObjectPropertyIdentifier;
281 provider: DataViewObjectPropertyIdentifier;
282 imageFormat?: string;
283 scriptInput?: ScriptInput;
284 }
285
286 export interface CompiledDataViewScriptResultMapping {
287 dataInput: CompiledDataViewMapping;
288 script: CompiledDataViewMappingScriptDefinition;
289 }
290
291 export interface CompiledDataViewMappingMetadata {
292 /** The metadata repetition objects. */
293 objects?: DataViewObjects;
294 }
295
296 export interface CompiledDataViewCategoricalMapping extends HasDataVolume, HasReductionAlgorithm {
297 categories?: CompiledDataViewRoleMappingWithReduction | CompiledDataViewListRoleMappingWithReduction;
298 values?: CompiledDataViewRoleMapping | CompiledDataViewGroupedRoleMapping | CompiledDataViewListRoleMapping;
299 includeEmptyGroups?: boolean;
300 }
301
302 export interface CompiledDataViewGroupingRoleMapping {
303 role: CompiledDataViewRole;
304 }
305
306 export interface CompiledDataViewSingleMapping {
307 role: CompiledDataViewRole;
308 }
309
310 export interface CompiledDataViewTableMapping extends HasDataVolume {
311 rows: CompiledDataViewRoleMappingWithReduction | CompiledDataViewListRoleMappingWithReduction;
312 }
313
314 export interface CompiledDataViewTreeMapping extends HasDataVolume {
315 nodes?: CompiledDataViewRoleForMappingWithReduction;
316 values?: CompiledDataViewRoleForMapping;
317 }
318
319 export interface CompiledDataViewMatrixMapping extends HasDataVolume {
320 rows?: CompiledDataViewRoleForMappingWithReduction | CompiledDataViewListRoleMappingWithReduction;
321 columns?: CompiledDataViewRoleForMappingWithReduction;
322 values?: CompiledDataViewRoleForMapping | CompiledDataViewListRoleMapping;
323 }
324
325 export type CompiledDataViewRoleMapping = CompiledDataViewRoleBindMapping | CompiledDataViewRoleForMapping;
326
327 export interface CompiledDataViewRoleBindMapping {
328 bind: {
329 to: CompiledDataViewRole;
330 };
331 }
332
333 export interface CompiledDataViewRoleForMapping {
334 for: {
335 in: CompiledDataViewRole;
336 };
337 }
338
339 export type CompiledDataViewRoleMappingWithReduction = CompiledDataViewRoleBindMappingWithReduction | CompiledDataViewRoleForMappingWithReduction;
340
341 export interface CompiledDataViewRoleBindMappingWithReduction extends CompiledDataViewRoleBindMapping, HasReductionAlgorithm {
342 }
343
344 export interface CompiledDataViewRoleForMappingWithReduction extends CompiledDataViewRoleForMapping, HasReductionAlgorithm {
345 }
346
347 export interface CompiledDataViewGroupedRoleMapping {
348 group: CompiledDataViewGroupedRoleGroupItemMapping;
349 }
350
351 export interface CompiledDataViewGroupedRoleGroupItemMapping extends HasReductionAlgorithm {
352 by: CompiledDataViewRole;
353 select: CompiledDataViewRoleMapping[];
354 }
355
356 export interface CompiledDataViewListRoleMapping {
357 select: CompiledDataViewRoleMapping[];
358 }
359
360 export interface CompiledDataViewListRoleMappingWithReduction extends CompiledDataViewListRoleMapping, HasReductionAlgorithm {
361 }
362
363 export const enum CompiledSubtotalType {
364 None = 0,
365 Before = 1,
366 After = 2
367 }
368
369 export interface CompiledDataViewRole {
370 role: string;
371 items: CompiledDataViewRoleItem[];
372 subtotalType?: CompiledSubtotalType;
373 showAll?: boolean;
374 activeItems?: string[];
375 }
376
377 export interface CompiledDataViewRoleItem {
378 queryName: string;
379 //changed to descriptor to not need to depend on ValueType class
380 type?: ValueTypeDescriptor;
381 joinPredicate?: JoinPredicateBehavior;
382 }
383}
384
385
386declare module powerbi {
387 /** Represents views of a data set. */
388 export interface DataView {
389 metadata: DataViewMetadata;
390 categorical?: DataViewCategorical;
391 single?: DataViewSingle;
392 tree?: DataViewTree;
393 table?: DataViewTable;
394 matrix?: DataViewMatrix;
395 scriptResult?: DataViewScriptResultData;
396 }
397
398 export interface DataViewMetadata {
399 columns: DataViewMetadataColumn[];
400
401 /** The metadata repetition objects. */
402 objects?: DataViewObjects;
403
404 /** When defined, describes whether the DataView contains just a segment of the complete data set. */
405 segment?: DataViewSegmentMetadata;
406 }
407
408 export interface DataViewMetadataColumn {
409 /** The user-facing display name of the column. */
410 displayName: string;
411
412 /** The query name the source column in the query. */
413 queryName?: string;
414
415 /** The format string of the column. */
416 format?: string; // TODO: Deprecate this, and populate format string through objects instead.
417
418 /** Data type information for the column. */
419 type?: ValueTypeDescriptor;
420
421 /** Indicates that this column is a measure (aggregate) value. */
422 isMeasure?: boolean;
423
424 /** The position of the column in the select statement. */
425 index?: number;
426
427 /** The properties that this column provides to the visualization. */
428 roles?: { [name: string]: boolean };
429
430 /** The metadata repetition objects. */
431 objects?: DataViewObjects;
432
433 /** The name of the containing group. */
434 groupName?: string;
435
436 /** The sort direction of this column. */
437 sort?: SortDirection;
438
439 /** The KPI metadata to use to convert a numeric status value into its visual representation. */
440 kpi?: DataViewKpiColumnMetadata;
441
442 /** Indicates that aggregates should not be computed across groups with different values of this column. */
443 discourageAggregationAcrossGroups?: boolean;
444
445 /** The aggregates computed for this column, if any. */
446 aggregates?: DataViewColumnAggregates;
447 }
448
449 export interface DataViewSegmentMetadata {
450 }
451
452 export interface DataViewColumnAggregates {
453 subtotal?: PrimitiveValue;
454 max?: PrimitiveValue;
455 min?: PrimitiveValue;
456 count?: number;
457
458 /** Client-computed maximum value for a column. */
459 maxLocal?: PrimitiveValue;
460
461 /** Client-computed maximum value for a column. */
462 minLocal?: PrimitiveValue;
463 }
464
465 export interface DataViewCategorical {
466 categories?: DataViewCategoryColumn[];
467 values?: DataViewValueColumns;
468 }
469
470 export interface DataViewCategoricalColumn {
471 source: DataViewMetadataColumn;
472 values: any[];
473
474 /** The data repetition objects. */
475 objects?: DataViewObjects[];
476 }
477
478 export interface DataViewValueColumns extends Array<DataViewValueColumn> {
479 /** Returns an array that groups the columns in this group together. */
480 grouped(): DataViewValueColumnGroup[];
481
482 /** The set of expressions that define the identity for instances of the value group. This must match items in the DataViewScopeIdentity in the grouped items result. */
483 identityFields?: data.ISQExpr[];
484
485 source?: DataViewMetadataColumn;
486 }
487
488 export interface DataViewValueColumnGroup {
489 values: DataViewValueColumn[];
490 identity?: DataViewScopeIdentity;
491
492 /** The data repetition objects. */
493 objects?: DataViewObjects;
494
495 name?: string;
496 }
497
498 export interface DataViewValueColumn extends DataViewCategoricalColumn {
499 highlights?: any[];
500 identity?: DataViewScopeIdentity;
501 }
502
503 // NOTE: The following is needed for backwards compatibility and should be deprecated. Callers should use
504 // DataViewMetadataColumn.aggregates instead.
505 export interface DataViewValueColumn extends DataViewColumnAggregates {
506 }
507
508 export interface DataViewCategoryColumn extends DataViewCategoricalColumn {
509 identity?: DataViewScopeIdentity[];
510
511 /** The set of expressions that define the identity for instances of the category. This must match items in the DataViewScopeIdentity in the identity. */
512 identityFields?: data.ISQExpr[];
513 }
514
515 export interface DataViewSingle {
516 value: any;
517 }
518
519 export interface DataViewTree {
520 root: DataViewTreeNode;
521 }
522
523 export interface DataViewTreeNode {
524 name?: string;
525
526 /**
527 * When used under the context of DataView.tree, this value is one of the elements in the values property.
528 *
529 * When used under the context of DataView.matrix, this property is the value of the particular
530 * group instance represented by this node (e.g. In a grouping on Year, a node can have value == 2016).
531 *
532 * DEPRECATED for usage under the context of DataView.matrix: This property is deprecated for objects
533 * that conform to the DataViewMatrixNode interface (which extends DataViewTreeNode).
534 * New visuals code should consume the new property levelValues on DataViewMatrixNode instead.
535 * If this node represents a composite group node in matrix, this property will be undefined.
536 */
537 value?: any;
538
539 /**
540 * When used under the context of DataView.tree, this property contains all the values in this node.
541 * The key of each of the key-value-pair in this dictionary is the position of the column in the
542 * select statement to which the value belongs.
543 *
544 * When used under the context of DataView.matrix.rows (as DataViewMatrixNode), if this node represents the
545 * inner-most dimension of row groups (i.e. a leaf node), then this property will contain the values at the
546 * matrix intersection under the group. The value type will be DataViewMatrixNodeValue, and their
547 * valueSourceIndex property will contain the position of the column in the select statement to which the
548 * value belongs.
549 *
550 * When used under the context of DataView.matrix.columns (as DataViewMatrixNode), this property is not used.
551 */
552 values?: { [id: number]: DataViewTreeNodeValue };
553
554 children?: DataViewTreeNode[];
555 identity?: DataViewScopeIdentity;
556
557 /** The data repetition objects. */
558 objects?: DataViewObjects;
559
560 /** The set of expressions that define the identity for the child nodes. This must match items in the DataViewScopeIdentity of those nodes. */
561 childIdentityFields?: data.ISQExpr[];
562 }
563
564 export interface DataViewTreeNodeValue {
565 value?: any;
566 }
567
568 export interface DataViewTreeNodeMeasureValue extends DataViewTreeNodeValue, DataViewColumnAggregates {
569 highlight?: any;
570 }
571
572 export interface DataViewTreeNodeGroupValue extends DataViewTreeNodeValue {
573 count?: any;
574 }
575
576 export interface DataViewTable {
577 columns: DataViewMetadataColumn[];
578
579 identity?: DataViewScopeIdentity[];
580
581 /** The set of expressions that define the identity for rows of the table. This must match items in the DataViewScopeIdentity in the identity. */
582 identityFields?: data.ISQExpr[];
583
584 rows?: DataViewTableRow[];
585
586 totals?: any[];
587 }
588
589 export interface DataViewTableRow extends Array<any> {
590 /** The metadata repetition objects. */
591 objects?: DataViewObjects[];
592 }
593
594 export interface DataViewMatrix {
595 rows: DataViewHierarchy;
596 columns: DataViewHierarchy;
597 valueSources: DataViewMetadataColumn[];
598 }
599
600 export interface DataViewMatrixNode extends DataViewTreeNode {
601 /** Indicates the level this node is on. Zero indicates the outermost children (root node level is undefined). */
602 level?: number;
603
604 /**
605 * Indicates the source metadata index on the node's level. Its value is 0 if omitted.
606 *
607 * DEPRECATED: This property is deprecated and exists for backward-compatibility only.
608 * New visuals code should consume the new property levelSourceIndex on DataViewMatrixGroupValue instead.
609 */
610 levelSourceIndex?: number;
611
612 /**
613 * The values of the particular group instance represented by this node.
614 * This array property would contain more than one element in a composite group
615 * (e.g. Year == 2016 and Month == 'January').
616 */
617 levelValues?: DataViewMatrixGroupValue[];
618
619 /** Indicates whether or not the node is a subtotal node. Its value is false if omitted. */
620 isSubtotal?: boolean;
621 }
622
623 /**
624 * Represents a value at a particular level of a matrix's rows or columns hierarchy.
625 * In the hierarchy level node is an instance of a composite group, this object will
626 * be one of multiple values
627 */
628 export interface DataViewMatrixGroupValue extends DataViewTreeNodeValue {
629 /**
630 * Indicates the index of the corresponding column for this group level value
631 * (held by DataViewHierarchyLevel.sources).
632 *
633 * @example
634 * // For example, to get the source column metadata of each level value at a particular row hierarchy node:
635 * let matrixRowsHierarchy: DataViewHierarchy = dataView.matrix.rows;
636 * let targetRowsHierarchyNode = <DataViewMatrixNode>matrixRowsHierarchy.root.children[0];
637 * // Use the DataViewMatrixNode.level property to get the corresponding DataViewHierarchyLevel...
638 * let targetRowsHierarchyLevel: DataViewHierarchyLevel = matrixRows.levels[targetRowsHierarchyNode.level];
639 * for (let levelValue in rowsRootNode.levelValues) {
640 * // columnMetadata is the source column for the particular levelValue.value in this loop iteration
641 * let columnMetadata: DataViewMetadataColumn =
642 * targetRowsHierarchyLevel.sources[levelValue.levelSourceIndex];
643 * }
644 */
645 levelSourceIndex: number;
646 }
647
648 /** Represents a value at the matrix intersection, used in the values property on DataViewMatrixNode (inherited from DataViewTreeNode). */
649 export interface DataViewMatrixNodeValue extends DataViewTreeNodeValue {
650 highlight?: any;
651
652 /** Indicates the index of the corresponding measure (held by DataViewMatrix.valueSources). Its value is 0 if omitted. */
653 valueSourceIndex?: number;
654 }
655
656 export interface DataViewHierarchy {
657 root: DataViewMatrixNode;
658 levels: DataViewHierarchyLevel[];
659 }
660
661 export interface DataViewHierarchyLevel {
662 sources: DataViewMetadataColumn[];
663 }
664
665 export interface DataViewKpiColumnMetadata {
666 graphic: string;
667
668 // When false, five state KPIs are in: { -2, -1, 0, 1, 2 }.
669 // When true, five state KPIs are in: { -1, -0.5, 0, 0.5, 1 }.
670 normalizedFiveStateKpiRange?: boolean;
671 }
672
673 export interface DataViewScriptResultData {
674 imageBase64: string;
675 }
676}
677
678
679declare module powerbi {
680 export interface DataViewMapping {
681 /**
682 * Defines set of conditions, at least one of which must be satisfied for this mapping to be used.
683 * Any roles not specified in the condition accept any number of items.
684 */
685 conditions?: DataViewMappingCondition[];
686 requiredProperties?: DataViewObjectPropertyIdentifier[];
687
688 categorical?: DataViewCategoricalMapping;
689 table?: DataViewTableMapping;
690 single?: DataViewSingleMapping;
691 tree?: DataViewTreeMapping;
692 matrix?: DataViewMatrixMapping;
693 scriptResult?: DataViewScriptResultMapping;
694 usage?: DataViewMappingUsage;
695 }
696
697 /** Describes whether a particular mapping is fits the set of projections. */
698 export interface DataViewMappingCondition {
699 [dataRole: string]: RoleCondition;
700 }
701
702 /** Describes a mapping which supports a data volume level. */
703 export interface HasDataVolume {
704 dataVolume?: number;
705 }
706
707 export interface DataViewCategoricalMapping extends HasDataVolume, HasReductionAlgorithm {
708 categories?: DataViewRoleMappingWithReduction | DataViewListRoleMappingWithReduction;
709 values?: DataViewRoleMapping | DataViewGroupedRoleMapping | DataViewListRoleMapping;
710
711 /** Specifies a constraint on the number of data rows supported by the visual. */
712 rowCount?: AcceptabilityNumberRange;
713
714 /** Indicates whether the data rows include empty groups */
715 includeEmptyGroups?: boolean;
716 }
717
718 export interface DataViewSingleMapping {
719 /** Indicates the role which is bound to this structure. */
720 role: string;
721 }
722
723 export interface DataViewTableMapping extends HasDataVolume {
724 rows: DataViewRoleMappingWithReduction | DataViewListRoleMappingWithReduction;
725
726 /** Specifies a constraint on the number of data rows supported by the visual. */
727 rowCount?: AcceptabilityNumberRange;
728 }
729
730 export interface DataViewTreeMapping extends HasDataVolume {
731 nodes?: DataViewRoleForMappingWithReduction;
732 values?: DataViewRoleForMapping;
733
734 /** Specifies a constraint on the depth of the tree supported by the visual. */
735 depth?: AcceptabilityNumberRange;
736 }
737
738 export interface DataViewMatrixMapping extends HasDataVolume {
739 rows?: DataViewRoleForMappingWithReduction | DataViewListRoleMappingWithReduction;
740 columns?: DataViewRoleForMappingWithReduction;
741 values?: DataViewRoleForMapping | DataViewListRoleMapping;
742 }
743
744 /* tslint:disable:no-unused-expression */
745 export type DataViewRoleMapping = DataViewRoleBindMapping | DataViewRoleForMapping;
746
747 /* tslint: enable */
748
749 export interface DataViewRoleBindMapping {
750 /**
751 * Indicates evaluation of a single-valued data role.
752 * Equivalent to for, without support for multiple items.
753 */
754 bind: {
755 to: string;
756 };
757 }
758
759 export interface DataViewRoleForMapping {
760 /** Indicates iteration of the in data role, as an array. */
761 for: {
762 in: string;
763 };
764 }
765
766 export type DataViewRoleMappingWithReduction = DataViewRoleBindMappingWithReduction | DataViewRoleForMappingWithReduction;
767
768 export interface DataViewRoleBindMappingWithReduction extends DataViewRoleBindMapping, HasReductionAlgorithm {
769 }
770
771 export interface DataViewRoleForMappingWithReduction extends DataViewRoleForMapping, HasReductionAlgorithm {
772 }
773
774 export interface DataViewGroupedRoleMapping {
775 group: {
776 by: string;
777 select: DataViewRoleMapping[];
778 dataReductionAlgorithm?: ReductionAlgorithm;
779 };
780 }
781
782 export interface DataViewListRoleMapping {
783 select: DataViewRoleMapping[];
784 }
785
786 export interface DataViewListRoleMappingWithReduction extends DataViewListRoleMapping, HasReductionAlgorithm {
787 }
788
789 export interface HasReductionAlgorithm {
790 dataReductionAlgorithm?: ReductionAlgorithm;
791 }
792
793 /** Describes how to reduce the amount of data exposed to the visual. */
794 export interface ReductionAlgorithm {
795 top?: DataReductionTop;
796 bottom?: DataReductionBottom;
797 sample?: DataReductionSample;
798 window?: DataReductionWindow;
799 }
800
801 /** Reduce the data to the Top(count) items. */
802 export interface DataReductionTop {
803 count?: number;
804 }
805
806 /** Reduce the data to the Bottom count items. */
807 export interface DataReductionBottom {
808 count?: number;
809 }
810
811 /** Reduce the data using a simple Sample of count items. */
812 export interface DataReductionSample {
813 count?: number;
814 }
815
816 /** Allow the data to be loaded one window, containing count items, at a time. */
817 export interface DataReductionWindow {
818 count?: number;
819 }
820
821 export interface AcceptabilityNumberRange {
822 /** Specifies a preferred range of values for the constraint. */
823 preferred?: NumberRange;
824
825 /** Specifies a supported range of values for the constraint. Defaults to preferred if not specified. */
826 supported?: NumberRange;
827 }
828
829 /** Defines the acceptable values of a number. */
830 export interface NumberRange {
831 min?: number;
832 max?: number;
833 }
834
835 export interface DataViewMappingScriptDefinition {
836 source: DataViewObjectPropertyIdentifier;
837 provider: DataViewObjectPropertyIdentifier;
838 imageFormat?: string;
839 }
840
841 export interface DataViewScriptResultMapping {
842 dataInput: DataViewMapping;
843 script: DataViewMappingScriptDefinition;
844 }
845
846 /** Defines how the mapping will be used. The set of objects in this interface can modify the usage. */
847 export interface DataViewMappingUsage {
848 regression: {
849 [propertyName: string]: DataViewObjectPropertyIdentifier;
850 };
851 }
852}
853
854
855declare module powerbi {
856 /** Represents evaluated, named, custom objects in a DataView. */
857 export interface DataViewObjects {
858 [name: string]: DataViewObject | DataViewObjectMap;
859 }
860
861 /** Represents an object (name-value pairs) in a DataView. */
862 export interface DataViewObject {
863 [propertyName: string]: DataViewPropertyValue;
864 }
865
866 export interface DataViewObjectWithId {
867 id: string;
868 object: DataViewObject;
869 }
870
871 export interface DataViewObjectPropertyIdentifier {
872 objectName: string;
873 propertyName: string;
874 }
875
876 export type DataViewObjectMap = DataViewObjectWithId[];
877
878 export type DataViewPropertyValue = PrimitiveValue | StructuralObjectValue;
879}
880
881
882declare module powerbi.data {
883 export interface DataViewObjectDescriptors {
884 /** Defines general properties for a visualization. */
885 general?: DataViewObjectDescriptor;
886
887 [objectName: string]: DataViewObjectDescriptor;
888 }
889
890 /** Defines a logical object in a visualization. */
891 export interface DataViewObjectDescriptor {
892 displayName?: DisplayNameGetter;
893 description?: DisplayNameGetter;
894 properties: DataViewObjectPropertyDescriptors;
895 }
896
897 export interface DataViewObjectPropertyDescriptors {
898 [propertyName: string]: DataViewObjectPropertyDescriptor;
899 }
900
901 /** Defines a property of a DataViewObjectDefinition. */
902 export interface DataViewObjectPropertyDescriptor {
903 displayName?: DisplayNameGetter;
904 description?: DisplayNameGetter;
905 placeHolderText?: DisplayNameGetter;
906 type: DataViewObjectPropertyTypeDescriptor;
907 rule?: DataViewObjectPropertyRuleDescriptor;
908
909 /** Indicates whether the Format Painter should ignore this property. */
910 suppressFormatPainterCopy?: boolean;
911 }
912
913 export type DataViewObjectPropertyTypeDescriptor = ValueTypeDescriptor | StructuralTypeDescriptor;
914
915 export interface DataViewObjectPropertyRuleDescriptor {
916 /** For rule typed properties, defines the input visual role name. */
917 inputRole?: string;
918
919 /** Defines the output for rule-typed properties. */
920 output?: DataViewObjectPropertyRuleOutputDescriptor;
921 }
922
923 export interface DataViewObjectPropertyRuleOutputDescriptor {
924 /** Name of the target property for rule output. */
925 property: string;
926
927 /** Names roles that define the selector for the output properties. */
928 selector: string[];
929 }
930
931}
932
933
934declare module powerbi.data {
935 /** Defines a match against all instances of given roles. */
936 export interface DataViewRoleWildcard {
937 roles: string[];
938 key: string;
939 }
940}
941
942
943declare module powerbi {
944 /** Encapsulates the identity of a data scope in a DataView. */
945 export interface DataViewScopeIdentity {
946 /** Predicate expression that identifies the scope. */
947 expr: data.ISQExpr;
948
949 /** Key string that identifies the DataViewScopeIdentity to a string, which can be used for equality comparison. */
950 key: string;
951 }
952}
953
954
955declare module powerbi.data {
956 /** Defines a match against all instances of a given DataView scope. */
957 export interface DataViewScopeWildcard {
958 exprs: ISQExpr[];
959 key: string;
960 }
961}
962
963
964declare module powerbi.data {
965 import IStringResourceProvider = jsCommon.IStringResourceProvider;
966
967 export type DisplayNameGetter = ((resourceProvider: IStringResourceProvider) => string) | string;
968}
969
970
971declare module powerbi.data {
972 export interface ScriptInputColumn {
973 /** The queryName of the corresponding Select from the associated SemanticQuery providing the data for this column. */
974 QueryName: string;
975
976 /** The name of this column expected by the script. */
977 Name: string;
978 }
979
980 export interface ScriptInput {
981 VariableName?: string;
982 Columns?: ScriptInputColumn[];
983 }
984}
985
986
987declare module powerbi.data {
988 /** Defines a selector for content, including data-, metadata, and user-defined repetition. */
989 export interface Selector {
990 /** Data-bound repetition selection. */
991 data?: DataRepetitionSelector[];
992
993 /** Metadata-bound repetition selection. Refers to a DataViewMetadataColumn queryName. */
994 metadata?: string;
995
996 /** User-defined repetition selection. */
997 id?: string;
998 }
999
1000 export type DataRepetitionSelector = DataViewScopeIdentity | DataViewScopeWildcard | DataViewRoleWildcard;
1001}
1002
1003
1004declare module powerbi.data {
1005 //intentionally blank interfaces since this is not part of the public API
1006
1007 export interface ISemanticFilter { }
1008
1009 export interface ISQExpr { }
1010
1011 export interface ISQConstantExpr extends ISQExpr { }
1012
1013}
1014
1015
1016declare module powerbi {
1017 export const enum SortDirection {
1018 Ascending = 1,
1019 Descending = 2,
1020 }
1021}
1022
1023
1024declare module powerbi {
1025 export interface IViewport {
1026 height: number;
1027 width: number;
1028 }
1029}
1030
1031
1032declare module powerbi {
1033 import DisplayNameGetter = powerbi.data.DisplayNameGetter;
1034
1035 /** Defines the data roles understood by the IVisual. */
1036 export interface VisualDataRole {
1037 /** Unique name for the VisualDataRole. */
1038 name: string;
1039
1040 /** Indicates the kind of role. This value is used to build user interfaces, such as a field well. */
1041 kind: VisualDataRoleKind;
1042
1043 displayName?: DisplayNameGetter;
1044
1045 /** The tooltip text */
1046 description?: DisplayNameGetter;
1047
1048 /** Indicates the preferred ValueTypes to be used in this data role. This is used by authoring tools when adding fields into the visual. */
1049 preferredTypes?: ValueTypeDescriptor[];
1050
1051 /** Indicates the required ValueTypes for this data role. Any values which do not match one of the ValueTypes specified will be null'd out */
1052 requiredTypes?: ValueTypeDescriptor[];
1053
1054 /** Indicates the cartesian role for the visual role */
1055 cartesianKind?: CartesianRoleKind;
1056
1057 /** Indicates the join predicate behavior of items in this role. */
1058 joinPredicate?: JoinPredicateBehavior;
1059 }
1060
1061 export interface RoleCondition extends NumberRange {
1062 kind?: VisualDataRoleKind;
1063 }
1064}
1065
1066
1067declare module powerbi.extensibility {
1068 export interface ISelectionId { }
1069
1070 export interface ISelectionIdBuilder {
1071 withCategory(categoryColumn: DataViewCategoryColumn, index: number): this;
1072 withSeries(seriesColumn: DataViewValueColumns, valueColumn: DataViewValueColumn | DataViewValueColumnGroup): this;
1073 withMeasure(measureId: string): this;
1074 createSelectionId(): ISelectionId;
1075 }
1076}
1077
1078
1079declare module powerbi.extensibility {
1080 interface ISelectionManager {
1081 select(selectionId: ISelectionId, multiSelect?: boolean): IPromise<ISelectionId[]>;
1082 hasSelection(): boolean;
1083 clear(): IPromise<{}>;
1084 getSelectionIds(): ISelectionId[];
1085 }
1086}
1087
1088
1089declare module powerbi.extensibility {
1090
1091 export interface IVisualPluginOptions {
1092 capabilities: VisualCapabilities;
1093 }
1094
1095 export interface IVisualConstructor {
1096 __capabilities__: VisualCapabilities;
1097 }
1098
1099 // These are the base interfaces. These should remain empty
1100 // All visual versions should extend these for type compatability
1101
1102 export interface IVisual { }
1103
1104 export interface IVisualHost { }
1105
1106 export interface VisualUpdateOptions { }
1107
1108 export interface VisualConstructorOptions { }
1109
1110}
1111
1112
1113
1114declare module powerbi.extensibility {
1115
1116 export interface VisualVersionOverloads {
1117 [name: string]: Function;
1118 }
1119
1120 export interface VisualVersionOverloadFactory {
1121 (visual: powerbi.extensibility.IVisual): VisualVersionOverloads;
1122 }
1123
1124 export interface VisualHostAdapter {
1125 (host: powerbi.IVisualHostServices): IVisualHost;
1126 }
1127
1128 export interface VisualVersion {
1129 version: string;
1130 overloads?: VisualVersionOverloadFactory;
1131 hostAdapter: VisualHostAdapter;
1132 }
1133
1134 /**
1135 * Extends the interface of a visual wrapper (IVisual) to include
1136 * the unwrap method which returns a direct reference to the wrapped visual.
1137 * Used in SafeExecutionWrapper and VisualAdapter
1138 */
1139 export interface WrappedVisual {
1140 /** Returns this visual inside of this wrapper */
1141 unwrap: () => powerbi.IVisual;
1142 }
1143}
1144
1145
1146/**
1147 * Change Log Version 1.0.0
1148 * - Add type to update options (data, resize, viewmode)
1149 * - Remove deprecated methods (onDataChange, onResizing, onViewModeChange)
1150 * - Add hostAdapter for host services versioning
1151 */
1152declare module powerbi.extensibility.v100 {
1153 /**
1154 * Represents a visualization displayed within an application (PowerBI dashboards, ad-hoc reporting, etc.).
1155 * This interface does not make assumptions about the underlying JS/HTML constructs the visual uses to render itself.
1156 */
1157 export interface IVisual extends extensibility.IVisual {
1158 /** Notifies the IVisual of an update (data, viewmode, size change). */
1159 update(options: VisualUpdateOptions): void;
1160
1161 /** Notifies the visual that it is being destroyed, and to do any cleanup necessary (such as unsubscribing event handlers). */
1162 destroy?(): void;
1163
1164 /** Gets the set of objects that the visual is currently displaying. */
1165 enumerateObjectInstances?(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
1166 }
1167
1168 export interface IVisualHost extends extensibility.IVisualHost { }
1169
1170 export interface VisualUpdateOptions extends extensibility.VisualUpdateOptions {
1171 viewport: IViewport;
1172 dataViews: DataView[];
1173 type: VisualUpdateType;
1174 viewMode?: ViewMode;
1175 }
1176
1177 export interface VisualConstructorOptions extends extensibility.VisualConstructorOptions {
1178 element: HTMLElement;
1179 host: IVisualHost;
1180 }
1181
1182}
1183
1184
1185
1186/**
1187 * Change Log Version 1.1.0
1188 */
1189declare module powerbi.extensibility.v110 {
1190 /**
1191 * Represents a visualization displayed within an application (PowerBI dashboards, ad-hoc reporting, etc.).
1192 * This interface does not make assumptions about the underlying JS/HTML constructs the visual uses to render itself.
1193 */
1194 export interface IVisual extends extensibility.IVisual {
1195 /** Notifies the IVisual of an update (data, viewmode, size change). */
1196 update(options: VisualUpdateOptions): void;
1197
1198 /** Notifies the visual that it is being destroyed, and to do any cleanup necessary (such as unsubscribing event handlers). */
1199 destroy?(): void;
1200
1201 /** Gets the set of objects that the visual is currently displaying. */
1202 enumerateObjectInstances?(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
1203 }
1204
1205 export interface IVisualHost extends extensibility.IVisualHost {
1206 createSelectionIdBuilder: () => visuals.ISelectionIdBuilder;
1207 createSelectionManager: () => ISelectionManager;
1208 }
1209
1210 export interface VisualUpdateOptions extends extensibility.VisualUpdateOptions {
1211 viewport: IViewport;
1212 dataViews: DataView[];
1213 type: VisualUpdateType;
1214 viewMode?: ViewMode;
1215 }
1216
1217 export interface VisualConstructorOptions extends extensibility.VisualConstructorOptions {
1218 element: HTMLElement;
1219 host: IVisualHost;
1220 }
1221
1222}
1223
1224
1225
1226declare module powerbi.extensibility {
1227 import DataViewObjectDescriptors = powerbi.data.DataViewObjectDescriptors;
1228
1229 /** Defines the capabilities of an IVisual. */
1230 export interface VisualCapabilities {
1231 /** Defines what roles the visual expects, and how those roles should be populated. This is useful for visual generation/editing. */
1232 dataRoles?: VisualDataRole[];
1233
1234 /** Defines the set of objects supported by this IVisual. */
1235 objects?: DataViewObjectDescriptors;
1236
1237 /** Defines how roles that the visual understands map to the DataView. This is useful for query generation. */
1238 dataViewMappings?: DataViewMapping[];
1239
1240 /** Indicates whether cross-highlight is supported by the visual. This is useful for query generation. */
1241 supportsHighlight?: boolean;
1242
1243 /** Indicates whether sorting is supported by the visual. This is useful for query generation */
1244 sorting?: VisualSortingCapabilities;
1245 }
1246}
1247
1248
1249declare module powerbi {
1250
1251 /**
1252 * Interface that provides scripted access to geographical location information associated with the hosting device
1253 * The Interface is similar to W3 Geolocation API Specification {@link https://dev.w3.org/geo/api/spec-source.html}
1254 */
1255 export interface IGeolocation {
1256 /**
1257 * Request repeated updates
1258 *
1259 * @param successCallback invoked when current location successfully obtained
1260 * @param errorCallback invoked when attempt to obtain the current location fails
1261 *
1262 * @return a number value that uniquely identifies a watch operation
1263 */
1264 watchPosition(successCallback: IPositionCallback, errorCallback?: IPositionErrorCallback): number;
1265 /**
1266 * Cancel the updates
1267 *
1268 * @param watchId a number returned from {@link IGeolocation#watchPosition}
1269 */
1270 clearWatch(watchId: number): void;
1271 /**
1272 * One-shot position request.
1273 *
1274 * @param successCallback invoked when current location successfully obtained
1275 * @param errorCallback invoked when attempt to obtain the current location fails
1276 */
1277 getCurrentPosition(successCallback: IPositionCallback, errorCallback?: IPositionErrorCallback): void;
1278 }
1279
1280 export interface IPositionCallback {
1281 (position: Position): void;
1282 }
1283
1284 export interface IPositionErrorCallback {
1285 (error: PositionError): void;
1286 }
1287}
1288
1289
1290declare module powerbi.visuals.telemetry {
1291
1292 export interface ITelemetryEventI<T> extends ITelemetryEvent {
1293 info: T;
1294 }
1295
1296 interface IErrorWithStackTraceAndSourceDetails extends IErrorWithStackTrace {
1297 source: string;
1298 lineNumber: number;
1299 columnNumber: number;
1300 }
1301
1302 export interface IErrorWithStackTrace extends IError {
1303 stack: string;
1304 }
1305
1306 export interface IError {
1307 message: string;
1308 }
1309
1310 export interface IPBIVisualException extends IErrorWithStackTraceAndSourceDetails {
1311 visualType: string;
1312 isCustom: boolean;
1313 apiVersion: string;
1314 }
1315
1316 export interface IPBIExtensibilityVisualApiUsage extends ICustomerAction {
1317 name: string;
1318 apiVersion: string;
1319 custom: boolean;
1320 }
1321
1322 export interface VisualTelemetryInfo {
1323 name: string;
1324 apiVersion: string;
1325 custom: boolean;
1326 }
1327
1328}
1329
1330
1331declare module powerbi.visuals.telemetry {
1332
1333 interface ITelemetryService {
1334 /** Log Telemetry event */
1335 logEvent(eventFactory: ITelemetryEventFactory): ITelemetryEvent;
1336 logEvent<T>(eventFactory: ITelemetryEventFactory1<T>, arg: T): ITelemetryEvent;
1337 logEvent<T1, T2>(eventFactory: ITelemetryEventFactory2<T1, T2>, arg1: T1, arg2: T2): ITelemetryEvent;
1338 logEvent<T1, T2, T3>(eventFactory: ITelemetryEventFactory3<T1, T2, T3>, arg1: T1, arg2: T2, arg3: T3): ITelemetryEvent;
1339 logEvent<T1, T2, T3, T4>(eventFactory: ITelemetryEventFactory4<T1, T2, T3, T4>, arg1: T1, arg2: T2, arg3: T3, arg4: T4): ITelemetryEvent;
1340 logEvent<T1, T2, T3, T4, T5>(eventFactory: ITelemetryEventFactory5<T1, T2, T3, T4, T5>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): ITelemetryEvent;
1341 logEvent<T1, T2, T3, T4, T5, T6>(eventFactory: ITelemetryEventFactory6<T1, T2, T3, T4, T5, T6>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): ITelemetryEvent;
1342 logEvent<T1, T2, T3, T4, T5, T6, T7>(eventFactory: ITelemetryEventFactory7<T1, T2, T3, T4, T5, T6, T7>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7): ITelemetryEvent;
1343 logEvent<T1, T2, T3, T4, T5, T6, T7, T8>(eventFactory: ITelemetryEventFactory8<T1, T2, T3, T4, T5, T6, T7, T8>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8): ITelemetryEvent;
1344 logEvent<T1, T2, T3, T4, T5, T6, T7, T8, T9>(eventFactory: ITelemetryEventFactory9<T1, T2, T3, T4, T5, T6, T7, T8, T9>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9): ITelemetryEvent;
1345 logEvent<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(eventFactory: ITelemetryEventFactory10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10): ITelemetryEvent;
1346 logEvent<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(eventFactory: ITelemetryEventFactory11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10, arg11: T11): ITelemetryEvent;
1347 }
1348
1349 interface ITelemetryEvent {
1350 name: string;
1351 category?: TelemetryCategory;
1352 id: string;
1353 loggers?: number;
1354 time: number;
1355 getFormattedInfoObject(): any;
1356 info: any;
1357 privateFields: string[];
1358 orgInfoFields: string[];
1359 }
1360
1361 interface ITelemetryEventFactory {
1362 (parentId: string): ITelemetryEvent;
1363 }
1364 interface ITelemetryEventFactory1<T> {
1365 (arg: T, parentId: string): ITelemetryEvent;
1366 }
1367 interface ITelemetryEventFactory2<T1, T2> {
1368 (arg1: T1, arg2: T2, parentId: string): ITelemetryEvent;
1369 }
1370 interface ITelemetryEventFactory3<T1, T2, T3> {
1371 (arg1: T1, arg2: T2, arg3: T3, parentId: string): ITelemetryEvent;
1372 }
1373 interface ITelemetryEventFactory4<T1, T2, T3, T4> {
1374 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, parentId: string): ITelemetryEvent;
1375 }
1376 interface ITelemetryEventFactory5<T1, T2, T3, T4, T5> {
1377 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, parentId: string): ITelemetryEvent;
1378 }
1379 interface ITelemetryEventFactory6<T1, T2, T3, T4, T5, T6> {
1380 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, parentId: string): ITelemetryEvent;
1381 }
1382 interface ITelemetryEventFactory7<T1, T2, T3, T4, T5, T6, T7> {
1383 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, parentId: string): ITelemetryEvent;
1384 }
1385 interface ITelemetryEventFactory8<T1, T2, T3, T4, T5, T6, T7, T8> {
1386 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, parentId: string): ITelemetryEvent;
1387 }
1388 interface ITelemetryEventFactory9<T1, T2, T3, T4, T5, T6, T7, T8, T9> {
1389 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, parentId: string): ITelemetryEvent;
1390 }
1391 interface ITelemetryEventFactory10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
1392 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10, parentId: string): ITelemetryEvent;
1393 }
1394 interface ITelemetryEventFactory11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
1395 (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10, arg11: T11, parentId: string): ITelemetryEvent;
1396 }
1397
1398 interface IBaseEvent {
1399 parentId: string;
1400 isError: boolean;
1401 errorSource: ErrorSource;
1402 errorCode: string;
1403 }
1404
1405 interface ICustomerAction extends IBaseEvent {
1406 }
1407}
1408
1409declare module powerbi {
1410 interface ITelemetryService { }
1411}
1412
1413
1414
1415
1416declare module powerbi {
1417 export interface DefaultValueDefinition {
1418 value: data.ISQConstantExpr;
1419 identityFieldsValues?: data.ISQConstantExpr[];
1420 }
1421
1422 export interface DefaultValueTypeDescriptor {
1423 defaultValue: boolean;
1424 }
1425}
1426
1427
1428declare module powerbi {
1429 import DisplayNameGetter = powerbi.data.DisplayNameGetter;
1430
1431 export type EnumMemberValue = string | number;
1432
1433 export interface IEnumMember {
1434 value: EnumMemberValue;
1435 displayName: DisplayNameGetter;
1436 }
1437
1438 /** Defines a custom enumeration data type, and its values. */
1439 export interface IEnumType {
1440 /** Gets the members of the enumeration, limited to the validMembers, if appropriate. */
1441 members(validMembers?: EnumMemberValue[]): IEnumMember[];
1442 }
1443
1444}
1445
1446
1447declare module powerbi {
1448 export interface Fill {
1449 solid?: {
1450 color?: string;
1451 };
1452 gradient?: {
1453 startColor?: string;
1454 endColor?: string;
1455 };
1456 pattern?: {
1457 patternKind?: string;
1458 color?: string;
1459 };
1460 }
1461
1462 export interface FillTypeDescriptor {
1463 solid?: {
1464 color?: FillSolidColorTypeDescriptor;
1465 };
1466 gradient?: {
1467 startColor?: boolean;
1468 endColor?: boolean;
1469 };
1470 pattern?: {
1471 patternKind?: boolean;
1472 color?: boolean;
1473 };
1474 }
1475
1476 export type FillSolidColorTypeDescriptor = boolean | FillSolidColorAdvancedTypeDescriptor;
1477
1478 export interface FillSolidColorAdvancedTypeDescriptor {
1479 /** Indicates whether the color value may be nullable, and a 'no fill' option is appropriate. */
1480 nullable: boolean;
1481 }
1482}
1483
1484
1485declare module powerbi {
1486 export interface FillRule extends FillRuleGeneric<string, number> {
1487 }
1488
1489 export interface FillRuleTypeDescriptor {
1490 }
1491
1492 export interface FillRuleGeneric<TColor, TValue> {
1493 linearGradient2?: LinearGradient2Generic<TColor, TValue>;
1494 linearGradient3?: LinearGradient3Generic<TColor, TValue>;
1495
1496 // stepped2?
1497 // ...
1498 }
1499
1500 export interface LinearGradient2Generic<TColor, TValue> {
1501 max: RuleColorStopGeneric<TColor, TValue>;
1502 min: RuleColorStopGeneric<TColor, TValue>;
1503 }
1504
1505 export interface LinearGradient3Generic<TColor, TValue> {
1506 max: RuleColorStopGeneric<TColor, TValue>;
1507 mid: RuleColorStopGeneric<TColor, TValue>;
1508 min: RuleColorStopGeneric<TColor, TValue>;
1509 }
1510
1511 export interface RuleColorStopGeneric<TColor, TValue> {
1512 color: TColor;
1513 value?: TValue;
1514 }
1515}
1516
1517
1518declare module powerbi {
1519 export interface FilterTypeDescriptor {
1520 }
1521}
1522
1523
1524declare module powerbi {
1525 export type ImageValue = ImageDefinitionGeneric<string>;
1526
1527 export interface ImageDefinitionGeneric<T> {
1528 name: T;
1529 url: T;
1530 scaling?: T;
1531 }
1532
1533 export interface ImageTypeDescriptor { }
1534
1535}
1536
1537
1538declare module powerbi {
1539 export type Paragraphs = Paragraph[];
1540 export interface Paragraph {
1541 horizontalTextAlignment?: string;
1542 textRuns: TextRun[];
1543 }
1544
1545 export interface ParagraphsTypeDescriptor {
1546 }
1547
1548 export interface TextRunStyle {
1549 fontFamily?: string;
1550 fontSize?: string;
1551 fontStyle?: string;
1552 fontWeight?: string;
1553 textDecoration?: string;
1554 }
1555
1556 export interface TextRun {
1557 textStyle?: TextRunStyle;
1558 url?: string;
1559 value: string;
1560 }
1561}
1562
1563
1564declare module powerbi {
1565 import SemanticFilter = data.ISemanticFilter;
1566
1567 /** Defines instances of structural types. */
1568 export type StructuralObjectValue =
1569 Fill |
1570 FillRule |
1571 SemanticFilter |
1572 DefaultValueDefinition |
1573 ImageValue |
1574 Paragraphs;
1575
1576 /** Describes a structural type in the client type system. Leaf properties should use ValueType. */
1577 export interface StructuralTypeDescriptor {
1578 fill?: FillTypeDescriptor;
1579 fillRule?: FillRuleTypeDescriptor;
1580 filter?: FilterTypeDescriptor;
1581 expression?: DefaultValueTypeDescriptor;
1582 image?: ImageTypeDescriptor;
1583 paragraphs?: ParagraphsTypeDescriptor;
1584
1585 //border?: BorderTypeDescriptor;
1586 //etc.
1587 }
1588}
1589
1590
1591declare module powerbi {
1592 /** Describes a data value type in the client type system. Can be used to get a concrete ValueType instance. */
1593 export interface ValueTypeDescriptor {
1594 // Simplified primitive types
1595 text?: boolean;
1596 numeric?: boolean;
1597 integer?: boolean;
1598 bool?: boolean;
1599 dateTime?: boolean;
1600 duration?: boolean;
1601 binary?: boolean;
1602 none?: boolean; //TODO: 5005022 remove none type when we introduce property categories.
1603
1604 // Extended types
1605 temporal?: TemporalTypeDescriptor;
1606 geography?: GeographyTypeDescriptor;
1607 misc?: MiscellaneousTypeDescriptor;
1608 formatting?: FormattingTypeDescriptor;
1609 enumeration?: IEnumType;
1610 scripting?: ScriptTypeDescriptor;
1611 }
1612
1613 export interface ScriptTypeDescriptor {
1614 source?: boolean;
1615 }
1616
1617 export interface TemporalTypeDescriptor {
1618 year?: boolean;
1619 month?: boolean;
1620 }
1621
1622 export interface GeographyTypeDescriptor {
1623 address?: boolean;
1624 city?: boolean;
1625 continent?: boolean;
1626 country?: boolean;
1627 county?: boolean;
1628 region?: boolean;
1629 postalCode?: boolean;
1630 stateOrProvince?: boolean;
1631 place?: boolean;
1632 latitude?: boolean;
1633 longitude?: boolean;
1634 }
1635
1636 export interface MiscellaneousTypeDescriptor {
1637 image?: boolean;
1638 imageUrl?: boolean;
1639 webUrl?: boolean;
1640 barcode?: boolean;
1641 }
1642
1643 export interface FormattingTypeDescriptor {
1644 color?: boolean;
1645 formatString?: boolean;
1646 alignment?: boolean;
1647 labelDisplayUnits?: boolean;
1648 fontSize?: boolean;
1649 labelDensity?: boolean;
1650 }
1651
1652 /** Describes instances of value type objects. */
1653 export type PrimitiveValue = string | number | boolean | Date;
1654}
1655
1656
1657declare module powerbi {
1658 import DataViewObjectDescriptor = powerbi.data.DataViewObjectDescriptor;
1659 import DataViewObjectDescriptors = powerbi.data.DataViewObjectDescriptors;
1660 import Selector = powerbi.data.Selector;
1661 import IPoint = powerbi.visuals.IPoint;
1662 import ISemanticFilter = powerbi.data.ISemanticFilter;
1663 import ISQExpr = powerbi.data.ISQExpr;
1664 import IStringResourceProvider = jsCommon.IStringResourceProvider;
1665 import IRect = powerbi.visuals.IRect;
1666
1667 /**
1668 * Represents a visualization displayed within an application (PowerBI dashboards, ad-hoc reporting, etc.).
1669 * This interface does not make assumptions about the underlying JS/HTML constructs the visual uses to render itself.
1670 */
1671 export interface IVisual {
1672 /**
1673 * Initializes an instance of the IVisual.
1674 *
1675 * @param options Initialization options for the visual.
1676 */
1677 init(options: VisualInitOptions): void;
1678
1679 /** Notifies the visual that it is being destroyed, and to do any cleanup necessary (such as unsubscribing event handlers). */
1680 destroy?(): void;
1681
1682 /**
1683 * Notifies the IVisual of an update (data, viewmode, size change).
1684 */
1685 update?(options: VisualUpdateOptions): void;
1686
1687 /**
1688 * Notifies the IVisual to resize.
1689 *
1690 * @param finalViewport This is the viewport that the visual will eventually be resized to.
1691 * @param resized true on on final call when resizing is complete.
1692 */
1693 onResizing?(finalViewport: IViewport, resizeMode?: ResizeMode): void;
1694
1695 /**
1696 * Notifies the IVisual of new data being provided.
1697 * This is an optional method that can be omitted if the visual is in charge of providing its own data.
1698 */
1699 onDataChanged?(options: VisualDataChangedOptions): void;
1700
1701 /** Notifies the IVisual to change view mode if applicable. */
1702 onViewModeChanged?(viewMode: ViewMode): void;
1703
1704 /** Notifies the IVisual to clear any selection. */
1705 onClearSelection?(): void;
1706
1707 /** Gets a value indicating whether the IVisual can be resized to the given viewport. */
1708 canResizeTo?(viewport: IViewport): boolean;
1709
1710 /** Gets the set of objects that the visual is currently displaying. */
1711 enumerateObjectInstances?(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
1712
1713 /** Gets the set of object repetitions that the visual can display. */
1714 enumerateObjectRepetition?(): VisualObjectRepetition[];
1715 }
1716
1717 /** Parameters available to a CustomizeQueryMethod */
1718 export interface CustomizeQueryOptions {
1719 /**
1720 * The data view mapping for this visual with some additional information. CustomizeQueryMethod implementations
1721 * are expected to edit this in-place.
1722 */
1723 dataViewMappings: data.CompiledDataViewMapping[];
1724
1725 /**
1726 * Visual should prefer to request a higher volume of data.
1727 */
1728 preferHigherDataVolume?: boolean;
1729 }
1730
1731 /** Parameters available to a sortable visual candidate */
1732 export interface VisualSortableOptions {
1733 /* The data view mapping for this visual with some additional information.*/
1734 dataViewMappings: data.CompiledDataViewMapping[];
1735 }
1736
1737 /** An imperative way for a visual to influence query generation beyond just its declared capabilities. */
1738 export interface CustomizeQueryMethod {
1739 (options: CustomizeQueryOptions): void;
1740 }
1741
1742 /** Defines the visual filtering capability for a particular filter kind. */
1743 export interface VisualFilterMapping {
1744 /** Specifies what data roles are used to control the filter semantics for this filter kind. */
1745 targetRoles: string[];
1746 }
1747
1748 /**
1749 * Defines the visual filtering capabilities for various filter kinds.
1750 * By default all visuals support attribute filters and measure filters in their innermost scope.
1751 */
1752 export interface VisualFilterMappings {
1753 measureFilter?: VisualFilterMapping;
1754 }
1755
1756 /** Defines the capabilities of an IVisual. */
1757 export interface VisualCapabilities {
1758 /** Defines what roles the visual expects, and how those roles should be populated. This is useful for visual generation/editing. */
1759 dataRoles?: VisualDataRole[];
1760
1761 /** Defines the set of objects supported by this IVisual. */
1762 objects?: DataViewObjectDescriptors;
1763
1764 /** Defines how roles that the visual understands map to the DataView. This is useful for query generation. */
1765 dataViewMappings?: DataViewMapping[];
1766
1767 /** Defines how filters are understood by the visual. This is used by query generation */
1768 filterMappings?: VisualFilterMappings;
1769
1770 /** Indicates whether cross-highlight is supported by the visual. This is useful for query generation. */
1771 supportsHighlight?: boolean;
1772
1773 /** Indicates whether the visual uses onSelected function for data selections. Default is true. */
1774 supportsSelection?: boolean;
1775
1776 /** Indicates whether sorting is supported by the visual. This is useful for query generation */
1777 sorting?: VisualSortingCapabilities;
1778
1779 /** Indicates whether a default title should be displayed. Visuals with self-describing layout can omit this. */
1780 suppressDefaultTitle?: boolean;
1781
1782 /** Indicates whether a default padding should be applied. */
1783 suppressDefaultPadding?: boolean;
1784
1785 /** Indicates whether drilling is supported by the visual. */
1786 drilldown?: VisualDrillCapabilities;
1787
1788 /** Indicates whether rotating is supported by the visual. */
1789 canRotate?: boolean;
1790
1791 /** Indicates whether showing the data underlying this visual would be helpful. Visuals that already show raw data can specify this. */
1792 disableVisualDetails?: boolean;
1793
1794 /** Indicates whether focus mode is supported for the visual. Visuals that would not benefit from focus mode (such as non-data-bound ones) can set it to true. */
1795 disableFocusMode?: boolean;
1796 }
1797
1798 /** Defines the visual sorting capability. */
1799 export interface VisualSortingCapabilities {
1800 /** When specified, indicates that the IVisual wants default sorting behavior. */
1801 default?: {};
1802
1803 /** When specified, indicates that the IVisual wants to control sort interactivity. */
1804 custom?: {};
1805
1806 /** When specified, indicates sorting that is inherently implied by the IVisual. This is useful to automatically sort. */
1807 implicit?: VisualImplicitSorting;
1808 }
1809
1810 /** Defines the visual's drill capability. */
1811 export interface VisualDrillCapabilities {
1812 /** Returns the drillable role names for this visual **/
1813 roles?: string[];
1814 }
1815
1816 /** Defines implied sorting behaviour for an IVisual. */
1817 export interface VisualImplicitSorting {
1818 clauses: VisualImplicitSortingClause[];
1819 }
1820
1821 export interface VisualImplicitSortingClause {
1822 role: string;
1823 direction: SortDirection;
1824 }
1825
1826 /** Defines the capabilities of an IVisual. */
1827 export interface VisualInitOptions {
1828 /** The DOM element the visual owns. */
1829 element: JQuery;
1830
1831 /** The set of services provided by the visual hosting layer. */
1832 host: IVisualHostServices;
1833
1834 /** Style information. */
1835 style: IVisualStyle;
1836
1837 /** The initial viewport size. */
1838 viewport: IViewport;
1839
1840 /** Animation options. */
1841 animation?: AnimationOptions;
1842
1843 /** Interactivity options. */
1844 interactivity?: InteractivityOptions;
1845 }
1846
1847 export interface VisualUpdateOptions {
1848 viewport: IViewport;
1849 dataViews: DataView[];
1850 suppressAnimations?: boolean;
1851 viewMode?: ViewMode;
1852 resizeMode?: ResizeMode;
1853 type?: VisualUpdateType;
1854 /** Indicates what type of update has been performed on the data.
1855 The default operation kind is Create.*/
1856 operationKind?: VisualDataChangeOperationKind;
1857 }
1858
1859 export interface VisualDataChangedOptions {
1860 dataViews: DataView[];
1861
1862 /** Optionally prevent animation transitions */
1863 suppressAnimations?: boolean;
1864
1865 /** Indicates what type of update has been performed on the data.
1866 The default operation kind is Create.*/
1867 operationKind?: VisualDataChangeOperationKind;
1868 }
1869
1870 export interface CustomSortEventArgs {
1871 sortDescriptors: SortableFieldDescriptor[];
1872 }
1873
1874 export interface SortableFieldDescriptor {
1875 queryName: string;
1876 sortDirection?: SortDirection;
1877 }
1878
1879 export interface IVisualErrorMessage {
1880 message: string;
1881 title: string;
1882 detail: string;
1883 }
1884
1885 export interface IVisualWarning {
1886 code: string;
1887 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
1888 }
1889
1890 /** Animation options for visuals. */
1891 export interface AnimationOptions {
1892 /** Indicates whether all transition frames should be flushed immediately, effectively "disabling" any visual transitions. */
1893 transitionImmediate: boolean;
1894 }
1895
1896 /** Interactivity options for visuals. */
1897 export interface InteractivityOptions {
1898 /** Indicates that dragging of data points should be permitted. */
1899 dragDataPoint?: boolean;
1900
1901 /** Indicates that data points should be selectable. */
1902 selection?: boolean;
1903
1904 /** Indicates that the chart and the legend are interactive */
1905 isInteractiveLegend?: boolean;
1906
1907 /** Indicates overflow behavior. Values are CSS oveflow strings */
1908 overflow?: string;
1909 }
1910
1911 export interface VisualDragPayload extends DragPayload {
1912 data?: Selector;
1913 field?: {};
1914 }
1915
1916 export interface DragEventArgs {
1917 event: DragEvent;
1918 data: VisualDragPayload;
1919 }
1920
1921 /** Defines geocoding services. */
1922 export interface IGeocoder {
1923 geocode(query: string, category?: string): IPromise<IGeocodeCoordinate>;
1924 geocodeBoundary(latitude: number, longitude: number, category: string, levelOfDetail?: number, maxGeoData?: number): IPromise<IGeocodeBoundaryCoordinate>;
1925 geocodePoint(latitude: number, longitude: number): IPromise<IGeocodeResource>;
1926
1927 /** returns data immediately if it is locally available (e.g. in cache), null if not in cache */
1928 tryGeocodeImmediate(query: string, category?: string): IGeocodeCoordinate;
1929 tryGeocodeBoundaryImmediate(latitude: number, longitude: number, category: string, levelOfDetail?: number, maxGeoData?: number): IGeocodeBoundaryCoordinate;
1930 }
1931
1932 export interface IGeocodeCoordinate {
1933 latitude: number;
1934 longitude: number;
1935 }
1936
1937 export interface IGeocodeBoundaryCoordinate {
1938 latitude?: number;
1939 longitude?: number;
1940 locations?: IGeocodeBoundaryPolygon[]; // one location can have multiple boundary polygons
1941 }
1942
1943 export interface IGeocodeResource extends IGeocodeCoordinate {
1944 addressLine: string;
1945 locality: string;
1946 neighborhood: string;
1947 adminDistrict: string;
1948 adminDistrict2: string;
1949 formattedAddress: string;
1950 postalCode: string;
1951 countryRegionIso2: string;
1952 countryRegion: string;
1953 landmark: string;
1954 }
1955
1956 export interface IGeocodeBoundaryPolygon {
1957 nativeBing: string;
1958
1959 /** array of lat/long pairs as [lat1, long1, lat2, long2,...] */
1960 geographic?: Float64Array;
1961
1962 /** array of absolute pixel position pairs [x1,y1,x2,y2,...]. It can be used by the client for cache the data. */
1963 absolute?: Float64Array;
1964 absoluteBounds?: IRect;
1965
1966 /** string of absolute pixel position pairs "x1 y1 x2 y2...". It can be used by the client for cache the data. */
1967 absoluteString?: string;
1968 }
1969
1970 export interface SelectorForColumn {
1971 [queryName: string]: data.DataRepetitionSelector;
1972 }
1973
1974 export interface SelectorsByColumn {
1975 /** Data-bound repetition selection. */
1976 dataMap?: SelectorForColumn;
1977
1978 /** Metadata-bound repetition selection. Refers to a DataViewMetadataColumn queryName. */
1979 metadata?: string;
1980
1981 /** User-defined repetition selection. */
1982 id?: string;
1983 }
1984
1985 // TODO: Consolidate these two into one object and add a method to transform SelectorsByColumn[] into Selector[] for components that need that structure
1986 export interface SelectEventArgs {
1987 data: Selector[];
1988 data2?: SelectorsByColumn[];
1989 }
1990
1991 export interface ContextMenuArgs {
1992 data: SelectorsByColumn[];
1993
1994 /** Absolute coordinates for the top-left anchor of the context menu. */
1995 position: IPoint;
1996 }
1997
1998 export interface SelectObjectEventArgs {
1999 object: DataViewObjectDescriptor;
2000 }
2001
2002 export interface FilterAnalyzerOptions {
2003 dataView: DataView;
2004
2005 /** The DataViewObjectPropertyIdentifier for default value */
2006 defaultValuePropertyId: DataViewObjectPropertyIdentifier;
2007
2008 /** The filter that will be analyzed */
2009 filter: ISemanticFilter;
2010
2011 /** The field SQExprs used in the filter */
2012 fieldSQExprs: ISQExpr[];
2013 }
2014
2015 export interface AnalyzedFilter {
2016 /** The default value of the slicer selected item and it can be undefined if there is no default value */
2017 defaultValue?: DefaultValueDefinition;
2018
2019 /** Indicates the filter has Not condition. */
2020 isNotFilter: boolean;
2021
2022 /** The selected filter values. */
2023 selectedIdentities: DataViewScopeIdentity[];
2024
2025 /** The filter after analyzed. It will be the default filter if it has defaultValue and the pre-analyzed filter is undefined. */
2026 filter: ISemanticFilter;
2027 }
2028
2029 /** Defines behavior for IVisual interaction with the host environment. */
2030 export interface IVisualHostServices {
2031 /** Returns the localized form of a string. */
2032 getLocalizedString(stringId: string): string;
2033
2034 /** Notifies of a DragStart event. */
2035 onDragStart(args: DragEventArgs): void;
2036
2037 ///** Indicates whether the drag payload is compatible with the IVisual's data role. This is useful when dropping to a particular drop area within the visual (e.g., dropping on a legend). */
2038 //canDropAs(payload: DragPayload, dataRole?: string): boolean;
2039
2040 ///** Notifies of a Drop event. */
2041 //onDrop(args: DragEventArgs, dataRole?: string);
2042
2043 /** Gets a value indicating whether the given selection is valid. */
2044 canSelect(args: SelectEventArgs): boolean;
2045
2046 /** Notifies of a data point being selected. */
2047 onSelect(args: SelectEventArgs): void; // TODO: Revisit onSelect vs. onSelectObject.
2048
2049 /** Notifies of a request for a context menu. */
2050 onContextMenu(args: ContextMenuArgs): void;
2051
2052 /** Check if selection is sticky or otherwise. */
2053 shouldRetainSelection(): boolean;
2054
2055 /** Notifies of a visual object being selected. */
2056 onSelectObject?(args: SelectObjectEventArgs): void; // TODO: make this mandatory, not optional.
2057
2058 /** Notifies that properties of the IVisual have changed. */
2059 persistProperties(changes: VisualObjectInstance[]): void;
2060 persistProperties(changes: VisualObjectInstancesToPersist): void;
2061
2062 ///** This information will be part of the query. */
2063 //onDataRangeChanged(range: {
2064 // categorical: { // TODO: this structure is affected by the reduction algorithm as well as the data view type
2065 // categories?: {
2066 // /** Index of the category. */
2067 // index: number;
2068 // lower?: DataViewScopeIdentity;
2069 // upper?: DataViewScopeIdentity;
2070 // }[]
2071 // }
2072 // });
2073
2074 ///** Notifies of a drill down on the specified data point. */
2075 //onDrillDown(data: DataViewScopeIdentity): void;
2076
2077 /** Requests more data to be loaded. */
2078 loadMoreData(): void;
2079
2080 /** Notification to sort on the specified column */
2081 onCustomSort(args: CustomSortEventArgs): void;
2082
2083 /** Indicates which view mode the host is in. */
2084 getViewMode(): ViewMode;
2085
2086 /** Notify any warning that happened during update of the visual. */
2087 setWarnings(clientWarnings: IVisualWarning[]): void;
2088
2089 /** Sets a toolbar on the host. */
2090 setToolbar($selector: JQuery): void;
2091
2092 /** Gets Geocoding Service. */
2093 geocoder(): IGeocoder;
2094
2095 /** Gets IGeolocation Service */
2096 geolocation(): IGeolocation;
2097
2098 /** Gets the locale string */
2099 locale?(): string;
2100
2101 /** Gets the promise factory. */
2102 promiseFactory(): IPromiseFactory;
2103
2104 /** Gets filter analyzer */
2105 analyzeFilter(options: FilterAnalyzerOptions): AnalyzedFilter;
2106
2107 /** Gets display name for the identities */
2108 getIdentityDisplayNames(identities: DataViewScopeIdentity[]): DisplayNameIdentityPair[];
2109
2110 /** Set the display names for their corresponding DataViewScopeIdentity */
2111 setIdentityDisplayNames(displayNamesIdentityPairs: DisplayNameIdentityPair[]): void;
2112
2113 }
2114
2115 export interface DisplayNameIdentityPair {
2116 displayName: string;
2117 identity: DataViewScopeIdentity;
2118 }
2119}
2120
2121
2122
2123declare module powerbi {
2124
2125 export interface IVisualPlugin {
2126 /** The name of the plugin. Must match the property name in powerbi.visuals. */
2127 name: string;
2128
2129 /** The key for the watermark style of this visual. Must match the id name in ExploreUI/views/svg/visualsWatermarks.svg */
2130 watermarkKey?: string;
2131
2132 /** Declares the capabilities for this IVisualPlugin type. */
2133 capabilities?: VisualCapabilities;
2134
2135 /** Function to call to create the visual. */
2136 create: (options?: extensibility.VisualConstructorOptions) => IVisual;
2137
2138 /**
2139 * Function to allow the visual to influence query generation. Called each time a query is generated
2140 * so the visual can translate its state into options understood by the query generator.
2141 */
2142 customizeQuery?: CustomizeQueryMethod;
2143
2144 /** Funation to allow the visual to provide additional information for telemetry. */
2145 getAdditionalTelemetry?: GetAdditionalTelemetryMethod;
2146
2147 /** The class of the plugin. At the moment it is only used to have a way to indicate the class name that a custom visual has. */
2148 class?: string;
2149
2150 /** The url to the icon to display within the visualization pane. */
2151 iconUrl?: string;
2152
2153 /** Check if a visual is custom */
2154 custom?: boolean;
2155
2156 /** Function to get the list of sortable roles */
2157 getSortableRoles?: (visualSortableOptions?: VisualSortableOptions) => string[];
2158
2159 /** The version of the api that this plugin should be run against */
2160 apiVersion?: string;
2161 }
2162
2163 /** Method for gathering addition information from the visual for telemetry. */
2164 export interface GetAdditionalTelemetryMethod {
2165 (dataView: DataView): any;
2166 }
2167
2168 /** Factory method for an IVisual. This factory method should be registered on the powerbi.visuals object. */
2169 export interface IVisualFactoryMethod {
2170 (): powerbi.IVisual;
2171 }
2172}
2173
2174
2175declare module powerbi {
2176 export interface IVisualStyle{
2177 colorPalette: IColorPalette;
2178 isHighContrast: boolean;
2179 titleText: ITextStyle;
2180 subTitleText: ITextStyle;
2181 labelText: ITextStyle;
2182 // TODO 4486317: This is a host-specific property that should be exposed through DataViewObjects.
2183 maxMarginFactor?: number;
2184 }
2185
2186 export interface ITextStyle extends IStyleInfo {
2187 fontFace?: string;
2188 fontSize?: string;
2189 fontWeight?: string;
2190 color: IColorInfo;
2191 }
2192
2193 export interface IColorPalette {
2194 background?: IColorInfo;
2195 foreground?: IColorInfo;
2196
2197 positive?: IColorInfo;
2198 neutral?: IColorInfo;
2199 negative?: IColorInfo;
2200 separator?: IColorInfo;
2201 selection?: IColorInfo;
2202
2203 dataColors: IDataColorPalette;
2204 }
2205
2206 export interface IDataColorPalette {
2207 /** Gets the color scale associated with the given key. */
2208 getColorScaleByKey(scaleKey: string): IColorScale;
2209
2210 /** Gets a fresh color scale with no colors allocated. */
2211 getNewColorScale(): IColorScale;
2212
2213 /** Gets the nth color in the palette. */
2214 getColorByIndex(index: number): IColorInfo;
2215
2216 /**
2217 * Gets the set of sentiment colors used for visuals such as KPIs
2218 * Note: This is only a temporary API so that we can have reasonable color schemes for KPIs
2219 * and gauges until the conditional formatting feature is implemented.
2220 */
2221 getSentimentColors(): IColorInfo[];
2222
2223 getBasePickerColors(): IColorInfo[];
2224
2225 /** Gets all the colors for the color palette **/
2226 getAllColors?(): IColorInfo[];
2227 }
2228
2229 export interface IColorScale {
2230 /** Gets the color associated with the given key. */
2231 getColor(key: any): IColorInfo;
2232
2233 /**
2234 * Clears the current scale, but rotates the colors such that the first color allocated will
2235 * the be first color that would have been allocated before clearing the scale.
2236 */
2237 clearAndRotateScale(): void;
2238
2239 /** Returns a copy of the current scale. */
2240 clone(): IColorScale;
2241
2242 getDomain(): any[];
2243 }
2244
2245 export interface IColorInfo extends IStyleInfo {
2246 value: string;
2247 }
2248
2249 export interface IStyleInfo {
2250 className?: string;
2251 }
2252}
2253
2254
2255declare module powerbi {
2256 import Selector = powerbi.data.Selector;
2257
2258 export interface VisualObjectInstance {
2259 /** The name of the object (as defined in VisualCapabilities). */
2260 objectName: string;
2261
2262 /** A display name for the object instance. */
2263 displayName?: string;
2264
2265 /** The set of property values for this object. Some of these properties may be defaults provided by the IVisual. */
2266 properties: {
2267 [propertyName: string]: DataViewPropertyValue;
2268 };
2269
2270 /** The selector that identifies this object. */
2271 selector: Selector;
2272
2273 /** Defines the constrained set of valid values for a property. */
2274 validValues?: {
2275 [propertyName: string]: string[];
2276 };
2277
2278 /** (Optional) VisualObjectInstanceEnumeration category index. */
2279 containerIdx?: number;
2280 }
2281
2282 export type VisualObjectInstanceEnumeration = VisualObjectInstance[] | VisualObjectInstanceEnumerationObject;
2283
2284 export interface VisualObjectInstanceEnumerationObject {
2285 /** The visual object instances. */
2286 instances: VisualObjectInstance[];
2287
2288 /** Defines a set of containers for related object instances. */
2289 containers?: VisualObjectInstanceContainer[];
2290 }
2291
2292 export interface VisualObjectInstanceContainer {
2293 displayName: data.DisplayNameGetter;
2294 }
2295
2296 export interface VisualObjectInstancesToPersist {
2297 /** Instances which should be merged with existing instances. */
2298 merge?: VisualObjectInstance[];
2299
2300 /** Instances which should replace existing instances. */
2301 replace?: VisualObjectInstance[];
2302
2303 /** Instances which should be deleted from the existing instances. */
2304 remove?: VisualObjectInstance[];
2305 }
2306
2307 export interface EnumerateVisualObjectInstancesOptions {
2308 objectName: string;
2309 }
2310}
2311
2312
2313
2314declare module powerbi {
2315 import Selector = powerbi.data.Selector;
2316
2317 export interface VisualObjectRepetition {
2318 /** The selector that identifies the objects. */
2319 selector: Selector;
2320
2321 /** The set of repetition descriptors for this object. */
2322 objects: {
2323 [objectName: string]: DataViewRepetitionObjectDescriptor;
2324 };
2325 }
2326
2327 export interface DataViewRepetitionObjectDescriptor {
2328 /** Properties used for formatting (e.g., Conditional Formatting). */
2329 formattingProperties?: string[];
2330 }
2331}
2332;declare module powerbi.visuals.telemetry {
2333 /**
2334 * Creates a client-side Guid string.
2335 * @returns A string representation of a Guid.
2336 */
2337 function generateGuid(): string;
2338}
2339declare module powerbi.visuals.telemetry {
2340 /**
2341 * Event fired when a visual is loaded through the visual adapter
2342 * @param name Name (guid) of the visual.
2343 * @param apiVersion Api version used by the visual.
2344 * @param custom Is the visual custom?
2345 * @param parentId Id of the parent event
2346 * @param isError True - action failed.
2347 * @param errorSource Source of the error. PowerBI = PowerBI has a problem, External = External Service (e.g. on-prem AS server is down), User = User error (e.g. uploading too much and hitting resource limitations.
2348 * @param errorCode PowerBI Error Code
2349 *
2350 * Generated by: Extensibility/events.bond
2351 */
2352 var ExtensibilityVisualApiUsageLoggers: number;
2353 var ExtensibilityVisualApiUsage: (name: string, apiVersion: string, custom: boolean, parentId: string, isError?: boolean, errorSource?: ErrorSource, errorCode?: string) => ITelemetryEventI<IPBIExtensibilityVisualApiUsage>;
2354 /**
2355 * Event fired for uncaught exception in IVisual.
2356 * @param visualType Type of the visual.
2357 * @param isCustom Is the visual custom?
2358 * @param apiVersion Api version used by the visual
2359 * @param source Source URL
2360 * @param lineNumber Line number
2361 * @param columnNumber Column number
2362 * @param stack Stack trace
2363 * @param message Error exception message.
2364 *
2365 * Generated by JsCommon/commonTelemetryEvents.bond
2366 */
2367 var VisualExceptionLoggers: number;
2368 var VisualException: (visualType: string, isCustom: boolean, apiVersion: string, source: string, lineNumber: number, columnNumber: number, stack: string, message: string) => ITelemetryEventI<IPBIVisualException>;
2369}
2370declare module powerbi.extensibility {
2371 function VisualPlugin(options: IVisualPluginOptions): ClassDecorator;
2372}
2373declare module powerbi.extensibility {
2374 import IPoint = visuals.IPoint;
2375 interface SelectionManagerOptions {
2376 hostServices: IVisualHostServices;
2377 }
2378 class SelectionManager implements ISelectionManager {
2379 private selectedIds;
2380 private hostServices;
2381 private promiseFactory;
2382 constructor(options: SelectionManagerOptions);
2383 select(selectionId: ISelectionId, multiSelect?: boolean): IPromise<ISelectionId[]>;
2384 showContextMenu(selectionId: ISelectionId, position: IPoint): IPromise<{}>;
2385 hasSelection(): boolean;
2386 clear(): IPromise<{}>;
2387 getSelectionIds(): ISelectionId[];
2388 private sendSelectionToHost(ids);
2389 private sendContextMenuToHost(selectionId, position);
2390 private getSelectorsByColumn(selectionIds);
2391 private selectInternal(selectionId, multiSelect);
2392 static containsSelection(list: ISelectionId[], id: ISelectionId): boolean;
2393 }
2394}
2395declare module powerbi.extensibility {
2396 /**
2397 * This class is designed to simplify the creation of SelectionId objects
2398 * It allows chaining to build up an object before calling 'create' to build a SelectionId
2399 */
2400 class SelectionIdBuilder implements ISelectionIdBuilder {
2401 private dataMap;
2402 private measure;
2403 withCategory(categoryColumn: DataViewCategoryColumn, index: number): this;
2404 withSeries(seriesColumn: DataViewValueColumns, valueColumn: DataViewValueColumn | DataViewValueColumnGroup): this;
2405 withMeasure(measureId: string): this;
2406 createSelectionId(): ISelectionId;
2407 private ensureDataMap();
2408 }
2409}
2410declare module powerbi.extensibility {
2411 import ITelemetryService = visuals.telemetry.ITelemetryService;
2412 let visualApiVersions: VisualVersion[];
2413 function createVisualAdapter(visualPlugin: IVisualPlugin, telemetryService?: powerbi.ITelemetryService | ITelemetryService): powerbi.IVisual;
2414 class VisualAdapter implements powerbi.IVisual, WrappedVisual {
2415 private visual;
2416 private apiVersionIndex;
2417 private plugin;
2418 private telemetryService;
2419 private legacy;
2420 constructor(visualPlugin: IVisualPlugin, telemetryService?: ITelemetryService);
2421 init(options: powerbi.VisualInitOptions): void;
2422 update(options: powerbi.VisualUpdateOptions): void;
2423 destroy(): void;
2424 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
2425 enumerateObjectRepetition(): VisualObjectRepetition[];
2426 onResizing(finalViewport: IViewport, resizeMode: ResizeMode): void;
2427 onDataChanged(options: VisualDataChangedOptions): void;
2428 onViewModeChanged(viewMode: ViewMode): void;
2429 onClearSelection(): void;
2430 canResizeTo(viewport: IViewport): boolean;
2431 unwrap(): powerbi.IVisual;
2432 private visualNew;
2433 private visualLegacy;
2434 private visualHasMethod(methodName);
2435 private getVersionIndex(version);
2436 private overloadMethods();
2437 private getCompiledOverloads();
2438 }
2439}
2440declare module powerbi.extensibility {
2441 import ITelemetryService = visuals.telemetry.ITelemetryService;
2442 import VisualTelemetryInfo = visuals.telemetry.VisualTelemetryInfo;
2443 class VisualSafeExecutionWrapper implements powerbi.IVisual, WrappedVisual {
2444 private wrappedVisual;
2445 private visualInfo;
2446 private telemetryService;
2447 private silent;
2448 constructor(wrappedVisual: powerbi.IVisual, visualInfo: VisualTelemetryInfo, telemetryService: ITelemetryService, silent?: boolean);
2449 init(options: VisualInitOptions): void;
2450 destroy(): void;
2451 update(options: powerbi.VisualUpdateOptions): void;
2452 onResizing(finalViewport: IViewport, resizeMode: ResizeMode): void;
2453 onDataChanged(options: VisualDataChangedOptions): void;
2454 onViewModeChanged(viewMode: ViewMode): void;
2455 onClearSelection(): void;
2456 canResizeTo(viewport: IViewport): boolean;
2457 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
2458 enumerateObjectRepetition(): VisualObjectRepetition[];
2459 unwrap(): powerbi.IVisual;
2460 isCustomVisual(): boolean;
2461 private executeSafely(callback);
2462 }
2463}
2464declare module powerbi.extensibility.v100 {
2465}
2466declare module powerbi.extensibility.v110 {
2467}
2468;declare module jsCommon {
2469 /**
2470 * DOM constants.
2471 */
2472 module DOMConstants {
2473 /**
2474 * Integer codes corresponding to individual keys on the keyboard.
2475 */
2476 const escKeyCode: number;
2477 const enterKeyCode: number;
2478 const tabKeyCode: number;
2479 const upArrowKeyCode: number;
2480 const downArrowKeyCode: number;
2481 const leftArrowKeyCode: number;
2482 const rightArrowKeyCode: number;
2483 const homeKeyCode: number;
2484 const endKeyCode: number;
2485 const backSpaceKeyCode: number;
2486 const deleteKeyCode: number;
2487 const spaceKeyCode: number;
2488 const shiftKeyCode: number;
2489 const ctrlKeyCode: number;
2490 const altKeyCode: number;
2491 const aKeyCode: number;
2492 const cKeyCode: number;
2493 const sKeyCode: number;
2494 const vKeyCode: number;
2495 const wKeyCode: number;
2496 const xKeyCode: number;
2497 const yKeyCode: number;
2498 const zKeyCode: number;
2499 /**
2500 * DOM Elements.
2501 */
2502 const DocumentBody: string;
2503 const Anchor: string;
2504 const EditableTextElements: string;
2505 const EditableNumericElements: string;
2506 /**
2507 * DOM Attributes and values.
2508 */
2509 const disabledAttributeOrValue: string;
2510 const readonlyAttributeOrValue: string;
2511 const idAttribute: string;
2512 const styleAttribute: string;
2513 const hrefAttribute: string;
2514 const targetAttribute: string;
2515 const blankValue: string;
2516 const selfValue: string;
2517 const classAttribute: string;
2518 const titleAttribute: string;
2519 const srcAttribute: string;
2520 /**
2521 * DOM event names.
2522 */
2523 const contextmenuEventName: string;
2524 const blurEventName: string;
2525 const keyUpEventName: string;
2526 const inputEventName: string;
2527 const changeEventName: string;
2528 const cutEventName: string;
2529 const keyDownEventName: string;
2530 const mouseMoveEventName: string;
2531 const mouseDownEventName: string;
2532 const mouseEnterEventName: string;
2533 const mouseLeaveEventName: string;
2534 const mouseOverEventName: string;
2535 const mouseOutEventName: string;
2536 const mouseClickEventName: string;
2537 const pasteEventName: string;
2538 const scrollEventName: string;
2539 const dropEventName: string;
2540 const focusEventName: string;
2541 const focusInEventName: string;
2542 const focusOutEventName: string;
2543 const selectEventName: string;
2544 const messageEventName: string;
2545 const loadEventName: string;
2546 const beforeUnload: string;
2547 /**
2548 * Common DOM event combination names.
2549 */
2550 const inputAndSelectEventNames: string;
2551 }
2552}
2553declare module powerbi {
2554 import IStringResourceProvider = jsCommon.IStringResourceProvider;
2555 interface ServiceError {
2556 statusCode: number;
2557 /**
2558 * This error code corresponds with a PowerBIServiceException that happened on the server.
2559 */
2560 errorCode?: string;
2561 /**
2562 * Message and stack trace should only be sent in non-production environments.
2563 */
2564 message?: string;
2565 stackTrace?: string;
2566 errorDetails?: PowerBIErrorDetail[];
2567 parameters?: ErrorParameter[];
2568 }
2569 interface PowerBIErrorDetail {
2570 code: string;
2571 detail: PowerBIErrorDetailValue;
2572 }
2573 interface ErrorParameter {
2574 Key: string;
2575 Value: string;
2576 }
2577 interface PowerBIErrorDetailValue {
2578 type: PowerBIErrorResourceType;
2579 value: string;
2580 }
2581 enum PowerBIErrorResourceType {
2582 ResourceCodeReference = 0,
2583 EmbeddedString = 1,
2584 }
2585 const enum ServiceErrorStatusCode {
2586 GeneralError = 0,
2587 CsdlFetching = 1,
2588 CsdlConvertXmlToConceptualSchema = 2,
2589 CsdlCreateClientSchema = 3,
2590 ExecuteSemanticQueryError = 4,
2591 ExecuteSemanticQueryInvalidStreamFormat = 5,
2592 ExecuteSemanticQueryTransformError = 6,
2593 }
2594 class ServiceErrorToClientError implements IClientError {
2595 private m_serviceError;
2596 private httpRequestId;
2597 private static codeName;
2598 code: string;
2599 ignorable: boolean;
2600 requestId: string;
2601 constructor(serviceError: ServiceError);
2602 getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
2603 }
2604 class PowerBIErrorDetailHelper {
2605 private static serverErrorPrefix;
2606 static addAdditionalInfo(errorDetails: ErrorDetails, pbiErrorDetails: PowerBIErrorDetail[], localize: IStringResourceProvider): ErrorDetails;
2607 static addMessageAndStackTrace(errorDetails: ErrorDetails, message: string, stackTrace: string, localize: IStringResourceProvider): ErrorDetails;
2608 static GetDetailsFromTransformError(localize: IStringResourceProvider, serviceError: ServiceError): ErrorDetails;
2609 static GetDetailsFromServerErrorStatusCode(localize: IStringResourceProvider, statusCode: number): ErrorDetails;
2610 }
2611}
2612declare module powerbi {
2613 let build: any;
2614}
2615declare module powerbi {
2616 const CategoryTypes: {
2617 Address: string;
2618 City: string;
2619 Continent: string;
2620 CountryRegion: string;
2621 County: string;
2622 Longitude: string;
2623 Latitude: string;
2624 Place: string;
2625 PostalCode: string;
2626 StateOrProvince: string;
2627 };
2628 interface IGeoTaggingAnalyzerService {
2629 isLongitudeOrLatitude(fieldRefName: string): boolean;
2630 isGeographic(fieldRefName: string): boolean;
2631 isGeocodable(fieldRefName: string): boolean;
2632 getFieldType(fieldName: string): string;
2633 isGeoshapable(fieldRefName: string): boolean;
2634 }
2635 function createGeoTaggingAnalyzerService(getLocalized: (string) => string): IGeoTaggingAnalyzerService;
2636 class GeoTaggingAnalyzerService implements IGeoTaggingAnalyzerService {
2637 private GeotaggingString_Continent;
2638 private GeotaggingString_Continents;
2639 private GeotaggingString_Country;
2640 private GeotaggingString_Countries;
2641 private GeotaggingString_State;
2642 private GeotaggingString_States;
2643 private GeotaggingString_City;
2644 private GeotaggingString_Cities;
2645 private GeotaggingString_Town;
2646 private GeotaggingString_Towns;
2647 private GeotaggingString_Province;
2648 private GeotaggingString_Provinces;
2649 private GeotaggingString_County;
2650 private GeotaggingString_Counties;
2651 private GeotaggingString_Village;
2652 private GeotaggingString_Villages;
2653 private GeotaggingString_Post;
2654 private GeotaggingString_Zip;
2655 private GeotaggingString_Code;
2656 private GeotaggingString_Place;
2657 private GeotaggingString_Places;
2658 private GeotaggingString_Address;
2659 private GeotaggingString_Addresses;
2660 private GeotaggingString_Street;
2661 private GeotaggingString_Streets;
2662 private GeotaggingString_Longitude;
2663 private GeotaggingString_Longitude_Short;
2664 private GeotaggingString_Latitude;
2665 private GeotaggingString_Latitude_Short;
2666 private GeotaggingString_PostalCode;
2667 private GeotaggingString_PostalCodes;
2668 private GeotaggingString_ZipCode;
2669 private GeotaggingString_ZipCodes;
2670 private GeotaggingString_Territory;
2671 private GeotaggingString_Territories;
2672 private GeotaggingString_VRMBackCompat_CountryRegion;
2673 private GeotaggingString_VRMBackCompat_StateOrProvince;
2674 constructor(getLocalized: (string) => string);
2675 isLongitudeOrLatitude(fieldRefName: string): boolean;
2676 isGeographic(fieldRefName: string): boolean;
2677 isGeocodable(fieldRefName: string): boolean;
2678 isGeoshapable(fieldRefName: string): boolean;
2679 private isGeoshapableEnglish(fieldRefName);
2680 private isAddress(fieldRefName);
2681 private isPlace(fieldRefName);
2682 private isCity(fieldRefName);
2683 private isStateOrProvince(fieldRefName);
2684 private isCountry(fieldRefName);
2685 private isCounty(fieldRefName);
2686 private isContinent(fieldRefName);
2687 private isPostalCode(fieldRefName);
2688 private isLongitude(fieldRefName);
2689 private isLatitude(fieldRefName);
2690 private isTerritory(fieldRefName);
2691 private static hasMatches(fieldName, possibleMatches, useStrict?);
2692 getFieldType(fieldName: string): string;
2693 private isEnglishAddress(fieldRefName);
2694 private isEnglishPlace(fieldRefName);
2695 private isEnglishCity(fieldRefName);
2696 private isEnglishStateOrProvince(fieldRefName);
2697 private isEnglishCountry(fieldRefName);
2698 private isEnglishCounty(fieldRefName);
2699 private isEnglishContinent(fieldRefName);
2700 private isEnglishPostalCode(fieldRefName);
2701 private isEnglishLongitude(fieldRefName);
2702 private isEnglishLatitude(fieldRefName);
2703 protected isEnglishTerritory(fieldRefName: string): boolean;
2704 private getEnglishFieldType(fieldName);
2705 }
2706}
2707declare var DEBUG: boolean;
2708declare module powerbi {
2709 import IStringResourceProvider = jsCommon.IStringResourceProvider;
2710 interface ILocalizableError {
2711 getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
2712 }
2713 interface IClientError extends ILocalizableError {
2714 code: string;
2715 debugInfo?: string;
2716 ignorable?: boolean;
2717 requestId?: string;
2718 }
2719 interface IClientWarning extends ILocalizableError {
2720 code: string;
2721 columnNameFromIndex: (index: number) => string;
2722 }
2723 /**
2724 this base class should be derived to give a generic error message but with a unique error code.
2725 */
2726 abstract class UnknownClientError implements IClientError {
2727 private errorCode;
2728 code: string;
2729 ignorable: boolean;
2730 constructor(code: string);
2731 getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
2732 }
2733 class HttpClientError implements IClientError {
2734 private httpRequestId;
2735 private httpStatusCode;
2736 constructor(httpStatusCode: number, requestId: string);
2737 code: string;
2738 ignorable: boolean;
2739 requestId: string;
2740 getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
2741 }
2742 class IgnorableClientError implements IClientError {
2743 code: string;
2744 ignorable: boolean;
2745 getDetails(resourceProvider: IStringResourceProvider): ErrorDetails;
2746 }
2747}
2748declare module jsCommon {
2749 interface ArrayIdItems<T> extends Array<T> {
2750 withId(id: number): T;
2751 }
2752 interface ArrayNamedItems<T> extends Array<T> {
2753 withName(name: string): T;
2754 }
2755 module ArrayExtensions {
2756 /**
2757 * Returns items that exist in target and other.
2758 */
2759 function intersect<T>(target: T[], other: T[]): T[];
2760 /**
2761 * Return elements exists in target but not exists in other.
2762 */
2763 function diff<T>(target: T[], other: T[]): T[];
2764 /**
2765 * Return an array with only the distinct items in the source.
2766 */
2767 function distinct<T>(source: T[]): T[];
2768 /**
2769 * Pushes content of source onto target,
2770 * for parts of course that do not already exist in target.
2771 */
2772 function union<T>(target: T[], source: T[]): void;
2773 /**
2774 * Pushes value onto target, if value does not already exist in target.
2775 */
2776 function unionSingle<T>(target: T[], value: T): void;
2777 /**
2778 * Returns an array with a range of items from source,
2779 * including the startIndex & endIndex.
2780 */
2781 function range<T>(source: T[], startIndex: number, endIndex: number): T[];
2782 /**
2783 * Returns an array that includes items from source, up to the specified count.
2784 */
2785 function take<T>(source: T[], count: number): T[];
2786 function copy<T>(source: T[]): T[];
2787 /**
2788 * Returns a value indicating whether the arrays have the same values in the same sequence.
2789 */
2790 function sequenceEqual<T>(left: T[], right: T[], comparison: (x: T, y: T) => boolean): boolean;
2791 /**
2792 * Returns null if the specified array is empty.
2793 * Otherwise returns the specified array.
2794 */
2795 function emptyToNull<T>(array: T[]): T[];
2796 function indexOf<T>(array: T[], predicate: (T) => boolean): number;
2797 /**
2798 * Returns a copy of the array rotated by the specified offset.
2799 */
2800 function rotate<T>(array: T[], offset: number): T[];
2801 function createWithId<T>(): ArrayIdItems<T>;
2802 function extendWithId<T>(array: {
2803 id: number;
2804 }[]): ArrayIdItems<T>;
2805 /**
2806 * Finds and returns the first item with a matching ID.
2807 */
2808 function findWithId<T>(array: T[], id: number): T;
2809 function createWithName<T>(): ArrayNamedItems<T>;
2810 function extendWithName<T>(array: {
2811 name: string;
2812 }[]): ArrayNamedItems<T>;
2813 function findItemWithName<T>(array: T[], name: string): T;
2814 function indexWithName<T>(array: T[], name: string): number;
2815 /**
2816 * Inserts a number in sorted order into a list of numbers already in sorted order.
2817 * @returns True if the item was added, false if it already existed.
2818 */
2819 function insertSorted(list: number[], value: number): boolean;
2820 /**
2821 * Removes the first occurrence of a value from a list if it exists.
2822 * @returns True if the value was removed, false if it did not exist in the list.
2823 */
2824 function removeFirst<T>(list: T[], value: T): boolean;
2825 /**
2826 * Deletes all items from the array.
2827 */
2828 function clear(array: any[]): void;
2829 function isUndefinedOrEmpty(array: any[]): boolean;
2830 function swap<T>(array: T[], firstIndex: number, secondIndex: number): void;
2831 function isInArray<T>(array: T[], lookupItem: T, compareCallback: (item1: T, item2: T) => boolean): boolean;
2832 /** Checks if the given object is an Array, and looking all the way up the prototype chain. */
2833 function isArrayOrInheritedArray(obj: {}): obj is Array<any>;
2834 }
2835}
2836declare module InJs {
2837 module DomFactory {
2838 function div(): JQuery;
2839 function span(): JQuery;
2840 function checkbox(): JQuery;
2841 function ul(): JQuery;
2842 function li(): JQuery;
2843 function button(): JQuery;
2844 function select(): JQuery;
2845 function textBox(): JQuery;
2846 function img(): JQuery;
2847 function iframe(): JQuery;
2848 }
2849}
2850declare module powerbi {
2851 /**
2852 * Module Double contains a set of constants and precision based utility methods
2853 * for dealing with doubles and their decimal garbage in the javascript.
2854 */
2855 module Double {
2856 const MIN_VALUE: number;
2857 const MAX_VALUE: number;
2858 const MIN_EXP: number;
2859 const MAX_EXP: number;
2860 const EPSILON: number;
2861 const DEFAULT_PRECISION: number;
2862 const DEFAULT_PRECISION_IN_DECIMAL_DIGITS: number;
2863 const LOG_E_10: number;
2864 const POSITIVE_POWERS: number[];
2865 const NEGATIVE_POWERS: number[];
2866 /**
2867 * Returns powers of 10.
2868 * Unlike the Math.pow this function produces no decimal garbage.
2869 * @param exp Exponent.
2870 */
2871 function pow10(exp: number): number;
2872 /**
2873 * Returns the 10 base logarithm of the number.
2874 * Unlike Math.log function this produces integer results with no decimal garbage.
2875 * @param val Positive value or zero.
2876 */
2877 function log10(val: number): number;
2878 /**
2879 * Returns a power of 10 representing precision of the number based on the number of meaningful decimal digits.
2880 * For example the precision of 56,263.3767 with the 6 meaningful decimal digit is 0.1.
2881 * @param x Value.
2882 * @param decimalDigits How many decimal digits are meaningfull.
2883 */
2884 function getPrecision(x: number, decimalDigits?: number): number;
2885 /**
2886 * Checks if a delta between 2 numbers is less than provided precision.
2887 * @param x One value.
2888 * @param y Another value.
2889 * @param precision Precision value.
2890 */
2891 function equalWithPrecision(x: number, y: number, precision?: number): boolean;
2892 /**
2893 * Checks if a first value is less than another taking
2894 * into account the loose precision based equality.
2895 * @param x One value.
2896 * @param y Another value.
2897 * @param precision Precision value.
2898 */
2899 function lessWithPrecision(x: number, y: number, precision?: number): boolean;
2900 /**
2901 * Checks if a first value is less or equal than another taking
2902 * into account the loose precision based equality.
2903 * @param x One value.
2904 * @param y Another value.
2905 * @param precision Precision value.
2906 */
2907 function lessOrEqualWithPrecision(x: number, y: number, precision?: number): boolean;
2908 /**
2909 * Checks if a first value is greater than another taking
2910 * into account the loose precision based equality.
2911 * @param x One value.
2912 * @param y Another value.
2913 * @param precision Precision value.
2914 */
2915 function greaterWithPrecision(x: number, y: number, precision?: number): boolean;
2916 /**
2917 * Checks if a first value is greater or equal to another taking
2918 * into account the loose precision based equality.
2919 * @param x One value.
2920 * @param y Another value.
2921 * @param precision Precision value.
2922 */
2923 function greaterOrEqualWithPrecision(x: number, y: number, precision?: number): boolean;
2924 /**
2925 * Floors the number unless it's withing the precision distance from the higher int.
2926 * @param x One value.
2927 * @param precision Precision value.
2928 */
2929 function floorWithPrecision(x: number, precision?: number): number;
2930 /**
2931 * Ceils the number unless it's withing the precision distance from the lower int.
2932 * @param x One value.
2933 * @param precision Precision value.
2934 */
2935 function ceilWithPrecision(x: number, precision?: number): number;
2936 /**
2937 * Floors the number to the provided precision.
2938 * For example 234,578 floored to 1,000 precision is 234,000.
2939 * @param x One value.
2940 * @param precision Precision value.
2941 */
2942 function floorToPrecision(x: number, precision?: number): number;
2943 /**
2944 * Ceils the number to the provided precision.
2945 * For example 234,578 floored to 1,000 precision is 235,000.
2946 * @param x One value.
2947 * @param precision Precision value.
2948 */
2949 function ceilToPrecision(x: number, precision?: number): number;
2950 /**
2951 * Rounds the number to the provided precision.
2952 * For example 234,578 floored to 1,000 precision is 235,000.
2953 * @param x One value.
2954 * @param precision Precision value.
2955 */
2956 function roundToPrecision(x: number, precision?: number): number;
2957 /**
2958 * Returns the value making sure that it's restricted to the provided range.
2959 * @param x One value.
2960 * @param min Range min boundary.
2961 * @param max Range max boundary.
2962 */
2963 function ensureInRange(x: number, min: number, max: number): number;
2964 /**
2965 * Rounds the value - this method is actually faster than Math.round - used in the graphics utils.
2966 * @param x Value to round.
2967 */
2968 function round(x: number): number;
2969 /**
2970 * Projects the value from the source range into the target range.
2971 * @param value Value to project.
2972 * @param fromMin Minimum of the source range.
2973 * @param toMin Minimum of the target range.
2974 * @param toMax Maximum of the target range.
2975 */
2976 function project(value: number, fromMin: number, fromSize: number, toMin: number, toSize: number): number;
2977 /**
2978 * Removes decimal noise.
2979 * @param value Value to be processed.
2980 */
2981 function removeDecimalNoise(value: number): number;
2982 /**
2983 * Checks whether the number is integer.
2984 * @param value Value to be checked.
2985 */
2986 function isInteger(value: number): boolean;
2987 /**
2988 * Dividing by increment will give us count of increments
2989 * Round out the rough edges into even integer
2990 * Multiply back by increment to get rounded value
2991 * e.g. Rounder.toIncrement(0.647291, 0.05) => 0.65
2992 * @param value - value to round to nearest increment
2993 * @param increment - smallest increment to round toward
2994 */
2995 function toIncrement(value: number, increment: number): number;
2996 }
2997}
2998declare module jsCommon {
2999 module Color {
3000 function rotate(rgbString: string, rotateFactor: number): string;
3001 function normalizeToHexString(color: string): string;
3002 function parseColorString(color: string): RgbColor;
3003 function darken(color: RgbColor, diff: number): RgbColor;
3004 function rgbString(color: RgbColor): string;
3005 function hexString(color: RgbColor): string;
3006 interface RgbColor {
3007 R: number;
3008 G: number;
3009 B: number;
3010 A?: number;
3011 }
3012 }
3013}
3014declare module jsCommon {
3015 /**
3016 * CSS constants.
3017 */
3018 module CssConstants {
3019 interface ClassAndSelector {
3020 class: string;
3021 selector: string;
3022 }
3023 function createClassAndSelector(className: string): ClassAndSelector;
3024 const styleAttribute: string;
3025 const pixelUnits: string;
3026 const heightProperty: string;
3027 const widthProperty: string;
3028 const topProperty: string;
3029 const bottomProperty: string;
3030 const leftProperty: string;
3031 const rightProperty: string;
3032 const marginTopProperty: string;
3033 const marginLeftProperty: string;
3034 const displayProperty: string;
3035 const backgroundProperty: string;
3036 const backgroundColorProperty: string;
3037 const backgroundRepeatProperty: string;
3038 const backgroundSizeProperty: string;
3039 const backgroundImageProperty: string;
3040 const textShadowProperty: string;
3041 const textAlignProperty: string;
3042 const borderTopWidthProperty: string;
3043 const borderBottomWidthProperty: string;
3044 const borderLeftWidthProperty: string;
3045 const borderRightWidthProperty: string;
3046 const fontSizeProperty: string;
3047 const fontWeightProperty: string;
3048 const colorProperty: string;
3049 const opacityProperty: string;
3050 const paddingLeftProperty: string;
3051 const paddingRightProperty: string;
3052 const positionProperty: string;
3053 const maxWidthProperty: string;
3054 const minWidthProperty: string;
3055 const overflowProperty: string;
3056 const overflowXProperty: string;
3057 const overflowYProperty: string;
3058 const transformProperty: string;
3059 const webkitTransformProperty: string;
3060 const cursorProperty: string;
3061 const visibilityProperty: string;
3062 const absoluteValue: string;
3063 const zeroPixelValue: string;
3064 const autoValue: string;
3065 const hiddenValue: string;
3066 const noneValue: string;
3067 const blockValue: string;
3068 const inlineBlockValue: string;
3069 const transparentValue: string;
3070 const boldValue: string;
3071 const visibleValue: string;
3072 const tableRowValue: string;
3073 const coverValue: string;
3074 const pointerValue: string;
3075 const scrollValue: string;
3076 }
3077 interface ExtendedCSSProperties extends CSSStyleDeclaration {
3078 scrollbarShadowColor: string;
3079 scrollbarHighlightColor: string;
3080 layoutGridChar: string;
3081 layoutGridType: string;
3082 textAutospace: string;
3083 textKashidaSpace: string;
3084 writingMode: string;
3085 scrollbarFaceColor: string;
3086 backgroundPositionY: string;
3087 lineBreak: string;
3088 imeMode: string;
3089 msBlockProgression: string;
3090 layoutGridLine: string;
3091 scrollbarBaseColor: string;
3092 layoutGrid: string;
3093 layoutFlow: string;
3094 textKashida: string;
3095 filter: string;
3096 zoom: string;
3097 scrollbarArrowColor: string;
3098 behavior: string;
3099 backgroundPositionX: string;
3100 accelerator: string;
3101 layoutGridMode: string;
3102 textJustifyTrim: string;
3103 scrollbar3dLightColor: string;
3104 msInterpolationMode: string;
3105 scrollbarTrackColor: string;
3106 scrollbarDarkShadowColor: string;
3107 styleFloat: string;
3108 getAttribute(attributeName: string, flags?: number): any;
3109 setAttribute(attributeName: string, AttributeValue: any, flags?: number): void;
3110 removeAttribute(attributeName: string, flags?: number): boolean;
3111 pixelWidth: number;
3112 posHeight: number;
3113 posLeft: number;
3114 pixelTop: number;
3115 pixelBottom: number;
3116 textDecorationNone: boolean;
3117 pixelLeft: number;
3118 posTop: number;
3119 posBottom: number;
3120 textDecorationOverline: boolean;
3121 posWidth: number;
3122 textDecorationLineThrough: boolean;
3123 pixelHeight: number;
3124 textDecorationBlink: boolean;
3125 posRight: number;
3126 pixelRight: number;
3127 textDecorationUnderline: boolean;
3128 webkitTransform: string;
3129 }
3130}
3131/**
3132 * Defines a Debug object. Calls to any functions in this object removed by the minifier.
3133 * The functions within this class are not minified away, so we use the preprocessor-style
3134 * comments to have the minifier remove those as well.
3135 */
3136declare module debug {
3137 let assertFailFunction: {
3138 (message: string): void;
3139 };
3140 /**
3141 * Asserts that the condition is true, fails otherwise.
3142 */
3143 function assert(condition: boolean, message: string): void;
3144 /**
3145 * Asserts that the value is neither null nor undefined, fails otherwise.
3146 */
3147 function assertValue<T>(value: T, message: string): void;
3148 /**
3149 * Asserts that the value is neither null nor undefined, and has a length property that returns greater than zero, fails otherwise.
3150 */
3151 function assertNonEmpty<T>(value: T[], message: string): void;
3152 /**
3153 * Makes no assertion on the given value.
3154 * This is documentation/placeholder that a value is possibly null or undefined (unlike assertValue).
3155 */
3156 function assertAnyValue<T>(value: T, message: string): void;
3157 function assertFail(message: string): void;
3158}
3159declare module jsCommon {
3160 interface IError extends Error {
3161 stack?: string;
3162 argument?: string;
3163 }
3164 module Errors {
3165 function infoNavAppAlreadyPresent(): IError;
3166 function invalidOperation(message: string): IError;
3167 function argument(argumentName: string, message: string): IError;
3168 function argumentNull(argumentName: string): IError;
3169 function argumentUndefined(argumentName: string): IError;
3170 function argumentOutOfRange(argumentName: string): IError;
3171 function pureVirtualMethodException(className: string, methodName: string): IError;
3172 function notImplementedException(message: string): IError;
3173 }
3174 /**
3175 * Captures the stack trace, if available.
3176 * It optionally takes the number of frames to remove from the stack trace.
3177 * By default, it removes the last frame to consider the calling type's
3178 * constructor and the temporary error used to capture the stack trace (below).
3179 * More levels can be requested as needed e..g. when an error is created
3180 * from a helper method. <Min requirement: IE10, Chrome, Firefox, Opera>.
3181 */
3182 function getStackTrace(leadingFramesToRemove?: number): string;
3183}
3184declare module jsCommon {
3185 /**
3186 * Represents a promise that may be rejected by its consumer.
3187 */
3188 interface IRejectablePromise extends JQueryPromise<void> {
3189 reject(...args: any[]): void;
3190 }
3191 module JQueryConstants {
3192 const VisibleSelector: string;
3193 }
3194}
3195declare module jsCommon {
3196 /**
3197 * Represents a lazily instantiated value.
3198 */
3199 class Lazy<T> {
3200 private value;
3201 private factoryMethod;
3202 constructor(factoryMethod: () => T);
3203 getValue(): T;
3204 }
3205}
3206declare module powerbi {
3207 module Prototype {
3208 /**
3209 * Returns a new object with the provided obj as its prototype.
3210 */
3211 function inherit<T>(obj: T, extension?: (inherited: T) => void): T;
3212 /**
3213 * Returns a new object with the provided obj as its prototype
3214 * if, and only if, the prototype has not been previously set
3215 */
3216 function inheritSingle<T>(obj: T): T;
3217 /**
3218 * Uses the provided callback function to selectively replace contents in the provided array.
3219 * @return A new array with those values overriden
3220 * or undefined if no overrides are necessary.
3221 */
3222 function overrideArray<T, TArray>(prototype: TArray, override: (T) => T): TArray;
3223 }
3224}
3225interface ScriptErrorInfo {
3226 message: string;
3227 sourceUrl: string;
3228 lineNumber: number;
3229 columnNumber: number;
3230 stack: string;
3231}
3232interface ErrorInfoKeyValuePair {
3233 errorInfoKey: string;
3234 errorInfoValue: string;
3235}
3236declare const enum ErrorType {
3237 VisualNotSupported = 1,
3238}
3239interface ErrorDetails {
3240 message: string;
3241 additionalErrorInfo: ErrorInfoKeyValuePair[];
3242 helpLink?: string;
3243 errorType?: ErrorType;
3244}
3245declare module powerbi.visuals {
3246 module shapes {
3247 interface IPolygon {
3248 absoluteCentroid: IPoint;
3249 polygonPoints: IPoint[];
3250 }
3251 interface IPoint {
3252 x: number;
3253 y: number;
3254 }
3255 interface ISize {
3256 width: number;
3257 height: number;
3258 }
3259 interface IVector {
3260 x: number;
3261 y: number;
3262 }
3263 interface IThickness {
3264 top: number;
3265 left: number;
3266 right: number;
3267 bottom: number;
3268 }
3269 }
3270}
3271declare module jsCommon {
3272 module Formatting {
3273 /**
3274 * Translate .NET format into something supported by jQuery.Globalize.
3275 */
3276 function findDateFormat(value: Date, format: string, cultureName: string): {
3277 value: Date;
3278 format: string;
3279 };
3280 /**
3281 * Translates unsupported .NET custom format expressions to the custom expressions supported by JQuery.Globalize.
3282 */
3283 function fixDateTimeFormat(format: string): string;
3284 }
3285}
3286declare module jsCommon {
3287 /**
3288 * Public API.
3289 */
3290 interface IJavaScriptDependency {
3291 javascriptFile: string;
3292 onLoadCallback?: () => JQueryPromise<void>;
3293 }
3294 interface IDependency {
3295 javaScriptFiles?: string[];
3296 cssFiles?: string[];
3297 javaScriptFilesWithCallback?: IJavaScriptDependency[];
3298 }
3299 function requires(dependency: IDependency, to?: () => void): void;
3300}
3301declare module powerbi {
3302 function createJQueryPromiseFactory(): IPromiseFactory;
3303}
3304declare module powerbi {
3305 interface IStorageService {
3306 getData(key: string): any;
3307 setData(key: string, data: any): void;
3308 }
3309 class EphemeralStorageService implements IStorageService {
3310 private cache;
3311 private clearCacheTimerId;
3312 private clearCacheInterval;
3313 static defaultClearCacheInterval: number;
3314 constructor(clearCacheInterval?: number);
3315 getData(key: string): any;
3316 setData(key: string, data: any): void;
3317 private clearCache();
3318 }
3319 var localStorageService: IStorageService;
3320 const ephemeralStorageService: IStorageService;
3321}
3322declare module jsCommon {
3323 module WordBreaker {
3324 import TextProperties = powerbi.TextProperties;
3325 import ITextAsSVGMeasurer = powerbi.ITextAsSVGMeasurer;
3326 import ITextTruncator = powerbi.ITextTruncator;
3327 interface WordBreakerResult {
3328 start: number;
3329 end: number;
3330 }
3331 /**
3332 * Find the word nearest the cursor specified within content
3333 * @param index - point within content to search forward/backward from
3334 * @param content - string to search
3335 */
3336 function find(index: number, content: string): WordBreakerResult;
3337 /**
3338 * Test for presence of breakers within content
3339 * @param content - string to test
3340 */
3341 function hasBreakers(content: string): boolean;
3342 /**
3343 * Count the number of pieces when broken by BREAKERS_REGEX
3344 * ~2.7x faster than WordBreaker.split(content).length
3345 * @param content - string to break and count
3346 */
3347 function wordCount(content: string): number;
3348 function getMaxWordWidth(content: string, textWidthMeasurer: ITextAsSVGMeasurer, properties: TextProperties): number;
3349 /**
3350 * Split content by breakers (words) and greedy fit as many words
3351 * into each index in the result based on max width and number of lines
3352 * e.g. Each index in result corresponds to a line of content
3353 * when used by AxisHelper.LabelLayoutStrategy.wordBreak
3354 * @param content - string to split
3355 * @param properties - text properties to be used by @param:textWidthMeasurer
3356 * @param textWidthMeasurer - function to calculate width of given text content
3357 * @param maxWidth - maximum allowed width of text content in each result
3358 * @param maxNumLines - maximum number of results we will allow, valid values must be greater than 0
3359 * @param truncator - (optional) if specified, used as a function to truncate content to a given width
3360 */
3361 function splitByWidth(content: string, properties: TextProperties, textWidthMeasurer: ITextAsSVGMeasurer, maxWidth: number, maxNumLines: number, truncator?: ITextTruncator): string[];
3362 }
3363}
3364declare module powerbi {
3365 interface ITextMeasurer {
3366 (textElement: SVGTextElement): number;
3367 }
3368 interface ITextAsSVGMeasurer {
3369 (textProperties: TextProperties): number;
3370 }
3371 interface ITextTruncator {
3372 (properties: TextProperties, maxWidth: number): string;
3373 }
3374 interface TextProperties {
3375 text?: string;
3376 fontFamily: string;
3377 fontSize: string;
3378 fontWeight?: string;
3379 fontStyle?: string;
3380 fontVariant?: string;
3381 whiteSpace?: string;
3382 }
3383 module TextMeasurementService {
3384 /**
3385 * Removes spanElement from DOM.
3386 */
3387 function removeSpanElement(): void;
3388 /**
3389 * This method measures the width of the text with the given SVG text properties.
3390 * @param textProperties The text properties to use for text measurement.
3391 */
3392 function measureSvgTextWidth(textProperties: TextProperties): number;
3393 /**
3394 * This method return the rect with the given SVG text properties.
3395 * @param textProperties The text properties to use for text measurement.
3396 */
3397 function measureSvgTextRect(textProperties: TextProperties): SVGRect;
3398 /**
3399 * This method measures the height of the text with the given SVG text properties.
3400 * @param textProperties The text properties to use for text measurement.
3401 */
3402 function measureSvgTextHeight(textProperties: TextProperties): number;
3403 /**
3404 * This method returns the text Rect with the given SVG text properties.
3405 * @param {TextProperties} textProperties - The text properties to use for text measurement
3406 */
3407 function estimateSvgTextBaselineDelta(textProperties: TextProperties): number;
3408 /**
3409 * This method estimates the height of the text with the given SVG text properties.
3410 * @param {TextProperties} textProperties - The text properties to use for text measurement
3411 */
3412 function estimateSvgTextHeight(textProperties: TextProperties, tightFightForNumeric?: boolean): number;
3413 /**
3414 * This method measures the width of the svgElement.
3415 * @param svgElement The SVGTextElement to be measured.
3416 */
3417 function measureSvgTextElementWidth(svgElement: SVGTextElement): number;
3418 /**
3419 * This method fetches the text measurement properties of the given DOM element.
3420 * @param element The selector for the DOM Element.
3421 */
3422 function getMeasurementProperties(element: JQuery): TextProperties;
3423 /**
3424 * This method fetches the text measurement properties of the given SVG text element.
3425 * @param svgElement The SVGTextElement to be measured.
3426 */
3427 function getSvgMeasurementProperties(svgElement: SVGTextElement): TextProperties;
3428 /**
3429 * This method returns the width of a div element.
3430 * @param element The div element.
3431 */
3432 function getDivElementWidth(element: JQuery): string;
3433 /**
3434 * Compares labels text size to the available size and renders ellipses when the available size is smaller.
3435 * @param textProperties The text properties (including text content) to use for text measurement.
3436 * @param maxWidth The maximum width available for rendering the text.
3437 */
3438 function getTailoredTextOrDefault(textProperties: TextProperties, maxWidth: number): string;
3439 /**
3440 * Compares labels text size to the available size and renders ellipses when the available size is smaller.
3441 * @param textElement The SVGTextElement containing the text to render.
3442 * @param maxWidth The maximum width available for rendering the text.
3443 */
3444 function svgEllipsis(textElement: SVGTextElement, maxWidth: number): void;
3445 /**
3446 * Word break textContent of <text> SVG element into <tspan>s
3447 * Each tspan will be the height of a single line of text
3448 * @param textElement - the SVGTextElement containing the text to wrap
3449 * @param maxWidth - the maximum width available
3450 * @param maxHeight - the maximum height available (defaults to single line)
3451 * @param linePadding - (optional) padding to add to line height
3452 */
3453 function wordBreak(textElement: SVGTextElement, maxWidth: number, maxHeight: number, linePadding?: number): void;
3454 /**
3455 * Word break textContent of span element into <span>s
3456 * Each span will be the height of a single line of text
3457 * @param textElement - the element containing the text to wrap
3458 * @param maxWidth - the maximum width available
3459 * @param maxHeight - the maximum height available (defaults to single line)
3460 * @param linePadding - (optional) padding to add to line height
3461 */
3462 function wordBreakOverflowingText(textElement: any, maxWidth: number, maxHeight: number, linePadding?: number): void;
3463 }
3464}
3465declare module jsCommon {
3466 module KeyUtils {
3467 function isArrowKey(keyCode: number): boolean;
3468 }
3469}
3470declare module jsCommon {
3471 /**
3472 * Responsible for throttling input function.
3473 */
3474 class ThrottleUtility {
3475 private fn;
3476 private timerFactory;
3477 private delay;
3478 constructor(delay?: number);
3479 run(fn: () => void): void;
3480 /**
3481 * Note: Public for testing purpose.
3482 */
3483 timerComplete(fn: () => void): void;
3484 }
3485}
3486declare module jsCommon {
3487 interface ITimerPromiseFactory {
3488 /**
3489 * Creates a promise that will be resolved after the specified delayInMs.
3490 * @return Promise.
3491 */
3492 create(delayInMs: number): IRejectablePromise;
3493 }
3494 /**
3495 * Responsible for creating timer promises.
3496 */
3497 class TimerPromiseFactory implements ITimerPromiseFactory {
3498 static instance: TimerPromiseFactory;
3499 /**
3500 * {@inheritDoc}
3501 */
3502 create(delayInMs: number): IRejectablePromise;
3503 }
3504}
3505/**
3506 * Defined in host.
3507 */
3508declare var clusterUri: string;
3509declare module jsCommon {
3510 /**
3511 * Http Status code we are interested.
3512 */
3513 enum HttpStatusCode {
3514 OK = 200,
3515 BadRequest = 400,
3516 Unauthorized = 401,
3517 Forbidden = 403,
3518 RequestEntityTooLarge = 413,
3519 }
3520 /**
3521 * Other HTTP Constants.
3522 */
3523 module HttpConstants {
3524 const ApplicationOctetStream: string;
3525 const MultiPartFormData: string;
3526 }
3527 /**
3528 * Extensions to String class.
3529 */
3530 module StringExtensions {
3531 function format(...args: string[]): string;
3532 /**
3533 * Compares two strings for equality, ignoring case.
3534 */
3535 function equalIgnoreCase(a: string, b: string): boolean;
3536 function startsWithIgnoreCase(a: string, b: string): boolean;
3537 function startsWith(a: string, b: string): boolean;
3538 /** Determines whether a string contains a specified substring (while ignoring case). */
3539 function containsIgnoreCase(source: string, substring: string): boolean;
3540 /**
3541 * Normalizes case for a string.
3542 * Used by equalIgnoreCase method.
3543 */
3544 function normalizeCase(value: string): string;
3545 /**
3546 * Is string null or empty or undefined?
3547 * @return True if the value is null or undefined or empty string,
3548 * otherwise false.
3549 */
3550 function isNullOrEmpty(value: string): boolean;
3551 /**
3552 * Returns true if the string is null, undefined, empty, or only includes white spaces.
3553 * @return True if the str is null, undefined, empty, or only includes white spaces,
3554 * otherwise false.
3555 */
3556 function isNullOrUndefinedOrWhiteSpaceString(str: string): boolean;
3557 /**
3558 * Returns a value indicating whether the str contains any whitespace.
3559 */
3560 function containsWhitespace(str: string): boolean;
3561 /**
3562 * Returns a value indicating whether the str is a whitespace string.
3563 */
3564 function isWhitespace(str: string): boolean;
3565 /**
3566 * Returns the string with any trailing whitespace from str removed.
3567 */
3568 function trimTrailingWhitespace(str: string): string;
3569 /**
3570 * Returns the string with any leading and trailing whitespace from str removed.
3571 */
3572 function trimWhitespace(str: string): string;
3573 /**
3574 * Returns length difference between the two provided strings.
3575 */
3576 function getLengthDifference(left: string, right: string): number;
3577 /**
3578 * Repeat char or string several times.
3579 * @param char The string to repeat.
3580 * @param count How many times to repeat the string.
3581 */
3582 function repeat(char: string, count: number): string;
3583 /**
3584 * Replace all the occurrences of the textToFind in the text with the textToReplace.
3585 * @param text The original string.
3586 * @param textToFind Text to find in the original string.
3587 * @param textToReplace New text replacing the textToFind.
3588 */
3589 function replaceAll(text: string, textToFind: string, textToReplace: string): string;
3590 function ensureUniqueNames(names: string[]): string[];
3591 /**
3592 * Returns a name that is not specified in the values.
3593 */
3594 function findUniqueName(usedNames: {
3595 [name: string]: boolean;
3596 }, baseName: string): string;
3597 function constructCommaSeparatedList(list: string[], resourceProvider: IStringResourceProvider, maxValue?: number): string;
3598 function escapeStringForRegex(s: string): string;
3599 /**
3600 * Remove file name reserved characters <>:"/\|?* from input string.
3601 */
3602 function normalizeFileName(fileName: string): string;
3603 /**
3604 * Similar to JSON.stringify, but strips away escape sequences so that the resulting
3605 * string is human-readable (and parsable by JSON formatting/validating tools).
3606 */
3607 function stringifyAsPrettyJSON(object: any): string;
3608 /**
3609 * Derive a CLS-compliant name from a specified string. If no allowed characters are present, return a fallback string instead.
3610 * TODO (6708134): this should have a fully Unicode-aware implementation
3611 */
3612 function deriveClsCompliantName(input: string, fallback: string): string;
3613 /** Performs cheap sanitization by stripping away HTML tag (<>) characters. */
3614 function stripTagDelimiters(s: string): string;
3615 }
3616 /**
3617 * Interface used for interacting with WCF typed objects.
3618 */
3619 interface TypedObject {
3620 __type: string;
3621 }
3622 interface TextMatch {
3623 start: number;
3624 end: number;
3625 text: string;
3626 }
3627 /**
3628 * The general utility class.
3629 */
3630 class Utility {
3631 private static TypeNamespace;
3632 static JsonContentType: string;
3633 static JpegContentType: string;
3634 static XJavascriptContentType: string;
3635 static JsonDataType: string;
3636 static BlobDataType: string;
3637 static HttpGetMethod: string;
3638 static HttpPostMethod: string;
3639 static HttpPutMethod: string;
3640 static HttpDeleteMethod: string;
3641 static HttpContentTypeHeader: string;
3642 static HttpAcceptHeader: string;
3643 static Undefined: string;
3644 private static staticContentLocation;
3645 /**
3646 * Ensures the specified value is not null or undefined. Throws a relevent exception if it is.
3647 * @param value The value to check.
3648 * @param context The context from which the check originated.
3649 * @param methodName The name of the method that initiated the check.
3650 * @param parameterName The parameter name of the value to check.
3651 */
3652 static throwIfNullOrUndefined(value: any, context: any, methodName: any, parameterName: any): void;
3653 /**
3654 * Ensures the specified value is not null, undefined or empty. Throws a relevent exception if it is.
3655 * @param value The value to check.
3656 * @param context The context from which the check originated.
3657 * @param methodName The name of the method that initiated the check.
3658 * @param parameterName The parameter name of the value to check.
3659 */
3660 static throwIfNullOrEmpty(value: any, context: any, methodName: string, parameterName: string): void;
3661 /**
3662 * Ensures the specified string is not null, undefined or empty. Throws a relevent exception if it is.
3663 * @param value The value to check.
3664 * @param context The context from which the check originated.
3665 * @param methodName The name of the method that initiated the check.
3666 * @param parameterName The parameter name of the value to check.
3667 */
3668 static throwIfNullOrEmptyString(value: string, context: any, methodName: string, parameterName: string): void;
3669 /**
3670 * Ensures the specified value is not null, undefined, whitespace or empty. Throws a relevent exception if it is.
3671 * @param value The value to check.
3672 * @param context The context from which the check originated.
3673 * @param methodName The name of the method that initiated the check.
3674 * @param parameterName The parameter name of the value to check.
3675 */
3676 static throwIfNullEmptyOrWhitespaceString(value: string, context: any, methodName: string, parameterName: string): void;
3677 /**
3678 * Ensures the specified condition is true. Throws relevant exception if it isn't.
3679 * @param condition The condition to check.
3680 * @param context The context from which the check originated.
3681 * @param methodName The name of the method that initiated the check.
3682 * @param parameterName The parameter name against which the condition is checked.
3683 */
3684 static throwIfNotTrue(condition: boolean, context: any, methodName: string, parameterName: string): void;
3685 /**
3686 * Checks whether the provided value is a 'string'.
3687 * @param value The value to test.
3688 */
3689 static isString(value: any): boolean;
3690 /**
3691 * Checks whether the provided value is a 'boolean'.
3692 * @param value The value to test.
3693 */
3694 static isBoolean(value: any): boolean;
3695 /**
3696 * Checks whether the provided value is a 'number'.
3697 * @param value The value to test.
3698 */
3699 static isNumber(value: any): boolean;
3700 /**
3701 * Checks whether the provided value is a Date instance.
3702 * @param value The value to test.
3703 */
3704 static isDate(value: any): boolean;
3705 /**
3706 * Checks whether the provided value is an 'object'.
3707 * @param value The value to test.
3708 */
3709 static isObject(value: any): boolean;
3710 /**
3711 * Checks whether the provided value is null or undefined.
3712 * @param value The value to test.
3713 */
3714 static isNullOrUndefined(value: any): boolean;
3715 /**
3716 * Combine a base url and a path.
3717 * @param baseUrl The base url.
3718 * @param path The path to add on to the base url.
3719 * @returns The combined url.
3720 */
3721 static urlCombine(baseUrl: string, path: string): string;
3722 static getAbsoluteUri(path: string): string;
3723 static getStaticResourceUri(path: string): string;
3724 static getComponentName(context: any): string;
3725 static throwException(e: any): void;
3726 static createClassSelector(className: string): string;
3727 static createIdSelector(id: string): string;
3728 /**
3729 * Creates a client-side Guid string.
3730 * @returns A string representation of a Guid.
3731 */
3732 static generateGuid(): string;
3733 /**
3734 * Try extract a cookie from {@link document.cookie} identified by key.
3735 */
3736 static getCookieValue(key: string): string;
3737 /**
3738 * Extracts the protocol://hostname section of a url.
3739 * @param url The URL from which to extract the section.
3740 * @returns The protocol://hostname portion of the given URL.
3741 */
3742 static getDomainForUrl(url: string): string;
3743 /**
3744 * Extracts the hostname and absolute path sections of a url.
3745 * @param url The URL from which to extract the section.
3746 * @returns The hostname and absolute path portion of the given URL.
3747 */
3748 static getHostNameForUrl(url: string): string;
3749 /**
3750 * Return the original url with query string stripped.
3751 * @param url The URL from which to extract the section.
3752 * @returns the original url with query string stripped.
3753 */
3754 static getUrlWithoutQueryString(url: string): string;
3755 /**
3756 * Extracts the protocol section of a url.
3757 * @param url The URL from which to extract the section.
3758 * @returns The protocol for the current URL.
3759 */
3760 static getProtocolFromUrl(url: string): string;
3761 /**
3762 * Returns a formatted href object from a URL.
3763 * @param url The URL used to generate the object.
3764 * @returns A jQuery object with the url.
3765 */
3766 static getHrefObjectFromUrl(url: string): JQuery;
3767 /**
3768 * Converts a WCF representation of a dictionary to a JavaScript dictionary.
3769 * @param wcfDictionary The WCF dictionary to convert.
3770 * @returns The native JavaScript representation of this dictionary.
3771 */
3772 static convertWcfToJsDictionary(wcfDictionary: any[]): {
3773 [index: string]: any;
3774 };
3775 static getDateFromWcfJsonString(jsonDate: string, fromUtcMilliseconds: boolean): Date;
3776 /**
3777 * Get the outer html of the given jquery object.
3778 * @param content The jquery object.
3779 * @returns The entire html representation of the object.
3780 */
3781 static getOuterHtml(content: JQuery): string;
3782 /**
3783 * Comparison Method: Compares two integer numbers.
3784 * @param a An integer value.
3785 * @param b An integer value.
3786 * @returns The comparison result.
3787 */
3788 static compareInt(a: number, b: number): number;
3789 /**
3790 * Return the index of the smallest value in a numerical array.
3791 * @param a A numeric array.
3792 * @returns The index of the smallest value in the array.
3793 */
3794 static getIndexOfMinValue(a: number[]): number;
3795 /**
3796 * Extracts a url from a background image attribute in the format of: url('www.foobar.com/image.png').
3797 * @param input The value of the background-image attribute.
3798 * @returns The extracted url.
3799 */
3800 static extractUrlFromCssBackgroundImage(input: string): string;
3801 /**
3802 * Verifies image data url of images.
3803 */
3804 static isValidImageDataUrl(url: string): boolean;
3805 static isLocalUrl(url: string): boolean;
3806 /**
3807 * Downloads a content string as a file.
3808 * @param content Content stream.
3809 * @param fileName File name to use.
3810 */
3811 static saveAsFile(content: any, fileName: string): void;
3812 /**
3813 * Helper method to get the simple type name from a typed object.
3814 * @param obj The typed object.
3815 * @returns The simple type name for the object.
3816 */
3817 static getType(obj: TypedObject): string;
3818 /**
3819 * Check if an element supports a specific event type.
3820 * @param eventName The name of the event.
3821 * @param element The element to test for event support.
3822 * @returns Whether the even is supported on the provided element.
3823 */
3824 static isEventSupported(eventName: string, element: Element): boolean;
3825 static toPixel(pixelAmount: number): string;
3826 static getPropertyCount(object: any): number;
3827 /**
3828 * Check if an element supports a specific event type.
3829 * @param filePath File path.
3830 * @returns File extension.
3831 */
3832 static getFileExtension(filePath: string): string;
3833 /**
3834 * Extract the filename out of a full path delimited by '\' or '/'.
3835 * @param filePath File path.
3836 * @returns filename File name.
3837 */
3838 static extractFileNameFromPath(filePath: string): string;
3839 /**
3840 * This method indicates whether window.clipboardData is supported.
3841 * For example, clipboard support for Windows Store apps is currently disabled
3842 * since window.clipboardData is unsupported (it raises access denied error)
3843 * since clipboard in Windows Store is being
3844 * achieved through Windows.ApplicationModel.DataTransfer.Clipboard class.
3845 */
3846 static canUseClipboard(): boolean;
3847 static is64BitOperatingSystem(): boolean;
3848 static parseNumber(value: any, defaultValue?: number): number;
3849 static getURLParamValue(name: string): string | number;
3850 /**
3851 * Return local timezone.
3852 * This function uses summer and winter offset to determine local time zone.
3853 * The result localTimeZoneString must be a subset of the strings used by server,
3854 * as documented here: https://msdn.microsoft.com/en-us/library/gg154758.aspx (Dynamic Daylight Savings Time (Compact 2013)).
3855 * @return Local timezone string or UTC if timezone cannot be found.
3856 */
3857 static getLocalTimeZoneString(): string;
3858 }
3859 class VersionUtility {
3860 /**
3861 * Compares 2 version strings.
3862 * @param versionA The first version string.
3863 * @param versionB The second version string.
3864 * @returns A result for the comparison.
3865 */
3866 static compareVersions(versionA: string, versionB: string): number;
3867 }
3868 module PerformanceUtil {
3869 class PerfMarker {
3870 private _name;
3871 private _start;
3872 constructor(name: string);
3873 private static begin(name);
3874 end(): void;
3875 }
3876 function create(name: string): PerfMarker;
3877 }
3878 module DeferUtility {
3879 /**
3880 * Wraps a callback and returns a new function.
3881 * The function can be called many times but the callback
3882 * will only be executed once on the next frame.
3883 * Use this to throttle big UI updates and access to DOM.
3884 */
3885 function deferUntilNextFrame(callback: Function): Function;
3886 }
3887}
3888declare module jsCommon {
3889 class TraceItem {
3890 type: TraceType;
3891 sessionId: string;
3892 requestId: string;
3893 text: string;
3894 timeStamp: Date;
3895 /**
3896 * Note: DO NOT USE for backward compability only.
3897 */
3898 _activityId: string;
3899 private static traceTypeStrings;
3900 constructor(text: string, type: TraceType, sessionId: string, requestId?: string);
3901 toString(): string;
3902 }
3903}
3904declare module jsCommon {
3905 module UrlUtils {
3906 function isValidUrl(value: string): boolean;
3907 function isValidImageUrl(url: string): boolean;
3908 function findAllValidUrls(text: string): TextMatch[];
3909 function getBase64ContentFromDataUri(uri: string): string;
3910 }
3911}
3912declare module jsCommon {
3913 module BrowserUtils {
3914 function isChrome(): boolean;
3915 function isInternetExplorerOrEdge(): boolean;
3916 /**
3917 * Get the current version of IE
3918 * @returns The version of Internet Explorer or a 0 (indicating the use of another browser).
3919 */
3920 function getInternetExplorerVersion(): number;
3921 }
3922}
3923declare module jsCommon {
3924 /**
3925 * Interface to help define objects indexed by number to a particular type.
3926 */
3927 interface INumberDictionary<T> {
3928 [key: number]: T;
3929 }
3930 /**
3931 * Interface to help define objects indexed by name to a particular type.
3932 */
3933 interface IStringDictionary<T> {
3934 [key: string]: T;
3935 }
3936 /**
3937 * Extensions for Enumerations.
3938 */
3939 module EnumExtensions {
3940 /**
3941 * Gets a value indicating whether the value has the bit flags set.
3942 */
3943 function hasFlag(value: number, flag: number): boolean;
3944 /**
3945 * Sets a value of a flag without modifying any other flags.
3946 */
3947 function setFlag(value: number, flag: number): number;
3948 /**
3949 * Resets a value of a flag without modifying any other flags.
3950 */
3951 function resetFlag(value: number, flag: number): number;
3952 /**
3953 * According to the TypeScript Handbook, this is safe to do.
3954 */
3955 function toString(enumType: any, value: number): string;
3956 }
3957 /**
3958 * Extensions to String class.
3959 */
3960 module StringExtensions {
3961 /**
3962 * Checks if a string ends with a sub-string.
3963 */
3964 function endsWith(str: string, suffix: string): boolean;
3965 }
3966 module LogicExtensions {
3967 function XOR(a: boolean, b: boolean): boolean;
3968 }
3969 module JsonComparer {
3970 /**
3971 * Performs JSON-style comparison of two objects.
3972 */
3973 function equals<T>(x: T, y: T): boolean;
3974 }
3975 /**
3976 * Values are in terms of 'pt'
3977 * Convert to pixels using PixelConverter.fromPoint
3978 */
3979 module TextSizeDefaults {
3980 /**
3981 * Stored in terms of 'pt'
3982 * Convert to pixels using PixelConverter.fromPoint
3983 */
3984 const TextSizeMin: number;
3985 /**
3986 * Stored in terms of 'pt'
3987 * Convert to pixels using PixelConverter.fromPoint
3988 */
3989 const TextSizeMax: number;
3990 /**
3991 * Returns the percentage of this value relative to the TextSizeMax
3992 * @param textSize - should be given in terms of 'pt'
3993 */
3994 function getScale(textSize: number): number;
3995 }
3996 module PixelConverter {
3997 /**
3998 * Appends 'px' to the end of number value for use as pixel string in styles
3999 */
4000 function toString(px: number): string;
4001 /**
4002 * Converts point value (pt) to pixels
4003 * Returns a string for font-size property
4004 * e.g. fromPoint(8) => '24px'
4005 */
4006 function fromPoint(pt: number): string;
4007 /**
4008 * Converts point value (pt) to pixels
4009 * Returns a number for font-size property
4010 * e.g. fromPoint(8) => 24px
4011 */
4012 function fromPointToPixel(pt: number): number;
4013 /**
4014 * Converts pixel value (px) to pt
4015 * e.g. toPoint(24) => 8
4016 */
4017 function toPoint(px: number): number;
4018 }
4019 module RegExpExtensions {
4020 /**
4021 * Runs exec on regex starting from 0 index
4022 * This is the expected behavior but RegExp actually remember
4023 * the last index they stopped at (found match at) and will
4024 * return unexpected results when run in sequence.
4025 * @param regex - regular expression object
4026 * @param value - string to search wiht regex
4027 * @param start - index within value to start regex
4028 */
4029 function run(regex: RegExp, value: string, start?: number): RegExpExecArray;
4030 }
4031}
4032declare module powerbi.visuals.utility {
4033 import IThickness = powerbi.visuals.shapes.IThickness;
4034 module StyleUtils {
4035 function getRotateAngleFromElement(element: JQuery): number;
4036 function getTranslateTransformFromElement(element: JQuery): IPoint;
4037 function getPadding(element: JQuery): IThickness;
4038 }
4039}
4040declare module jsCommon {
4041 interface ITraceListener {
4042 logTrace(trace: TraceItem): void;
4043 }
4044 class ConsoleTracer implements ITraceListener {
4045 logTrace(trace: TraceItem): void;
4046 }
4047 module Trace {
4048 /**
4049 * Trace a warning. Please ensure that no PII is being logged.
4050 */
4051 function warning(text: string, requestId?: string): void;
4052 /**
4053 * Trace an error. Please ensure that no PII is being logged.
4054 */
4055 function error(text: string, includeStackTrace?: boolean, requestId?: string): void;
4056 /**
4057 * Trace an information. Please ensure that no PII is being logged.
4058 */
4059 function verbose(text: string, requestId?: string): void;
4060 function addListener(listener: ITraceListener): void;
4061 function removeListener(listener: ITraceListener): void;
4062 function resetListeners(): void;
4063 function reset(): void;
4064 function getTraces(): Array<TraceItem>;
4065 /**
4066 * Note: Used for unit-test only.
4067 */
4068 function disableDefaultListener(): void;
4069 function enableDefaultListener(): void;
4070 }
4071}
4072declare module jsCommon {
4073 /**
4074 * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
4075 */
4076 enum TraceType {
4077 Information = 0,
4078 Verbose = 1,
4079 Warning = 2,
4080 Error = 3,
4081 ExpectedError = 4,
4082 UnexpectedError = 5,
4083 Fatal = 6,
4084 }
4085}
4086declare module jsCommon {
4087 function ensurePowerView(action?: () => void): void;
4088 function ensureMap(locale: string, action: () => void): void;
4089 function mapControlLoaded(): void;
4090 function waitForMapControlLoaded(): JQueryPromise<void>;
4091}
4092declare let globalMapControlLoaded: () => void;
4093declare module InJs {
4094 /**
4095 * The types of possible traces within the system, this aligns to the traces available in Cloud Platform.
4096 */
4097 enum TraceType {
4098 information = 0,
4099 verbose = 1,
4100 warning = 2,
4101 error = 3,
4102 expectedError = 4,
4103 unexpectedError = 5,
4104 fatal = 6,
4105 }
4106}
4107;declare module powerbi.data {
4108 /** Allows generic traversal and type discovery for a SQExpr tree. */
4109 interface ISQExprVisitorWithArg<T, TArg> {
4110 visitEntity(expr: SQEntityExpr, arg: TArg): T;
4111 visitColumnRef(expr: SQColumnRefExpr, arg: TArg): T;
4112 visitMeasureRef(expr: SQMeasureRefExpr, arg: TArg): T;
4113 visitAggr(expr: SQAggregationExpr, arg: TArg): T;
4114 visitPercentile(expr: SQPercentileExpr, arg: TArg): T;
4115 visitHierarchy(expr: SQHierarchyExpr, arg: TArg): T;
4116 visitHierarchyLevel(expr: SQHierarchyLevelExpr, arg: TArg): T;
4117 visitPropertyVariationSource(expr: SQPropertyVariationSourceExpr, arg: TArg): T;
4118 visitSelectRef(expr: SQSelectRefExpr, arg: TArg): T;
4119 visitAnd(expr: SQAndExpr, arg: TArg): T;
4120 visitBetween(expr: SQBetweenExpr, arg: TArg): T;
4121 visitIn(expr: SQInExpr, arg: TArg): T;
4122 visitOr(expr: SQOrExpr, arg: TArg): T;
4123 visitCompare(expr: SQCompareExpr, arg: TArg): T;
4124 visitContains(expr: SQContainsExpr, arg: TArg): T;
4125 visitExists(expr: SQExistsExpr, arg: TArg): T;
4126 visitNot(expr: SQNotExpr, arg: TArg): T;
4127 visitStartsWith(expr: SQStartsWithExpr, arg: TArg): T;
4128 visitConstant(expr: SQConstantExpr, arg: TArg): T;
4129 visitDateSpan(expr: SQDateSpanExpr, arg: TArg): T;
4130 visitDateAdd(expr: SQDateAddExpr, arg: TArg): T;
4131 visitNow(expr: SQNowExpr, arg: TArg): T;
4132 visitDefaultValue(expr: SQDefaultValueExpr, arg: TArg): T;
4133 visitAnyValue(expr: SQAnyValueExpr, arg: TArg): T;
4134 visitArithmetic(expr: SQArithmeticExpr, arg: TArg): T;
4135 visitFillRule(expr: SQFillRuleExpr, arg: TArg): T;
4136 visitResourcePackageItem(expr: SQResourcePackageItemExpr, arg: TArg): T;
4137 visitScopedEval(expr: SQScopedEvalExpr, arg: TArg): T;
4138 }
4139 interface ISQExprVisitor<T> extends ISQExprVisitorWithArg<T, void> {
4140 }
4141 /** Default IQueryExprVisitorWithArg implementation that others may derive from. */
4142 class DefaultSQExprVisitorWithArg<T, TArg> implements ISQExprVisitorWithArg<T, TArg> {
4143 visitEntity(expr: SQEntityExpr, arg: TArg): T;
4144 visitColumnRef(expr: SQColumnRefExpr, arg: TArg): T;
4145 visitMeasureRef(expr: SQMeasureRefExpr, arg: TArg): T;
4146 visitAggr(expr: SQAggregationExpr, arg: TArg): T;
4147 visitPercentile(expr: SQPercentileExpr, arg: TArg): T;
4148 visitHierarchy(expr: SQHierarchyExpr, arg: TArg): T;
4149 visitHierarchyLevel(expr: SQHierarchyLevelExpr, arg: TArg): T;
4150 visitPropertyVariationSource(expr: SQPropertyVariationSourceExpr, arg: TArg): T;
4151 visitSelectRef(expr: SQSelectRefExpr, arg: TArg): T;
4152 visitBetween(expr: SQBetweenExpr, arg: TArg): T;
4153 visitIn(expr: SQInExpr, arg: TArg): T;
4154 visitAnd(expr: SQAndExpr, arg: TArg): T;
4155 visitOr(expr: SQOrExpr, arg: TArg): T;
4156 visitCompare(expr: SQCompareExpr, arg: TArg): T;
4157 visitContains(expr: SQContainsExpr, arg: TArg): T;
4158 visitExists(expr: SQExistsExpr, arg: TArg): T;
4159 visitNot(expr: SQNotExpr, arg: TArg): T;
4160 visitStartsWith(expr: SQStartsWithExpr, arg: TArg): T;
4161 visitConstant(expr: SQConstantExpr, arg: TArg): T;
4162 visitDateSpan(expr: SQDateSpanExpr, arg: TArg): T;
4163 visitDateAdd(expr: SQDateAddExpr, arg: TArg): T;
4164 visitNow(expr: SQNowExpr, arg: TArg): T;
4165 visitDefaultValue(expr: SQDefaultValueExpr, arg: TArg): T;
4166 visitAnyValue(expr: SQAnyValueExpr, arg: TArg): T;
4167 visitArithmetic(expr: SQArithmeticExpr, arg: TArg): T;
4168 visitFillRule(expr: SQFillRuleExpr, arg: TArg): T;
4169 visitResourcePackageItem(expr: SQResourcePackageItemExpr, arg: TArg): T;
4170 visitScopedEval(expr: SQScopedEvalExpr, arg: TArg): T;
4171 visitDefault(expr: SQExpr, arg: TArg): T;
4172 }
4173 /** Default ISQExprVisitor implementation that others may derive from. */
4174 class DefaultSQExprVisitor<T> extends DefaultSQExprVisitorWithArg<T, void> implements ISQExprVisitor<T> {
4175 }
4176 /** Default ISQExprVisitor implementation that implements default traversal and that others may derive from. */
4177 class DefaultSQExprVisitorWithTraversal implements ISQExprVisitor<void>, IFillRuleDefinitionVisitor<void, void> {
4178 visitEntity(expr: SQEntityExpr): void;
4179 visitColumnRef(expr: SQColumnRefExpr): void;
4180 visitMeasureRef(expr: SQMeasureRefExpr): void;
4181 visitAggr(expr: SQAggregationExpr): void;
4182 visitPercentile(expr: SQPercentileExpr): void;
4183 visitHierarchy(expr: SQHierarchyExpr): void;
4184 visitHierarchyLevel(expr: SQHierarchyLevelExpr): void;
4185 visitPropertyVariationSource(expr: SQPropertyVariationSourceExpr): void;
4186 visitSelectRef(expr: SQSelectRefExpr): void;
4187 visitBetween(expr: SQBetweenExpr): void;
4188 visitIn(expr: SQInExpr): void;
4189 visitAnd(expr: SQAndExpr): void;
4190 visitOr(expr: SQOrExpr): void;
4191 visitCompare(expr: SQCompareExpr): void;
4192 visitContains(expr: SQContainsExpr): void;
4193 visitExists(expr: SQExistsExpr): void;
4194 visitNot(expr: SQNotExpr): void;
4195 visitStartsWith(expr: SQStartsWithExpr): void;
4196 visitConstant(expr: SQConstantExpr): void;
4197 visitDateSpan(expr: SQDateSpanExpr): void;
4198 visitDateAdd(expr: SQDateAddExpr): void;
4199 visitNow(expr: SQNowExpr): void;
4200 visitDefaultValue(expr: SQDefaultValueExpr): void;
4201 visitAnyValue(expr: SQAnyValueExpr): void;
4202 visitArithmetic(expr: SQArithmeticExpr): void;
4203 visitFillRule(expr: SQFillRuleExpr): void;
4204 visitLinearGradient2(gradient2: LinearGradient2Definition): void;
4205 visitLinearGradient3(gradient3: LinearGradient3Definition): void;
4206 visitResourcePackageItem(expr: SQResourcePackageItemExpr): void;
4207 visitScopedEval(expr: SQScopedEvalExpr): void;
4208 visitDefault(expr: SQExpr): void;
4209 private visitFillRuleStop(stop);
4210 }
4211}
4212declare module powerbi {
4213 /** Defines a custom enumeration data type, and its values. */
4214 interface IEnumType {
4215 /** Gets the members of the enumeration, limited to the validMembers, if appropriate. */
4216 members(validMembers?: EnumMemberValue[]): IEnumMember[];
4217 }
4218 function createEnumType(members: IEnumMember[]): IEnumType;
4219}
4220declare module powerbi {
4221 import SQExpr = powerbi.data.SQExpr;
4222 interface FillDefinition {
4223 solid?: {
4224 color?: SQExpr;
4225 };
4226 gradient?: {
4227 startColor?: SQExpr;
4228 endColor?: SQExpr;
4229 };
4230 pattern?: {
4231 patternKind?: SQExpr;
4232 color?: SQExpr;
4233 };
4234 }
4235 module FillSolidColorTypeDescriptor {
4236 /** Gets a value indicating whether the descriptor is nullable or not. */
4237 function nullable(descriptor: FillSolidColorTypeDescriptor): boolean;
4238 }
4239}
4240declare module powerbi {
4241 import SQExpr = powerbi.data.SQExpr;
4242 interface FillRuleTypeDescriptor {
4243 }
4244 interface FillRuleDefinition extends FillRuleGeneric<SQExpr, SQExpr> {
4245 }
4246 interface FillRule extends FillRuleGeneric<string, number> {
4247 }
4248 type LinearGradient2 = LinearGradient2Generic<string, number>;
4249 type LinearGradient3 = LinearGradient3Generic<string, number>;
4250 type LinearGradient2Definition = LinearGradient2Generic<SQExpr, SQExpr>;
4251 type LinearGradient3Definition = LinearGradient3Generic<SQExpr, SQExpr>;
4252 type RuleColorStopDefinition = RuleColorStopGeneric<SQExpr, SQExpr>;
4253 type RuleColorStop = RuleColorStopGeneric<string, number>;
4254 interface IFillRuleDefinitionVisitor<T2, T3> {
4255 visitLinearGradient2(linearGradient2: LinearGradient2Definition, arg?: any): T2;
4256 visitLinearGradient3(linearGradient3: LinearGradient3Definition, arg?: any): T3;
4257 }
4258}
4259declare module powerbi {
4260 import SQExpr = powerbi.data.SQExpr;
4261 interface ImageTypeDescriptor {
4262 }
4263 type ImageDefinition = ImageDefinitionGeneric<SQExpr>;
4264 module ImageDefinition {
4265 const urlType: ValueTypeDescriptor;
4266 }
4267}
4268declare module powerbi {
4269 import SQExpr = powerbi.data.SQExpr;
4270 interface ParagraphsTypeDescriptor {
4271 }
4272 type ParagraphsDefinition = ParagraphDefinition[];
4273 type ParagraphDefinition = ParagraphDefinitionGeneric<SQExpr>;
4274 type TextRunDefinition = TextRunDefinitionGeneric<SQExpr>;
4275 interface ParagraphDefinitionGeneric<TExpr> {
4276 horizontalTextAlignment?: string;
4277 textRuns: TextRunDefinitionGeneric<TExpr>[];
4278 }
4279 interface TextRunDefinitionGeneric<TExpr> {
4280 textStyle?: TextRunStyle;
4281 url?: string;
4282 value: string | TExpr;
4283 }
4284}
4285declare module powerbi {
4286 import SemanticFilter = powerbi.data.SemanticFilter;
4287 type StructuralObjectDefinition = FillDefinition | FillRuleDefinition | SemanticFilter | DefaultValueDefinition | ImageDefinition | ParagraphsDefinition;
4288 module StructuralTypeDescriptor {
4289 function isValid(type: StructuralTypeDescriptor): boolean;
4290 }
4291}
4292declare module powerbi {
4293 interface ValueTypeDescriptor {
4294 extendedType?: ExtendedType;
4295 }
4296 /** Describes a data value type, including a primitive type and extended type if any (derived from data category). */
4297 class ValueType implements ValueTypeDescriptor {
4298 private static typeCache;
4299 private underlyingType;
4300 private category;
4301 private temporalType;
4302 private geographyType;
4303 private miscType;
4304 private formattingType;
4305 private enumType;
4306 private scriptingType;
4307 /** Do not call the ValueType constructor directly. Use the ValueType.fromXXX methods. */
4308 constructor(type: ExtendedType, category?: string, enumType?: IEnumType);
4309 /** Creates or retrieves a ValueType object based on the specified ValueTypeDescriptor. */
4310 static fromDescriptor(descriptor: ValueTypeDescriptor): ValueType;
4311 /** Advanced: Generally use fromDescriptor instead. Creates or retrieves a ValueType object for the specified ExtendedType. */
4312 static fromExtendedType(extendedType: ExtendedType): ValueType;
4313 /** Creates or retrieves a ValueType object for the specified PrimitiveType and data category. */
4314 static fromPrimitiveTypeAndCategory(primitiveType: PrimitiveType, category?: string): ValueType;
4315 /** Creates a ValueType to describe the given IEnumType. */
4316 static fromEnum(enumType: IEnumType): ValueType;
4317 /** Determines if the specified type is compatible from at least one of the otherTypes. */
4318 static isCompatibleTo(type: ValueTypeDescriptor, otherTypes: ValueTypeDescriptor[]): boolean;
4319 /** Determines if the instance ValueType is convertable from the 'other' ValueType. */
4320 isCompatibleFrom(other: ValueType): boolean;
4321 /**
4322 * Determines if the instance ValueType is equal to the 'other' ValueType
4323 * @param {ValueType} other the other ValueType to check equality against
4324 * @returns True if the instance ValueType is equal to the 'other' ValueType
4325 */
4326 equals(other: ValueType): boolean;
4327 /** Gets the exact primitive type of this ValueType. */
4328 primitiveType: PrimitiveType;
4329 /** Gets the exact extended type of this ValueType. */
4330 extendedType: ExtendedType;
4331 /** Gets the data category string (if any) for this ValueType. */
4332 categoryString: string;
4333 /** Indicates whether the type represents text values. */
4334 text: boolean;
4335 /** Indicates whether the type represents any numeric value. */
4336 numeric: boolean;
4337 /** Indicates whether the type represents integer numeric values. */
4338 integer: boolean;
4339 /** Indicates whether the type represents Boolean values. */
4340 bool: boolean;
4341 /** Indicates whether the type represents any date/time values. */
4342 dateTime: boolean;
4343 /** Indicates whether the type represents duration values. */
4344 duration: boolean;
4345 /** Indicates whether the type represents binary values. */
4346 binary: boolean;
4347 /** Indicates whether the type represents none values. */
4348 none: boolean;
4349 /** Returns an object describing temporal values represented by the type, if it represents a temporal type. */
4350 temporal: TemporalType;
4351 /** Returns an object describing geographic values represented by the type, if it represents a geographic type. */
4352 geography: GeographyType;
4353 /** Returns an object describing the specific values represented by the type, if it represents a miscellaneous extended type. */
4354 misc: MiscellaneousType;
4355 /** Returns an object describing the formatting values represented by the type, if it represents a formatting type. */
4356 formatting: FormattingType;
4357 /** Returns an object describing the enum values represented by the type, if it represents an enumeration type. */
4358 enum: IEnumType;
4359 scripting: ScriptType;
4360 }
4361 class ScriptType implements ScriptTypeDescriptor {
4362 private underlyingType;
4363 constructor(type: ExtendedType);
4364 source: boolean;
4365 }
4366 class TemporalType implements TemporalTypeDescriptor {
4367 private underlyingType;
4368 constructor(type: ExtendedType);
4369 year: boolean;
4370 month: boolean;
4371 }
4372 class GeographyType implements GeographyTypeDescriptor {
4373 private underlyingType;
4374 constructor(type: ExtendedType);
4375 address: boolean;
4376 city: boolean;
4377 continent: boolean;
4378 country: boolean;
4379 county: boolean;
4380 region: boolean;
4381 postalCode: boolean;
4382 stateOrProvince: boolean;
4383 place: boolean;
4384 latitude: boolean;
4385 longitude: boolean;
4386 }
4387 class MiscellaneousType implements MiscellaneousTypeDescriptor {
4388 private underlyingType;
4389 constructor(type: ExtendedType);
4390 image: boolean;
4391 imageUrl: boolean;
4392 webUrl: boolean;
4393 barcode: boolean;
4394 }
4395 class FormattingType implements FormattingTypeDescriptor {
4396 private underlyingType;
4397 constructor(type: ExtendedType);
4398 color: boolean;
4399 formatString: boolean;
4400 alignment: boolean;
4401 labelDisplayUnits: boolean;
4402 fontSize: boolean;
4403 labelDensity: boolean;
4404 }
4405 /** Defines primitive value types. Must be consistent with types defined by server conceptual schema. */
4406 enum PrimitiveType {
4407 Null = 0,
4408 Text = 1,
4409 Decimal = 2,
4410 Double = 3,
4411 Integer = 4,
4412 Boolean = 5,
4413 Date = 6,
4414 DateTime = 7,
4415 DateTimeZone = 8,
4416 Time = 9,
4417 Duration = 10,
4418 Binary = 11,
4419 None = 12,
4420 }
4421 /** Defines extended value types, which include primitive types and known data categories constrained to expected primitive types. */
4422 enum ExtendedType {
4423 Numeric = 256,
4424 Temporal = 512,
4425 Geography = 1024,
4426 Miscellaneous = 2048,
4427 Formatting = 4096,
4428 Scripting = 8192,
4429 Null = 0,
4430 Text = 1,
4431 Decimal = 258,
4432 Double = 259,
4433 Integer = 260,
4434 Boolean = 5,
4435 Date = 518,
4436 DateTime = 519,
4437 DateTimeZone = 520,
4438 Time = 521,
4439 Duration = 10,
4440 Binary = 11,
4441 None = 12,
4442 Year = 66048,
4443 Year_Text = 66049,
4444 Year_Integer = 66308,
4445 Year_Date = 66054,
4446 Year_DateTime = 66055,
4447 Month = 131584,
4448 Month_Text = 131585,
4449 Month_Integer = 131844,
4450 Month_Date = 131590,
4451 Month_DateTime = 131591,
4452 Address = 6554625,
4453 City = 6620161,
4454 Continent = 6685697,
4455 Country = 6751233,
4456 County = 6816769,
4457 Region = 6882305,
4458 PostalCode = 6947840,
4459 PostalCode_Text = 6947841,
4460 PostalCode_Integer = 6948100,
4461 StateOrProvince = 7013377,
4462 Place = 7078913,
4463 Latitude = 7144448,
4464 Latitude_Decimal = 7144706,
4465 Latitude_Double = 7144707,
4466 Longitude = 7209984,
4467 Longitude_Decimal = 7210242,
4468 Longitude_Double = 7210243,
4469 Image = 13109259,
4470 ImageUrl = 13174785,
4471 WebUrl = 13240321,
4472 Barcode = 13305856,
4473 Barcode_Text = 13305857,
4474 Barcode_Integer = 13306116,
4475 Color = 19664897,
4476 FormatString = 19730433,
4477 Alignment = 20058113,
4478 LabelDisplayUnits = 20123649,
4479 FontSize = 20189443,
4480 LabelDensity = 20254979,
4481 Enumeration = 26214401,
4482 ScriptSource = 32776193,
4483 }
4484}
4485declare module powerbi.data {
4486 /**
4487 * Represents the versions of the data shape binding structure.
4488 * NOTE Keep this file in sync with the Sql\InfoNav\src\Data\Contracts\DsqGeneration\DataShapeBindingVersions.cs
4489 * file in the TFS Dev branch.
4490 */
4491 const enum DataShapeBindingVersions {
4492 /** The initial version of data shape binding */
4493 Version0 = 0,
4494 /** Explicit subtotal support for axis groupings. */
4495 Version1 = 1,
4496 }
4497 interface DataShapeBindingLimitTarget {
4498 Primary?: number;
4499 }
4500 enum DataShapeBindingLimitType {
4501 Top = 0,
4502 First = 1,
4503 Last = 2,
4504 Sample = 3,
4505 Bottom = 4,
4506 }
4507 interface DataShapeBindingLimit {
4508 Count?: number;
4509 Target: DataShapeBindingLimitTarget;
4510 Type: DataShapeBindingLimitType;
4511 }
4512 interface DataShapeBinding {
4513 Version?: number;
4514 Primary: DataShapeBindingAxis;
4515 Secondary?: DataShapeBindingAxis;
4516 Aggregates?: DataShapeBindingAggregate[];
4517 Projections?: number[];
4518 Limits?: DataShapeBindingLimit[];
4519 Highlights?: FilterDefinition[];
4520 DataReduction?: DataShapeBindingDataReduction;
4521 IncludeEmptyGroups?: boolean;
4522 SuppressedJoinPredicates?: number[];
4523 }
4524 interface DataShapeBindingDataReduction {
4525 Primary?: DataShapeBindingDataReductionAlgorithm;
4526 Secondary?: DataShapeBindingDataReductionAlgorithm;
4527 DataVolume?: number;
4528 }
4529 interface DataShapeBindingDataReductionAlgorithm {
4530 Top?: DataShapeBindingDataReductionTopLimit;
4531 Sample?: DataShapeBindingDataReductionSampleLimit;
4532 Bottom?: DataShapeBindingDataReductionBottomLimit;
4533 Window?: DataShapeBindingDataReductionDataWindow;
4534 }
4535 interface DataShapeBindingDataReductionTopLimit {
4536 Count?: number;
4537 }
4538 interface DataShapeBindingDataReductionSampleLimit {
4539 Count?: number;
4540 }
4541 interface DataShapeBindingDataReductionBottomLimit {
4542 Count?: number;
4543 }
4544 interface DataShapeBindingDataReductionDataWindow {
4545 Count?: number;
4546 RestartTokens?: RestartToken;
4547 }
4548 interface DataShapeBindingAxis {
4549 Groupings: DataShapeBindingAxisGrouping[];
4550 }
4551 enum SubtotalType {
4552 None = 0,
4553 Before = 1,
4554 After = 2,
4555 }
4556 interface DataShapeBindingAxisGrouping {
4557 Projections: number[];
4558 GroupBy?: number[];
4559 SuppressedProjections?: number[];
4560 Subtotal?: SubtotalType;
4561 ShowItemsWithNoData?: number[];
4562 }
4563 interface DataShapeBindingAggregate {
4564 Select: number;
4565 Kind: DataShapeBindingAggregateKind;
4566 }
4567 const enum DataShapeBindingAggregateKind {
4568 None = 0,
4569 Min = 1,
4570 Max = 2,
4571 }
4572}
4573declare module powerbi.data {
4574 module DataShapeBindingDataReduction {
4575 function createFrom(reduction: ReductionAlgorithm): DataShapeBindingDataReductionAlgorithm;
4576 }
4577}
4578declare module powerbi.data {
4579 interface FederatedConceptualSchemaInitOptions {
4580 schemas: {
4581 [name: string]: ConceptualSchema;
4582 };
4583 links?: ConceptualSchemaLink[];
4584 }
4585 /** Represents a federated conceptual schema. */
4586 class FederatedConceptualSchema {
4587 private schemas;
4588 private links;
4589 constructor(options: FederatedConceptualSchemaInitOptions);
4590 schema(name: string): ConceptualSchema;
4591 }
4592 /** Describes a semantic relationship between ConceptualSchemas. */
4593 interface ConceptualSchemaLink {
4594 }
4595}
4596declare module powerbi.data {
4597 module Selector {
4598 function filterFromSelector(selectors: Selector[], isNot?: boolean): SemanticFilter;
4599 function matchesData(selector: Selector, identities: DataViewScopeIdentity[]): boolean;
4600 function matchesKeys(selector: Selector, keysList: SQExpr[][]): boolean;
4601 /** Determines whether two selectors are equal. */
4602 function equals(x: Selector, y: Selector): boolean;
4603 function getKey(selector: Selector): string;
4604 function containsWildcard(selector: Selector): boolean;
4605 function hasRoleWildcard(selector: Selector): boolean;
4606 function isRoleWildcard(dataItem: DataRepetitionSelector): dataItem is DataViewRoleWildcard;
4607 }
4608}
4609declare module powerbi.data {
4610 interface QueryDefinition {
4611 Version?: number;
4612 From: EntitySource[];
4613 Where?: QueryFilter[];
4614 OrderBy?: QuerySortClause[];
4615 Select: QueryExpressionContainer[];
4616 GroupBy?: QueryExpressionContainer[];
4617 }
4618 interface FilterDefinition {
4619 Version?: number;
4620 From: EntitySource[];
4621 Where: QueryFilter[];
4622 }
4623 enum EntitySourceType {
4624 Table = 0,
4625 Pod = 1,
4626 }
4627 interface EntitySource {
4628 Name: string;
4629 EntitySet?: string;
4630 Entity?: string;
4631 Schema?: string;
4632 Type?: EntitySourceType;
4633 }
4634 interface QueryFilter {
4635 Target?: QueryExpressionContainer[];
4636 Condition: QueryExpressionContainer;
4637 }
4638 interface QuerySortClause {
4639 Expression: QueryExpressionContainer;
4640 Direction: SortDirection;
4641 }
4642 interface QueryExpressionContainer {
4643 Name?: string;
4644 SourceRef?: QuerySourceRefExpression;
4645 Column?: QueryColumnExpression;
4646 Measure?: QueryMeasureExpression;
4647 Aggregation?: QueryAggregationExpression;
4648 Percentile?: QueryPercentileExpression;
4649 Hierarchy?: QueryHierarchyExpression;
4650 HierarchyLevel?: QueryHierarchyLevelExpression;
4651 PropertyVariationSource?: QueryPropertyVariationSourceExpression;
4652 And?: QueryBinaryExpression;
4653 Between?: QueryBetweenExpression;
4654 In?: QueryInExpression;
4655 Or?: QueryBinaryExpression;
4656 Comparison?: QueryComparisonExpression;
4657 Not?: QueryNotExpression;
4658 Contains?: QueryContainsExpression;
4659 StartsWith?: QueryStartsWithExpression;
4660 Exists?: QueryExistsExpression;
4661 Boolean?: QueryBooleanExpression;
4662 DateTime?: QueryDateTimeExpression;
4663 DateTimeSecond?: QueryDateTimeSecondExpression;
4664 Date?: QueryDateTimeExpression;
4665 Decimal?: QueryDecimalExpression;
4666 Integer?: QueryIntegerExpression;
4667 Null?: QueryNullExpression;
4668 Number?: QueryNumberExpression;
4669 String?: QueryStringExpression;
4670 Literal?: QueryLiteralExpression;
4671 DateSpan?: QueryDateSpanExpression;
4672 DateAdd?: QueryDateAddExpression;
4673 Now?: QueryNowExpression;
4674 DefaultValue?: QueryDefaultValueExpression;
4675 AnyValue?: QueryAnyValueExpression;
4676 Arithmetic?: QueryArithmeticExpression;
4677 ScopedEval?: QueryScopedEvalExpression;
4678 FillRule?: QueryFillRuleExpression;
4679 ResourcePackageItem?: QueryResourcePackageItem;
4680 SelectRef?: QuerySelectRefExpression;
4681 }
4682 interface QueryPropertyExpression {
4683 Expression: QueryExpressionContainer;
4684 Property: string;
4685 }
4686 interface QueryColumnExpression extends QueryPropertyExpression {
4687 }
4688 interface QueryMeasureExpression extends QueryPropertyExpression {
4689 }
4690 interface QuerySourceRefExpression {
4691 Source: string;
4692 }
4693 interface QuerySelectRefExpression {
4694 ExpressionName: string;
4695 }
4696 interface QueryAggregationExpression {
4697 Function: QueryAggregateFunction;
4698 Expression: QueryExpressionContainer;
4699 }
4700 interface QueryPercentileExpression {
4701 Expression: QueryExpressionContainer;
4702 K: number;
4703 Exclusive?: boolean;
4704 }
4705 interface QueryHierarchyExpression {
4706 Expression: QueryExpressionContainer;
4707 Hierarchy: string;
4708 }
4709 interface QueryHierarchyLevelExpression {
4710 Expression: QueryExpressionContainer;
4711 Level: string;
4712 }
4713 interface QueryPropertyVariationSourceExpression {
4714 Expression: QueryExpressionContainer;
4715 Name: string;
4716 Property: string;
4717 }
4718 interface QueryBinaryExpression {
4719 Left: QueryExpressionContainer;
4720 Right: QueryExpressionContainer;
4721 }
4722 interface QueryBetweenExpression {
4723 Expression: QueryExpressionContainer;
4724 LowerBound: QueryExpressionContainer;
4725 UpperBound: QueryExpressionContainer;
4726 }
4727 interface QueryInExpression {
4728 Expressions: QueryExpressionContainer[];
4729 Values: QueryExpressionContainer[][];
4730 }
4731 interface QueryComparisonExpression extends QueryBinaryExpression {
4732 ComparisonKind: QueryComparisonKind;
4733 }
4734 interface QueryContainsExpression extends QueryBinaryExpression {
4735 }
4736 interface QueryNotExpression {
4737 Expression: QueryExpressionContainer;
4738 }
4739 interface QueryStartsWithExpression extends QueryBinaryExpression {
4740 }
4741 interface QueryExistsExpression {
4742 Expression: QueryExpressionContainer;
4743 }
4744 interface QueryConstantExpression<T> {
4745 Value: T;
4746 }
4747 interface QueryLiteralExpression {
4748 Value: string;
4749 }
4750 interface QueryBooleanExpression extends QueryConstantExpression<boolean> {
4751 }
4752 interface QueryDateTimeExpression extends QueryConstantExpression<string> {
4753 }
4754 interface QueryDateTimeSecondExpression extends QueryConstantExpression<string> {
4755 }
4756 interface QueryDecimalExpression extends QueryConstantExpression<number> {
4757 }
4758 interface QueryIntegerExpression extends QueryConstantExpression<number> {
4759 }
4760 interface QueryNumberExpression extends QueryConstantExpression<string> {
4761 }
4762 interface QueryNullExpression {
4763 }
4764 interface QueryStringExpression extends QueryConstantExpression<string> {
4765 }
4766 interface QueryDateSpanExpression {
4767 TimeUnit: TimeUnit;
4768 Expression: QueryExpressionContainer;
4769 }
4770 interface QueryDateAddExpression {
4771 Amount: number;
4772 TimeUnit: TimeUnit;
4773 Expression: QueryExpressionContainer;
4774 }
4775 interface QueryNowExpression {
4776 }
4777 interface QueryDefaultValueExpression {
4778 }
4779 interface QueryAnyValueExpression {
4780 }
4781 interface QueryArithmeticExpression {
4782 Left: QueryExpressionContainer;
4783 Right: QueryExpressionContainer;
4784 Operator: ArithmeticOperatorKind;
4785 }
4786 const enum ArithmeticOperatorKind {
4787 Add = 0,
4788 Subtract = 1,
4789 Multiply = 2,
4790 Divide = 3,
4791 }
4792 function getArithmeticOperatorName(arithmeticOperatorKind: ArithmeticOperatorKind): string;
4793 interface QueryFillRuleExpression {
4794 Input: QueryExpressionContainer;
4795 FillRule: FillRuleGeneric<QueryExpressionContainer, QueryExpressionContainer>;
4796 }
4797 interface QueryResourcePackageItem {
4798 PackageName: string;
4799 PackageType: number;
4800 ItemName: string;
4801 }
4802 interface QueryScopedEvalExpression {
4803 Expression: QueryExpressionContainer;
4804 Scope: QueryExpressionContainer[];
4805 }
4806 enum TimeUnit {
4807 Day = 0,
4808 Week = 1,
4809 Month = 2,
4810 Year = 3,
4811 Decade = 4,
4812 Second = 5,
4813 Minute = 6,
4814 Hour = 7,
4815 }
4816 enum QueryAggregateFunction {
4817 Sum = 0,
4818 Avg = 1,
4819 Count = 2,
4820 Min = 3,
4821 Max = 4,
4822 CountNonNull = 5,
4823 Median = 6,
4824 StandardDeviation = 7,
4825 Variance = 8,
4826 }
4827 enum QueryComparisonKind {
4828 Equal = 0,
4829 GreaterThan = 1,
4830 GreaterThanOrEqual = 2,
4831 LessThan = 3,
4832 LessThanOrEqual = 4,
4833 }
4834 /** Defines semantic data types. */
4835 enum SemanticType {
4836 None = 0,
4837 Number = 1,
4838 Integer = 3,
4839 DateTime = 4,
4840 Time = 8,
4841 Date = 20,
4842 Month = 35,
4843 Year = 67,
4844 YearAndMonth = 128,
4845 MonthAndDay = 256,
4846 Decade = 515,
4847 YearAndWeek = 1024,
4848 String = 2048,
4849 Boolean = 4096,
4850 Table = 8192,
4851 Range = 16384,
4852 }
4853 interface QueryMetadata {
4854 Select?: SelectMetadata[];
4855 Filters?: FilterMetadata[];
4856 }
4857 interface SelectMetadata {
4858 Restatement: string;
4859 Type?: number;
4860 Format?: string;
4861 DataCategory?: ConceptualDataCategory;
4862 /** The select projection name. */
4863 Name?: string;
4864 kpiStatusGraphic?: string;
4865 kpi?: DataViewKpiColumnMetadata;
4866 }
4867 interface FilterMetadata {
4868 Restatement: string;
4869 Kind?: FilterKind;
4870 /** The expression being filtered. This is reflected in the filter card UI. */
4871 expression?: QueryExpressionContainer;
4872 }
4873 enum FilterKind {
4874 Default = 0,
4875 Period = 1,
4876 }
4877}
4878declare module powerbi.data {
4879 /** Represents a projection from a query result. */
4880 interface QueryProjection {
4881 /** Name of item in the semantic query Select clause. */
4882 queryRef: string;
4883 /** Optional format string. */
4884 format?: string;
4885 }
4886 /** A set of QueryProjections, grouped by visualization property, and ordered within that property. */
4887 interface QueryProjectionsByRole {
4888 [roleName: string]: QueryProjectionCollection;
4889 }
4890 class QueryProjectionCollection {
4891 private items;
4892 private _activeProjectionRefs;
4893 private _showAll;
4894 constructor(items: QueryProjection[], activeProjectionRefs?: string[], showAll?: boolean);
4895 /** Returns all projections in a mutable array. */
4896 all(): QueryProjection[];
4897 activeProjectionRefs: string[];
4898 showAll: boolean;
4899 addActiveQueryReference(queryRef: string): void;
4900 getLastActiveQueryReference(): string;
4901 /** Replaces the given oldQueryRef with newQueryRef in this QueryProjectionCollection. */
4902 replaceQueryRef(oldQueryRef: string, newQueryRef: string): void;
4903 clone(): QueryProjectionCollection;
4904 }
4905 module QueryProjectionsByRole {
4906 /** Clones the QueryProjectionsByRole. */
4907 function clone(roles: QueryProjectionsByRole): QueryProjectionsByRole;
4908 /** Returns the QueryProjectionCollection for that role. Even returns empty collections so that 'drillable' and 'activeProjection' fields are preserved. */
4909 function getRole(roles: QueryProjectionsByRole, name: string): QueryProjectionCollection;
4910 }
4911}
4912declare module powerbi {
4913 interface VisualElement {
4914 DataRoles?: DataRole[];
4915 Settings?: VisualElementSettings;
4916 }
4917 /** Defines common settings for a visual element. */
4918 interface VisualElementSettings {
4919 DisplayUnitSystemType?: DisplayUnitSystemType;
4920 }
4921 interface DataRole {
4922 Name: string;
4923 Projection: number;
4924 isActive?: boolean;
4925 }
4926 /** The system used to determine display units used during formatting */
4927 enum DisplayUnitSystemType {
4928 /** Default display unit system, which saves space by using units such as K, M, bn with PowerView rules for when to pick a unit. Suitable for chart axes. */
4929 Default = 0,
4930 /** A verbose display unit system that will only respect the formatting defined in the model. Suitable for explore mode single-value cards. */
4931 Verbose = 1,
4932 /**
4933 * A display unit system that uses units such as K, M, bn if we have at least one of those units (e.g. 0.9M is not valid as it's less than 1 million).
4934 * Suitable for dashboard tile cards
4935 */
4936 WholeUnits = 2,
4937 /**A display unit system that also contains Auto and None units for data labels*/
4938 DataLabels = 3,
4939 }
4940}
4941declare module powerbi.data.contracts {
4942 interface DataViewSource {
4943 data: any;
4944 type?: string;
4945 }
4946}
4947declare module powerbi {
4948 /** Repreasents the sequence of the dates/times */
4949 class DateTimeSequence {
4950 private static MIN_COUNT;
4951 private static MAX_COUNT;
4952 min: Date;
4953 max: Date;
4954 unit: DateTimeUnit;
4955 sequence: Date[];
4956 interval: number;
4957 intervalOffset: number;
4958 /** Creates new instance of the DateTimeSequence */
4959 constructor(unit: DateTimeUnit);
4960 /**
4961 * Add a new Date to a sequence.
4962 * @param date - date to add
4963 */
4964 add(date: Date): void;
4965 /**
4966 * Extends the sequence to cover new date range
4967 * @param min - new min to be covered by sequence
4968 * @param max - new max to be covered by sequence
4969 */
4970 extendToCover(min: Date, max: Date): void;
4971 /**
4972 * Move the sequence to cover new date range
4973 * @param min - new min to be covered by sequence
4974 * @param max - new max to be covered by sequence
4975 */
4976 moveToCover(min: Date, max: Date): void;
4977 /**
4978 * Calculate a new DateTimeSequence
4979 * @param dataMin - Date representing min of the data range
4980 * @param dataMax - Date representing max of the data range
4981 * @param expectedCount - expected number of intervals in the sequence
4982 * @param unit - of the intervals in the sequence
4983 */
4984 static calculate(dataMin: Date, dataMax: Date, expectedCount: number, unit?: DateTimeUnit): DateTimeSequence;
4985 static calculateYears(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4986 static calculateMonths(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4987 static calculateWeeks(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4988 static calculateDays(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4989 static calculateHours(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4990 static calculateMinutes(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4991 static calculateSeconds(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4992 static calculateMilliseconds(dataMin: Date, dataMax: Date, expectedCount: number): DateTimeSequence;
4993 static addInterval(value: Date, interval: number, unit: DateTimeUnit): Date;
4994 private static fromNumericSequence(date, sequence, unit);
4995 private static getDelta(min, max, unit);
4996 static getIntervalUnit(min: Date, max: Date, maxCount: number): DateTimeUnit;
4997 }
4998 /** DateUtils module provides DateTimeSequence with set of additional date manipulation routines */
4999 module DateUtils {
5000 /**
5001 * Adds a specified number of years to the provided date.
5002 * @param date - date value
5003 * @param yearDelta - number of years to add
5004 */
5005 function addYears(date: Date, yearDelta: number): Date;
5006 /**
5007 * Adds a specified number of months to the provided date.
5008 * @param date - date value
5009 * @param monthDelta - number of months to add
5010 */
5011 function addMonths(date: Date, monthDelta: number): Date;
5012 /**
5013 * Adds a specified number of weeks to the provided date.
5014 * @param date - date value
5015 * @param weeks - number of weeks to add
5016 */
5017 function addWeeks(date: Date, weeks: number): Date;
5018 /**
5019 * Adds a specified number of days to the provided date.
5020 * @param date - date value
5021 * @param days - number of days to add
5022 */
5023 function addDays(date: Date, days: number): Date;
5024 /**
5025 * Adds a specified number of hours to the provided date.
5026 * @param date - date value
5027 * @param hours - number of hours to add
5028 */
5029 function addHours(date: Date, hours: number): Date;
5030 /**
5031 * Adds a specified number of minutes to the provided date.
5032 * @param date - date value
5033 * @param minutes - number of minutes to add
5034 */
5035 function addMinutes(date: Date, minutes: number): Date;
5036 /**
5037 * Adds a specified number of seconds to the provided date.
5038 * @param date - date value
5039 * @param seconds - number of seconds to add
5040 */
5041 function addSeconds(date: Date, seconds: number): Date;
5042 /**
5043 * Adds a specified number of milliseconds to the provided date.
5044 * @param date - date value
5045 * @param milliseconds - number of milliseconds to add
5046 */
5047 function addMilliseconds(date: Date, milliseconds: number): Date;
5048 }
5049}
5050declare module powerbi {
5051 class DisplayUnit {
5052 value: number;
5053 title: string;
5054 labelFormat: string;
5055 applicableRangeMin: number;
5056 applicableRangeMax: number;
5057 project(value: number): number;
5058 reverseProject(value: number): number;
5059 isApplicableTo(value: number): boolean;
5060 isScaling(): boolean;
5061 }
5062 class DisplayUnitSystem {
5063 units: DisplayUnit[];
5064 displayUnit: DisplayUnit;
5065 private unitBaseValue;
5066 protected static UNSUPPORTED_FORMATS: RegExp;
5067 constructor(units?: DisplayUnit[]);
5068 title: string;
5069 update(value: number): void;
5070 private findApplicableDisplayUnit(value);
5071 format(value: number, format: string, decimals?: number, trailingZeros?: boolean): string;
5072 isFormatSupported(format: string): boolean;
5073 isPercentageFormat(format: string): boolean;
5074 shouldRespectScalingUnit(format: string): boolean;
5075 getNumberOfDecimalsForFormatting(format: string, decimals?: number): number;
5076 isScalingUnit(): boolean;
5077 private formatHelper(value, nonScientificFormat, format, decimals?, trailingZeros?);
5078 /** Formats a single value by choosing an appropriate base for the DisplayUnitSystem before formatting. */
5079 formatSingleValue(value: number, format: string, decimals?: number, trailingZeros?: boolean): string;
5080 private shouldUseValuePrecision(value);
5081 protected isScientific(value: number): boolean;
5082 protected hasScientitifcFormat(format: string): boolean;
5083 protected supportsScientificFormat(format: string): boolean;
5084 protected shouldFallbackToScientific(value: number, format: string): boolean;
5085 protected getScientificFormat(data: number, format: string, decimals: number, trailingZeros: boolean): string;
5086 }
5087 /** Provides a unit system that is defined by formatting in the model, and is suitable for visualizations shown in single number visuals in explore mode. */
5088 class NoDisplayUnitSystem extends DisplayUnitSystem {
5089 constructor();
5090 }
5091 /** Provides a unit system that creates a more concise format for displaying values. This is suitable for most of the cases where
5092 we are showing values (chart axes) and as such it is the default unit system. */
5093 class DefaultDisplayUnitSystem extends DisplayUnitSystem {
5094 private static units;
5095 constructor(unitLookup: (exponent: number) => DisplayUnitSystemNames);
5096 format(data: number, format: string, decimals?: number, trailingZeros?: boolean): string;
5097 static reset(): void;
5098 private static getUnits(unitLookup);
5099 }
5100 /** Provides a unit system that creates a more concise format for displaying values, but only allows showing a unit if we have at least
5101 one of those units (e.g. 0.9M is not allowed since it's less than 1 million). This is suitable for cases such as dashboard tiles
5102 where we have restricted space but do not want to show partial units. */
5103 class WholeUnitsDisplayUnitSystem extends DisplayUnitSystem {
5104 private static units;
5105 constructor(unitLookup: (exponent: number) => DisplayUnitSystemNames);
5106 static reset(): void;
5107 private static getUnits(unitLookup);
5108 format(data: number, format: string, decimals?: number, trailingZeros?: boolean): string;
5109 }
5110 class DataLabelsDisplayUnitSystem extends DisplayUnitSystem {
5111 private static AUTO_DISPLAYUNIT_VALUE;
5112 private static NONE_DISPLAYUNIT_VALUE;
5113 protected static UNSUPPORTED_FORMATS: RegExp;
5114 private static units;
5115 constructor(unitLookup: (exponent: number) => DisplayUnitSystemNames);
5116 isFormatSupported(format: string): boolean;
5117 private static getUnits(unitLookup);
5118 format(data: number, format: string, decimals?: number, trailingZeros?: boolean): string;
5119 }
5120 interface DisplayUnitSystemNames {
5121 title: string;
5122 format: string;
5123 }
5124}
5125declare module powerbi {
5126 class NumericSequence {
5127 private static MIN_COUNT;
5128 private static MAX_COUNT;
5129 private maxAllowedMargin;
5130 private canExtendMin;
5131 private canExtendMax;
5132 interval: number;
5133 intervalOffset: number;
5134 min: number;
5135 max: number;
5136 precision: number;
5137 sequence: number[];
5138 static calculate(range: NumericSequenceRange, expectedCount: number, maxAllowedMargin?: number, minPower?: number, useZeroRefPoint?: boolean, steps?: number[]): NumericSequence;
5139 /**
5140 * Calculates the sequence of int numbers which are mapped to the multiples of the units grid.
5141 * @min - The minimum of the range.
5142 * @max - The maximum of the range.
5143 * @maxCount - The max count of intervals.
5144 * @steps - array of intervals.
5145 */
5146 static calculateUnits(min: number, max: number, maxCount: number, steps: number[]): NumericSequence;
5147 trimMinMax(min: number, max: number): void;
5148 }
5149}
5150declare module powerbi {
5151 class NumericSequenceRange {
5152 private static DEFAULT_MAX;
5153 private static MIN_SUPPORTED_DOUBLE;
5154 private static MAX_SUPPORTED_DOUBLE;
5155 min: number;
5156 max: number;
5157 includeZero: boolean;
5158 forcedSingleStop: number;
5159 hasDataRange: boolean;
5160 hasFixedMin: boolean;
5161 hasFixedMax: boolean;
5162 private _ensureIncludeZero();
5163 private _ensureNotEmpty();
5164 private _ensureDirection();
5165 getSize(): number;
5166 shrinkByStep(range: NumericSequenceRange, step: number): void;
5167 static calculate(dataMin: number, dataMax: number, fixedMin?: number, fixedMax?: number, includeZero?: boolean): NumericSequenceRange;
5168 static calculateDataRange(dataMin: number, dataMax: number, includeZero?: boolean): NumericSequenceRange;
5169 static calculateFixedRange(fixedMin: number, fixedMax: number, includeZero?: boolean): NumericSequenceRange;
5170 }
5171 /** Note: Exported for testability */
5172 module ValueUtil {
5173 function hasValue(value: any): boolean;
5174 }
5175}
5176declare module powerbi.visuals {
5177 /**
5178 * Formats the value using provided format expression
5179 * @param value - value to be formatted and converted to string.
5180 * @param format - format to be applied if the number shouldn't be abbreviated.
5181 * If the number should be abbreviated this string is checked for special characters like $ or % if any
5182 */
5183 interface ICustomValueFormatter {
5184 (value: any, format?: string): string;
5185 }
5186 interface ICustomValueColumnFormatter {
5187 (value: any, column: DataViewMetadataColumn, formatStringProp: DataViewObjectPropertyIdentifier): string;
5188 }
5189 interface ValueFormatterOptions {
5190 /** The format string to use. */
5191 format?: string;
5192 /** The data value. */
5193 value?: any;
5194 /** The data value. */
5195 value2?: any;
5196 /** The number of ticks. */
5197 tickCount?: any;
5198 /** The display unit system to use */
5199 displayUnitSystemType?: DisplayUnitSystemType;
5200 /** True if we are formatting single values in isolation (e.g. card), as opposed to multiple values with a common base (e.g. chart axes) */
5201 formatSingleValues?: boolean;
5202 /** True if we want to trim off unnecessary zeroes after the decimal and remove a space before the % symbol */
5203 allowFormatBeautification?: boolean;
5204 /** Specifies the maximum number of decimal places to show*/
5205 precision?: number;
5206 /** Detect axis precision based on value */
5207 detectAxisPrecision?: boolean;
5208 /** Specifies the column type of the data value */
5209 columnType?: ValueTypeDescriptor;
5210 }
5211 interface IValueFormatter {
5212 format(value: any): string;
5213 displayUnit?: DisplayUnit;
5214 options?: ValueFormatterOptions;
5215 }
5216 /** Captures all locale-specific options used by the valueFormatter. */
5217 interface ValueFormatterLocalizationOptions {
5218 null: string;
5219 true: string;
5220 false: string;
5221 NaN: string;
5222 infinity: string;
5223 negativeInfinity: string;
5224 /** Returns a beautified form the given format string. */
5225 beautify(format: string): string;
5226 /** Returns an object describing the given exponent in the current language. */
5227 describe(exponent: number): DisplayUnitSystemNames;
5228 restatementComma: string;
5229 restatementCompoundAnd: string;
5230 restatementCompoundOr: string;
5231 }
5232 module valueFormatter {
5233 const DefaultIntegerFormat: string;
5234 const DefaultNumericFormat: string;
5235 const DefaultDateFormat: string;
5236 function getLocalizedString(stringId: string): string;
5237 function getFormatMetadata(format: string): powerbi.NumberFormat.NumericFormatMetadata;
5238 function setLocaleOptions(options: ValueFormatterLocalizationOptions): void;
5239 function createDefaultFormatter(formatString: string, allowFormatBeautification?: boolean): IValueFormatter;
5240 /** Creates an IValueFormatter to be used for a range of values. */
5241 function create(options: ValueFormatterOptions): IValueFormatter;
5242 function format(value: any, format?: string, allowFormatBeautification?: boolean): string;
5243 function formatValueColumn(value: any, column: DataViewMetadataColumn, formatStringProp: DataViewObjectPropertyIdentifier): string;
5244 function getFormatString(column: DataViewMetadataColumn, formatStringProperty: DataViewObjectPropertyIdentifier, suppressTypeFallback?: boolean): string;
5245 /** The returned string will look like 'A, B, ..., and C' */
5246 function formatListAnd(strings: string[]): string;
5247 /** The returned string will look like 'A, B, ..., or C' */
5248 function formatListOr(strings: string[]): string;
5249 function getDisplayUnits(displayUnitSystemType: DisplayUnitSystemType): DisplayUnit[];
5250 }
5251}
5252declare module powerbi {
5253 interface IColorAllocator {
5254 /** Computes the color corresponding to the provided value. */
5255 color(value: PrimitiveValue): string;
5256 }
5257 interface IColorAllocatorFactory {
5258 /** Creates a gradient that that transitions between two colors. */
5259 linearGradient2(options: LinearGradient2): IColorAllocator;
5260 /** Creates a gradient that that transitions between three colors. */
5261 linearGradient3(options: LinearGradient3, splitScales: boolean): IColorAllocator;
5262 }
5263}
5264declare module powerbi.data {
5265 interface CompiledDataViewRoleBindMappingWithReduction extends CompiledDataViewRoleBindMapping, HasReductionAlgorithm {
5266 }
5267 interface CompiledDataViewRoleForMappingWithReduction extends CompiledDataViewRoleForMapping, HasReductionAlgorithm {
5268 }
5269}
5270declare module powerbi.data {
5271 module DataRoleHelper {
5272 function getMeasureIndexOfRole(grouped: DataViewValueColumnGroup[], roleName: string): number;
5273 function getCategoryIndexOfRole(categories: DataViewCategoryColumn[], roleName: string): number;
5274 function hasRole(column: DataViewMetadataColumn, name: string): boolean;
5275 function hasRoleInDataView(dataView: DataView, name: string): boolean;
5276 function hasRoleInValueColumn(valueColumn: DataViewValueColumn, name: string): boolean;
5277 }
5278}
5279declare module powerbi.data {
5280 function createIDataViewCategoricalReader(dataView: DataView): IDataViewCategoricalReader;
5281 interface IDataViewCategoricalReader {
5282 hasCategories(): boolean;
5283 getCategoryCount(): number;
5284 getCategoryValues(roleName: string): any;
5285 getCategoryValue(roleName: string, categoryIndex: number): any;
5286 getCategoryColumn(roleName: string): DataViewCategoryColumn;
5287 getCategoryMetadataColumn(roleName: string): DataViewMetadataColumn;
5288 getCategoryColumnIdentityFields(roleName: string): powerbi.data.ISQExpr[];
5289 getCategoryDisplayName(roleName: string): string;
5290 hasCompositeCategories(): boolean;
5291 hasCategoryWithRole(roleName: string): boolean;
5292 getCategoryObjects(roleName: string, categoryIndex: number): DataViewObjects;
5293 hasValues(roleName: string): boolean;
5294 /**
5295 * Obtains the value for the given role name, category index, and series index.
5296 *
5297 * Note: in cases where have multiple values in a role where the multiple values
5298 * are not being used to create a static series, the first is obtained. (this is
5299 * a rare case)
5300 */
5301 getValue(roleName: string, categoryIndex: number, seriesIndex?: number): any;
5302 /**
5303 * Obtains the highlighted value for the given role name, category index, and series index.
5304 *
5305 * Note: in cases where have multiple values in a role where the multiple values
5306 * are not being used to create a static series, the first is obtained. (this is
5307 * a rare case)
5308 */
5309 getHighlight(roleName: string, categoryIndex: number, seriesIndex?: number): any;
5310 /**
5311 * Obtains all the values for the given role name, category index, and series index, drawing
5312 * from each of the value columns at that intersection. Used when you have multiple
5313 * values in a role that are not conceptually a static series.
5314 */
5315 getAllValuesForRole(roleName: string, categoryIndex: number, seriesIndex?: number): any[];
5316 /**
5317 * Obtains all the highlight values for the given role name, category index, and series index, drawing
5318 * from each of the value columns at that intersection. Used when you have multiple
5319 * values in a role that are not conceptually a static series.
5320 */
5321 getAllHighlightsForRole(roleName: string, categoryIndex: number, seriesIndex?: number): any[];
5322 /**
5323 * Obtains the first non-null value for the given role name and category index.
5324 * It should mainly be used for values that are expected to be the same across
5325 * series, but avoids false nulls when the data is sparse.
5326 */
5327 getFirstNonNullValueForCategory(roleName: string, categoryIndex: number): any;
5328 getMeasureQueryName(roleName: string): string;
5329 getValueColumn(roleName: string, seriesIndex?: number): DataViewValueColumn;
5330 getValueMetadataColumn(roleName: string, seriesIndex?: number): DataViewMetadataColumn;
5331 getValueDisplayName(roleName: string, seriesIndex?: number): string;
5332 hasDynamicSeries(): boolean;
5333 /**
5334 * Get the series count. This requires a value role name for cases where you may
5335 * have a static series, but is not required if the only series you expect are dynamic
5336 * or single series.
5337 *
5338 * @param valueRoleName The role of the value for which a static series may exist
5339 */
5340 getSeriesCount(valueRoleName?: string): number;
5341 getSeriesObjects(seriesIndex: number): DataViewObjects;
5342 getSeriesValueColumns(): DataViewValueColumns;
5343 getSeriesValueColumnGroup(seriesIndex: number): DataViewValueColumnGroup;
5344 getSeriesMetadataColumn(): DataViewMetadataColumn;
5345 getSeriesColumnIdentityFields(): powerbi.data.ISQExpr[];
5346 getSeriesName(seriesIndex: number): PrimitiveValue;
5347 getSeriesDisplayName(): string;
5348 }
5349}
5350declare module powerbi.data {
5351 module DataViewConcatenateCategoricalColumns {
5352 function detectAndApply(dataView: DataView, objectDescriptors: DataViewObjectDescriptors, roleMappings: DataViewMapping[], projectionOrdering: DataViewProjectionOrdering, selects: DataViewSelectTransform[], projectionActiveItems: DataViewProjectionActiveItems): DataView;
5353 /** For applying concatenation to the DataViewCategorical that is the data for one of the frames in a play chart. */
5354 function applyToPlayChartCategorical(metadata: DataViewMetadata, objectDescriptors: DataViewObjectDescriptors, categoryRoleName: string, categorical: DataViewCategorical): DataView;
5355 }
5356}
5357declare module powerbi {
5358 const enum RoleItemContext {
5359 CategoricalValue = 0,
5360 CategoricalValueGroup = 1,
5361 }
5362 interface IDataViewMappingVisitor {
5363 visitRole(role: string, context?: RoleItemContext): void;
5364 visitReduction?(reductionAlgorithm?: ReductionAlgorithm): void;
5365 }
5366 module DataViewMapping {
5367 function visitMapping(mapping: DataViewMapping, visitor: IDataViewMappingVisitor): void;
5368 function visitCategorical(mapping: DataViewCategoricalMapping, visitor: IDataViewMappingVisitor): void;
5369 function visitCategoricalCategories(mapping: DataViewRoleMappingWithReduction | DataViewListRoleMappingWithReduction, visitor: IDataViewMappingVisitor): void;
5370 function visitCategoricalValues(mapping: DataViewRoleMapping | DataViewGroupedRoleMapping | DataViewListRoleMapping, visitor: IDataViewMappingVisitor): void;
5371 function visitTable(mapping: DataViewTableMapping, visitor: IDataViewMappingVisitor): void;
5372 /**
5373 * For visiting DataViewMatrixMapping.rows, DataViewMatrixMapping.columns, or DataViewMatrixMapping.values.
5374 *
5375 * @param mapping Can be one of DataViewMatrixMapping.rows, DataViewMatrixMapping.columns, or DataViewMatrixMapping.values.
5376 * @param visitor The visitor.
5377 */
5378 function visitMatrixItems(mapping: DataViewRoleForMappingWithReduction | DataViewListRoleMappingWithReduction, visitor: IDataViewMappingVisitor): void;
5379 function visitTreeNodes(mapping: DataViewRoleForMappingWithReduction, visitor: IDataViewMappingVisitor): void;
5380 function visitTreeValues(mapping: DataViewRoleForMapping, visitor: IDataViewMappingVisitor): void;
5381 function visitGrouped(mapping: DataViewGroupedRoleMapping, visitor: IDataViewMappingVisitor): void;
5382 }
5383}
5384declare module powerbi.data {
5385 interface DataViewNormalizeValuesApplyOptions {
5386 dataview: DataView;
5387 dataViewMappings: DataViewMapping[];
5388 dataRoles: VisualDataRole[];
5389 }
5390 /**
5391 * Interface of a function for deciding whether a column is tied to any role that has required type(s).
5392 *
5393 * @param columnIndex the position of the column in the select statement, i.e. the same semantic as the index property on the DataViewMetadataColumn interface.
5394 * @returns true iff the column in the specified columnIndex is tied to any role that has required type(s), i.e. if the value in that column potentially needs to get normalized.
5395 */
5396 interface IMetadataColumnFilter {
5397 (columnIndex: number): boolean;
5398 }
5399 /**
5400 * Returns true iff the specified value is of matching type as required by the role assigned to the column associated with this filter object.
5401 */
5402 interface IColumnValueFilter {
5403 (value: any): boolean;
5404 }
5405 /**
5406 * Interface of a function for deciding whether a value needs to be normalized due to not having a matching type as required by a role tied to the column associated with the specified columnIndex.
5407 *
5408 * @param columnIndex the position of the column in the select statement, i.e. the same semantic as the index property on the DataViewMetadataColumn interface.
5409 * @returns false iff the specified value needs to be normalized due to not having a matching type as required by a role tied to the column associated with the specified columnIndex.
5410 */
5411 interface IValueFilter {
5412 (columnIndex: number, value: any): boolean;
5413 }
5414 module DataViewNormalizeValues {
5415 function apply(options: DataViewNormalizeValuesApplyOptions): void;
5416 function filterVariantMeasures(dataview: DataView, dataViewMappings: DataViewMapping[], rolesToNormalize: VisualDataRole[]): void;
5417 function generateMetadataColumnFilter(columns: DataViewMetadataColumn[], rolesToNormalize: VisualDataRole[]): IMetadataColumnFilter;
5418 function generateValueFilter(columns: DataViewMetadataColumn[], rolesToNormalize: VisualDataRole[]): IValueFilter;
5419 function getColumnRequiredTypes(column: DataViewMetadataColumn, rolesToNormalize: VisualDataRole[]): ValueType[];
5420 function normalizeVariant<T>(object: T, key: string | number, columnIndex: number, valueFilter: IValueFilter): T;
5421 }
5422}
5423declare module powerbi {
5424 module DataViewObjects {
5425 /** Gets the value of the given object/property pair. */
5426 function getValue<T>(objects: DataViewObjects, propertyId: DataViewObjectPropertyIdentifier, defaultValue?: T): T;
5427 /** Gets an object from objects. */
5428 function getObject(objects: DataViewObjects, objectName: string, defaultValue?: DataViewObject): DataViewObject;
5429 /** Gets a map of user-defined objects. */
5430 function getUserDefinedObjects(objects: DataViewObjects, objectName: string): DataViewObjectMap;
5431 /** Gets the solid color from a fill property. */
5432 function getFillColor(objects: DataViewObjects, propertyId: DataViewObjectPropertyIdentifier, defaultColor?: string): string;
5433 /** Returns true if the given object represents a collection of user-defined objects */
5434 function isUserDefined(objectOrMap: DataViewObject | DataViewObjectMap): boolean;
5435 }
5436 module DataViewObject {
5437 function getValue<T>(object: DataViewObject, propertyName: string, defaultValue?: T): T;
5438 /** Gets the solid color from a fill property using only a propertyName */
5439 function getFillColorByPropertyName(objects: DataViewObjects, propertyName: string, defaultColor?: string): string;
5440 }
5441}
5442declare module powerbi.data {
5443 /** Defines the values for particular objects. */
5444 interface DataViewObjectDefinitions {
5445 [objectName: string]: DataViewObjectDefinition[];
5446 }
5447 interface DataViewObjectDefinition {
5448 selector?: Selector;
5449 properties: DataViewObjectPropertyDefinitions;
5450 }
5451 interface DataViewObjectPropertyDefinitions {
5452 [name: string]: DataViewObjectPropertyDefinition;
5453 }
5454 type DataViewObjectPropertyDefinition = SQExpr | StructuralObjectDefinition;
5455 module DataViewObjectDefinitions {
5456 /** Creates or reuses a DataViewObjectDefinition for matching the given objectName and selector within the defns. */
5457 function ensure(defns: DataViewObjectDefinitions, objectName: string, selector: Selector): DataViewObjectDefinition;
5458 function deleteProperty(defns: DataViewObjectDefinitions, objectName: string, selector: Selector, propertyName: string): void;
5459 function setValue(defns: DataViewObjectDefinitions, propertyId: DataViewObjectPropertyIdentifier, selector: Selector, value: DataViewObjectPropertyDefinition): void;
5460 function getValue(defns: DataViewObjectDefinitions, propertyId: DataViewObjectPropertyIdentifier, selector: Selector): DataViewObjectPropertyDefinition;
5461 function getPropertyContainer(defns: DataViewObjectDefinitions, propertyId: DataViewObjectPropertyIdentifier, selector: Selector): DataViewObjectPropertyDefinitions;
5462 function getObjectDefinition(defns: DataViewObjectDefinitions, objectName: string, selector: Selector): DataViewObjectDefinition;
5463 function propertiesAreEqual(a: DataViewObjectPropertyDefinition, b: DataViewObjectPropertyDefinition): boolean;
5464 function allPropertiesAreEqual(a: DataViewObjectPropertyDefinitions, b: DataViewObjectPropertyDefinitions): boolean;
5465 function encodePropertyValue(value: DataViewPropertyValue, valueTypeDescriptor: ValueTypeDescriptor): DataViewObjectPropertyDefinition;
5466 function clone(original: DataViewObjectDefinitions): DataViewObjectDefinitions;
5467 }
5468 module DataViewObjectDefinition {
5469 function deleteSingleProperty(defn: DataViewObjectDefinition, propertyName: string): void;
5470 }
5471}
5472declare module powerbi.data {
5473 module DataViewObjectDescriptors {
5474 /** Attempts to find the format string property. This can be useful for upgrade and conversion. */
5475 function findFormatString(descriptors: DataViewObjectDescriptors): DataViewObjectPropertyIdentifier;
5476 /** Attempts to find the filter property. This can be useful for propagating filters from one visual to others. */
5477 function findFilterOutput(descriptors: DataViewObjectDescriptors): DataViewObjectPropertyIdentifier;
5478 /** Attempts to find the default value property. This can be useful for propagating schema default value. */
5479 function findDefaultValue(descriptors: DataViewObjectDescriptors): DataViewObjectPropertyIdentifier;
5480 }
5481}
5482declare module powerbi.data {
5483 interface DataViewObjectDefinitionsByRepetition {
5484 metadataOnce?: DataViewObjectDefinitionsForSelector;
5485 userDefined?: DataViewObjectDefinitionsForSelector[];
5486 metadata?: DataViewObjectDefinitionsForSelector[];
5487 data: DataViewObjectDefinitionsForSelectorWithRule[];
5488 }
5489 interface DataViewObjectDefinitionsForSelector {
5490 selector?: Selector;
5491 objects: DataViewNamedObjectDefinition[];
5492 }
5493 interface DataViewObjectDefinitionsForSelectorWithRule extends DataViewObjectDefinitionsForSelector {
5494 rules?: RuleEvaluation[];
5495 }
5496 interface DataViewNamedObjectDefinition {
5497 name: string;
5498 properties: DataViewObjectPropertyDefinitions;
5499 }
5500 module DataViewObjectEvaluationUtils {
5501 function evaluateDataViewObjects(evalContext: IEvalContext, objectDescriptors: DataViewObjectDescriptors, objectDefns: DataViewNamedObjectDefinition[]): DataViewObjects;
5502 function groupObjectsBySelector(objectDefinitions: DataViewObjectDefinitions): DataViewObjectDefinitionsByRepetition;
5503 function addImplicitObjects(objectsForAllSelectors: DataViewObjectDefinitionsByRepetition, objectDescriptors: DataViewObjectDescriptors, columns: DataViewMetadataColumn[], selectTransforms: DataViewSelectTransform[]): void;
5504 }
5505}
5506declare module powerbi.data {
5507 /** Responsible for evaluating object property expressions to be applied at various scopes in a DataView. */
5508 module DataViewObjectEvaluator {
5509 function run(evalContext: IEvalContext, objectDescriptor: DataViewObjectDescriptor, propertyDefinitions: DataViewObjectPropertyDefinitions): DataViewObject;
5510 /** Note: Exported for testability */
5511 function evaluateProperty(evalContext: IEvalContext, propertyDescriptor: DataViewObjectPropertyDescriptor, propertyDefinition: DataViewObjectPropertyDefinition): any;
5512 }
5513}
5514declare module powerbi.data {
5515 module DataViewPivotCategorical {
5516 /**
5517 * Pivots categories in a categorical DataView into valueGroupings.
5518 * This is akin to a mathematical matrix transpose.
5519 */
5520 function apply(dataView: DataView): DataView;
5521 }
5522}
5523declare module powerbi.data {
5524 module DataViewPivotMatrix {
5525 /** Pivots row hierarchy members in a matrix DataView into column hierarchy. */
5526 function apply(dataViewMatrix: DataViewMatrix, context: MatrixTransformationContext): void;
5527 function cloneTree(node: DataViewMatrixNode): DataViewMatrixNode;
5528 function cloneTreeExecuteOnLeaf(node: DataViewMatrixNode, callback?: (node: DataViewMatrixNode) => void): DataViewMatrixNode;
5529 }
5530}
5531declare module powerbi.data {
5532 module DataViewSelfCrossJoin {
5533 /**
5534 * Returns a new DataView based on the original, with a single DataViewCategorical category that is "cross joined"
5535 * to itself as a value grouping.
5536 * This is the mathematical equivalent of taking an array and turning it into an identity matrix.
5537 */
5538 function apply(dataView: DataView): DataView;
5539 }
5540}
5541declare module powerbi.data {
5542 module DataViewPivotCategoricalToPrimaryGroups {
5543 /**
5544 * If mapping requests cross axis data reduction and the binding has secondary grouping, mutates the binding to
5545 * pivot the secondary before the primary.
5546 */
5547 function pivotBinding(binding: DataShapeBinding, allMappings: CompiledDataViewMapping[], finalMapping: CompiledDataViewMapping, defaultDataVolume: number): void;
5548 function unpivotResult(oldDataView: DataView, selects: DataViewSelectTransform[], dataViewMappings: DataViewMapping[], projectionActiveItems: DataViewProjectionActiveItems): DataView;
5549 }
5550}
5551declare module powerbi.data {
5552 import INumberDictionary = jsCommon.INumberDictionary;
5553 interface DataViewTransformApplyOptions {
5554 prototype: DataView;
5555 objectDescriptors: DataViewObjectDescriptors;
5556 dataViewMappings?: DataViewMapping[];
5557 transforms: DataViewTransformActions;
5558 colorAllocatorFactory: IColorAllocatorFactory;
5559 dataRoles: VisualDataRole[];
5560 }
5561 /** Describes the Transform actions to be done to a prototype DataView. */
5562 interface DataViewTransformActions {
5563 /** Describes transform metadata for each semantic query select item, as the arrays align, by index. */
5564 selects?: DataViewSelectTransform[];
5565 /** Describes the DataViewObject definitions. */
5566 objects?: DataViewObjectDefinitions;
5567 /** Describes the splitting of a single input DataView into multiple DataViews. */
5568 splits?: DataViewSplitTransform[];
5569 /** Describes the projection metadata which includes projection ordering and active items. */
5570 roles?: DataViewRoleTransformMetadata;
5571 }
5572 interface DataViewSplitTransform {
5573 selects: INumberDictionary<boolean>;
5574 }
5575 interface DataViewProjectionOrdering {
5576 [roleName: string]: number[];
5577 }
5578 interface DataViewProjectionActiveItemInfo {
5579 queryRef: string;
5580 /** Describes if the active item should be ignored in concatenation.
5581 If the active item has a drill filter, it will not be used in concatenation.
5582 If the value of suppressConcat is true, the activeItem will be ommitted from concatenation. */
5583 suppressConcat?: boolean;
5584 }
5585 interface DataViewProjectionActiveItems {
5586 [roleName: string]: DataViewProjectionActiveItemInfo[];
5587 }
5588 interface DataViewRoleTransformMetadata {
5589 /** Describes the order of selects (referenced by query index) in each role. */
5590 ordering?: DataViewProjectionOrdering;
5591 /** Describes the active items in each role. */
5592 activeItems?: DataViewProjectionActiveItems;
5593 }
5594 interface MatrixTransformationContext {
5595 rowHierarchyRewritten: boolean;
5596 columnHierarchyRewritten: boolean;
5597 hierarchyTreesRewritten: boolean;
5598 }
5599 const enum StandardDataViewKinds {
5600 None = 0,
5601 Categorical = 1,
5602 Matrix = 2,
5603 Single = 4,
5604 Table = 8,
5605 Tree = 16,
5606 }
5607 module DataViewTransform {
5608 function apply(options: DataViewTransformApplyOptions): DataView[];
5609 function forEachNodeAtLevel(node: DataViewMatrixNode, targetLevel: number, callback: (node: DataViewMatrixNode) => void): void;
5610 function transformObjects(dataView: DataView, targetDataViewKinds: StandardDataViewKinds, objectDescriptors: DataViewObjectDescriptors, objectDefinitions: DataViewObjectDefinitions, selectTransforms: DataViewSelectTransform[], colorAllocatorFactory: IColorAllocatorFactory): void;
5611 function createValueColumns(values?: DataViewValueColumn[], valueIdentityFields?: SQExpr[], source?: DataViewMetadataColumn): DataViewValueColumns;
5612 function setGrouped(values: DataViewValueColumns, groupedResult?: DataViewValueColumnGroup[]): void;
5613 }
5614}
5615declare module powerbi.data {
5616 function createDisplayNameGetter(displayNameKey: string): (IStringResourceProvider) => string;
5617 function getDisplayName(displayNameGetter: data.DisplayNameGetter, resourceProvider: jsCommon.IStringResourceProvider): string;
5618}
5619declare module powerbi.data {
5620 /** Represents a data reader. */
5621 interface IDataReader {
5622 /** Executes a query, with a promise of completion. The response object should be compatible with the transform implementation. */
5623 execute?(options: DataReaderExecutionOptions): RejectablePromise2<DataReaderData, IClientError>;
5624 /** Transforms the given data into a DataView. When this function is not specified, the data is put on a property on the DataView. */
5625 transform?(obj: DataReaderData): DataReaderTransformResult;
5626 /** Stops all future communication and reject and pending communication */
5627 stopCommunication?(): void;
5628 /** Resumes communication which enables future requests */
5629 resumeCommunication?(): void;
5630 /** Clear cache */
5631 clearCache?(dataSource: DataReaderDataSource): void;
5632 /** rewriteCacheEntries */
5633 rewriteCacheEntries?(dataSource: DataReaderDataSource, rewriter: DataReaderCacheRewriter): void;
5634 /** Sets the result into the local cache */
5635 setLocalCacheResult?(options: DataReaderExecutionOptions, dataAsObject: DataReaderData): void;
5636 }
5637 /** Represents a query generator. */
5638 interface IQueryGenerator {
5639 /** Query generation function to convert a (prototype) SemanticQuery to a runnable query command. */
5640 execute(options: QueryGeneratorOptions): QueryGeneratorResult;
5641 }
5642 interface IFederatedConceptualSchemaReader {
5643 /** Executes a request for conceptual schema with a promise of completion. */
5644 execute(options: FederatedConceptualSchemaReaderOptions): IPromise<FederatedConceptualSchemaResponse>;
5645 /** Transforms the given data into a FederatedConceptualSchema. */
5646 transform(obj: FederatedConceptualSchemaResponse): SchemaReaderTransformResult;
5647 }
5648 /** Represents a custom data reader plugin, to be registered in the powerbi.data.plugins object. */
5649 interface IDataReaderPlugin {
5650 /** The name of this plugin. */
5651 name: string;
5652 /** Factory method for the IDataReader. */
5653 reader(hostServices: IDataReaderHostServices): IDataReader;
5654 /** Factory method for the IQueryGenerator. */
5655 queryGenerator?(): IQueryGenerator;
5656 /** Factory method for the IFederatedConceptualSchemaReader. */
5657 schemaReader?(hostServices: IDataReaderHostServices): IFederatedConceptualSchemaReader;
5658 }
5659 interface QueryGeneratorOptions {
5660 query: SemanticQuery;
5661 mappings: CompiledDataViewMapping[];
5662 additionalProjections?: AdditionalQueryProjection[];
5663 highlightFilter?: SemanticFilter;
5664 restartToken?: RestartToken;
5665 dataWindow?: QueryGeneratorDataWindow;
5666 }
5667 interface AdditionalQueryProjection {
5668 queryName: string;
5669 selector: Selector;
5670 aggregates?: ProjectionAggregates;
5671 }
5672 interface ProjectionAggregates {
5673 min?: boolean;
5674 max?: boolean;
5675 }
5676 interface QueryGeneratorResult {
5677 command: DataReaderQueryCommand;
5678 splits?: DataViewSplitTransform[];
5679 /**
5680 * If the query generator needs to rewrite the input query, this property will contain information about the important changes.
5681 *
5682 * Any rewrite done by query generator should be internal to the particular query generator, but in some rare cases this information
5683 * is needed in order for other components to correctly consume the query result.
5684 */
5685 queryRewrites?: QueryRewriteRecordContainer[];
5686 }
5687 /**
5688 * In each instance of QueryRewriteRecordContainer, exactly one of the optional properties will be populated with change record.
5689 */
5690 interface QueryRewriteRecordContainer {
5691 selectExprAdded?: QueryRewriteSelectExprAddedRecord;
5692 projectionQueryRefChanged?: QueryRewriteProjectionQueryRefChangedRecord;
5693 }
5694 /** Indicates a new SQExpr got added at a particular index. */
5695 interface QueryRewriteSelectExprAddedRecord {
5696 selectIndex: number;
5697 namedSQExpr: NamedSQExpr;
5698 }
5699 /** Indicates a queryRef in the query projection for a particular role got changed. */
5700 interface QueryRewriteProjectionQueryRefChangedRecord {
5701 /** The role for which a queryRef in the query projection got changed. */
5702 role: string;
5703 /** The original queryRef. */
5704 oldQueryRef: string;
5705 /** The new, internal queryRef. */
5706 newInternalQueryRef: string;
5707 }
5708 interface DataReaderTransformResult {
5709 dataView?: DataView;
5710 restartToken?: RestartToken;
5711 error?: IClientError;
5712 warning?: IClientWarning;
5713 }
5714 interface QueryGeneratorDataWindow {
5715 }
5716 interface RestartToken {
5717 }
5718 interface DataReaderQueryCommand {
5719 }
5720 /** Represents a query command defined by an IDataReader. */
5721 interface DataReaderCommand {
5722 }
5723 /** Represents a data source defined by an IDataReader. */
5724 interface DataReaderDataSource {
5725 }
5726 /** Represents arbitrary data defined by an IDataReader. */
5727 interface DataReaderData {
5728 }
5729 /** Represents cacheRewriter that will rewrite the cache of reader as defined by an IDataReader. */
5730 interface DataReaderCacheRewriter {
5731 }
5732 interface DataReaderExecutionOptions {
5733 dataSource?: DataReaderDataSource;
5734 command: DataReaderCommand;
5735 allowCache?: boolean;
5736 cacheResponseOnServer?: boolean;
5737 ignoreViewportForCache?: boolean;
5738 }
5739 interface FederatedConceptualSchemaReaderOptions {
5740 dataSources: ConceptualSchemaReaderDataSource[];
5741 }
5742 interface ConceptualSchemaReaderDataSource {
5743 id: number;
5744 /** Specifies the name used in Semantic Queries to reference this DataSource. */
5745 name: string;
5746 /** Specifies the type of IDataReaderPlugin. */
5747 type?: string;
5748 }
5749 interface FederatedConceptualSchemaResponse {
5750 data: FederatedConceptualSchemaData;
5751 }
5752 interface FederatedConceptualSchemaData {
5753 }
5754 interface SchemaReaderTransformResult {
5755 schema: FederatedConceptualSchema;
5756 error?: SchemaReaderError;
5757 }
5758 interface SchemaReaderError {
5759 requestId?: string;
5760 serviceError?: ServiceError;
5761 clientError: IClientError;
5762 }
5763 interface IDataReaderHostServices {
5764 promiseFactory(): IPromiseFactory;
5765 }
5766}
5767declare module powerbi {
5768 /** Enumeration of DateTimeUnits */
5769 enum DateTimeUnit {
5770 Year = 0,
5771 Month = 1,
5772 Week = 2,
5773 Day = 3,
5774 Hour = 4,
5775 Minute = 5,
5776 Second = 6,
5777 Millisecond = 7,
5778 }
5779 interface IFormattingService {
5780 /**
5781 * Formats the value using provided format expression and culture
5782 * @param value - value to be formatted and converted to string.
5783 * @param format - format to be applied. If undefined or empty then generic format is used.
5784 */
5785 formatValue(value: any, format?: string): string;
5786 /**
5787 * Replaces the indexed format tokens (for example {0:c2}) in the format string with the localized formatted arguments.
5788 * @param formatWithIndexedTokens - format string with a set of indexed format tokens.
5789 * @param args - array of values which should replace the tokens in the format string.
5790 * @param culture - localization culture. If undefined then the current culture is used.
5791 */
5792 format(formatWithIndexedTokens: string, args: any[], culture?: string): string;
5793 /** Gets a value indicating whether the specified format a standard numeric format specifier. */
5794 isStandardNumberFormat(format: string): boolean;
5795 /** Performs a custom format with a value override. Typically used for custom formats showing scaled values. */
5796 formatNumberWithCustomOverride(value: number, format: string, nonScientificOverrideFormat: string): string;
5797 /** Gets the format string to use for dates in particular units. */
5798 dateFormatString(unit: DateTimeUnit): string;
5799 }
5800}
5801declare module powerbi.data {
5802 /** Represents common expression patterns for 'field' expressions such as columns, column aggregates, measures, etc. */
5803 interface FieldExprPattern {
5804 column?: FieldExprColumnPattern;
5805 columnAggr?: FieldExprColumnAggrPattern;
5806 columnHierarchyLevelVariation?: FieldExprColumnHierarchyLevelVariationPattern;
5807 entity?: FieldExprEntityPattern;
5808 entityAggr?: FieldExprEntityAggrPattern;
5809 hierarchy?: FieldExprHierarchyPattern;
5810 hierarchyLevel?: FieldExprHierarchyLevelPattern;
5811 hierarchyLevelAggr?: FieldExprHierarchyLevelAggrPattern;
5812 measure?: FieldExprMeasurePattern;
5813 percentile?: FieldExprPercentilePattern;
5814 percentOfGrandTotal?: FieldExprPercentOfGrandTotalPattern;
5815 selectRef?: FieldExprSelectRefPattern;
5816 }
5817 /** By design there is no default, no-op visitor. Components concerned with patterns need to be aware of all patterns as they are added. */
5818 interface IFieldExprPatternVisitor<T> {
5819 visitColumn(column: FieldExprColumnPattern): T;
5820 visitColumnAggr(columnAggr: FieldExprColumnAggrPattern): T;
5821 visitColumnHierarchyLevelVariation(columnHierarchyLevelVariation: FieldExprColumnHierarchyLevelVariationPattern): T;
5822 visitEntity(entity: FieldExprEntityPattern): T;
5823 visitEntityAggr(entityAggr: FieldExprEntityAggrPattern): T;
5824 visitHierarchy(hierarchy: FieldExprHierarchyPattern): T;
5825 visitHierarchyLevel(hierarchyLevel: FieldExprHierarchyLevelPattern): T;
5826 visitHierarchyLevelAggr(hierarchyLevelAggr: FieldExprHierarchyLevelAggrPattern): T;
5827 visitMeasure(measure: FieldExprMeasurePattern): T;
5828 visitPercentile(percentile: FieldExprPercentilePattern): T;
5829 visitPercentOfGrandTotal(percentOfGrandTotal: FieldExprPercentOfGrandTotalPattern): T;
5830 visitSelectRef(selectRef: FieldExprSelectRefPattern): T;
5831 }
5832 interface FieldExprEntityPattern {
5833 schema: string;
5834 entity: string;
5835 entityVar?: string;
5836 }
5837 interface FieldExprEntityItemPattern extends FieldExprEntityPattern {
5838 }
5839 interface FieldExprEntityPropertyPattern extends FieldExprEntityItemPattern {
5840 name: string;
5841 }
5842 type FieldExprColumnPattern = FieldExprEntityPropertyPattern;
5843 type FieldExprMeasurePattern = FieldExprEntityPropertyPattern;
5844 type FieldExprHierarchyPattern = FieldExprEntityPropertyPattern;
5845 type FieldExprPropertyPattern = FieldExprColumnPattern | FieldExprMeasurePattern | FieldExprHierarchyPattern;
5846 interface FieldExprEntityAggrPattern extends FieldExprEntityPattern {
5847 aggregate: QueryAggregateFunction;
5848 }
5849 interface FieldExprColumnAggrPattern extends FieldExprColumnPattern {
5850 aggregate: QueryAggregateFunction;
5851 }
5852 interface FieldExprHierarchyLevelPattern extends FieldExprEntityItemPattern {
5853 name: string;
5854 level: string;
5855 }
5856 interface FieldExprHierarchyLevelAggrPattern extends FieldExprHierarchyLevelPattern {
5857 aggregate: QueryAggregateFunction;
5858 }
5859 interface FieldExprColumnHierarchyLevelVariationPattern {
5860 source: FieldExprColumnPattern;
5861 level: FieldExprHierarchyLevelPattern;
5862 variationName: string;
5863 }
5864 interface FieldExprPercentilePattern {
5865 arg: FieldExprPattern;
5866 k: number;
5867 exclusive: boolean;
5868 }
5869 interface FieldExprPercentOfGrandTotalPattern {
5870 baseExpr: FieldExprPattern;
5871 }
5872 interface FieldExprSelectRefPattern {
5873 expressionName: string;
5874 }
5875 module SQExprBuilder {
5876 function fieldExpr(fieldExpr: FieldExprPattern): SQExpr;
5877 function fromColumnAggr(columnAggr: FieldExprColumnAggrPattern): SQAggregationExpr;
5878 function fromColumn(column: FieldExprColumnPattern): SQColumnRefExpr;
5879 function fromEntity(entityPattern: FieldExprEntityPattern): SQEntityExpr;
5880 function fromEntityAggr(entityAggr: FieldExprEntityAggrPattern): SQAggregationExpr;
5881 function fromHierarchyLevelAggr(hierarchyLevelAggr: FieldExprHierarchyLevelAggrPattern): SQAggregationExpr;
5882 function fromHierarchyLevel(hierarchyLevelPattern: FieldExprHierarchyLevelPattern): SQHierarchyLevelExpr;
5883 function fromHierarchy(hierarchyPattern: FieldExprHierarchyPattern): SQHierarchyExpr;
5884 }
5885 module SQExprConverter {
5886 function asFieldPattern(sqExpr: SQExpr): FieldExprPattern;
5887 }
5888 module FieldExprPattern {
5889 function visit<T>(expr: SQExpr | FieldExprPattern, visitor: IFieldExprPatternVisitor<T>): T;
5890 function toColumnRefSQExpr(columnPattern: FieldExprColumnPattern): SQColumnRefExpr;
5891 function getAggregate(fieldExpr: FieldExprPattern): QueryAggregateFunction;
5892 function isAggregation(fieldExpr: FieldExprPattern): boolean;
5893 function hasFieldExprName(fieldExpr: FieldExprPattern): boolean;
5894 function getPropertyName(fieldExpr: FieldExprPattern): string;
5895 function getHierarchyName(fieldExpr: FieldExprPattern): string;
5896 function getColumnRef(fieldExpr: FieldExprPattern): FieldExprPropertyPattern;
5897 function getFieldExprName(fieldExpr: FieldExprPattern): string;
5898 function getSchema(fieldExpr: FieldExprPattern): string;
5899 function toFieldExprEntityPattern(fieldExpr: FieldExprPattern): FieldExprEntityPattern;
5900 function toFieldExprEntityItemPattern(fieldExpr: FieldExprPattern): FieldExprEntityPattern;
5901 }
5902}
5903declare module powerbi {
5904 module DataViewAnalysis {
5905 import QueryProjectionsByRole = powerbi.data.QueryProjectionsByRole;
5906 import DataViewObjectDescriptors = powerbi.data.DataViewObjectDescriptors;
5907 import DataViewObjectDefinitions = powerbi.data.DataViewObjectDefinitions;
5908 interface ValidateAndReshapeResult {
5909 dataView?: DataView;
5910 isValid: boolean;
5911 }
5912 interface RoleKindByQueryRef {
5913 [queryRef: string]: VisualDataRoleKind;
5914 }
5915 interface DataViewMappingResult {
5916 supportedMappings: DataViewMapping[];
5917 /** A set of mapping errors if there are no supported mappings */
5918 mappingErrors: DataViewMappingMatchError[];
5919 }
5920 enum DataViewMappingMatchErrorCode {
5921 conditionRangeTooLarge = 0,
5922 conditionRangeTooSmall = 1,
5923 conditionKindExpectedMeasure = 2,
5924 conditionKindExpectedGrouping = 3,
5925 conditionKindExpectedGroupingOrMeasure = 4,
5926 }
5927 interface DataViewMappingMatchError {
5928 code: DataViewMappingMatchErrorCode;
5929 roleName: string;
5930 mappingIndex?: number;
5931 conditionIndex?: number;
5932 }
5933 /** Reshapes the data view to match the provided schema if possible. If not, returns null */
5934 function validateAndReshape(dataView: DataView, dataViewMappings: DataViewMapping[]): ValidateAndReshapeResult;
5935 function countGroups(columns: DataViewMetadataColumn[]): number;
5936 function countMeasures(columns: DataViewMetadataColumn[]): number;
5937 /** Indicates whether the dataView conforms to the specified schema. */
5938 function supports(dataView: DataView, roleMapping: DataViewMapping, usePreferredDataViewSchema?: boolean): boolean;
5939 /**
5940 * Determines whether the value conforms to the range in the role condition, returning undefined
5941 * if so or an appropriate error code if not.
5942 */
5943 function validateRange(value: number, roleCondition: RoleCondition, ignoreMin?: boolean): DataViewMappingMatchErrorCode;
5944 /** Determines the appropriate DataViewMappings for the projections. */
5945 function chooseDataViewMappings(projections: QueryProjectionsByRole, mappings: DataViewMapping[], roleKindByQueryRef: RoleKindByQueryRef, objectDescriptors?: DataViewObjectDescriptors, objectDefinitions?: DataViewObjectDefinitions): DataViewMappingResult;
5946 function getPropertyCount(roleName: string, projections: QueryProjectionsByRole, useActiveIfAvailable?: boolean): number;
5947 function hasSameCategoryIdentity(dataView1: DataView, dataView2: DataView): boolean;
5948 function areMetadataColumnsEquivalent(column1: DataViewMetadataColumn, column2: DataViewMetadataColumn): boolean;
5949 function isMetadataEquivalent(metadata1: DataViewMetadata, metadata2: DataViewMetadata): boolean;
5950 }
5951}
5952declare module powerbi.data {
5953 module DataViewRoleWildcard {
5954 function fromRoles(roles: string[]): DataViewRoleWildcard;
5955 function equals(firstRoleWildcard: DataViewRoleWildcard, secondRoleWildcard: DataViewRoleWildcard): boolean;
5956 }
5957}
5958declare module powerbi {
5959 module DataViewScopeIdentity {
5960 /** Compares the two DataViewScopeIdentity values for equality. */
5961 function equals(x: DataViewScopeIdentity, y: DataViewScopeIdentity, ignoreCase?: boolean): boolean;
5962 function filterFromIdentity(identities: DataViewScopeIdentity[], isNot?: boolean): data.SemanticFilter;
5963 function filterFromExprs(orExprs: data.SQExpr[], isNot?: boolean): data.SemanticFilter;
5964 }
5965 module data {
5966 function createDataViewScopeIdentity(expr: SQExpr): DataViewScopeIdentity;
5967 }
5968}
5969declare module powerbi.data {
5970 module DataViewScopeWildcard {
5971 function matches(wildcard: DataViewScopeWildcard, instance: DataViewScopeIdentity): boolean;
5972 function equals(firstScopeWildcard: DataViewScopeWildcard, secondScopeWildcard: DataViewScopeWildcard): boolean;
5973 function fromExprs(exprs: SQExpr[]): DataViewScopeWildcard;
5974 }
5975}
5976declare module powerbi.data {
5977 interface IColorAllocatorCache {
5978 get(key: SQFillRuleExpr): IColorAllocator;
5979 register(key: SQFillRuleExpr, colorAllocator: IColorAllocator): this;
5980 }
5981 function createColorAllocatorCache(): IColorAllocatorCache;
5982}
5983declare module powerbi.data {
5984 /** Responsible for providing specific values to be used by expression and rule evaluation. */
5985 interface IEvalContext {
5986 getColorAllocator(expr: SQFillRuleExpr): IColorAllocator;
5987 getExprValue(expr: SQExpr): PrimitiveValue;
5988 getRoleValue(roleName: string): PrimitiveValue;
5989 }
5990}
5991declare module powerbi.data {
5992 interface DataViewRegressionRunOptions {
5993 dataViewMappings: DataViewMapping[];
5994 visualDataViews: DataView[];
5995 dataRoles: VisualDataRole[];
5996 objectDescriptors: DataViewObjectDescriptors;
5997 objectDefinitions: DataViewObjectDefinitions;
5998 colorAllocatorFactory: IColorAllocatorFactory;
5999 transformSelects: DataViewSelectTransform[];
6000 metadata: DataViewMetadata;
6001 projectionActiveItems: DataViewProjectionActiveItems;
6002 }
6003 module DataViewRegression {
6004 const regressionYQueryName: string;
6005 function run(options: DataViewRegressionRunOptions): DataView[];
6006 /**
6007 * This function will compute the linear regression algorithm on the sourceDataView and create a new dataView.
6008 * It works on scalar axis only.
6009 * The algorithm is as follows
6010 *
6011 * 1. Find the cartesian X and Y roles and the columns that correspond to those roles
6012 * 2. Get the data points, (X, Y) pairs, for each series, combining if needed.
6013 * 3. Compute the X and Y points for regression line using Y = Slope * X + Intercept
6014 * If highlights values are present, repeat steps 2 & 3 using highlight values.
6015 * 4. Create the new dataView using the points computed above
6016 */
6017 function linearRegressionTransform(sourceDataView: DataView, dataRoles: VisualDataRole[], regressionDataViewMapping: DataViewMapping, objectDescriptors: DataViewObjectDescriptors, objectDefinitions: DataViewObjectDefinitions, colorAllocatorFactory: IColorAllocatorFactory): DataView;
6018 }
6019}
6020declare module powerbi.data {
6021 import RoleKindByQueryRef = DataViewAnalysis.RoleKindByQueryRef;
6022 interface DataViewSelectTransform {
6023 displayName?: string;
6024 queryName?: string;
6025 format?: string;
6026 type?: ValueType;
6027 roles?: {
6028 [roleName: string]: boolean;
6029 };
6030 kpi?: DataViewKpiColumnMetadata;
6031 sort?: SortDirection;
6032 expr?: SQExpr;
6033 discourageAggregationAcrossGroups?: boolean;
6034 /** Describes the default value applied to a column, if any. */
6035 defaultValue?: DefaultValueDefinition;
6036 }
6037 module DataViewSelectTransform {
6038 /** Convert selection info to projections */
6039 function projectionsFromSelects(selects: DataViewSelectTransform[], projectionActiveItems: DataViewProjectionActiveItems): QueryProjectionsByRole;
6040 /** Use selections and metadata to fashion query role kinds */
6041 function createRoleKindFromMetadata(selects: DataViewSelectTransform[], metadata: DataViewMetadata): RoleKindByQueryRef;
6042 }
6043}
6044declare module powerbi.data {
6045 interface ICategoricalEvalContext extends IEvalContext {
6046 setCurrentRowIndex(index: number): void;
6047 }
6048 function createCategoricalEvalContext(colorAllocatorProvider: IColorAllocatorCache, dataViewCategorical: DataViewCategorical): ICategoricalEvalContext;
6049}
6050declare module powerbi.data {
6051 interface ITableEvalContext extends IEvalContext {
6052 setCurrentRowIndex(index: number): void;
6053 }
6054 function createTableEvalContext(colorAllocatorProvider: IColorAllocatorCache, dataViewTable: DataViewTable, selectTransforms: DataViewSelectTransform[]): ITableEvalContext;
6055}
6056declare module powerbi.data {
6057 class RuleEvaluation {
6058 evaluate(evalContext: IEvalContext): any;
6059 }
6060}
6061declare module powerbi.data {
6062 class ColorRuleEvaluation extends RuleEvaluation {
6063 private inputRole;
6064 private allocator;
6065 constructor(inputRole: string, allocator: IColorAllocator);
6066 evaluate(evalContext: IEvalContext): any;
6067 }
6068}
6069declare module powerbi.data.utils {
6070 module DataViewMatrixUtils {
6071 /**
6072 * Invokes the specified callback once per leaf nodes (including root-level leaves and descendent leaves) of the
6073 * specified rootNodes, with an optional index parameter in the callback that is the 0-based index of the
6074 * particular leaf node in the context of this forEachLeafNode(...) invocation.
6075 *
6076 * If rootNodes is null or undefined or empty, the specified callback will not get invoked.
6077 *
6078 * The treePath parameter in the callback is an ordered set of nodes that form the path from the specified
6079 * rootNodes down to the leafNode argument itself. If callback leafNode is one of the specified rootNodes,
6080 * then treePath will be an array of length 1 containing that very node.
6081 *
6082 * IMPORTANT: The treePath array passed to the callback will be modified after the callback function returns!
6083 * If your callback needs to retain a copy of the treePath, please clone the array before returning.
6084 */
6085 function forEachLeafNode(rootNodes: DataViewMatrixNode | DataViewMatrixNode[], callback: (leafNode: DataViewMatrixNode, index?: number, treePath?: DataViewMatrixNode[]) => void): void;
6086 /**
6087 * Returned an object tree where each node and its children property are inherited from the specified node
6088 * hierarchy, from the root down to the nodes at the specified deepestLevelToInherit, inclusively.
6089 *
6090 * The inherited nodes at level === deepestLevelToInherit will NOT get an inherited version of children array
6091 * property, i.e. its children property is the same array object referenced in the input node's object tree.
6092 *
6093 * @param node The input node with the hierarchy object tree.
6094 * @param deepestLevelToInherit The highest level for a node to get inherited. See DataViewMatrixNode.level property.
6095 * @param useInheritSingle If true, then a node will get inherited in the returned object tree only if it is
6096 * not already an inherited object. Same goes for the node's children property. This is useful for creating
6097 * "visual DataView" objects from "query DataView" objects, as object inheritance is the mechanism for
6098 * "visual DataView" to override properties in "query DataView", and that "query DataView" never contains
6099 * inherited objects.
6100 */
6101 function inheritMatrixNodeHierarchy(node: DataViewMatrixNode, deepestLevelToInherit: number, useInheritSingle: boolean): DataViewMatrixNode;
6102 /**
6103 * Returns true if the specified matrixOrHierarchy contains any composite grouping, i.e. a grouping on multiple columns.
6104 * An example of composite grouping is one on [Year, Quarter, Month], where a particular group instance can have
6105 * Year === 2016, Quarter === 'Qtr 1', Month === 1.
6106 *
6107 * Returns false if the specified matrixOrHierarchy does not contain any composite group,
6108 * or if matrixOrHierarchy is null or undefined.
6109 */
6110 function containsCompositeGroup(matrixOrHierarchy: DataViewMatrix | DataViewHierarchy): boolean;
6111 }
6112}
6113declare module powerbi.data.utils {
6114 module DataViewMetadataColumnUtils {
6115 interface MetadataColumnAndProjectionIndex {
6116 /**
6117 * A metadata column taken from a source collection, e.g. DataViewHierarchyLevel.sources, DataViewMatrix.valueSources...
6118 */
6119 metadataColumn: DataViewMetadataColumn;
6120 /**
6121 * The index of this.metadataColumn in its sources collection.
6122 *
6123 * E.g.1 This can be the value of the property DataViewMatrixGroupValue.levelSourceIndex which is the index of this.metadataColumn in DataViewHierarchyLevel.sources.
6124 * E.g.2 This can be the value of the property DataViewMatrixNodeValue.valueSourceIndex which refer to columns in DataViewMatrix.valueSources.
6125 */
6126 sourceIndex: number;
6127 /**
6128 * The index of this.metadataColumn in the projection ordering of a given role.
6129 */
6130 projectionOrderIndex: number;
6131 }
6132 /**
6133 * Returns true iff the specified metadataColumn is assigned to the specified targetRole.
6134 */
6135 function isForRole(metadataColumn: DataViewMetadataColumn, targetRole: string): boolean;
6136 /**
6137 * Joins each column in the specified columnSources with projection ordering index into a wrapper object.
6138 *
6139 * Note: In order for this function to reliably calculate the "source index" of a particular column, the
6140 * specified columnSources must be a non-filtered array of column sources from the DataView, such as
6141 * the DataViewHierarchyLevel.sources and DataViewMatrix.valueSources array properties.
6142 *
6143 * @param columnSources E.g. DataViewHierarchyLevel.sources, DataViewMatrix.valueSources...
6144 * @param projection The projection ordering. It must contain an ordering for the specified role.
6145 * @param role The role for getting the relevant projection ordering, as well as for filtering out the irrevalent columns in columnSources.
6146 */
6147 function joinMetadataColumnsAndProjectionOrder(columnSources: DataViewMetadataColumn[], projection: DataViewProjectionOrdering, role: string): MetadataColumnAndProjectionIndex[];
6148 }
6149}
6150declare module powerbi.data {
6151 import ArrayNamedItems = jsCommon.ArrayNamedItems;
6152 class ConceptualSchema {
6153 entities: ArrayNamedItems<ConceptualEntity>;
6154 capabilities: ConceptualCapabilities;
6155 /** Indicates whether the user can edit this ConceptualSchema. This is used to enable/disable model authoring UX. */
6156 canEdit: boolean;
6157 findProperty(entityName: string, propertyName: string): ConceptualProperty;
6158 findHierarchy(entityName: string, name: string): ConceptualHierarchy;
6159 findHierarchyByVariation(variationEntityName: string, variationColumnName: string, variationName: string, hierarchyName: string): ConceptualHierarchy;
6160 /**
6161 * Returns the first property of the entity whose kpi is tied to kpiProperty
6162 */
6163 findPropertyWithKpi(entityName: string, kpiProperty: ConceptualProperty): ConceptualProperty;
6164 }
6165 interface ConceptualCapabilities {
6166 discourageQueryAggregateUsage: boolean;
6167 normalizedFiveStateKpiRange: boolean;
6168 supportsMedian: boolean;
6169 supportsPercentile: boolean;
6170 supportsScopedEval: boolean;
6171 }
6172 interface ConceptualPropertyItemContainer {
6173 properties: ArrayNamedItems<ConceptualProperty>;
6174 hierarchies?: ArrayNamedItems<ConceptualHierarchy>;
6175 displayFolders?: ArrayNamedItems<ConceptualDisplayFolder>;
6176 }
6177 interface ConceptualPropertyItem {
6178 name: string;
6179 displayName: string;
6180 hidden?: boolean;
6181 }
6182 interface ConceptualEntity extends ConceptualPropertyItemContainer {
6183 name: string;
6184 displayName: string;
6185 visibility?: ConceptualVisibility;
6186 calculated?: boolean;
6187 queryable?: ConceptualQueryableState;
6188 navigationProperties?: ArrayNamedItems<ConceptualNavigationProperty>;
6189 }
6190 interface ConceptualDisplayFolder extends ConceptualPropertyItem, ConceptualPropertyItemContainer {
6191 }
6192 interface ConceptualProperty extends ConceptualPropertyItem {
6193 type: ValueType;
6194 kind: ConceptualPropertyKind;
6195 format?: string;
6196 column?: ConceptualColumn;
6197 queryable?: ConceptualQueryableState;
6198 measure?: ConceptualMeasure;
6199 kpiValue?: ConceptualProperty;
6200 }
6201 interface ConceptualHierarchy extends ConceptualPropertyItem {
6202 levels: ArrayNamedItems<ConceptualHierarchyLevel>;
6203 }
6204 interface ConceptualHierarchyLevel extends ConceptualPropertyItem {
6205 column: ConceptualProperty;
6206 }
6207 interface ConceptualNavigationProperty {
6208 name: string;
6209 isActive: boolean;
6210 sourceColumn?: ConceptualColumn;
6211 targetEntity: ConceptualEntity;
6212 sourceMultiplicity: ConceptualMultiplicity;
6213 targetMultiplicity: ConceptualMultiplicity;
6214 }
6215 interface ConceptualVariationSource {
6216 name: string;
6217 isDefault: boolean;
6218 navigationProperty?: ConceptualNavigationProperty;
6219 defaultHierarchy?: ConceptualHierarchy;
6220 defaultProperty?: ConceptualProperty;
6221 }
6222 interface ConceptualColumn {
6223 defaultAggregate?: ConceptualDefaultAggregate;
6224 keys?: ArrayNamedItems<ConceptualProperty>;
6225 idOnEntityKey?: boolean;
6226 calculated?: boolean;
6227 defaultValue?: SQConstantExpr;
6228 variations?: ArrayNamedItems<ConceptualVariationSource>;
6229 aggregateBehavior?: ConceptualAggregateBehavior;
6230 }
6231 interface ConceptualMeasure {
6232 kpi?: ConceptualPropertyKpi;
6233 }
6234 interface ConceptualPropertyKpi {
6235 statusMetadata: DataViewKpiColumnMetadata;
6236 trendMetadata?: DataViewKpiColumnMetadata;
6237 status?: ConceptualProperty;
6238 goal?: ConceptualProperty;
6239 trend?: ConceptualProperty;
6240 }
6241 const enum ConceptualVisibility {
6242 Visible = 0,
6243 Hidden = 1,
6244 ShowAsVariationsOnly = 2,
6245 IsPrivate = 4,
6246 }
6247 const enum ConceptualQueryableState {
6248 Queryable = 0,
6249 Error = 1,
6250 }
6251 const enum ConceptualMultiplicity {
6252 ZeroOrOne = 0,
6253 One = 1,
6254 Many = 2,
6255 }
6256 const enum ConceptualPropertyKind {
6257 Column = 0,
6258 Measure = 1,
6259 Kpi = 2,
6260 }
6261 const enum ConceptualDefaultAggregate {
6262 Default = 0,
6263 None = 1,
6264 Sum = 2,
6265 Count = 3,
6266 Min = 4,
6267 Max = 5,
6268 Average = 6,
6269 DistinctCount = 7,
6270 }
6271 enum ConceptualDataCategory {
6272 None = 0,
6273 Address = 1,
6274 City = 2,
6275 Company = 3,
6276 Continent = 4,
6277 Country = 5,
6278 County = 6,
6279 Date = 7,
6280 Image = 8,
6281 ImageUrl = 9,
6282 Latitude = 10,
6283 Longitude = 11,
6284 Organization = 12,
6285 Place = 13,
6286 PostalCode = 14,
6287 Product = 15,
6288 StateOrProvince = 16,
6289 WebUrl = 17,
6290 }
6291 const enum ConceptualAggregateBehavior {
6292 Default = 0,
6293 DiscourageAcrossGroups = 1,
6294 }
6295}
6296declare module powerbi {
6297 import ArrayNamedItems = jsCommon.ArrayNamedItems;
6298 import FederatedConceptualSchema = powerbi.data.FederatedConceptualSchema;
6299 import QueryProjectionsByRole = data.QueryProjectionsByRole;
6300 interface ScriptResult {
6301 source: string;
6302 provider: string;
6303 }
6304 module ScriptResultUtil {
6305 function findScriptResult(dataViewMappings: DataViewMapping[] | data.CompiledDataViewMapping[]): DataViewScriptResultMapping | data.CompiledDataViewScriptResultMapping;
6306 function extractScriptResult(dataViewMappings: data.CompiledDataViewMapping[]): ScriptResult;
6307 function extractScriptResultFromVisualConfig(dataViewMappings: DataViewMapping[], objects: powerbi.data.DataViewObjectDefinitions): ScriptResult;
6308 function getScriptInput(projections: QueryProjectionsByRole, selects: ArrayNamedItems<data.NamedSQExpr>, schema: FederatedConceptualSchema): data.ScriptInput;
6309 }
6310}
6311declare module powerbi.data.segmentation {
6312 interface DataViewTableSegment extends DataViewTable {
6313 /**
6314 * Index of the last item that had a merge flag in the underlying data.
6315 * We assume merge flags are not random but adjacent to each other.
6316 */
6317 lastMergeIndex?: number;
6318 }
6319 interface DataViewTreeSegmentNode extends DataViewTreeNode {
6320 /** Indicates whether the node is a duplicate of a node from a previous segment. */
6321 isMerge?: boolean;
6322 }
6323 interface DataViewCategoricalSegment extends DataViewCategorical {
6324 /**
6325 * Index of the last item that had a merge flag in the underlying data.
6326 * We assume merge flags are not random but adjacent to each other.
6327 */
6328 lastMergeIndex?: number;
6329 }
6330 interface DataViewMatrixSegmentNode extends DataViewMatrixNode {
6331 /**
6332 * Index of the last item that had a merge flag in the underlying data.
6333 * We assume merge flags are not random but adjacent to each other.
6334 */
6335 isMerge?: boolean;
6336 }
6337 module DataViewMerger {
6338 function mergeDataViews(source: DataView, segment: DataView): void;
6339 /** Note: Public for testability */
6340 function mergeTables(source: DataViewTable, segment: DataViewTableSegment): void;
6341 /**
6342 * Merge categories values and identities
6343 *
6344 * Note: Public for testability
6345 */
6346 function mergeCategorical(source: DataViewCategorical, segment: DataViewCategoricalSegment): void;
6347 /** Note: Public for testability */
6348 function mergeTreeNodes(sourceRoot: DataViewTreeNode, segmentRoot: DataViewTreeNode, allowDifferentStructure: boolean): void;
6349 }
6350}
6351declare module powerbi.data {
6352 /** Rewrites an expression tree, including all descendant nodes. */
6353 class SQExprRewriter implements ISQExprVisitor<SQExpr>, IFillRuleDefinitionVisitor<LinearGradient2Definition, LinearGradient3Definition> {
6354 visitColumnRef(expr: SQColumnRefExpr): SQExpr;
6355 visitMeasureRef(expr: SQMeasureRefExpr): SQExpr;
6356 visitAggr(expr: SQAggregationExpr): SQExpr;
6357 visitSelectRef(expr: SQSelectRefExpr): SQExpr;
6358 visitPercentile(expr: SQPercentileExpr): SQExpr;
6359 visitHierarchy(expr: SQHierarchyExpr): SQExpr;
6360 visitHierarchyLevel(expr: SQHierarchyLevelExpr): SQExpr;
6361 visitPropertyVariationSource(expr: SQPropertyVariationSourceExpr): SQExpr;
6362 visitEntity(expr: SQEntityExpr): SQExpr;
6363 visitAnd(orig: SQAndExpr): SQExpr;
6364 visitBetween(orig: SQBetweenExpr): SQExpr;
6365 visitIn(orig: SQInExpr): SQExpr;
6366 private rewriteAll(origExprs);
6367 visitOr(orig: SQOrExpr): SQExpr;
6368 visitCompare(orig: SQCompareExpr): SQExpr;
6369 visitContains(orig: SQContainsExpr): SQExpr;
6370 visitExists(orig: SQExistsExpr): SQExpr;
6371 visitNot(orig: SQNotExpr): SQExpr;
6372 visitStartsWith(orig: SQStartsWithExpr): SQExpr;
6373 visitConstant(expr: SQConstantExpr): SQExpr;
6374 visitDateSpan(orig: SQDateSpanExpr): SQExpr;
6375 visitDateAdd(orig: SQDateAddExpr): SQExpr;
6376 visitNow(orig: SQNowExpr): SQExpr;
6377 visitDefaultValue(orig: SQDefaultValueExpr): SQExpr;
6378 visitAnyValue(orig: SQAnyValueExpr): SQExpr;
6379 visitArithmetic(orig: SQArithmeticExpr): SQExpr;
6380 visitScopedEval(orig: SQScopedEvalExpr): SQExpr;
6381 visitFillRule(orig: SQFillRuleExpr): SQExpr;
6382 visitLinearGradient2(origGradient2: LinearGradient2Definition): LinearGradient2Definition;
6383 visitLinearGradient3(origGradient3: LinearGradient3Definition): LinearGradient3Definition;
6384 private visitFillRuleStop(stop);
6385 visitResourcePackageItem(orig: SQResourcePackageItemExpr): SQExpr;
6386 }
6387}
6388declare module powerbi.data {
6389 /** Responsible for writing equality comparisons against a field to an SQInExpr. */
6390 module EqualsToInRewriter {
6391 function run(expr: SQExpr): SQExpr;
6392 }
6393}
6394declare module powerbi.data {
6395 interface FilterValueScopeIdsContainer {
6396 isNot: boolean;
6397 scopeIds: DataViewScopeIdentity[];
6398 }
6399 module SQExprConverter {
6400 function asScopeIdsContainer(filter: SemanticFilter, fieldSQExprs: SQExpr[]): FilterValueScopeIdsContainer;
6401 /** Gets a comparand value from the given DataViewScopeIdentity. */
6402 function getFirstComparandValue(identity: DataViewScopeIdentity): any;
6403 }
6404}
6405declare module powerbi.data {
6406 /** Recognizes DataViewScopeIdentity expression trees to extract comparison keys. */
6407 module ScopeIdentityExtractor {
6408 function getKeys(expr: SQExpr): SQExpr[];
6409 function getInExpr(expr: SQExpr): SQInExpr;
6410 }
6411}
6412declare module powerbi.data {
6413 module PrimitiveValueEncoding {
6414 function decimal(value: number): string;
6415 function double(value: number): string;
6416 function integer(value: number): string;
6417 function dateTime(value: Date): string;
6418 function text(value: string): string;
6419 function nullEncoding(): string;
6420 function boolean(value: boolean): string;
6421 }
6422}
6423declare module powerbi.data {
6424 interface ISQAggregationOperations {
6425 /** Returns an array of supported aggregates for a given expr and role type. */
6426 getSupportedAggregates(expr: SQExpr, schema: FederatedConceptualSchema, targetTypes: ValueTypeDescriptor[]): QueryAggregateFunction[];
6427 isSupportedAggregate(expr: SQExpr, schema: FederatedConceptualSchema, aggregate: QueryAggregateFunction, targetTypes: ValueTypeDescriptor[]): boolean;
6428 createExprWithAggregate(expr: SQExpr, schema: FederatedConceptualSchema, aggregateNonNumericFields: boolean, targetTypes: ValueTypeDescriptor[], preferredAggregate?: QueryAggregateFunction): SQExpr;
6429 }
6430 function createSQAggregationOperations(datetimeMinMaxSupported: boolean): ISQAggregationOperations;
6431}
6432declare module powerbi.data {
6433 module SQHierarchyExprUtils {
6434 function getConceptualHierarchyLevelFromExpr(conceptualSchema: FederatedConceptualSchema, fieldExpr: FieldExprPattern): ConceptualHierarchyLevel;
6435 function getConceptualHierarchyLevel(conceptualSchema: FederatedConceptualSchema, schemaName: string, entity: string, hierarchy: string, hierarchyLevel: string): ConceptualHierarchyLevel;
6436 function getConceptualHierarchy(sqExpr: SQExpr, federatedSchema: FederatedConceptualSchema): ConceptualHierarchy;
6437 function expandExpr(schema: FederatedConceptualSchema, expr: SQExpr, suppressHierarchyLevelExpansion?: boolean): SQExpr | SQExpr[];
6438 function isHierarchyOrVariation(schema: FederatedConceptualSchema, expr: SQExpr): boolean;
6439 function getSourceVariationExpr(hierarchyLevelExpr: data.SQHierarchyLevelExpr): SQColumnRefExpr;
6440 function getSourceHierarchy(hierarchyLevelExpr: data.SQHierarchyLevelExpr): SQHierarchyExpr;
6441 function getHierarchySourceAsVariationSource(hierarchyLevelExpr: SQHierarchyLevelExpr): SQPropertyVariationSourceExpr;
6442 /**
6443 * Returns true if firstExpr and secondExpr are levels in the same hierarchy and firstExpr is before secondExpr in allLevels.
6444 */
6445 function areHierarchyLevelsOrdered(allLevels: SQHierarchyLevelExpr[], firstExpr: SQExpr, secondExpr: SQExpr): boolean;
6446 /**
6447 * Given an ordered set of levels and an ordered subset of those levels, returns the index where
6448 * expr should be inserted into the subset to maintain the correct order.
6449 */
6450 function getInsertionIndex(allLevels: SQHierarchyLevelExpr[], orderedSubsetOfLevels: SQHierarchyLevelExpr[], expr: SQHierarchyLevelExpr): number;
6451 }
6452 module SQExprHierarchyToHierarchyLevelConverter {
6453 function convert(sqExpr: SQExpr, federatedSchema: FederatedConceptualSchema): SQExpr[];
6454 }
6455}
6456declare module powerbi.data {
6457 interface SQExprGroup {
6458 expr: SQExpr;
6459 children: SQHierarchyLevelExpr[];
6460 /** Index of expression in the query. */
6461 selectQueryIndex: number;
6462 }
6463 module SQExprGroupUtils {
6464 /** Group all projections. Eacch group can consist of either a single property, or a collection of hierarchy items. */
6465 function groupExprs(schema: FederatedConceptualSchema, exprs: SQExpr[]): SQExprGroup[];
6466 }
6467}
6468declare module powerbi.data {
6469 /** Represents an immutable expression within a SemanticQuery. */
6470 abstract class SQExpr implements ISQExpr {
6471 private _kind;
6472 constructor(kind: SQExprKind);
6473 static equals(x: SQExpr, y: SQExpr, ignoreCase?: boolean): boolean;
6474 validate(schema: FederatedConceptualSchema, aggrUtils: ISQAggregationOperations, errors?: SQExprValidationError[]): SQExprValidationError[];
6475 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6476 kind: SQExprKind;
6477 static isColumn(expr: SQExpr): expr is SQColumnRefExpr;
6478 static isConstant(expr: SQExpr): expr is SQConstantExpr;
6479 static isEntity(expr: SQExpr): expr is SQEntityExpr;
6480 static isHierarchy(expr: SQExpr): expr is SQHierarchyExpr;
6481 static isHierarchyLevel(expr: SQExpr): expr is SQHierarchyLevelExpr;
6482 static isAggregation(expr: SQExpr): expr is SQAggregationExpr;
6483 static isMeasure(expr: SQExpr): expr is SQMeasureRefExpr;
6484 static isSelectRef(expr: SQExpr): expr is SQSelectRefExpr;
6485 static isResourcePackageItem(expr: SQExpr): expr is SQResourcePackageItemExpr;
6486 getMetadata(federatedSchema: FederatedConceptualSchema): SQExprMetadata;
6487 getDefaultAggregate(federatedSchema: FederatedConceptualSchema, forceAggregation?: boolean): QueryAggregateFunction;
6488 /** Return the SQExpr[] of group on columns if it has group on keys otherwise return the SQExpr of the column.*/
6489 getKeyColumns(schema: FederatedConceptualSchema): SQExpr[];
6490 /** Returns a value indicating whether the expression would group on keys other than itself.*/
6491 hasGroupOnKeys(schema: FederatedConceptualSchema): boolean;
6492 private getPropertyKeys(schema);
6493 getConceptualProperty(federatedSchema: FederatedConceptualSchema): ConceptualProperty;
6494 getTargetEntityForVariation(federatedSchema: FederatedConceptualSchema, variationName: string): string;
6495 getTargetEntity(federatedSchema: FederatedConceptualSchema): SQEntityExpr;
6496 private getHierarchyLevelConceptualProperty(federatedSchema);
6497 private getMetadataForVariation(field, federatedSchema);
6498 private getMetadataForHierarchyLevel(field, federatedSchema);
6499 private getMetadataForPercentOfGrandTotal();
6500 private getPropertyMetadata(field, property);
6501 private getMetadataForProperty(field, federatedSchema);
6502 private static getMetadataForEntity(field, federatedSchema);
6503 }
6504 const enum SQExprKind {
6505 Entity = 0,
6506 ColumnRef = 1,
6507 MeasureRef = 2,
6508 Aggregation = 3,
6509 PropertyVariationSource = 4,
6510 Hierarchy = 5,
6511 HierarchyLevel = 6,
6512 And = 7,
6513 Between = 8,
6514 In = 9,
6515 Or = 10,
6516 Contains = 11,
6517 Compare = 12,
6518 StartsWith = 13,
6519 Exists = 14,
6520 Not = 15,
6521 Constant = 16,
6522 DateSpan = 17,
6523 DateAdd = 18,
6524 Now = 19,
6525 AnyValue = 20,
6526 DefaultValue = 21,
6527 Arithmetic = 22,
6528 FillRule = 23,
6529 ResourcePackageItem = 24,
6530 ScopedEval = 25,
6531 Scope = 26,
6532 Percentile = 27,
6533 SelectRef = 28,
6534 }
6535 interface SQExprMetadata {
6536 kind: FieldKind;
6537 type: ValueType;
6538 format?: string;
6539 idOnEntityKey?: boolean;
6540 aggregate?: QueryAggregateFunction;
6541 defaultAggregate?: ConceptualDefaultAggregate;
6542 }
6543 const enum FieldKind {
6544 /** Indicates the field references a column, which evaluates to a distinct set of values (e.g., Year, Name, SalesQuantity, etc.). */
6545 Column = 0,
6546 /** Indicates the field references a measure, which evaluates to a single value (e.g., SalesYTD, Sum(Sales), etc.). */
6547 Measure = 1,
6548 }
6549 /** Note: Exported for testability */
6550 function defaultAggregateForDataType(type: ValueType): QueryAggregateFunction;
6551 /** Note: Exported for testability */
6552 function defaultAggregateToQueryAggregateFunction(aggregate: ConceptualDefaultAggregate): QueryAggregateFunction;
6553 class SQEntityExpr extends SQExpr {
6554 schema: string;
6555 entity: string;
6556 variable: string;
6557 constructor(schema: string, entity: string, variable?: string);
6558 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6559 }
6560 class SQArithmeticExpr extends SQExpr {
6561 left: SQExpr;
6562 right: SQExpr;
6563 operator: ArithmeticOperatorKind;
6564 constructor(left: SQExpr, right: SQExpr, operator: ArithmeticOperatorKind);
6565 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6566 }
6567 class SQScopedEvalExpr extends SQExpr {
6568 expression: SQExpr;
6569 scope: SQExpr[];
6570 constructor(expression: SQExpr, scope: SQExpr[]);
6571 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6572 getMetadata(federatedSchema: FederatedConceptualSchema): SQExprMetadata;
6573 }
6574 abstract class SQPropRefExpr extends SQExpr {
6575 ref: string;
6576 source: SQExpr;
6577 constructor(kind: SQExprKind, source: SQExpr, ref: string);
6578 }
6579 class SQColumnRefExpr extends SQPropRefExpr {
6580 constructor(source: SQExpr, ref: string);
6581 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6582 }
6583 class SQMeasureRefExpr extends SQPropRefExpr {
6584 constructor(source: SQExpr, ref: string);
6585 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6586 }
6587 class SQAggregationExpr extends SQExpr {
6588 arg: SQExpr;
6589 func: QueryAggregateFunction;
6590 constructor(arg: SQExpr, func: QueryAggregateFunction);
6591 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6592 }
6593 class SQPercentileExpr extends SQExpr {
6594 arg: SQExpr;
6595 k: number;
6596 exclusive: boolean;
6597 constructor(arg: SQExpr, k: number, exclusive: boolean);
6598 getMetadata(federatedSchema: FederatedConceptualSchema): SQExprMetadata;
6599 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6600 }
6601 class SQPropertyVariationSourceExpr extends SQExpr {
6602 arg: SQExpr;
6603 name: string;
6604 property: string;
6605 constructor(arg: SQExpr, name: string, property: string);
6606 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6607 }
6608 class SQHierarchyExpr extends SQExpr {
6609 arg: SQExpr;
6610 hierarchy: string;
6611 constructor(arg: SQExpr, hierarchy: string);
6612 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6613 }
6614 class SQHierarchyLevelExpr extends SQExpr {
6615 arg: SQExpr;
6616 level: string;
6617 constructor(arg: SQExpr, level: string);
6618 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6619 }
6620 class SQSelectRefExpr extends SQExpr {
6621 expressionName: string;
6622 constructor(expressionName: string);
6623 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6624 }
6625 class SQAndExpr extends SQExpr {
6626 left: SQExpr;
6627 right: SQExpr;
6628 constructor(left: SQExpr, right: SQExpr);
6629 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6630 }
6631 class SQBetweenExpr extends SQExpr {
6632 arg: SQExpr;
6633 lower: SQExpr;
6634 upper: SQExpr;
6635 constructor(arg: SQExpr, lower: SQExpr, upper: SQExpr);
6636 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6637 }
6638 class SQInExpr extends SQExpr {
6639 args: SQExpr[];
6640 values: SQExpr[][];
6641 constructor(args: SQExpr[], values: SQExpr[][]);
6642 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6643 }
6644 class SQOrExpr extends SQExpr {
6645 left: SQExpr;
6646 right: SQExpr;
6647 constructor(left: SQExpr, right: SQExpr);
6648 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6649 }
6650 class SQCompareExpr extends SQExpr {
6651 comparison: QueryComparisonKind;
6652 left: SQExpr;
6653 right: SQExpr;
6654 constructor(comparison: QueryComparisonKind, left: SQExpr, right: SQExpr);
6655 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6656 }
6657 class SQContainsExpr extends SQExpr {
6658 left: SQExpr;
6659 right: SQExpr;
6660 constructor(left: SQExpr, right: SQExpr);
6661 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6662 }
6663 class SQStartsWithExpr extends SQExpr {
6664 left: SQExpr;
6665 right: SQExpr;
6666 constructor(left: SQExpr, right: SQExpr);
6667 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6668 }
6669 class SQExistsExpr extends SQExpr {
6670 arg: SQExpr;
6671 constructor(arg: SQExpr);
6672 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6673 }
6674 class SQNotExpr extends SQExpr {
6675 arg: SQExpr;
6676 constructor(arg: SQExpr);
6677 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6678 }
6679 class SQConstantExpr extends SQExpr implements ISQConstantExpr {
6680 type: ValueType;
6681 /** The native JavaScript representation of the value. */
6682 value: any;
6683 /** The string encoded, lossless representation of the value. */
6684 valueEncoded: string;
6685 constructor(type: ValueType, value: any, valueEncoded: string);
6686 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6687 getMetadata(federatedSchema: FederatedConceptualSchema): SQExprMetadata;
6688 }
6689 class SQDateSpanExpr extends SQExpr {
6690 unit: TimeUnit;
6691 arg: SQExpr;
6692 constructor(unit: TimeUnit, arg: SQExpr);
6693 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6694 }
6695 class SQDateAddExpr extends SQExpr {
6696 unit: TimeUnit;
6697 amount: number;
6698 arg: SQExpr;
6699 constructor(unit: TimeUnit, amount: number, arg: SQExpr);
6700 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6701 }
6702 class SQNowExpr extends SQExpr {
6703 constructor();
6704 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6705 }
6706 class SQDefaultValueExpr extends SQExpr {
6707 constructor();
6708 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6709 }
6710 class SQAnyValueExpr extends SQExpr {
6711 constructor();
6712 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6713 }
6714 class SQFillRuleExpr extends SQExpr {
6715 input: SQExpr;
6716 rule: FillRuleDefinition;
6717 constructor(input: SQExpr, fillRule: FillRuleDefinition);
6718 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6719 }
6720 class SQResourcePackageItemExpr extends SQExpr {
6721 packageName: string;
6722 packageType: number;
6723 itemName: string;
6724 constructor(packageName: string, packageType: number, itemName: string);
6725 accept<T, TArg>(visitor: ISQExprVisitorWithArg<T, TArg>, arg?: TArg): T;
6726 }
6727 /** Provides utilities for creating & manipulating expressions. */
6728 module SQExprBuilder {
6729 function entity(schema: string, entity: string, variable?: string): SQEntityExpr;
6730 function columnRef(source: SQExpr, prop: string): SQColumnRefExpr;
6731 function measureRef(source: SQExpr, prop: string): SQMeasureRefExpr;
6732 function aggregate(source: SQExpr, aggregate: QueryAggregateFunction): SQAggregationExpr;
6733 function selectRef(expressionName: string): SQSelectRefExpr;
6734 function percentile(source: SQExpr, k: number, exclusive: boolean): SQPercentileExpr;
6735 function arithmetic(left: SQExpr, right: SQExpr, operator: ArithmeticOperatorKind): SQArithmeticExpr;
6736 function scopedEval(expression: SQExpr, scope: SQExpr[]): SQScopedEvalExpr;
6737 function hierarchy(source: SQExpr, hierarchy: string): SQHierarchyExpr;
6738 function propertyVariationSource(source: SQExpr, name: string, property: string): SQPropertyVariationSourceExpr;
6739 function hierarchyLevel(source: SQExpr, level: string): SQHierarchyLevelExpr;
6740 function and(left: SQExpr, right: SQExpr): SQExpr;
6741 function between(arg: SQExpr, lower: SQExpr, upper: SQExpr): SQBetweenExpr;
6742 function inExpr(args: SQExpr[], values: SQExpr[][]): SQInExpr;
6743 function or(left: SQExpr, right: SQExpr): SQExpr;
6744 function compare(kind: QueryComparisonKind, left: SQExpr, right: SQExpr): SQCompareExpr;
6745 function contains(left: SQExpr, right: SQExpr): SQContainsExpr;
6746 function exists(arg: SQExpr): SQExistsExpr;
6747 function equal(left: SQExpr, right: SQExpr): SQCompareExpr;
6748 function not(arg: SQExpr): SQNotExpr;
6749 function startsWith(left: SQExpr, right: SQExpr): SQStartsWithExpr;
6750 function nullConstant(): SQConstantExpr;
6751 function now(): SQNowExpr;
6752 function defaultValue(): SQDefaultValueExpr;
6753 function anyValue(): SQAnyValueExpr;
6754 function boolean(value: boolean): SQConstantExpr;
6755 function dateAdd(unit: TimeUnit, amount: number, arg: SQExpr): SQDateAddExpr;
6756 function dateTime(value: Date, valueEncoded?: string): SQConstantExpr;
6757 function dateSpan(unit: TimeUnit, arg: SQExpr): SQDateSpanExpr;
6758 function decimal(value: number, valueEncoded?: string): SQConstantExpr;
6759 function double(value: number, valueEncoded?: string): SQConstantExpr;
6760 function integer(value: number, valueEncoded?: string): SQConstantExpr;
6761 function text(value: string, valueEncoded?: string): SQConstantExpr;
6762 /** Returns an SQExpr that evaluates to the constant value. */
6763 function typedConstant(value: PrimitiveValue, type: ValueTypeDescriptor): SQConstantExpr;
6764 function setAggregate(expr: SQExpr, aggregate: QueryAggregateFunction): SQExpr;
6765 function removeAggregate(expr: SQExpr): SQExpr;
6766 function setPercentOfGrandTotal(expr: SQExpr): SQExpr;
6767 function removePercentOfGrandTotal(expr: SQExpr): SQExpr;
6768 function removeEntityVariables(expr: SQExpr): SQExpr;
6769 function fillRule(expr: SQExpr, rule: FillRuleDefinition): SQFillRuleExpr;
6770 function resourcePackageItem(packageName: string, packageType: number, itemName: string): SQResourcePackageItemExpr;
6771 }
6772 /** Provides utilities for obtaining information about expressions. */
6773 module SQExprInfo {
6774 function getAggregate(expr: SQExpr): QueryAggregateFunction;
6775 }
6776 const enum SQExprValidationError {
6777 invalidAggregateFunction = 0,
6778 invalidSchemaReference = 1,
6779 invalidEntityReference = 2,
6780 invalidColumnReference = 3,
6781 invalidMeasureReference = 4,
6782 invalidHierarchyReference = 5,
6783 invalidHierarchyLevelReference = 6,
6784 invalidLeftOperandType = 7,
6785 invalidRightOperandType = 8,
6786 invalidValueType = 9,
6787 invalidPercentileArgument = 10,
6788 }
6789 class SQExprValidationVisitor extends SQExprRewriter {
6790 errors: SQExprValidationError[];
6791 private schema;
6792 private aggrUtils;
6793 constructor(schema: FederatedConceptualSchema, aggrUtils: ISQAggregationOperations, errors?: SQExprValidationError[]);
6794 visitIn(expr: SQInExpr): SQExpr;
6795 visitCompare(expr: SQCompareExpr): SQExpr;
6796 visitColumnRef(expr: SQColumnRefExpr): SQExpr;
6797 visitMeasureRef(expr: SQMeasureRefExpr): SQExpr;
6798 visitAggr(expr: SQAggregationExpr): SQExpr;
6799 visitHierarchy(expr: SQHierarchyExpr): SQExpr;
6800 visitHierarchyLevel(expr: SQHierarchyLevelExpr): SQExpr;
6801 visitPercentile(expr: SQPercentileExpr): SQExpr;
6802 visitEntity(expr: SQEntityExpr): SQExpr;
6803 visitContains(expr: SQContainsExpr): SQExpr;
6804 visitStartsWith(expr: SQContainsExpr): SQExpr;
6805 visitArithmetic(expr: SQArithmeticExpr): SQExpr;
6806 visitScopedEval(expr: SQScopedEvalExpr): SQExpr;
6807 private validateOperandsAndTypeForStartOrContains(left, right);
6808 private validateArithmeticTypes(left, right);
6809 private validateCompatibleType(left, right);
6810 private validateEntity(schemaName, entityName);
6811 private validateHierarchy(schemaName, entityName, hierarchyName);
6812 private validateHierarchyLevel(schemaName, entityName, hierarchyName, levelName);
6813 private register(error);
6814 private isQueryable(fieldExpr);
6815 }
6816}
6817declare module powerbi.data {
6818 import ConceptualEntity = powerbi.data.ConceptualEntity;
6819 import SQEntityExpr = powerbi.data.SQEntityExpr;
6820 module SQExprUtils {
6821 function supportsArithmetic(expr: SQExpr, schema: FederatedConceptualSchema): boolean;
6822 function indexOfExpr(items: SQExpr[], searchElement: SQExpr): number;
6823 function sequenceEqual(x: SQExpr[], y: SQExpr[]): boolean;
6824 function uniqueName(namedItems: NamedSQExpr[], expr: SQExpr, exprDefaultName?: string): string;
6825 /** Generates a default expression name */
6826 function defaultName(expr: SQExpr, fallback?: string): string;
6827 /** Gets a value indicating whether the expr is a model measure or an aggregate. */
6828 function isMeasure(expr: SQExpr): boolean;
6829 /** Gets a value indicating whether the expr is an AnyValue or equals comparison to AnyValue*/
6830 function isAnyValue(expr: SQExpr): boolean;
6831 /** Gets a value indicating whether the expr is a DefaultValue or equals comparison to DefaultValue*/
6832 function isDefaultValue(expr: SQExpr): boolean;
6833 function discourageAggregation(expr: SQExpr, schema: FederatedConceptualSchema): boolean;
6834 function getAggregateBehavior(expr: SQExpr, schema: FederatedConceptualSchema): ConceptualAggregateBehavior;
6835 function getSchemaCapabilities(expr: SQExpr, schema: FederatedConceptualSchema): ConceptualCapabilities;
6836 function getKpiMetadata(expr: SQExpr, schema: FederatedConceptualSchema): DataViewKpiColumnMetadata;
6837 function getConceptualEntity(entityExpr: SQEntityExpr, schema: FederatedConceptualSchema): ConceptualEntity;
6838 function getDefaultValue(fieldSQExpr: SQExpr, schema: FederatedConceptualSchema): SQConstantExpr;
6839 function getDefaultValues(fieldSQExprs: SQExpr[], schema: FederatedConceptualSchema): SQConstantExpr[];
6840 /** Return compare or and expression for key value pairs. */
6841 function getDataViewScopeIdentityComparisonExpr(fieldsExpr: SQExpr[], values: SQConstantExpr[]): SQExpr;
6842 function getActiveTablesNames(queryDefn: data.SemanticQuery): string[];
6843 function isRelatedToMany(schema: FederatedConceptualSchema, sourceExpr: SQEntityExpr, targetExpr: SQEntityExpr): boolean;
6844 function isRelatedToOne(schema: FederatedConceptualSchema, sourceExpr: SQEntityExpr, targetExpr: SQEntityExpr): boolean;
6845 function isRelatedOneToOne(schema: FederatedConceptualSchema, sourceExpr: SQEntityExpr, targetExpr: SQEntityExpr): boolean;
6846 /** Performs a union of the 2 arrays with SQExpr.equals as comparator to skip duplicate items,
6847 and returns a new array. When available, we should use _.unionWith from lodash. */
6848 function concatUnique(leftExprs: SQExpr[], rightExprs: SQExpr[]): SQExpr[];
6849 }
6850}
6851declare module powerbi.data {
6852 class SemanticQueryRewriter {
6853 private exprRewriter;
6854 constructor(exprRewriter: ISQExprVisitor<SQExpr>);
6855 rewriteFrom(fromValue: SQFrom): SQFrom;
6856 rewriteSelect(selectItems: NamedSQExpr[], from: SQFrom): NamedSQExpr[];
6857 rewriteGroupBy(groupByitems: NamedSQExpr[], from: SQFrom): NamedSQExpr[];
6858 private rewriteNamedSQExpressions(expressions, from);
6859 rewriteOrderBy(orderByItems: SQSortDefinition[], from: SQFrom): SQSortDefinition[];
6860 rewriteWhere(whereItems: SQFilter[], from: SQFrom): SQFilter[];
6861 }
6862}
6863declare module powerbi.data {
6864 import ArrayNamedItems = jsCommon.ArrayNamedItems;
6865 interface NamedSQExpr {
6866 name: string;
6867 expr: SQExpr;
6868 }
6869 interface SQFilter {
6870 target?: SQExpr[];
6871 condition: SQExpr;
6872 }
6873 /** Represents an entity reference in SemanticQuery from. */
6874 interface SQFromEntitySource {
6875 entity: string;
6876 schema: string;
6877 }
6878 /** Represents a sort over an expression. */
6879 interface SQSortDefinition {
6880 expr: SQExpr;
6881 direction: SortDirection;
6882 }
6883 interface QueryFromEnsureEntityResult {
6884 name: string;
6885 new?: boolean;
6886 }
6887 interface SQSourceRenames {
6888 [from: string]: string;
6889 }
6890 /**
6891 * Represents a semantic query that is:
6892 * 1) Round-trippable with a JSON QueryDefinition.
6893 * 2) Immutable
6894 * 3) Long-lived and does not have strong references to a conceptual model (only names).
6895 */
6896 class SemanticQuery {
6897 private static empty;
6898 private fromValue;
6899 private whereItems;
6900 private orderByItems;
6901 private selectItems;
6902 private groupByItems;
6903 constructor(from: SQFrom, where: SQFilter[], orderBy: SQSortDefinition[], select: NamedSQExpr[], groupBy: NamedSQExpr[]);
6904 static create(): SemanticQuery;
6905 private static createWithTrimmedFrom(from, where, orderBy, select, groupBy);
6906 from(): SQFrom;
6907 /** Returns a query equivalent to this, with the specified selected items. */
6908 select(values: NamedSQExpr[]): SemanticQuery;
6909 /** Gets the items being selected in this query. */
6910 select(): ArrayNamedItems<NamedSQExpr>;
6911 private getSelect();
6912 private static createNamedExpressionArray(items);
6913 private setSelect(values);
6914 private static rewriteExpressionsWithSourceRenames(values, from);
6915 /** Removes the given expression from the select. */
6916 removeSelect(expr: SQExpr): SemanticQuery;
6917 /** Removes the given expression from order by. */
6918 removeOrderBy(expr: SQExpr): SemanticQuery;
6919 selectNameOf(expr: SQExpr): string;
6920 setSelectAt(index: number, expr: SQExpr): SemanticQuery;
6921 /** Adds a the expression to the select clause. */
6922 addSelect(expr: SQExpr, exprName?: string): SemanticQuery;
6923 private createNamedExpr(currentNames, from, expr, exprName?);
6924 /** Returns a query equivalent to this, with the specified groupBy items. */
6925 groupBy(values: NamedSQExpr[]): SemanticQuery;
6926 /** Gets the groupby items in this query. */
6927 groupBy(): ArrayNamedItems<NamedSQExpr>;
6928 private getGroupBy();
6929 private setGroupBy(values);
6930 addGroupBy(expr: SQExpr): SemanticQuery;
6931 /** Gets or sets the sorting for this query. */
6932 orderBy(values: SQSortDefinition[]): SemanticQuery;
6933 orderBy(): SQSortDefinition[];
6934 private getOrderBy();
6935 private setOrderBy(values);
6936 /** Gets or sets the filters for this query. */
6937 where(values: SQFilter[]): SemanticQuery;
6938 where(): SQFilter[];
6939 private getWhere();
6940 private setWhere(values);
6941 addWhere(filter: SemanticFilter): SemanticQuery;
6942 rewrite(exprRewriter: ISQExprVisitor<SQExpr>): SemanticQuery;
6943 }
6944 /** Represents a semantic filter condition. Round-trippable with a JSON FilterDefinition. Instances of this class are immutable. */
6945 class SemanticFilter implements ISemanticFilter {
6946 private fromValue;
6947 private whereItems;
6948 constructor(from: SQFrom, where: SQFilter[]);
6949 static fromSQExpr(contract: SQExpr): SemanticFilter;
6950 static getDefaultValueFilter(fieldSQExprs: SQExpr | SQExpr[]): SemanticFilter;
6951 static getAnyValueFilter(fieldSQExprs: SQExpr | SQExpr[]): SemanticFilter;
6952 private static getDataViewScopeIdentityComparisonFilters(fieldSQExprs, value);
6953 from(): SQFrom;
6954 conditions(): SQExpr[];
6955 where(): SQFilter[];
6956 rewrite(exprRewriter: ISQExprVisitor<SQExpr>): SemanticFilter;
6957 validate(schema: FederatedConceptualSchema, aggrUtils: ISQAggregationOperations, errors?: SQExprValidationError[]): SQExprValidationError[];
6958 /** Merges a list of SemanticFilters into one. */
6959 static merge(filters: SemanticFilter[]): SemanticFilter;
6960 static isDefaultFilter(filter: SemanticFilter): boolean;
6961 static isAnyFilter(filter: SemanticFilter): boolean;
6962 static isSameFilter(leftFilter: SemanticFilter, rightFilter: SemanticFilter): boolean;
6963 private static applyFilter(filter, from, where);
6964 }
6965 /** Represents a SemanticQuery/SemanticFilter from clause. */
6966 class SQFrom {
6967 private items;
6968 constructor(items?: {
6969 [name: string]: SQFromEntitySource;
6970 });
6971 keys(): string[];
6972 entity(key: string): SQFromEntitySource;
6973 ensureEntity(entity: SQFromEntitySource, desiredVariableName?: string): QueryFromEnsureEntityResult;
6974 remove(key: string): void;
6975 /** Converts the entity name into a short reference name. Follows the Semantic Query convention of a short name. */
6976 private candidateName(ref);
6977 clone(): SQFrom;
6978 }
6979 class SQExprRewriterWithSourceRenames extends SQExprRewriter {
6980 private renames;
6981 constructor(renames: SQSourceRenames);
6982 visitEntity(expr: SQEntityExpr): SQExpr;
6983 rewriteFilter(filter: SQFilter): SQFilter;
6984 rewriteArray(exprs: SQExpr[]): SQExpr[];
6985 static rewrite(expr: SQExpr, from: SQFrom): SQExpr;
6986 }
6987}
6988declare module powerbi.data {
6989 /** Utility for creating a DataView from columns of data. */
6990 interface IDataViewBuilderCategorical {
6991 withCategory(options: DataViewBuilderCategoryColumnOptions): IDataViewBuilderCategorical;
6992 withCategories(categories: DataViewCategoryColumn[]): IDataViewBuilderCategorical;
6993 withValues(options: DataViewBuilderValuesOptions): IDataViewBuilderCategorical;
6994 withGroupedValues(options: DataViewBuilderGroupedValuesOptions): IDataViewBuilderCategorical;
6995 build(): DataView;
6996 }
6997 interface DataViewBuilderColumnOptions {
6998 source: DataViewMetadataColumn;
6999 }
7000 interface DataViewBuilderCategoryColumnOptions extends DataViewBuilderColumnOptions {
7001 values: PrimitiveValue[];
7002 identityFrom: DataViewBuilderColumnIdentitySource;
7003 }
7004 interface DataViewBuilderValuesOptions {
7005 columns: DataViewBuilderValuesColumnOptions[];
7006 }
7007 interface DataViewBuilderGroupedValuesOptions {
7008 groupColumn: DataViewBuilderCategoryColumnOptions;
7009 valueColumns: DataViewBuilderColumnOptions[];
7010 data: DataViewBuilderSeriesData[][];
7011 }
7012 /** Indicates the source set of identities. */
7013 interface DataViewBuilderColumnIdentitySource {
7014 fields: SQExpr[];
7015 identities?: DataViewScopeIdentity[];
7016 }
7017 interface DataViewBuilderValuesColumnOptions extends DataViewBuilderColumnOptions, DataViewBuilderSeriesData {
7018 }
7019 interface DataViewBuilderSeriesData {
7020 values: PrimitiveValue[];
7021 highlights?: PrimitiveValue[];
7022 /** Client-computed maximum value for a column. */
7023 maxLocal?: any;
7024 /** Client-computed maximum value for a column. */
7025 minLocal?: any;
7026 }
7027 function createCategoricalDataViewBuilder(): IDataViewBuilderCategorical;
7028}
7029declare module powerbi.data {
7030 import SQExpr = powerbi.data.SQExpr;
7031 function createStaticEvalContext(colorAllocatorCache?: IColorAllocatorCache): IEvalContext;
7032 function createStaticEvalContext(colorAllocatorCache: IColorAllocatorCache, dataView: DataView, selectTransforms: DataViewSelectTransform[]): IEvalContext;
7033 function getExprValueFromTable(expr: SQExpr, selectTransforms: DataViewSelectTransform[], table: DataViewTable, rowIdx: number): PrimitiveValue;
7034}
7035declare module powerbi.data {
7036 function createMatrixEvalContext(colorAllocatorProvider: IColorAllocatorCache, dataViewMatrix: DataViewMatrix): IEvalContext;
7037}
7038declare module powerbi {
7039 /** Culture interfaces. These match the Globalize library interfaces intentionally. */
7040 interface Culture {
7041 name: string;
7042 calendar: Calendar;
7043 calendars: CalendarDictionary;
7044 numberFormat: NumberFormatInfo;
7045 }
7046 interface Calendar {
7047 patterns: any;
7048 firstDay: number;
7049 }
7050 interface CalendarDictionary {
7051 [key: string]: Calendar;
7052 }
7053 interface NumberFormatInfo {
7054 decimals: number;
7055 groupSizes: number[];
7056 negativeInfinity: string;
7057 positiveInfinity: string;
7058 }
7059 /**
7060 * NumberFormat module contains the static methods for formatting the numbers.
7061 * It extends the JQuery.Globalize functionality to support complete set of .NET
7062 * formatting expressions for numeric types including custom formats.
7063 */
7064 module NumberFormat {
7065 const NumberFormatComponentsDelimeter: string;
7066 interface NumericFormatMetadata {
7067 format: string;
7068 hasEscapes: boolean;
7069 hasQuotes: boolean;
7070 hasE: boolean;
7071 hasCommas: boolean;
7072 hasDots: boolean;
7073 hasPercent: boolean;
7074 hasPermile: boolean;
7075 precision: number;
7076 scale: number;
7077 }
7078 interface NumberFormatComponents {
7079 hasNegative: boolean;
7080 positive: string;
7081 negative: string;
7082 zero: string;
7083 }
7084 function getNumericFormat(value: number, baseFormat: string): string;
7085 function addDecimalsToFormat(baseFormat: string, decimals: number, trailingZeros: boolean): string;
7086 function hasFormatComponents(format: string): boolean;
7087 function getComponents(format: string): NumberFormatComponents;
7088 /** Evaluates if the value can be formatted using the NumberFormat */
7089 function canFormat(value: any): boolean;
7090 function isStandardFormat(format: string): boolean;
7091 /** Formats the number using specified format expression and culture */
7092 function format(value: number, format: string, culture: Culture): string;
7093 /** Performs a custom format with a value override. Typically used for custom formats showing scaled values. */
7094 function formatWithCustomOverride(value: number, format: string, nonScientificOverrideFormat: string, culture: Culture): string;
7095 /**
7096 * Returns the formatMetadata of the format
7097 * When calculating precision and scale, if format string of
7098 * positive[;negative;zero] => positive format will be used
7099 * @param (required) format - format string
7100 * @param (optional) calculatePrecision - calculate precision of positive format
7101 * @param (optional) calculateScale - calculate scale of positive format
7102 */
7103 function getCustomFormatMetadata(format: string, calculatePrecision?: boolean, calculateScale?: boolean): NumericFormatMetadata;
7104 }
7105 var formattingService: IFormattingService;
7106}
7107declare module powerbi.data {
7108 /** Serializes SQExpr in a form optimized in-memory comparison, but not intended for storage on disk. */
7109 module SQExprShortSerializer {
7110 function serialize(expr: SQExpr): string;
7111 function serializeArray(exprs: SQExpr[]): string;
7112 }
7113}
7114declare module powerbi.visuals {
7115 import Selector = powerbi.data.Selector;
7116 import SelectorForColumn = powerbi.SelectorForColumn;
7117 /**
7118 * A combination of identifiers used to uniquely identify
7119 * data points and their bound geometry.
7120 */
7121 class SelectionId implements ISelectionId {
7122 private selector;
7123 private selectorsByColumn;
7124 private key;
7125 private keyWithoutHighlight;
7126 highlight: boolean;
7127 constructor(selector: Selector, highlight: boolean);
7128 equals(other: SelectionId): boolean;
7129 /**
7130 * Checks equality against other for all identifiers existing in this.
7131 */
7132 includes(other: SelectionId, ignoreHighlight?: boolean): boolean;
7133 getKey(): string;
7134 getKeyWithoutHighlight(): string;
7135 hasIdentity(): boolean;
7136 getSelector(): Selector;
7137 getSelectorsByColumn(): Selector;
7138 static createNull(highlight?: boolean): SelectionId;
7139 static createWithId(id: DataViewScopeIdentity, highlight?: boolean): SelectionId;
7140 static createWithMeasure(measureId: string, highlight?: boolean): SelectionId;
7141 static createWithIdAndMeasure(id: DataViewScopeIdentity, measureId: string, highlight?: boolean): SelectionId;
7142 static createWithIdAndMeasureAndCategory(id: DataViewScopeIdentity, measureId: string, queryName: string, highlight?: boolean): SelectionId;
7143 static createWithIds(id1: DataViewScopeIdentity, id2: DataViewScopeIdentity, highlight?: boolean): SelectionId;
7144 static createWithIdsAndMeasure(id1: DataViewScopeIdentity, id2: DataViewScopeIdentity, measureId: string, highlight?: boolean): SelectionId;
7145 static createWithSelectorForColumnAndMeasure(dataMap: SelectorForColumn, measureId: string, highlight?: boolean): SelectionId;
7146 static createWithHighlight(original: SelectionId): SelectionId;
7147 private static idArray(id1, id2);
7148 }
7149 /**
7150 * This class is designed to simplify the creation of SelectionId objects
7151 * It allows chaining to build up an object before calling 'create' to build a SelectionId
7152 */
7153 class SelectionIdBuilder implements ISelectionIdBuilder {
7154 private dataMap;
7155 private measure;
7156 static builder(): SelectionIdBuilder;
7157 withCategory(categoryColumn: DataViewCategoryColumn, index: number): this;
7158 withSeries(seriesColumn: DataViewValueColumns, valueColumn: DataViewValueColumn | DataViewValueColumnGroup): this;
7159 withMeasure(measureId: string): this;
7160 createSelectionId(): SelectionId;
7161 private ensureDataMap();
7162 }
7163}
7164;declare module powerbi.visuals {
7165 class Point implements IPoint {
7166 x: number;
7167 y: number;
7168 constructor(x?: number, y?: number);
7169 }
7170}
7171declare module powerbi.visuals {
7172 class Rect implements IRect {
7173 left: number;
7174 top: number;
7175 width: number;
7176 height: number;
7177 constructor(left?: number, top?: number, width?: number, height?: number);
7178 }
7179}
7180declare module powerbi.visuals {
7181 enum LegendIcon {
7182 Box = 0,
7183 Circle = 1,
7184 Line = 2,
7185 }
7186 enum LegendPosition {
7187 Top = 0,
7188 Bottom = 1,
7189 Right = 2,
7190 Left = 3,
7191 None = 4,
7192 TopCenter = 5,
7193 BottomCenter = 6,
7194 RightCenter = 7,
7195 LeftCenter = 8,
7196 }
7197 interface LegendPosition2D {
7198 textPosition?: Point;
7199 glyphPosition?: Point;
7200 }
7201 interface LegendDataPoint extends SelectableDataPoint, LegendPosition2D {
7202 label: string;
7203 color: string;
7204 icon: LegendIcon;
7205 category?: string;
7206 measure?: any;
7207 iconOnlyOnLabel?: boolean;
7208 tooltip?: string;
7209 layerNumber?: number;
7210 }
7211 interface LegendData {
7212 title?: string;
7213 dataPoints: LegendDataPoint[];
7214 grouped?: boolean;
7215 labelColor?: string;
7216 fontSize?: number;
7217 }
7218 const legendProps: {
7219 show: string;
7220 position: string;
7221 titleText: string;
7222 showTitle: string;
7223 labelColor: string;
7224 fontSize: string;
7225 };
7226 function createLegend(legendParentElement: JQuery, interactive: boolean, interactivityService: IInteractivityService, isScrollable?: boolean, legendPosition?: LegendPosition): ILegend;
7227 interface ILegend {
7228 getMargins(): IViewport;
7229 isVisible(): boolean;
7230 changeOrientation(orientation: LegendPosition): void;
7231 getOrientation(): LegendPosition;
7232 drawLegend(data: LegendData, viewport: IViewport): any;
7233 /**
7234 * Reset the legend by clearing it
7235 */
7236 reset(): void;
7237 }
7238 module Legend {
7239 function isLeft(orientation: LegendPosition): boolean;
7240 function isTop(orientation: LegendPosition): boolean;
7241 function positionChartArea(chartArea: D3.Selection, legend: ILegend): void;
7242 }
7243 class SVGLegend implements ILegend {
7244 private orientation;
7245 private viewport;
7246 private parentViewport;
7247 private svg;
7248 private group;
7249 private clearCatcher;
7250 private element;
7251 private interactivityService;
7252 private legendDataStartIndex;
7253 private arrowPosWindow;
7254 private data;
7255 private isScrollable;
7256 private lastCalculatedWidth;
7257 private visibleLegendWidth;
7258 private visibleLegendHeight;
7259 private legendFontSizeMarginDifference;
7260 private legendFontSizeMarginValue;
7261 static DefaultFontSizeInPt: number;
7262 private static LegendIconRadius;
7263 private static LegendIconRadiusFactor;
7264 private static MaxTextLength;
7265 private static MaxTitleLength;
7266 private static TextAndIconPadding;
7267 private static TitlePadding;
7268 private static LegendEdgeMariginWidth;
7269 private static LegendMaxWidthFactor;
7270 private static TopLegendHeight;
7271 private static DefaultTextMargin;
7272 private static DefaultMaxLegendFactor;
7273 private static LegendIconYRatio;
7274 private static LegendArrowOffset;
7275 private static LegendArrowHeight;
7276 private static LegendArrowWidth;
7277 private static DefaultFontFamily;
7278 private static DefaultTitleFontFamily;
7279 private static LegendItem;
7280 private static LegendText;
7281 private static LegendIcon;
7282 private static LegendTitle;
7283 private static NavigationArrow;
7284 constructor(element: JQuery, legendPosition: LegendPosition, interactivityService: IInteractivityService, isScrollable: boolean);
7285 private updateLayout();
7286 private calculateViewport();
7287 getMargins(): IViewport;
7288 isVisible(): boolean;
7289 changeOrientation(orientation: LegendPosition): void;
7290 getOrientation(): LegendPosition;
7291 drawLegend(data: LegendData, viewport: IViewport): void;
7292 drawLegendInternal(data: LegendData, viewport: IViewport, autoWidth: boolean): void;
7293 private normalizePosition(points);
7294 private calculateTitleLayout(title);
7295 /** Performs layout offline for optimal perfomance */
7296 private calculateLayout(data, autoWidth);
7297 private updateNavigationArrowLayout(navigationArrows, remainingDataLength, visibleDataLength);
7298 private calculateHorizontalNavigationArrowsLayout(title);
7299 private calculateVerticalNavigationArrowsLayout(title);
7300 /**
7301 * Calculates the widths for each horizontal legend item.
7302 */
7303 private static calculateHorizontalLegendItemsWidths(dataPoints, availableWidth, iconPadding, fontSize);
7304 private calculateHorizontalLayout(dataPoints, title, navigationArrows);
7305 private calculateVerticalLayout(dataPoints, title, navigationArrows, autoWidth);
7306 private drawNavigationArrows(layout);
7307 private isTopOrBottom(orientation);
7308 private isCentered(orientation);
7309 reset(): void;
7310 private static getTextProperties(isTitle, text?, fontSize?);
7311 private setTooltipToLegendItems(data);
7312 }
7313 module LegendData {
7314 var DefaultLegendLabelFillColor: string;
7315 function update(legendData: LegendData, legendObject: DataViewObject): void;
7316 }
7317}
7318declare module powerbi.visuals {
7319 module axisScale {
7320 const linear: string;
7321 const log: string;
7322 const type: IEnumType;
7323 }
7324}
7325declare module powerbi.visuals {
7326 module axisStyle {
7327 const showBoth: string;
7328 const showTitleOnly: string;
7329 const showUnitOnly: string;
7330 const type: IEnumType;
7331 }
7332}
7333declare module powerbi.visuals {
7334 module axisType {
7335 const scalar: string;
7336 const categorical: string;
7337 const both: string;
7338 const type: IEnumType;
7339 }
7340}
7341declare module powerbi.visuals {
7342 module basicShapeType {
7343 const rectangle: string;
7344 const oval: string;
7345 const line: string;
7346 const arrow: string;
7347 const triangle: string;
7348 const type: IEnumType;
7349 }
7350}
7351declare module powerbi.visuals {
7352 module imageScalingType {
7353 const normal: string;
7354 const fit: string;
7355 const fill: string;
7356 const type: IEnumType;
7357 }
7358}
7359declare module powerbi.visuals {
7360 module labelPosition {
7361 const insideEnd: string;
7362 const insideCenter: string;
7363 const outsideEnd: string;
7364 const insideBase: string;
7365 const type: IEnumType;
7366 }
7367}
7368declare module powerbi.visuals {
7369 module labelStyle {
7370 const category: string;
7371 const data: string;
7372 const both: string;
7373 const type: IEnumType;
7374 }
7375}
7376declare module powerbi.visuals {
7377 module legendPosition {
7378 const top: string;
7379 const bottom: string;
7380 const left: string;
7381 const right: string;
7382 const topCenter: string;
7383 const bottomCenter: string;
7384 const leftCenter: string;
7385 const rightCenter: string;
7386 const type: IEnumType;
7387 }
7388}
7389declare module powerbi.visuals {
7390 module kpiDirection {
7391 const positive: string;
7392 const negative: string;
7393 const type: IEnumType;
7394 }
7395}
7396declare module powerbi.visuals {
7397 module lineStyle {
7398 const dashed: string;
7399 const solid: string;
7400 const dotted: string;
7401 const type: IEnumType;
7402 }
7403}
7404declare module powerbi.visuals {
7405 module outline {
7406 const none: string;
7407 const bottomOnly: string;
7408 const topOnly: string;
7409 const leftOnly: string;
7410 const rightOnly: string;
7411 const topBottom: string;
7412 const leftRight: string;
7413 const frame: string;
7414 function showTop(outline: string): boolean;
7415 function showRight(outline: string): boolean;
7416 function showBottom(outline: string): boolean;
7417 function showLeft(outline: string): boolean;
7418 const type: IEnumType;
7419 }
7420}
7421declare module powerbi.visuals {
7422 module referenceLinePosition {
7423 const back: string;
7424 const front: string;
7425 const type: IEnumType;
7426 }
7427 module referenceLineDataLabelHorizontalPosition {
7428 const left: string;
7429 const right: string;
7430 const type: IEnumType;
7431 }
7432 module referenceLineDataLabelVerticalPosition {
7433 const above: string;
7434 const under: string;
7435 const type: IEnumType;
7436 }
7437}
7438declare module powerbi.visuals {
7439 module slicerOrientation {
7440 const enum Orientation {
7441 Vertical = 0,
7442 Horizontal = 1,
7443 }
7444 const type: IEnumType;
7445 }
7446}
7447declare module powerbi.visuals {
7448 module yAxisPosition {
7449 const left: string;
7450 const right: string;
7451 const type: IEnumType;
7452 }
7453}
7454declare module powerbi.visuals {
7455 module AnimatorCommon {
7456 const MinervaAnimationDuration: number;
7457 const MaxDataPointsToAnimate: number;
7458 function GetAnimationDuration(animator: IGenericAnimator, suppressAnimations: boolean): number;
7459 }
7460 interface IAnimatorOptions {
7461 duration?: number;
7462 }
7463 interface IAnimationOptions {
7464 interactivityService: IInteractivityService;
7465 }
7466 interface IAnimationResult {
7467 failed: boolean;
7468 }
7469 interface IAnimator<T extends IAnimatorOptions, U extends IAnimationOptions, V extends IAnimationResult> {
7470 getDuration(): number;
7471 getEasing(): string;
7472 animate(options: U): V;
7473 }
7474 type IGenericAnimator = IAnimator<IAnimatorOptions, IAnimationOptions, IAnimationResult>;
7475 /**
7476 * We just need to have a non-null animator to allow axis animations in cartesianChart.
7477 * Note: Use this temporarily for Line/Scatter until we add more animations (MinervaPlugins only).
7478 */
7479 class BaseAnimator<T extends IAnimatorOptions, U extends IAnimationOptions, V extends IAnimationResult> implements IAnimator<T, U, V> {
7480 protected animationDuration: number;
7481 constructor(options?: T);
7482 getDuration(): number;
7483 animate(options: U): V;
7484 getEasing(): string;
7485 }
7486}
7487declare module powerbi.visuals {
7488 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
7489 interface ColumnChartAnimationOptions extends IAnimationOptions {
7490 viewModel: ColumnChartData;
7491 series: D3.UpdateSelection;
7492 layout: IColumnLayout;
7493 itemCS: ClassAndSelector;
7494 mainGraphicsContext: D3.Selection;
7495 viewPort: IViewport;
7496 }
7497 interface ColumnChartAnimationResult extends IAnimationResult {
7498 shapes: D3.UpdateSelection;
7499 }
7500 type IColumnChartAnimator = IAnimator<IAnimatorOptions, ColumnChartAnimationOptions, ColumnChartAnimationResult>;
7501 class WebColumnChartAnimator extends BaseAnimator<IAnimatorOptions, ColumnChartAnimationOptions, ColumnChartAnimationResult> implements IColumnChartAnimator {
7502 private previousViewModel;
7503 constructor(options?: IAnimatorOptions);
7504 animate(options: ColumnChartAnimationOptions): ColumnChartAnimationResult;
7505 private animateNormalToHighlighted(options);
7506 private animateHighlightedToHighlighted(options);
7507 private animateHighlightedToNormal(options);
7508 private animateDefaultShapes(data, series, layout, itemCS);
7509 }
7510}
7511declare module powerbi.visuals {
7512 interface DonutChartAnimationOptions extends IAnimationOptions {
7513 viewModel: DonutData;
7514 graphicsContext: D3.Selection;
7515 labelGraphicsContext: D3.Selection;
7516 colors: IDataColorPalette;
7517 layout: DonutLayout;
7518 sliceWidthRatio: number;
7519 radius: number;
7520 viewport: IViewport;
7521 innerArcRadiusRatio: number;
7522 labels: Label[];
7523 }
7524 interface DonutChartAnimationResult extends IAnimationResult {
7525 shapes: D3.UpdateSelection;
7526 highlightShapes: D3.UpdateSelection;
7527 }
7528 type IDonutChartAnimator = IAnimator<IAnimatorOptions, DonutChartAnimationOptions, DonutChartAnimationResult>;
7529 class WebDonutChartAnimator extends BaseAnimator<IAnimatorOptions, DonutChartAnimationOptions, DonutChartAnimationResult> implements IDonutChartAnimator {
7530 private previousViewModel;
7531 constructor(options?: IAnimatorOptions);
7532 animate(options: DonutChartAnimationOptions): DonutChartAnimationResult;
7533 private animateNormalToHighlighted(options);
7534 private animateHighlightedToHighlighted(options);
7535 private animateHighlightedToNormal(options);
7536 private animateDefaultShapes(options);
7537 private animateDefaultHighlightShapes(options);
7538 }
7539}
7540declare module powerbi.visuals {
7541 interface FunnelAnimationOptions extends IAnimationOptions {
7542 viewModel: FunnelData;
7543 layout: IFunnelLayout;
7544 axisGraphicsContext: D3.Selection;
7545 shapeGraphicsContext: D3.Selection;
7546 percentGraphicsContext: D3.Selection;
7547 labelGraphicsContext: D3.Selection;
7548 axisOptions: FunnelAxisOptions;
7549 slicesWithoutHighlights: FunnelSlice[];
7550 labelLayout: ILabelLayout;
7551 isHidingPercentBars: boolean;
7552 visualInitOptions: VisualInitOptions;
7553 }
7554 interface FunnelAnimationResult extends IAnimationResult {
7555 shapes: D3.UpdateSelection;
7556 dataLabels: D3.UpdateSelection;
7557 }
7558 type IFunnelAnimator = IAnimator<IAnimatorOptions, FunnelAnimationOptions, FunnelAnimationResult>;
7559 class WebFunnelAnimator extends BaseAnimator<IAnimatorOptions, FunnelAnimationOptions, FunnelAnimationResult> implements IFunnelAnimator {
7560 private previousViewModel;
7561 constructor(options?: IAnimatorOptions);
7562 animate(options: FunnelAnimationOptions): FunnelAnimationResult;
7563 private animateNormalToHighlighted(options);
7564 private animateHighlightedToHighlighted(options);
7565 private animateHighlightedToNormal(options);
7566 private animateDefaultAxis(graphicsContext, axisOptions, isHidingPercentBars);
7567 private animateDefaultShapes(data, slices, graphicsContext, layout);
7568 private animateDefaultDataLabels(options);
7569 private animatePercentBars(options);
7570 private animateToFunnelPercent(context, targetData, layout);
7571 private animatePercentBarComponents(data, options);
7572 }
7573}
7574declare module powerbi.visuals {
7575 interface TreemapAnimationOptions extends IAnimationOptions {
7576 viewModel: TreemapData;
7577 nodes: D3.Layout.GraphNode[];
7578 highlightNodes: D3.Layout.GraphNode[];
7579 majorLabeledNodes: D3.Layout.GraphNode[];
7580 minorLabeledNodes: D3.Layout.GraphNode[];
7581 shapeGraphicsContext: D3.Selection;
7582 labelGraphicsContext: D3.Selection;
7583 layout: ITreemapLayout;
7584 labelSettings: VisualDataLabelsSettings;
7585 }
7586 interface TreemapAnimationResult extends IAnimationResult {
7587 shapes: D3.UpdateSelection;
7588 highlightShapes: D3.UpdateSelection;
7589 majorLabels: D3.UpdateSelection;
7590 minorLabels: D3.UpdateSelection;
7591 }
7592 type ITreemapAnimator = IAnimator<IAnimatorOptions, TreemapAnimationOptions, TreemapAnimationResult>;
7593 class WebTreemapAnimator extends BaseAnimator<IAnimatorOptions, TreemapAnimationOptions, TreemapAnimationResult> implements ITreemapAnimator {
7594 previousViewModel: TreemapData;
7595 constructor(options?: IAnimatorOptions);
7596 animate(options: TreemapAnimationOptions): TreemapAnimationResult;
7597 private animateNormalToHighlighted(options);
7598 private animateHighlightedToHighlighted(options);
7599 private animateHighlightedToNormal(options);
7600 private animateDefaultShapes(context, nodes, hasSelection, hasHighlights, layout);
7601 private animateDefaultHighlightShapes(context, nodes, hasSelection, hasHighlights, layout);
7602 private animateDefaultMajorLabels(context, nodes, labelSettings, layout);
7603 private animateDefaultMinorLabels(context, nodes, labelSettings, layout);
7604 }
7605}
7606declare module powerbi.visuals {
7607 /**
7608 * This is the baseline for some most common used object properties across visuals.
7609 * When adding new properties, please try to reuse the existing ones.
7610 */
7611 const StandardObjectProperties: {
7612 axisEnd: {
7613 displayName: (IStringResourceProvider: any) => string;
7614 description: (IStringResourceProvider: any) => string;
7615 placeHolderText: (IStringResourceProvider: any) => string;
7616 type: {
7617 numeric: boolean;
7618 };
7619 suppressFormatPainterCopy: boolean;
7620 };
7621 axisScale: {
7622 displayName: (IStringResourceProvider: any) => string;
7623 type: {
7624 enumeration: IEnumType;
7625 };
7626 };
7627 axisStart: {
7628 displayName: (IStringResourceProvider: any) => string;
7629 description: (IStringResourceProvider: any) => string;
7630 placeHolderText: (IStringResourceProvider: any) => string;
7631 type: {
7632 numeric: boolean;
7633 };
7634 suppressFormatPainterCopy: boolean;
7635 };
7636 axisStyle: {
7637 displayName: (IStringResourceProvider: any) => string;
7638 type: {
7639 enumeration: IEnumType;
7640 };
7641 };
7642 axisType: {
7643 displayName: (IStringResourceProvider: any) => string;
7644 type: {
7645 enumeration: IEnumType;
7646 };
7647 };
7648 backColor: {
7649 displayName: (IStringResourceProvider: any) => string;
7650 description: (IStringResourceProvider: any) => string;
7651 type: {
7652 fill: {
7653 solid: {
7654 color: boolean;
7655 };
7656 };
7657 };
7658 };
7659 dataColor: {
7660 displayName: (IStringResourceProvider: any) => string;
7661 description: (IStringResourceProvider: any) => string;
7662 type: {
7663 fill: {
7664 solid: {
7665 color: boolean;
7666 };
7667 };
7668 };
7669 };
7670 dataLabelColor: {
7671 displayName: (IStringResourceProvider: any) => string;
7672 description: (IStringResourceProvider: any) => string;
7673 type: {
7674 fill: {
7675 solid: {
7676 color: boolean;
7677 };
7678 };
7679 };
7680 };
7681 dataLabelDecimalPoints: {
7682 displayName: (IStringResourceProvider: any) => string;
7683 placeHolderText: (IStringResourceProvider: any) => string;
7684 type: {
7685 numeric: boolean;
7686 };
7687 };
7688 dataLabelDisplayUnits: {
7689 displayName: (IStringResourceProvider: any) => string;
7690 description: (IStringResourceProvider: any) => string;
7691 type: {
7692 formatting: {
7693 labelDisplayUnits: boolean;
7694 };
7695 };
7696 suppressFormatPainterCopy: boolean;
7697 };
7698 dataLabelHorizontalPosition: {
7699 displayName: (IStringResourceProvider: any) => string;
7700 description: (IStringResourceProvider: any) => string;
7701 type: {
7702 enumeration: IEnumType;
7703 };
7704 };
7705 dataLabelShow: {
7706 displayName: (IStringResourceProvider: any) => string;
7707 description: (IStringResourceProvider: any) => string;
7708 type: {
7709 bool: boolean;
7710 };
7711 };
7712 dataLabelVerticalPosition: {
7713 displayName: (IStringResourceProvider: any) => string;
7714 description: (IStringResourceProvider: any) => string;
7715 type: {
7716 enumeration: IEnumType;
7717 };
7718 };
7719 defaultColor: {
7720 displayName: (IStringResourceProvider: any) => string;
7721 type: {
7722 fill: {
7723 solid: {
7724 color: boolean;
7725 };
7726 };
7727 };
7728 };
7729 fill: {
7730 displayName: (IStringResourceProvider: any) => string;
7731 type: {
7732 fill: {
7733 solid: {
7734 color: boolean;
7735 };
7736 };
7737 };
7738 };
7739 fontColor: {
7740 displayName: (IStringResourceProvider: any) => string;
7741 description: (IStringResourceProvider: any) => string;
7742 type: {
7743 fill: {
7744 solid: {
7745 color: boolean;
7746 };
7747 };
7748 };
7749 };
7750 fontSize: {
7751 displayName: (IStringResourceProvider: any) => string;
7752 type: {
7753 formatting: {
7754 fontSize: boolean;
7755 };
7756 };
7757 };
7758 formatString: {
7759 type: {
7760 formatting: {
7761 formatString: boolean;
7762 };
7763 };
7764 };
7765 image: {
7766 type: {
7767 image: {};
7768 };
7769 };
7770 labelColor: {
7771 displayName: (IStringResourceProvider: any) => string;
7772 type: {
7773 fill: {
7774 solid: {
7775 color: boolean;
7776 };
7777 };
7778 };
7779 };
7780 labelDisplayUnits: {
7781 displayName: (IStringResourceProvider: any) => string;
7782 description: (IStringResourceProvider: any) => string;
7783 type: {
7784 formatting: {
7785 labelDisplayUnits: boolean;
7786 };
7787 };
7788 };
7789 labelPrecision: {
7790 displayName: (IStringResourceProvider: any) => string;
7791 description: (IStringResourceProvider: any) => string;
7792 placeHolderText: (IStringResourceProvider: any) => string;
7793 type: {
7794 numeric: boolean;
7795 };
7796 };
7797 legendPosition: {
7798 displayName: (IStringResourceProvider: any) => string;
7799 description: (IStringResourceProvider: any) => string;
7800 type: {
7801 enumeration: IEnumType;
7802 };
7803 };
7804 legendTitle: {
7805 displayName: (IStringResourceProvider: any) => string;
7806 description: (IStringResourceProvider: any) => string;
7807 type: {
7808 text: boolean;
7809 };
7810 };
7811 lineColor: {
7812 displayName: (IStringResourceProvider: any) => string;
7813 description: (IStringResourceProvider: any) => string;
7814 type: {
7815 fill: {
7816 solid: {
7817 color: boolean;
7818 };
7819 };
7820 };
7821 };
7822 outline: {
7823 displayName: (IStringResourceProvider: any) => string;
7824 type: {
7825 enumeration: IEnumType;
7826 };
7827 };
7828 outlineColor: {
7829 displayName: (IStringResourceProvider: any) => string;
7830 description: (IStringResourceProvider: any) => string;
7831 type: {
7832 fill: {
7833 solid: {
7834 color: boolean;
7835 };
7836 };
7837 };
7838 };
7839 outlineWeight: {
7840 displayName: (IStringResourceProvider: any) => string;
7841 description: (IStringResourceProvider: any) => string;
7842 type: {
7843 numeric: boolean;
7844 };
7845 };
7846 show: {
7847 displayName: (IStringResourceProvider: any) => string;
7848 type: {
7849 bool: boolean;
7850 };
7851 };
7852 showAllDataPoints: {
7853 displayName: (IStringResourceProvider: any) => string;
7854 type: {
7855 bool: boolean;
7856 };
7857 };
7858 showLegendTitle: {
7859 displayName: (IStringResourceProvider: any) => string;
7860 description: (IStringResourceProvider: any) => string;
7861 type: {
7862 bool: boolean;
7863 };
7864 };
7865 referenceLinePosition: {
7866 displayName: (IStringResourceProvider: any) => string;
7867 description: (IStringResourceProvider: any) => string;
7868 type: {
7869 enumeration: IEnumType;
7870 };
7871 };
7872 referenceLineStyle: {
7873 displayName: (IStringResourceProvider: any) => string;
7874 description: (IStringResourceProvider: any) => string;
7875 type: {
7876 enumeration: IEnumType;
7877 };
7878 };
7879 transparency: {
7880 displayName: (IStringResourceProvider: any) => string;
7881 description: (IStringResourceProvider: any) => string;
7882 type: {
7883 numeric: boolean;
7884 };
7885 };
7886 yAxisPosition: {
7887 displayName: (IStringResourceProvider: any) => string;
7888 description: (IStringResourceProvider: any) => string;
7889 type: {
7890 enumeration: IEnumType;
7891 };
7892 };
7893 };
7894}
7895declare module powerbi.visuals {
7896 const animatedTextObjectDescs: data.DataViewObjectDescriptors;
7897 const animatedNumberCapabilities: VisualCapabilities;
7898}
7899declare module powerbi.visuals {
7900 const basicShapeCapabilities: VisualCapabilities;
7901 const basicShapeProps: {
7902 general: {
7903 shapeType: DataViewObjectPropertyIdentifier;
7904 };
7905 line: {
7906 transparency: DataViewObjectPropertyIdentifier;
7907 weight: DataViewObjectPropertyIdentifier;
7908 roundEdge: DataViewObjectPropertyIdentifier;
7909 lineColor: DataViewObjectPropertyIdentifier;
7910 };
7911 fill: {
7912 transparency: DataViewObjectPropertyIdentifier;
7913 fillColor: DataViewObjectPropertyIdentifier;
7914 show: DataViewObjectPropertyIdentifier;
7915 };
7916 rotation: {
7917 angle: DataViewObjectPropertyIdentifier;
7918 };
7919 };
7920}
7921declare module powerbi.visuals {
7922 function getColumnChartCapabilities(transposeAxes?: boolean): VisualCapabilities;
7923 const columnChartProps: {
7924 dataPoint: {
7925 defaultColor: DataViewObjectPropertyIdentifier;
7926 fill: DataViewObjectPropertyIdentifier;
7927 showAllDataPoints: DataViewObjectPropertyIdentifier;
7928 };
7929 general: {
7930 formatString: DataViewObjectPropertyIdentifier;
7931 };
7932 categoryAxis: {
7933 axisType: DataViewObjectPropertyIdentifier;
7934 };
7935 legend: {
7936 labelColor: DataViewObjectPropertyIdentifier;
7937 };
7938 plotArea: {
7939 image: DataViewObjectPropertyIdentifier;
7940 transparency: DataViewObjectPropertyIdentifier;
7941 };
7942 };
7943}
7944declare module powerbi.visuals {
7945 const comboChartCapabilities: VisualCapabilities;
7946 const comboChartProps: {
7947 general: {
7948 formatString: DataViewObjectPropertyIdentifier;
7949 };
7950 valueAxis: {
7951 secShow: DataViewObjectPropertyIdentifier;
7952 };
7953 legend: {
7954 labelColor: DataViewObjectPropertyIdentifier;
7955 };
7956 dataPoint: {
7957 showAllDataPoints: DataViewObjectPropertyIdentifier;
7958 };
7959 };
7960}
7961declare module powerbi.visuals {
7962 const donutChartCapabilities: VisualCapabilities;
7963 const donutChartProps: {
7964 general: {
7965 formatString: DataViewObjectPropertyIdentifier;
7966 };
7967 dataPoint: {
7968 defaultColor: DataViewObjectPropertyIdentifier;
7969 fill: DataViewObjectPropertyIdentifier;
7970 };
7971 legend: {
7972 show: DataViewObjectPropertyIdentifier;
7973 position: DataViewObjectPropertyIdentifier;
7974 showTitle: DataViewObjectPropertyIdentifier;
7975 titleText: DataViewObjectPropertyIdentifier;
7976 labelColor: DataViewObjectPropertyIdentifier;
7977 };
7978 };
7979}
7980declare module powerbi.visuals {
7981 const dataDotChartCapabilities: VisualCapabilities;
7982}
7983declare module powerbi.visuals {
7984 const filledMapCapabilities: VisualCapabilities;
7985 const filledMapProps: {
7986 general: {
7987 formatString: DataViewObjectPropertyIdentifier;
7988 };
7989 dataPoint: {
7990 defaultColor: DataViewObjectPropertyIdentifier;
7991 fill: DataViewObjectPropertyIdentifier;
7992 showAllDataPoints: DataViewObjectPropertyIdentifier;
7993 };
7994 legend: {
7995 show: DataViewObjectPropertyIdentifier;
7996 position: DataViewObjectPropertyIdentifier;
7997 showTitle: DataViewObjectPropertyIdentifier;
7998 titleText: DataViewObjectPropertyIdentifier;
7999 };
8000 labels: {
8001 show: DataViewObjectPropertyIdentifier;
8002 color: DataViewObjectPropertyIdentifier;
8003 labelDisplayUnits: DataViewObjectPropertyIdentifier;
8004 labelPrecision: DataViewObjectPropertyIdentifier;
8005 };
8006 categoryLabels: {
8007 show: DataViewObjectPropertyIdentifier;
8008 };
8009 };
8010}
8011declare module powerbi.visuals {
8012 const funnelChartCapabilities: VisualCapabilities;
8013 const funnelChartProps: {
8014 general: {
8015 formatString: DataViewObjectPropertyIdentifier;
8016 };
8017 dataPoint: {
8018 defaultColor: DataViewObjectPropertyIdentifier;
8019 fill: DataViewObjectPropertyIdentifier;
8020 };
8021 };
8022}
8023declare module powerbi.visuals {
8024 const gaugeRoleNames: {
8025 y: string;
8026 minValue: string;
8027 maxValue: string;
8028 targetValue: string;
8029 };
8030 const gaugeCapabilities: VisualCapabilities;
8031 const gaugeProps: {
8032 dataPoint: {
8033 fill: DataViewObjectPropertyIdentifier;
8034 target: DataViewObjectPropertyIdentifier;
8035 };
8036 };
8037}
8038declare module powerbi.visuals {
8039 const imageVisualCapabilities: VisualCapabilities;
8040}
8041declare module powerbi.visuals {
8042 var scriptVisualCapabilities: VisualCapabilities;
8043}
8044declare module powerbi.visuals.samples {
8045 var consoleWriterCapabilities: VisualCapabilities;
8046}
8047declare module powerbi.visuals.samples {
8048 class ConsoleWriter implements IVisual {
8049 static converter(dataView: DataView): any;
8050 init(options: VisualInitOptions): void;
8051 onResizing(viewport: IViewport): void;
8052 update(options: VisualUpdateOptions): void;
8053 }
8054}
8055declare module powerbi.visuals {
8056 const lineChartCapabilities: VisualCapabilities;
8057 const lineChartProps: {
8058 general: {
8059 formatString: DataViewObjectPropertyIdentifier;
8060 };
8061 dataPoint: {
8062 defaultColor: DataViewObjectPropertyIdentifier;
8063 fill: DataViewObjectPropertyIdentifier;
8064 };
8065 trend: {
8066 show: DataViewObjectPropertyIdentifier;
8067 };
8068 categoryAxis: {
8069 axisType: DataViewObjectPropertyIdentifier;
8070 };
8071 legend: {
8072 labelColor: DataViewObjectPropertyIdentifier;
8073 };
8074 labels: {
8075 labelDensity: DataViewObjectPropertyIdentifier;
8076 };
8077 plotArea: {
8078 image: DataViewObjectPropertyIdentifier;
8079 transparency: DataViewObjectPropertyIdentifier;
8080 };
8081 };
8082}
8083declare module powerbi.visuals {
8084 const mapCapabilities: VisualCapabilities;
8085 const mapProps: {
8086 general: {
8087 formatString: DataViewObjectPropertyIdentifier;
8088 };
8089 dataPoint: {
8090 defaultColor: DataViewObjectPropertyIdentifier;
8091 fill: DataViewObjectPropertyIdentifier;
8092 showAllDataPoints: DataViewObjectPropertyIdentifier;
8093 };
8094 legend: {
8095 show: DataViewObjectPropertyIdentifier;
8096 position: DataViewObjectPropertyIdentifier;
8097 showTitle: DataViewObjectPropertyIdentifier;
8098 titleText: DataViewObjectPropertyIdentifier;
8099 };
8100 };
8101}
8102declare module powerbi.visuals {
8103 const multiRowCardCapabilities: VisualCapabilities;
8104 const multiRowCardProps: {
8105 card: {
8106 outline: DataViewObjectPropertyIdentifier;
8107 outlineColor: DataViewObjectPropertyIdentifier;
8108 outlineWeight: DataViewObjectPropertyIdentifier;
8109 barShow: DataViewObjectPropertyIdentifier;
8110 barColor: DataViewObjectPropertyIdentifier;
8111 barWeight: DataViewObjectPropertyIdentifier;
8112 cardPadding: DataViewObjectPropertyIdentifier;
8113 cardBackground: DataViewObjectPropertyIdentifier;
8114 };
8115 };
8116}
8117declare module powerbi.visuals {
8118 const textboxCapabilities: VisualCapabilities;
8119}
8120declare module powerbi.visuals {
8121 const cheerMeterCapabilities: VisualCapabilities;
8122}
8123declare module powerbi.visuals {
8124 const scatterChartCapabilities: VisualCapabilities;
8125 const scatterChartProps: {
8126 general: {
8127 formatString: DataViewObjectPropertyIdentifier;
8128 };
8129 dataPoint: {
8130 defaultColor: DataViewObjectPropertyIdentifier;
8131 fill: DataViewObjectPropertyIdentifier;
8132 };
8133 trend: {
8134 show: DataViewObjectPropertyIdentifier;
8135 };
8136 colorBorder: {
8137 show: DataViewObjectPropertyIdentifier;
8138 };
8139 fillPoint: {
8140 show: DataViewObjectPropertyIdentifier;
8141 };
8142 colorByCategory: {
8143 show: DataViewObjectPropertyIdentifier;
8144 };
8145 currentFrameIndex: {
8146 index: DataViewObjectPropertyIdentifier;
8147 };
8148 legend: {
8149 labelColor: DataViewObjectPropertyIdentifier;
8150 };
8151 plotArea: {
8152 image: DataViewObjectPropertyIdentifier;
8153 transparency: DataViewObjectPropertyIdentifier;
8154 };
8155 };
8156}
8157declare module powerbi.visuals {
8158 const slicerCapabilities: VisualCapabilities;
8159 const slicerProps: {
8160 general: {
8161 outlineColor: DataViewObjectPropertyIdentifier;
8162 outlineWeight: DataViewObjectPropertyIdentifier;
8163 orientation: DataViewObjectPropertyIdentifier;
8164 count: DataViewObjectPropertyIdentifier;
8165 };
8166 selection: {
8167 selectAllCheckboxEnabled: DataViewObjectPropertyIdentifier;
8168 singleSelect: DataViewObjectPropertyIdentifier;
8169 };
8170 header: {
8171 show: DataViewObjectPropertyIdentifier;
8172 fontColor: DataViewObjectPropertyIdentifier;
8173 background: DataViewObjectPropertyIdentifier;
8174 outline: DataViewObjectPropertyIdentifier;
8175 textSize: DataViewObjectPropertyIdentifier;
8176 };
8177 items: {
8178 fontColor: DataViewObjectPropertyIdentifier;
8179 background: DataViewObjectPropertyIdentifier;
8180 outline: DataViewObjectPropertyIdentifier;
8181 textSize: DataViewObjectPropertyIdentifier;
8182 };
8183 selectedPropertyIdentifier: DataViewObjectPropertyIdentifier;
8184 filterPropertyIdentifier: DataViewObjectPropertyIdentifier;
8185 formatString: DataViewObjectPropertyIdentifier;
8186 defaultValue: DataViewObjectPropertyIdentifier;
8187 };
8188}
8189declare module powerbi.visuals {
8190 const tableCapabilities: VisualCapabilities;
8191}
8192declare module powerbi.visuals {
8193 const matrixRoleNames: {
8194 rows: string;
8195 columns: string;
8196 values: string;
8197 };
8198 const matrixCapabilities: VisualCapabilities;
8199}
8200declare module powerbi.visuals {
8201 const treemapCapabilities: VisualCapabilities;
8202 const treemapProps: {
8203 general: {
8204 formatString: DataViewObjectPropertyIdentifier;
8205 };
8206 dataPoint: {
8207 fill: DataViewObjectPropertyIdentifier;
8208 };
8209 legend: {
8210 show: DataViewObjectPropertyIdentifier;
8211 position: DataViewObjectPropertyIdentifier;
8212 showTitle: DataViewObjectPropertyIdentifier;
8213 titleText: DataViewObjectPropertyIdentifier;
8214 labelColor: DataViewObjectPropertyIdentifier;
8215 };
8216 labels: {
8217 show: DataViewObjectPropertyIdentifier;
8218 color: DataViewObjectPropertyIdentifier;
8219 labelDisplayUnits: DataViewObjectPropertyIdentifier;
8220 labelPrecision: DataViewObjectPropertyIdentifier;
8221 };
8222 categoryLabels: {
8223 show: DataViewObjectPropertyIdentifier;
8224 };
8225 };
8226}
8227declare module powerbi.visuals {
8228 const cardCapabilities: VisualCapabilities;
8229 var cardProps: {
8230 categoryLabels: {
8231 show: DataViewObjectPropertyIdentifier;
8232 color: DataViewObjectPropertyIdentifier;
8233 fontSize: DataViewObjectPropertyIdentifier;
8234 };
8235 labels: {
8236 color: DataViewObjectPropertyIdentifier;
8237 labelPrecision: DataViewObjectPropertyIdentifier;
8238 labelDisplayUnits: DataViewObjectPropertyIdentifier;
8239 fontSize: DataViewObjectPropertyIdentifier;
8240 };
8241 wordWrap: {
8242 show: DataViewObjectPropertyIdentifier;
8243 };
8244 };
8245}
8246declare module powerbi.visuals {
8247 const waterfallChartCapabilities: VisualCapabilities;
8248 const waterfallChartProps: {
8249 general: {
8250 formatString: DataViewObjectPropertyIdentifier;
8251 };
8252 sentimentColors: {
8253 increaseFill: DataViewObjectPropertyIdentifier;
8254 decreaseFill: DataViewObjectPropertyIdentifier;
8255 totalFill: DataViewObjectPropertyIdentifier;
8256 };
8257 legend: {
8258 labelColor: DataViewObjectPropertyIdentifier;
8259 };
8260 };
8261}
8262declare module powerbi.visuals {
8263 const KPIStatusWithHistoryCapabilities: VisualCapabilities;
8264}
8265declare module powerbi.visuals.capabilities {
8266 let animatedNumber: VisualCapabilities;
8267 let areaChart: VisualCapabilities;
8268 let barChart: VisualCapabilities;
8269 let card: VisualCapabilities;
8270 let multiRowCard: VisualCapabilities;
8271 let clusteredBarChart: VisualCapabilities;
8272 let clusteredColumnChart: VisualCapabilities;
8273 let columnChart: VisualCapabilities;
8274 let comboChart: VisualCapabilities;
8275 let dataDotChart: VisualCapabilities;
8276 let dataDotClusteredColumnComboChart: VisualCapabilities;
8277 let dataDotStackedColumnComboChart: VisualCapabilities;
8278 let donutChart: VisualCapabilities;
8279 let funnel: VisualCapabilities;
8280 let gauge: VisualCapabilities;
8281 let hundredPercentStackedBarChart: VisualCapabilities;
8282 let hundredPercentStackedColumnChart: VisualCapabilities;
8283 let image: VisualCapabilities;
8284 let lineChart: VisualCapabilities;
8285 let lineStackedColumnComboChart: VisualCapabilities;
8286 let lineClusteredColumnComboChart: VisualCapabilities;
8287 let map: VisualCapabilities;
8288 let filledMap: VisualCapabilities;
8289 let treemap: VisualCapabilities;
8290 let pieChart: VisualCapabilities;
8291 let scatterChart: VisualCapabilities;
8292 let table: VisualCapabilities;
8293 let matrix: VisualCapabilities;
8294 let slicer: VisualCapabilities;
8295 let textbox: VisualCapabilities;
8296 let waterfallChart: VisualCapabilities;
8297 let cheerMeter: VisualCapabilities;
8298 let scriptVisual: VisualCapabilities;
8299 let kpi: VisualCapabilities;
8300}
8301declare module powerbi.visuals {
8302 interface ColumnBehaviorOptions {
8303 datapoints: SelectableDataPoint[];
8304 bars: D3.Selection;
8305 eventGroup: D3.Selection;
8306 mainGraphicsContext: D3.Selection;
8307 hasHighlights: boolean;
8308 viewport: IViewport;
8309 axisOptions: ColumnAxisOptions;
8310 showLabel: boolean;
8311 }
8312 class ColumnChartWebBehavior implements IInteractiveBehavior {
8313 private options;
8314 bindEvents(options: ColumnBehaviorOptions, selectionHandler: ISelectionHandler): void;
8315 renderSelection(hasSelection: boolean): void;
8316 private static getDatumForLastInputEvent();
8317 }
8318}
8319declare module powerbi.visuals {
8320 interface DataDotChartBehaviorOptions {
8321 dots: D3.Selection;
8322 dotLabels: D3.Selection;
8323 isPartOfCombo?: boolean;
8324 datapoints?: DataDotChartDataPoint[];
8325 }
8326 class DataDotChartWebBehavior implements IInteractiveBehavior {
8327 private dots;
8328 bindEvents(options: DataDotChartBehaviorOptions, selectionHandler: ISelectionHandler): void;
8329 renderSelection(hasSelection: boolean): void;
8330 }
8331}
8332declare module powerbi.visuals {
8333 interface DonutBehaviorOptions {
8334 slices: D3.Selection;
8335 highlightSlices: D3.Selection;
8336 clearCatcher: D3.Selection;
8337 hasHighlights: boolean;
8338 allowDrilldown: boolean;
8339 visual: IVisual;
8340 }
8341 class DonutChartWebBehavior implements IInteractiveBehavior {
8342 private slices;
8343 private highlightSlices;
8344 private hasHighlights;
8345 bindEvents(options: DonutBehaviorOptions, selectionHandler: ISelectionHandler): void;
8346 renderSelection(hasSelection: boolean): void;
8347 }
8348}
8349declare module powerbi.visuals {
8350 interface FunnelBehaviorOptions {
8351 bars: D3.Selection;
8352 interactors: D3.Selection;
8353 clearCatcher: D3.Selection;
8354 hasHighlights: boolean;
8355 }
8356 class FunnelWebBehavior implements IInteractiveBehavior {
8357 private bars;
8358 private interactors;
8359 private hasHighlights;
8360 bindEvents(options: FunnelBehaviorOptions, selectionHandler: ISelectionHandler): void;
8361 renderSelection(hasSelection: boolean): void;
8362 }
8363}
8364declare module powerbi.visuals {
8365 interface PlayBehaviorOptions {
8366 traceLineRenderer?: ITraceLineRenderer;
8367 }
8368}
8369declare module powerbi.visuals {
8370 interface LineChartBehaviorOptions {
8371 lines: D3.Selection;
8372 interactivityLines: D3.Selection;
8373 dots: D3.Selection;
8374 areas: D3.Selection;
8375 isPartOfCombo?: boolean;
8376 tooltipOverlay: D3.Selection;
8377 }
8378 class LineChartWebBehavior implements IInteractiveBehavior {
8379 private lines;
8380 private dots;
8381 private areas;
8382 private tooltipOverlay;
8383 bindEvents(options: LineChartBehaviorOptions, selectionHandler: ISelectionHandler): void;
8384 renderSelection(hasSelection: boolean): void;
8385 }
8386}
8387declare module powerbi.visuals {
8388 interface MapBehaviorOptions {
8389 dataPoints: SelectableDataPoint[];
8390 bubbles?: D3.Selection;
8391 slices?: D3.Selection;
8392 shapes?: D3.Selection;
8393 clearCatcher: D3.Selection;
8394 bubbleEventGroup?: D3.Selection;
8395 sliceEventGroup?: D3.Selection;
8396 shapeEventGroup?: D3.Selection;
8397 }
8398 class MapBehavior implements IInteractiveBehavior {
8399 private bubbles;
8400 private slices;
8401 private shapes;
8402 private mapPointerEventsDisabled;
8403 private mapPointerTimeoutSet;
8404 private viewChangedSinceLastClearMouseDown;
8405 private receivedZoomOrPanEvent;
8406 bindEvents(options: MapBehaviorOptions, selectionHandler: ISelectionHandler): void;
8407 renderSelection(hasSelection: boolean): void;
8408 viewChanged(): void;
8409 resetZoomPan(): void;
8410 hasReceivedZoomOrPanEvent(): boolean;
8411 }
8412}
8413declare module powerbi.visuals {
8414 interface ScatterBehaviorChartData {
8415 xCol: DataViewMetadataColumn;
8416 yCol: DataViewMetadataColumn;
8417 dataPoints: ScatterChartDataPoint[];
8418 legendData: LegendData;
8419 axesLabels: ChartAxesLabels;
8420 size?: DataViewMetadataColumn;
8421 sizeRange: NumberRange;
8422 fillPoint?: boolean;
8423 colorBorder?: boolean;
8424 }
8425 interface ScatterBehaviorOptions {
8426 dataPointsSelection: D3.Selection;
8427 eventGroup?: D3.Selection;
8428 data: ScatterBehaviorChartData;
8429 plotContext: D3.Selection;
8430 playOptions?: PlayBehaviorOptions;
8431 }
8432 interface ScatterMobileBehaviorOptions extends ScatterBehaviorOptions {
8433 host: ICartesianVisualHost;
8434 root: D3.Selection;
8435 background: D3.Selection;
8436 visualInitOptions: VisualInitOptions;
8437 xAxisProperties: IAxisProperties;
8438 yAxisProperties: IAxisProperties;
8439 }
8440 class ScatterChartWebBehavior implements IInteractiveBehavior {
8441 private bubbles;
8442 private shouldEnableFill;
8443 private colorBorder;
8444 private playOptions;
8445 bindEvents(options: ScatterBehaviorOptions, selectionHandler: ISelectionHandler): void;
8446 renderSelection(hasSelection: boolean): void;
8447 }
8448 const enum DragType {
8449 Drag = 0,
8450 DragEnd = 1,
8451 }
8452 class ScatterChartMobileBehavior implements IInteractiveBehavior {
8453 private static CrosshairClassName;
8454 private static ScatterChartCircleTagName;
8455 private static DotClassName;
8456 private static DotClassSelector;
8457 private static Horizontal;
8458 private static Vertical;
8459 private host;
8460 private mainGraphicsContext;
8461 private data;
8462 private crosshair;
8463 private crosshairHorizontal;
8464 private crosshairVertical;
8465 private lastDotIndex;
8466 private xAxisProperties;
8467 private yAxisProperties;
8468 bindEvents(options: ScatterMobileBehaviorOptions, selectionHandler: ISelectionHandler): void;
8469 renderSelection(HasSelection: boolean): void;
8470 setSelectionHandler(selectionHandler: ISelectionHandler): void;
8471 private makeDataPointsSelectable(...selection);
8472 private makeRootSelectable(selection);
8473 private makeDragable(...selection);
8474 private disableDefaultTouchInteractions(selection);
8475 setOptions(options: ScatterMobileBehaviorOptions): void;
8476 private select(index);
8477 selectRoot(): void;
8478 drag(t: DragType): void;
8479 private onDrag();
8480 private onClick();
8481 private getMouseCoordinates();
8482 private selectDotByIndex(index);
8483 private selectDot(dotIndex);
8484 private moveCrosshairToIndexDot(index);
8485 private moveCrosshairToXY(x, y);
8486 private drawCrosshair(addTo, x, y, width, height);
8487 private findClosestDotIndex(x, y);
8488 private updateLegend(dotIndex);
8489 private createLegendDataPoints(dotIndex);
8490 }
8491}
8492declare module powerbi.visuals {
8493 interface HorizontalSlicerBehaviorOptions extends SlicerBehaviorOptions {
8494 itemsContainer: D3.Selection;
8495 }
8496 class HorizontalSlicerWebBehavior implements IInteractiveBehavior {
8497 private itemLabels;
8498 private dataPoints;
8499 private interactivityService;
8500 private slicerSettings;
8501 bindEvents(options: HorizontalSlicerBehaviorOptions, selectionHandler: ISelectionHandler): void;
8502 renderSelection(hasSelection: boolean): void;
8503 }
8504}
8505declare module powerbi.visuals {
8506 interface VerticalSlicerBehaviorOptions extends SlicerBehaviorOptions {
8507 itemContainers: D3.Selection;
8508 itemInputs: D3.Selection;
8509 }
8510 class VerticalSlicerWebBehavior implements IInteractiveBehavior {
8511 private itemLabels;
8512 private itemInputs;
8513 private dataPoints;
8514 private interactivityService;
8515 private settings;
8516 bindEvents(options: VerticalSlicerBehaviorOptions, selectionHandler: ISelectionHandler): void;
8517 renderSelection(hasSelection: boolean): void;
8518 }
8519}
8520declare module powerbi.visuals {
8521 interface SlicerOrientationBehaviorOptions {
8522 behaviorOptions: SlicerBehaviorOptions;
8523 orientation: slicerOrientation.Orientation;
8524 }
8525 interface SlicerBehaviorOptions {
8526 slicerContainer: D3.Selection;
8527 itemLabels: D3.Selection;
8528 clear: D3.Selection;
8529 dataPoints: SlicerDataPoint[];
8530 interactivityService: IInteractivityService;
8531 settings: SlicerSettings;
8532 }
8533 class SlicerWebBehavior implements IInteractiveBehavior {
8534 private behavior;
8535 private static isTouch;
8536 bindEvents(options: SlicerOrientationBehaviorOptions, selectionHandler: ISelectionHandler): void;
8537 renderSelection(hasSelection: boolean): void;
8538 static bindSlicerEvents(slicerContainer: D3.Selection, slicers: D3.Selection, slicerClear: D3.Selection, selectionHandler: ISelectionHandler, slicerSettings: SlicerSettings, interactivityService: IInteractivityService): void;
8539 static setSelectionOnSlicerItems(selectableItems: D3.Selection, itemLabel: D3.Selection, hasSelection: boolean, interactivityService: IInteractivityService, slicerSettings: SlicerSettings): void;
8540 static styleSlicerItems(slicerItems: D3.Selection, hasSelection: boolean, isSelectionInverted: boolean): void;
8541 private static bindSlicerItemSelectionEvent(slicers, selectionHandler, slicerSettings, interactivityService);
8542 private static bindSlicerClearEvent(slicerClear, selectionHandler);
8543 private static styleSlicerContainer(slicerContainer, interactivityService);
8544 private static isMultiSelect(event, settings, interactivityService);
8545 private createWebBehavior(options);
8546 }
8547}
8548declare module powerbi.visuals {
8549 interface LegendBehaviorOptions {
8550 legendItems: D3.Selection;
8551 legendIcons: D3.Selection;
8552 clearCatcher: D3.Selection;
8553 }
8554 class LegendBehavior implements IInteractiveBehavior {
8555 static dimmedLegendColor: string;
8556 private legendIcons;
8557 bindEvents(options: LegendBehaviorOptions, selectionHandler: ISelectionHandler): void;
8558 renderSelection(hasSelection: boolean): void;
8559 }
8560}
8561declare module powerbi.visuals {
8562 interface TreemapBehaviorOptions {
8563 shapes: D3.Selection;
8564 highlightShapes: D3.Selection;
8565 majorLabels: D3.Selection;
8566 minorLabels: D3.Selection;
8567 nodes: TreemapNode[];
8568 hasHighlights: boolean;
8569 }
8570 class TreemapWebBehavior implements IInteractiveBehavior {
8571 private shapes;
8572 private highlightShapes;
8573 private hasHighlights;
8574 bindEvents(options: TreemapBehaviorOptions, selectionHandler: ISelectionHandler): void;
8575 renderSelection(hasSelection: boolean): void;
8576 }
8577}
8578declare module powerbi.visuals {
8579 interface WaterfallChartBehaviorOptions {
8580 bars: D3.Selection;
8581 }
8582 class WaterfallChartWebBehavior {
8583 private bars;
8584 bindEvents(options: WaterfallChartBehaviorOptions, selectionHandler: ISelectionHandler): void;
8585 renderSelection(hasSelection: boolean): void;
8586 }
8587}
8588declare module powerbi.visuals {
8589 interface LabelsBehaviorOptions {
8590 labelItems: D3.Selection;
8591 }
8592 class LabelsBehavior implements IInteractiveBehavior {
8593 static DefaultLabelOpacity: number;
8594 static DimmedLabelOpacity: number;
8595 private labelItems;
8596 bindEvents(options: LabelsBehaviorOptions, selectionHandler: ISelectionHandler): void;
8597 renderSelection(hasSelection: boolean): void;
8598 }
8599}
8600declare module powerbi.visuals {
8601 interface CartesianBehaviorOptions {
8602 layerOptions: any[];
8603 clearCatcher: D3.Selection;
8604 }
8605 class CartesianChartBehavior implements IInteractiveBehavior {
8606 private behaviors;
8607 constructor(behaviors: IInteractiveBehavior[]);
8608 bindEvents(options: CartesianBehaviorOptions, selectionHandler: ISelectionHandler): void;
8609 renderSelection(hasSelection: boolean): void;
8610 }
8611}
8612declare module powerbi.visuals {
8613 interface VisualConfig {
8614 visualType: string;
8615 projections: data.QueryProjectionsByRole[];
8616 /**
8617 * This is the one that has info like Total, Combochart viz types, legend settings, etc...
8618 * Each IVisual implementation, should simply cast this to whatever object they expect.
8619 */
8620 config?: any;
8621 }
8622}
8623declare module powerbi.visuals {
8624 import ITextAsSVGMeasurer = powerbi.ITextAsSVGMeasurer;
8625 /**
8626 * Default ranges are for when we have a field chosen for the axis,
8627 * but no values are returned by the query.
8628 */
8629 const emptyDomain: number[];
8630 interface IAxisProperties {
8631 /**
8632 * The D3 Scale object.
8633 */
8634 scale: D3.Scale.GenericScale<any>;
8635 /**
8636 * The D3 Axis object.
8637 */
8638 axis: D3.Svg.Axis;
8639 /**
8640 * An array of the tick values to display for this axis.
8641 */
8642 values: any[];
8643 /**
8644 * The ValueType of the column used for this axis.
8645 */
8646 axisType: ValueType;
8647 /**
8648 * A formatter with appropriate properties configured for this field.
8649 */
8650 formatter: IValueFormatter;
8651 /**
8652 * The axis title label.
8653 */
8654 axisLabel: string;
8655 /**
8656 * Cartesian axes are either a category or value axis.
8657 */
8658 isCategoryAxis: boolean;
8659 /**
8660 * (optional) The max width for category tick label values. used for ellipsis truncation / label rotation.
8661 */
8662 xLabelMaxWidth?: number;
8663 /**
8664 * (optional) The thickness of each category on the axis.
8665 */
8666 categoryThickness?: number;
8667 /**
8668 * (optional) The outer padding in pixels applied to the D3 scale.
8669 */
8670 outerPadding?: number;
8671 /**
8672 * (optional) Whether we are using a default domain.
8673 */
8674 usingDefaultDomain?: boolean;
8675 /**
8676 * (optional) do default d3 axis labels fit?
8677 */
8678 willLabelsFit?: boolean;
8679 /**
8680 * (optional) word break axis labels
8681 */
8682 willLabelsWordBreak?: boolean;
8683 /**
8684 * (optional) Whether log scale is possible on the current domain.
8685 */
8686 isLogScaleAllowed?: boolean;
8687 /**
8688 * (optional) Whether domain contains zero value and log scale is enabled.
8689 */
8690 hasDisallowedZeroInDomain?: boolean;
8691 /**
8692 *(optional) The original data domain. Linear scales use .nice() to round to cleaner edge values. Keep the original data domain for later.
8693 */
8694 dataDomain?: number[];
8695 /**
8696 * (optional) The D3 graphics context for this axis
8697 */
8698 graphicsContext?: D3.Selection;
8699 }
8700 interface IMargin {
8701 top: number;
8702 bottom: number;
8703 left: number;
8704 right: number;
8705 }
8706 interface CreateAxisOptions {
8707 /**
8708 * The dimension length for the axis, in pixels.
8709 */
8710 pixelSpan: number;
8711 /**
8712 * The data domain. [min, max] for a scalar axis, or [1...n] index array for ordinal.
8713 */
8714 dataDomain: number[];
8715 /**
8716 * The DataViewMetadataColumn will be used for dataType and tick value formatting.
8717 */
8718 metaDataColumn: DataViewMetadataColumn;
8719 /**
8720 * The format string.
8721 */
8722 formatString: string;
8723 /**
8724 * outerPadding to be applied to the axis.
8725 */
8726 outerPadding: number;
8727 /**
8728 * Indicates if this is the category axis.
8729 */
8730 isCategoryAxis?: boolean;
8731 /**
8732 * If true and the dataType is numeric or dateTime,
8733 * create a linear axis, else create an ordinal axis.
8734 */
8735 isScalar?: boolean;
8736 /**
8737 * (optional) The scale is inverted for a vertical axis,
8738 * and different optimizations are made for tick labels.
8739 */
8740 isVertical?: boolean;
8741 /**
8742 * (optional) For visuals that do not need zero (e.g. column/bar) use tickInterval.
8743 */
8744 useTickIntervalForDisplayUnits?: boolean;
8745 /**
8746 * (optional) Combo charts can override the tick count to
8747 * align y1 and y2 grid lines.
8748 */
8749 forcedTickCount?: number;
8750 /**
8751 * (optional) Callback for looking up actual values from indices,
8752 * used when formatting tick labels.
8753 */
8754 getValueFn?: (index: number, type: ValueType) => any;
8755 /**
8756 * (optional) The width/height of each category on the axis.
8757 */
8758 categoryThickness?: number;
8759 /** (optional) the scale type of the axis. e.g. log, linear */
8760 scaleType?: string;
8761 /** (optional) user selected display units */
8762 axisDisplayUnits?: number;
8763 /** (optional) user selected precision */
8764 axisPrecision?: number;
8765 /** (optional) for 100 percent stacked charts, causes formatString override and minTickInterval adjustments */
8766 is100Pct?: boolean;
8767 /** (optional) sets clamping on the D3 scale, useful for drawing column chart rectangles as it simplifies the math during layout */
8768 shouldClamp?: boolean;
8769 }
8770 interface CreateScaleResult {
8771 scale: D3.Scale.GenericScale<any>;
8772 bestTickCount: number;
8773 usingDefaultDomain?: boolean;
8774 }
8775 interface TickLabelMargins {
8776 xMax: number;
8777 yLeft: number;
8778 yRight: number;
8779 }
8780 module AxisHelper {
8781 function getRecommendedNumberOfTicksForXAxis(availableWidth: number): number;
8782 function getRecommendedNumberOfTicksForYAxis(availableWidth: number): number;
8783 /**
8784 * Get the best number of ticks based on minimum value, maximum value,
8785 * measure metadata and max tick count.
8786 *
8787 * @param min The minimum of the data domain.
8788 * @param max The maximum of the data domain.
8789 * @param valuesMetadata The measure metadata array.
8790 * @param maxTickCount The max count of intervals.
8791 * @param isDateTime - flag to show single tick when min is equal to max.
8792 */
8793 function getBestNumberOfTicks(min: number, max: number, valuesMetadata: DataViewMetadataColumn[], maxTickCount: number, isDateTime?: boolean): number;
8794 function hasNonIntegerData(valuesMetadata: DataViewMetadataColumn[]): boolean;
8795 function getRecommendedTickValues(maxTicks: number, scale: D3.Scale.GenericScale<any>, axisType: ValueType, isScalar: boolean, minTickInterval?: number): any[];
8796 function getRecommendedTickValuesForAnOrdinalRange(maxTicks: number, labels: string[]): string[];
8797 function getRecommendedTickValuesForAQuantitativeRange(maxTicks: number, scale: D3.Scale.GenericScale<any>, minInterval?: number): number[];
8798 function getMargin(availableWidth: number, availableHeight: number, xMargin: number, yMargin: number): IMargin;
8799 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;
8800 function columnDataTypeHasValue(dataType: ValueTypeDescriptor): boolean;
8801 function createOrdinalType(): ValueType;
8802 function isOrdinal(type: ValueTypeDescriptor): boolean;
8803 function isOrdinalScale(scale: any): boolean;
8804 function isDateTime(type: ValueTypeDescriptor): boolean;
8805 function invertScale(scale: any, x: any): any;
8806 function extent(scale: any): number[];
8807 function invertOrdinalScale(scale: D3.Scale.OrdinalScale, x: number): any;
8808 function findClosestXAxisIndex(categoryValue: number, categoryAxisValues: CartesianDataPoint[]): number;
8809 function lookupOrdinalIndex(scale: D3.Scale.OrdinalScale, pixelValue: number): number;
8810 /** scale(value1) - scale(value2) with zero checking and min(+/-1, result) */
8811 function diffScaled(scale: D3.Scale.GenericScale<any>, value1: any, value2: any): number;
8812 function createDomain(data: CartesianSeries[], axisType: ValueTypeDescriptor, isScalar: boolean, forcedScalarDomain: any[], ensureDomain?: NumberRange): number[];
8813 function ensureValuesInRange(values: number[], min: number, max: number): number[];
8814 /**
8815 * Gets the ValueType of a category column, defaults to Text if the type is not present.
8816 */
8817 function getCategoryValueType(metadataColumn: DataViewMetadataColumn, isScalar?: boolean): ValueType;
8818 /**
8819 * Create a D3 axis including scale. Can be vertical or horizontal, and either datetime, numeric, or text.
8820 * @param options The properties used to create the axis.
8821 */
8822 function createAxis(options: CreateAxisOptions): IAxisProperties;
8823 function createScale(options: CreateAxisOptions): CreateScaleResult;
8824 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;
8825 function getMinTickValueInterval(formatString: string, columnType: ValueType, is100Pct?: boolean): number;
8826 /**
8827 * Creates a [min,max] from your Cartiesian data values.
8828 *
8829 * @param data The series array of CartesianDataPoints.
8830 * @param includeZero Columns and bars includeZero, line and scatter do not.
8831 */
8832 function createValueDomain(data: CartesianSeries[], includeZero: boolean): number[];
8833 module LabelLayoutStrategy {
8834 function willLabelsFit(axisProperties: IAxisProperties, availableWidth: number, textMeasurer: ITextAsSVGMeasurer, properties: TextProperties): boolean;
8835 function willLabelsWordBreak(axisProperties: IAxisProperties, margin: IMargin, availableWidth: number, textWidthMeasurer: ITextAsSVGMeasurer, textHeightMeasurer: ITextAsSVGMeasurer, textTruncator: (properties: TextProperties, maxWidth: number) => string, properties: TextProperties): boolean;
8836 const DefaultRotation: {
8837 sine: number;
8838 cosine: number;
8839 tangent: number;
8840 transform: string;
8841 dy: string;
8842 };
8843 const DefaultRotationWithScrollbar: {
8844 sine: number;
8845 cosine: number;
8846 tangent: number;
8847 transform: string;
8848 dy: string;
8849 };
8850 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;
8851 function wordBreak(text: D3.Selection, axisProperties: IAxisProperties, maxHeight: number): void;
8852 function clip(text: D3.Selection, availableWidth: number, svgEllipsis: (textElement: SVGTextElement, maxWidth: number) => void): void;
8853 }
8854 function createOrdinalScale(pixelSpan: number, dataDomain: any[], outerPaddingRatio?: number): D3.Scale.OrdinalScale;
8855 function isLogScalePossible(domain: any[], axisType?: ValueType): boolean;
8856 function createNumericalScale(axisScaleType: string, pixelSpan: number, dataDomain: any[], dataType: ValueType, outerPadding?: number, niceCount?: number, shouldClamp?: boolean): D3.Scale.GenericScale<any>;
8857 function createLinearScale(pixelSpan: number, dataDomain: any[], outerPadding?: number, niceCount?: number, shouldClamp?: boolean): D3.Scale.LinearScale;
8858 function getRangeForColumn(sizeColumn: DataViewValueColumn): NumberRange;
8859 /**
8860 * Set customized domain, but don't change when nothing is set
8861 */
8862 function applyCustomizedDomain(customizedDomain: any, forcedDomain: any[]): any[];
8863 /**
8864 * Combine the forced domain with the actual domain if one of the values was set.
8865 * The forcedDomain is in 1st priority. Extends the domain if the any reference point requires it.
8866 */
8867 function combineDomain(forcedDomain: any[], domain: any[], ensureDomain?: NumberRange): any[];
8868 function createAxisLabel(properties: DataViewObject, label: string, unitType: string, y2?: boolean): string;
8869 function scaleShouldClamp(combinedDomain: any[], domain: any[]): boolean;
8870 function normalizeNonFiniteNumber(value: number): number;
8871 /**
8872 * Indicates whether the number is power of 10.
8873 */
8874 function powerOfTen(d: any): boolean;
8875 }
8876}
8877declare module powerbi.visuals {
8878 module ShapeFactory {
8879 module ShapeFactoryConsts {
8880 const PaddingConstRatio: number;
8881 const TrianglePaddingConstRatio: number;
8882 const TriangleEndPaddingConstRatio: number;
8883 const ShapeConstRatio: number;
8884 const SmallPaddingConstValue: number;
8885 const OvalRadiusConst: number;
8886 const OvalRadiusConstPadding: number;
8887 const ArrowLeftHeadPoint: Point;
8888 const ArrowMiddleHeadPoint: Point;
8889 const ArrowRightHeadPoint: Point;
8890 const ArrowRightMiddleHeadPoint: Point;
8891 const ArrowBottomRightPoint: Point;
8892 const ArrowBottomLeftPoint: Point;
8893 const ArrowLeftMiddleHeadPoint: Point;
8894 }
8895 /** this function creates a rectangle svg */
8896 function createRectangle(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
8897 /** this function creates a oval svg */
8898 function createOval(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
8899 /** this function creates a line svg */
8900 function createLine(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
8901 /** this function creates a arrow svg */
8902 function createUpArrow(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
8903 /** this function creates a triangle svg */
8904 function createTriangle(data: BasicShapeData, viewportHeight: number, viewportWidth: number, selectedElement: D3.Selection, degrees: number): void;
8905 }
8906}
8907declare module powerbi.visuals {
8908 module CartesianHelper {
8909 function getCategoryAxisProperties(dataViewMetadata: DataViewMetadata, axisTitleOnByDefault?: boolean): DataViewObject;
8910 function getValueAxisProperties(dataViewMetadata: DataViewMetadata, axisTitleOnByDefault?: boolean): DataViewObject;
8911 function isScalar(isScalar: boolean, xAxisCardProperties: DataViewObject): boolean;
8912 function getPrecision(precision: DataViewPropertyValue): number;
8913 function lookupXValue(data: CartesianData, index: number, type: ValueType, isScalar: boolean): any;
8914 function findMaxCategoryIndex(series: CartesianSeries[]): number;
8915 }
8916}
8917declare module powerbi.visuals {
8918 class ColorHelper {
8919 private fillProp;
8920 private defaultDataPointColor;
8921 private colors;
8922 private defaultColorScale;
8923 constructor(colors: IDataColorPalette, fillProp?: DataViewObjectPropertyIdentifier, defaultDataPointColor?: string);
8924 /**
8925 * Gets the color for the given series value.
8926 * If no explicit color or default color has been set then the color is
8927 * allocated from the color scale for this series.
8928 */
8929 getColorForSeriesValue(objects: DataViewObjects, fieldIds: powerbi.data.ISQExpr[], value: string): string;
8930 /**
8931 * Gets the color scale for the given series.
8932 */
8933 getColorScaleForSeries(fieldIds: powerbi.data.ISQExpr[]): IColorScale;
8934 /**
8935 * Gets the color for the given measure.
8936 */
8937 getColorForMeasure(objects: DataViewObjects, measureKey: any): string;
8938 static normalizeSelector(selector: data.Selector, isSingleSeries?: boolean): data.Selector;
8939 }
8940}
8941declare module powerbi.visuals {
8942 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
8943 module ColumnUtil {
8944 const DimmedOpacity: number;
8945 const DefaultOpacity: number;
8946 function applyUserMinMax(isScalar: boolean, dataView: DataViewCategorical, xAxisCardProperties: DataViewObject): DataViewCategorical;
8947 function transformDomain(dataView: DataViewCategorical, min: DataViewPropertyValue, max: DataViewPropertyValue): DataViewCategorical;
8948 function getCategoryAxis(data: ColumnChartData, size: number, layout: CategoryLayout, isVertical: boolean, forcedXMin?: DataViewPropertyValue, forcedXMax?: DataViewPropertyValue, axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
8949 function applyInteractivity(columns: D3.Selection, onDragStart: any): void;
8950 function getFillOpacity(selected: boolean, highlight: boolean, hasSelection: boolean, hasPartialHighlights: boolean): number;
8951 function getClosestColumnIndex(coordinate: number, columnsCenters: number[]): number;
8952 function setChosenColumnOpacity(mainGraphicsContext: D3.Selection, columnGroupSelector: string, selectedColumnIndex: number, lastColumnIndex: number): void;
8953 function drawSeries(data: ColumnChartData, graphicsContext: D3.Selection, axisOptions: ColumnAxisOptions): D3.UpdateSelection;
8954 function drawDefaultShapes(data: ColumnChartData, series: D3.UpdateSelection, layout: IColumnLayout, itemCS: ClassAndSelector, filterZeros: boolean, hasSelection: boolean): D3.UpdateSelection;
8955 function drawDefaultLabels(series: D3.UpdateSelection, context: D3.Selection, layout: ILabelLayout, viewPort: IViewport, isAnimator?: boolean, animationDuration?: number): D3.UpdateSelection;
8956 function normalizeInfinityInScale(scale: D3.Scale.GenericScale<any>): void;
8957 function calculatePosition(d: ColumnChartDataPoint, axisOptions: ColumnAxisOptions): number;
8958 }
8959 module ClusteredUtil {
8960 function clearColumns(mainGraphicsContext: D3.Selection, itemCS: ClassAndSelector): void;
8961 }
8962 interface ValueMultiplers {
8963 pos: number;
8964 neg: number;
8965 }
8966 module StackedUtil {
8967 function getSize(scale: D3.Scale.GenericScale<any>, size: number, zeroVal?: number): number;
8968 function calcValueDomain(data: ColumnChartSeries[], is100pct: boolean): NumberRange;
8969 function getStackedMultiplier(dataView: DataViewCategorical, rowIdx: number, seriesCount: number, categoryCount: number, converterStrategy: IColumnChartConverterStrategy): ValueMultiplers;
8970 function clearColumns(mainGraphicsContext: D3.Selection, itemCS: ClassAndSelector): void;
8971 }
8972}
8973declare module powerbi.visuals {
8974 interface PivotedCategoryInfo {
8975 categories?: any[];
8976 categoryFormatter?: IValueFormatter;
8977 categoryIdentities?: DataViewScopeIdentity[];
8978 categoryObjects?: DataViewObjects[];
8979 }
8980 module converterHelper {
8981 function categoryIsAlsoSeriesRole(dataView: DataViewCategorical, seriesRoleName: string, categoryRoleName: string): boolean;
8982 function getPivotedCategories(dataView: DataViewCategorical, formatStringProp: DataViewObjectPropertyIdentifier): PivotedCategoryInfo;
8983 function getSeriesName(source: DataViewMetadataColumn): string;
8984 function getFormattedLegendLabel(source: DataViewMetadataColumn, values: DataViewValueColumns, formatStringProp: DataViewObjectPropertyIdentifier): string;
8985 function createAxesLabels(categoryAxisProperties: DataViewObject, valueAxisProperties: DataViewObject, category: DataViewMetadataColumn, values: DataViewMetadataColumn[]): {
8986 xAxisLabel: any;
8987 yAxisLabel: any;
8988 };
8989 function isImageUrlColumn(column: DataViewMetadataColumn): boolean;
8990 function isWebUrlColumn(column: DataViewMetadataColumn): boolean;
8991 function hasImageUrlColumn(dataView: DataView): boolean;
8992 function formatFromMetadataColumn(value: any, column: DataViewMetadataColumn, formatStringProp: DataViewObjectPropertyIdentifier): string;
8993 }
8994}
8995declare module powerbi.visuals {
8996 const enum PointLabelPosition {
8997 Above = 0,
8998 Below = 1,
8999 }
9000 interface PointDataLabelsSettings extends VisualDataLabelsSettings {
9001 position: PointLabelPosition;
9002 }
9003 interface LabelFormattedTextOptions {
9004 label: any;
9005 maxWidth?: number;
9006 format?: string;
9007 formatter?: IValueFormatter;
9008 fontSize?: number;
9009 }
9010 interface VisualDataLabelsSettings {
9011 show: boolean;
9012 showLabelPerSeries?: boolean;
9013 isSeriesExpanded?: boolean;
9014 displayUnits?: number;
9015 showCategory?: boolean;
9016 position?: any;
9017 precision?: number;
9018 labelColor: string;
9019 categoryLabelColor?: string;
9020 fontSize?: number;
9021 labelStyle?: any;
9022 }
9023 interface VisualDataLabelsSettingsOptions {
9024 show: boolean;
9025 enumeration: ObjectEnumerationBuilder;
9026 dataLabelsSettings: VisualDataLabelsSettings;
9027 displayUnits?: boolean;
9028 precision?: boolean;
9029 position?: boolean;
9030 positionObject?: string[];
9031 selector?: powerbi.data.Selector;
9032 fontSize?: boolean;
9033 showAll?: boolean;
9034 labelDensity?: boolean;
9035 labelStyle?: boolean;
9036 }
9037 interface LabelEnabledDataPoint {
9038 labelX?: number;
9039 labelY?: number;
9040 labelFill?: string;
9041 labeltext?: string;
9042 labelFormatString?: string;
9043 isLabelInside?: boolean;
9044 labelFontSize?: number;
9045 }
9046 interface IColumnFormatterCache {
9047 [column: string]: IValueFormatter;
9048 defaultFormatter?: IValueFormatter;
9049 }
9050 interface IColumnFormatterCacheManager {
9051 cache: IColumnFormatterCache;
9052 getOrCreate: (formatString: string, labelSetting: VisualDataLabelsSettings, value2?: number) => IValueFormatter;
9053 }
9054 interface LabelPosition {
9055 y: (d: any, i: number) => number;
9056 x: (d: any, i: number) => number;
9057 }
9058 interface ILabelLayout {
9059 labelText: (d: any) => string;
9060 labelLayout: LabelPosition;
9061 filter: (d: any) => boolean;
9062 style: {};
9063 }
9064 interface DataLabelObject extends DataViewObject {
9065 show: boolean;
9066 color: Fill;
9067 labelDisplayUnits: number;
9068 labelPrecision?: number;
9069 labelPosition: any;
9070 fontSize?: number;
9071 showAll?: boolean;
9072 showSeries?: boolean;
9073 labelDensity?: number;
9074 labelStyle?: any;
9075 }
9076 module dataLabelUtils {
9077 const minLabelFontSize: number;
9078 const labelMargin: number;
9079 const maxLabelWidth: number;
9080 const defaultColumnLabelMargin: number;
9081 const defaultColumnHalfLabelHeight: number;
9082 const DefaultDy: string;
9083 const DefaultFontSizeInPt: number;
9084 const StandardFontFamily: string;
9085 const LabelTextProperties: TextProperties;
9086 const defaultLabelColor: string;
9087 const defaultInsideLabelColor: string;
9088 const hundredPercentFormat: string;
9089 const defaultLabelPrecision: number;
9090 function updateLabelSettingsFromLabelsObject(labelsObj: DataLabelObject, labelSettings: VisualDataLabelsSettings): void;
9091 function updateLineChartLabelSettingsFromLabelsObject(labelsObj: DataLabelObject, labelSettings: LineChartDataLabelsSettings): void;
9092 function getDefaultLabelSettings(show?: boolean, labelColor?: string, fontSize?: number): VisualDataLabelsSettings;
9093 function getDefaultCardLabelSettings(labelColor: string, categoryLabelColor: string, fontSize?: number): VisualDataLabelsSettings;
9094 function getDefaultTreemapLabelSettings(): VisualDataLabelsSettings;
9095 function getDefaultSunburstLabelSettings(): VisualDataLabelsSettings;
9096 function getDefaultColumnLabelSettings(isLabelPositionInside: boolean): VisualDataLabelsSettings;
9097 function getDefaultPointLabelSettings(): PointDataLabelsSettings;
9098 function getDefaultLineChartLabelSettings(isComboChart?: boolean): LineChartDataLabelsSettings;
9099 function getDefaultMapLabelSettings(): PointDataLabelsSettings;
9100 function getDefaultDonutLabelSettings(): VisualDataLabelsSettings;
9101 function getDefaultGaugeLabelSettings(): VisualDataLabelsSettings;
9102 function getDefaultFunnelLabelSettings(): VisualDataLabelsSettings;
9103 function getDefaultKpiLabelSettings(): VisualDataLabelsSettings;
9104 function getLabelPrecision(precision: number, format: string): number;
9105 function drawDefaultLabelsForDataPointChart(data: any[], context: D3.Selection, layout: ILabelLayout, viewport: IViewport, isAnimator?: boolean, animationDuration?: number, hasSelection?: boolean): D3.UpdateSelection;
9106 /**
9107 * Note: Funnel chart uses animation and does not use collision detection.
9108 */
9109 function drawDefaultLabelsForFunnelChart(data: FunnelSlice[], context: D3.Selection, layout: ILabelLayout, isAnimator?: boolean, animationDuration?: number): D3.UpdateSelection;
9110 function cleanDataLabels(context: D3.Selection, removeLines?: boolean): void;
9111 function setHighlightedLabelsOpacity(context: D3.Selection, hasSelection: boolean, hasHighlights: boolean): void;
9112 function getLabelFormattedText(options: LabelFormattedTextOptions): string;
9113 function getLabelLayoutXYForWaterfall(xAxisProperties: IAxisProperties, categoryWidth: number, yAxisProperties: IAxisProperties, dataDomain: number[]): LabelPosition;
9114 function doesDataLabelFitInShape(d: WaterfallChartDataPoint, yAxisProperties: IAxisProperties, layout: WaterfallLayout): boolean;
9115 function getMapLabelLayout(labelSettings: PointDataLabelsSettings): ILabelLayout;
9116 function getColumnChartLabelLayout(data: ColumnChartData, labelLayoutXY: any, isColumn: boolean, isHundredPercent: boolean, axisFormatter: IValueFormatter, axisOptions: ColumnAxisOptions, interactivityService: IInteractivityService, visualWidth?: number): ILabelLayout;
9117 function getColumnChartLabelFilter(d: ColumnChartDataPoint, hasSelection: boolean, hasHighlights: boolean, axisOptions: ColumnAxisOptions, visualWidth?: number): any;
9118 function getScatterChartLabelLayout(xScale: D3.Scale.GenericScale<any>, yScale: D3.Scale.GenericScale<any>, labelSettings: PointDataLabelsSettings, viewport: IViewport, sizeRange: NumberRange): ILabelLayout;
9119 function getLineChartLabelLayout(xScale: D3.Scale.GenericScale<any>, yScale: D3.Scale.GenericScale<any>, labelSettings: PointDataLabelsSettings, isScalar: boolean, axisFormatter: IValueFormatter): ILabelLayout;
9120 function getFunnelChartLabelLayout(data: FunnelData, axisOptions: FunnelAxisOptions, textMinimumPadding: number, labelSettings: VisualDataLabelsSettings, currentViewport: IViewport): ILabelLayout;
9121 function enumerateDataLabels(options: VisualDataLabelsSettingsOptions): ObjectEnumerationBuilder;
9122 function enumerateCategoryLabels(enumeration: ObjectEnumerationBuilder, dataLabelsSettings: VisualDataLabelsSettings, withFill: boolean, isShowCategory?: boolean, fontSize?: number): void;
9123 function createColumnFormatterCacheManager(): IColumnFormatterCacheManager;
9124 function getOptionsForLabelFormatter(labelSetting: VisualDataLabelsSettings, formatString: string, value2?: number, precision?: number): ValueFormatterOptions;
9125 function isTextWidthOverflows(textWidth: any, maxTextWidth: any): boolean;
9126 function isTextHeightOverflows(textHeight: any, innerChordLength: any): boolean;
9127 }
9128}
9129declare module powerbi.visuals {
9130 import ISize = shapes.ISize;
9131 module DonutLabelUtils {
9132 const LineStrokeWidth: number;
9133 const DiagonalLineIndex: number;
9134 const HorizontalLineIndex: number;
9135 function getLabelLeaderLineForDonutChart(donutArcDescriptor: DonutArcDescriptor, donutProperties: DonutChartProperties, parentPoint: IPoint, sliceArc?: number): number[][];
9136 /** We calculate the rectangles of the leader lines for collision detection
9137 *width: x2 - x1; height: y2 - y1 */
9138 function getLabelLeaderLinesSizeForDonutChart(leaderLinePoints: number[][]): ISize[];
9139 function getXPositionForDonutLabel(textPointX: number): number;
9140 function getSpaceAvailableForDonutLabels(labelXPos: number, viewport: IViewport): number;
9141 }
9142}
9143declare module powerbi.visuals {
9144 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
9145 import ISize = shapes.ISize;
9146 module NewDataLabelUtils {
9147 const DefaultLabelFontSizeInPt: number;
9148 const MapPolylineOpacity: number;
9149 const LabelDensityBufferFactor: number;
9150 const LabelDensityPadding: number;
9151 const LabelDensityMin: number;
9152 const LabelDensityMax: number;
9153 let startingLabelOffset: number;
9154 let maxLabelOffset: number;
9155 let maxLabelWidth: number;
9156 let hundredPercentFormat: string;
9157 let LabelTextProperties: TextProperties;
9158 let defaultLabelColor: string;
9159 let defaultInsideLabelColor: string;
9160 const horizontalLabelBackgroundPadding: number;
9161 const verticalLabelBackgroundPadding: number;
9162 let labelGraphicsContextClass: ClassAndSelector;
9163 let labelBackgroundGraphicsContextClass: ClassAndSelector;
9164 function drawDefaultLabels(context: D3.Selection, dataLabels: Label[], numeric?: boolean, twoRows?: boolean, hasTooltip?: boolean): D3.UpdateSelection;
9165 function animateDefaultLabels(context: D3.Selection, dataLabels: Label[], duration: number, numeric?: boolean, easeType?: string): D3.UpdateSelection;
9166 /** Draws black rectangles based on the bounding bx of labels, to be used in debugging */
9167 function drawLabelBackground(context: D3.Selection, dataLabels: Label[], fill?: string, fillOpacity?: number): D3.UpdateSelection;
9168 function drawLabelLeaderLines(context: D3.Selection, filteredDataLabels: Label[], key?: (data: any, index?: number) => any, leaderLineColor?: string): void;
9169 function getLabelFormattedText(label: string | number, format?: string, formatter?: IValueFormatter): string;
9170 function getDisplayUnitValueFromAxisFormatter(axisFormatter: IValueFormatter, labelSettings: VisualDataLabelsSettings): number;
9171 function createColumnFormatterCacheManager(): IColumnFormatterCacheManager;
9172 function removeDuplicates(labelDataPoints: LabelDataPoint[]): LabelDataPoint[];
9173 function getDataLabelLayoutOptions(type: CartesianChartType): DataLabelLayoutOptions;
9174 function getTextSize(text: string, fontSize: number): ISize;
9175 }
9176}
9177declare module powerbi.visuals {
9178 module KpiUtil {
9179 const enum KpiImageSize {
9180 Small = 0,
9181 Big = 1,
9182 }
9183 interface KpiImageMetadata {
9184 statusGraphic: string;
9185 caption: string;
9186 class: string;
9187 }
9188 interface KPIGraphicClass {
9189 kpiIconClass: string;
9190 statusValues: string[];
9191 }
9192 function getClassForKpi(kpi: DataViewKpiColumnMetadata, value: string, kpiImageSize?: KpiImageSize): string;
9193 function getKpiImageMetadata(metaDataColumn: DataViewMetadataColumn, value: string, kpiImageSize?: KpiImageSize): KpiImageMetadata;
9194 }
9195}
9196declare module powerbi.visuals {
9197 module ReferenceLineHelper {
9198 const referenceLineProps: {
9199 show: string;
9200 lineColor: string;
9201 transparency: string;
9202 value: string;
9203 style: string;
9204 position: string;
9205 dataLabelShow: string;
9206 dataLabelColor: string;
9207 dataLabelDecimalPoints: string;
9208 dataLabelHorizontalPosition: string;
9209 dataLabelVerticalPosition: string;
9210 dataLabelDisplayUnits: string;
9211 };
9212 function enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, referenceLines: DataViewObjectMap, defaultColor: string, objectName: string): void;
9213 function render(options: ReferenceLineOptions): void;
9214 function createLabelDataPoint(options: ReferenceLineDataLabelOptions): LabelDataPoint;
9215 function extractReferenceLineValue(referenceLineProperties: DataViewObject): number;
9216 }
9217}
9218declare module powerbi.visuals {
9219 module InteractivityUtils {
9220 function getPositionOfLastInputEvent(): IPoint;
9221 function registerStandardInteractivityHandlers(selection: D3.Selection, selectionHandler: ISelectionHandler): void;
9222 function registerStandardSelectionHandler(selection: D3.Selection, selectionHandler: ISelectionHandler): void;
9223 function registerStandardContextMenuHandler(selection: D3.Selection, selectionHandler: ISelectionHandler): void;
9224 function registerGroupInteractivityHandlers(group: D3.Selection, selectionHandler: ISelectionHandler): void;
9225 function registerGroupSelectionHandler(group: D3.Selection, selectionHandler: ISelectionHandler): void;
9226 function registerGroupContextMenuHandler(group: D3.Selection, selectionHandler: ISelectionHandler): void;
9227 }
9228}
9229declare module powerbi.visuals {
9230 import DataView = powerbi.DataView;
9231 function getInvalidValueWarnings(dataViews: DataView[], supportsNaN: boolean, supportsNegativeInfinity: boolean, supportsPositiveInfinity: boolean): IVisualWarning[];
9232}
9233declare module powerbi.visuals {
9234 interface IListView {
9235 data(data: any[], dataIdFunction: (d) => {}, dataAppended: boolean): IListView;
9236 rowHeight(rowHeight: number): IListView;
9237 viewport(viewport: IViewport): IListView;
9238 render(): void;
9239 empty(): void;
9240 }
9241 module ListViewFactory {
9242 function createListView(options: any): IListView;
9243 }
9244 interface ListViewOptions {
9245 enter: (selection: D3.Selection) => void;
9246 exit: (selection: D3.Selection) => void;
9247 update: (selection: D3.Selection) => void;
9248 loadMoreData: () => void;
9249 baseContainer: D3.Selection;
9250 rowHeight: number;
9251 viewport: IViewport;
9252 scrollEnabled: boolean;
9253 isReadMode: () => boolean;
9254 }
9255}
9256declare module powerbi.visuals {
9257 module MapUtil {
9258 interface IPixelArrayResult {
9259 array: Float64Array;
9260 arrayString: string;
9261 }
9262 const Settings: {
9263 MaxBingRequest: number;
9264 MaxCacheSize: number;
9265 MaxCacheSizeOverflow: number;
9266 BingKey: string;
9267 BingUrl: string;
9268 BingUrlGeodata: string;
9269 UseDoubleArrayGeodataResult: boolean;
9270 UseDoubleArrayDequeueTimeout: number;
9271 };
9272 const MinAllowedLatitude: number;
9273 const MaxAllowedLatitude: number;
9274 const MinAllowedLongitude: number;
9275 const MaxAllowedLongitude: number;
9276 const TileSize: number;
9277 const MaxLevelOfDetail: number;
9278 const MinLevelOfDetail: number;
9279 const MaxAutoZoomLevel: number;
9280 const DefaultLevelOfDetail: number;
9281 const WorkerErrorName: string;
9282 const CategoryTypes: {
9283 Address: string;
9284 City: string;
9285 Continent: string;
9286 CountryRegion: string;
9287 County: string;
9288 Longitude: string;
9289 Latitude: string;
9290 Place: string;
9291 PostalCode: string;
9292 StateOrProvince: string;
9293 };
9294 function clip(n: number, minValue: number, maxValue: number): number;
9295 function getMapSize(levelOfDetail: number): number;
9296 /**
9297 * @param latLongArray - is a Float64Array as [lt0, lon0, lat1, long1, lat2, long2,....]
9298 * @param buildString - optional, if true returns also a string as "x0 y0 x1 y1 x2 y2 ...."
9299 * @returns IPixelArrayResult with Float64Array as [x0, y0, x1, y1, x2, y2,....]
9300 */
9301 function latLongToPixelXYArray(latLongArray: Float64Array, levelOfDetail: number, buildString?: boolean): IPixelArrayResult;
9302 function getLocationBoundaries(latLongArray: Float64Array): Microsoft.Maps.LocationRect;
9303 /**
9304 * Note: this code is taken from Bing.
9305 * see Point Compression Algorithm http://msdn.microsoft.com/en-us/library/jj158958.aspx
9306 * see Decompression Algorithm in http://msdn.microsoft.com/en-us/library/dn306801.aspx
9307 */
9308 function parseEncodedSpatialValueArray(value: any): Float64Array;
9309 function calcGeoData(data: IGeocodeBoundaryCoordinate): void;
9310 function locationToPixelXY(location: Microsoft.Maps.Location, levelOfDetail: number): powerbi.visuals.Point;
9311 function locationRectToRectXY(locationRect: Microsoft.Maps.LocationRect, levelOfDetail: number): powerbi.visuals.Rect;
9312 function latLongToPixelXY(latitude: number, longitude: number, levelOfDetail: number): powerbi.visuals.Point;
9313 function pixelXYToLocation(pixelX: number, pixelY: number, levelOfDetail: number): Microsoft.Maps.Location;
9314 module CurrentLocation {
9315 function createPushpin(location: Microsoft.Maps.Location): Microsoft.Maps.Pushpin;
9316 }
9317 }
9318 class MapPolygonInfo {
9319 private _locationRect;
9320 private _baseRect;
9321 private _currentRect;
9322 constructor();
9323 reCalc(mapControl: Microsoft.Maps.Map, width: number, height: number): void;
9324 scale: number;
9325 transform: Transform;
9326 outherTransform: Transform;
9327 setViewBox(svg: SVGSVGElement): void;
9328 innerTransform: Transform;
9329 transformToString(transform: Transform): string;
9330 }
9331}
9332declare module powerbi.visuals.utility {
9333 interface SelectionManagerOptions {
9334 hostServices: IVisualHostServices;
9335 }
9336 class SelectionManager {
9337 private selectedIds;
9338 private hostServices;
9339 constructor(options: SelectionManagerOptions);
9340 select(selectionId: SelectionId, multiSelect?: boolean): JQueryDeferred<SelectionId[]>;
9341 showContextMenu(selectionId: SelectionId, position?: Point): JQueryDeferred<{}>;
9342 hasSelection(): boolean;
9343 clear(): JQueryDeferred<{}>;
9344 getSelectionIds(): SelectionId[];
9345 private sendSelectionToHost(ids);
9346 private sendContextMenuToHost(selectionId, position);
9347 private getSelectorsByColumn(selectionIds);
9348 private selectInternal(selectionId, multiSelect);
9349 static containsSelection(list: SelectionId[], id: SelectionId): boolean;
9350 }
9351}
9352declare module powerbi.visuals {
9353 module shapes {
9354 class Polygon {
9355 private _absoluteCentroid;
9356 private _absoluteBoundingRect;
9357 polygonPoints: IPoint[];
9358 pixelBoundingRect: Rect;
9359 constructor(absolutePoints: Float64Array);
9360 absoluteCentroid(): IPoint;
9361 absoluteBoundingRect(): Rect;
9362 /**
9363 * Check if label text contain in polygon shape.
9364 *
9365 * @return true/false is the label fit in polygon.
9366 * measure if rects points are inside the polygon shape
9367 * return true if there is at least 3 point inside the polygon
9368 */
9369 contains(rect: IRect): boolean;
9370 /**
9371 * Check if label text is outside of polygon shape.
9372 * It checks 8 points in the label. TopLeft, TopCenter, TopRight, MiddleLeft, MiddleRight, BottomLeft, BottomMiddle, BottomRight
9373 * @return true/false is there is any conflict (at least one point inside the shape).
9374 */
9375 conflicts(rect: IRect): boolean;
9376 /**
9377 * returns intersection point of a line (depicted by two points) and a polygon.
9378 *
9379 * @return the point of intersection or null if there is no intersection.
9380 */
9381 lineIntersectionPoint(p0: IPoint, p1: IPoint): IPoint;
9382 /**
9383 * calculate Polygon Area.
9384 *
9385 * @return the area of the polygon (as number).
9386 */
9387 static calculateAbsolutePolygonArea(polygonPoints: IPoint[]): number;
9388 /**
9389 * Check if label text is outside of polygon bounding box.
9390 *
9391 * @return true/false is there is any conflict (at least one point inside the shape).
9392 */
9393 private isConflictWithBoundingBox(rect);
9394 /**
9395 * Calculate Polygon Centroid.
9396 *
9397 * @return 'center' point of the polygon.
9398 * calculate the polygon area
9399 * calculate the average points of the polygon by x & y axis.
9400 * divided the average point by the area
9401 */
9402 private calculatePolygonCentroid();
9403 private calculateBoundingRect();
9404 /**
9405 * Check if point exist inside polygon shape.
9406 *
9407 * @return true/false if point exist inside shape.
9408 * ray-casting algorithm based on:
9409 * http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
9410 */
9411 private inside(point);
9412 /**
9413 * Checks if a line (presented as two points) intersects with a another line
9414 */
9415 private getLineIntersection(line0p1, line0p2, line1p1, line1p2);
9416 private convertArrayPathToPoints(path);
9417 }
9418 module Point {
9419 function offset(point: IPoint, offsetX: number, offsetY: number): IPoint;
9420 function equals(point: IPoint, other: IPoint): boolean;
9421 function clone(point: IPoint): IPoint;
9422 function toString(point: IPoint): string;
9423 function serialize(point: IPoint): string;
9424 function getDistance(point: IPoint, other: IPoint): number;
9425 function equalWithPrecision(point1: IPoint, point2: IPoint): boolean;
9426 function parsePoint(value: any, defaultValue?: IPoint): IPoint;
9427 }
9428 module Size {
9429 function isEmpty(size: ISize): boolean;
9430 function equals(size: ISize, other: ISize): boolean;
9431 function clone(size: ISize): ISize;
9432 function inflate(size: ISize, padding: IThickness): ISize;
9433 function deflate(size: ISize, padding: IThickness): ISize;
9434 function combine(size: ISize, other: ISize): ISize;
9435 function toRect(size: ISize): IRect;
9436 function toString(size: ISize): string;
9437 function equal(size1: ISize, size2: ISize): boolean;
9438 function equalWithPrecision(size1: ISize, size2: ISize): boolean;
9439 function parseSize(value: any, defaultValue?: ISize): ISize;
9440 }
9441 module Rect {
9442 function getOffset(rect: IRect): IPoint;
9443 function getSize(rect: IRect): ISize;
9444 function setSize(rect: IRect, value: ISize): void;
9445 function right(rect: IRect): number;
9446 function bottom(rect: IRect): number;
9447 function topLeft(rect: IRect): IPoint;
9448 function topRight(rect: IRect): IPoint;
9449 function bottomLeft(rect: IRect): IPoint;
9450 function bottomRight(rect: IRect): IPoint;
9451 function equals(rect: IRect, other: IRect): boolean;
9452 function clone(rect: IRect): IRect;
9453 function toString(rect: IRect): string;
9454 function offset(rect: IRect, offsetX: number, offsetY: number): IRect;
9455 function inflate(rect: IRect, padding: IThickness): IRect;
9456 function deflate(rect: IRect, padding: IThickness): IRect;
9457 function inflateBy(rect: IRect, padding: number): IRect;
9458 function deflateBy(rect: IRect, padding: number): IRect;
9459 /**
9460 * Get closest point.
9461 *
9462 * @return the closest point on the rect to the (x,y) point given.
9463 * In case the (x,y) given is inside the rect, (x,y) will be returned.
9464 * Otherwise, a point on a border will be returned.
9465 */
9466 function getClosestPoint(rect: IRect, x: number, y: number): IPoint;
9467 function equal(rect1: IRect, rect2: IRect): boolean;
9468 function equalWithPrecision(rect1: IRect, rect2: IRect): boolean;
9469 function isEmpty(rect: IRect): boolean;
9470 function containsPoint(rect: IRect, point: IPoint): boolean;
9471 function isIntersecting(rect1: IRect, rect2: IRect): boolean;
9472 function intersect(rect1: IRect, rect2: IRect): IRect;
9473 function combine(rect1: IRect, rect2: IRect): IRect;
9474 function parseRect(value: any, defaultValue?: IRect): IRect;
9475 }
9476 module Thickness {
9477 function inflate(thickness: IThickness, other: IThickness): IThickness;
9478 function getWidth(thickness: IThickness): number;
9479 function getHeight(thickness: IThickness): number;
9480 function clone(thickness: IThickness): IThickness;
9481 function equals(thickness: IThickness, other: IThickness): boolean;
9482 function flipHorizontal(thickness: IThickness): void;
9483 function flipVertical(thickness: IThickness): void;
9484 function toString(thickness: IThickness): string;
9485 function toCssString(thickness: IThickness): string;
9486 function isEmpty(thickness: IThickness): boolean;
9487 function equal(thickness1: IThickness, thickness2: IThickness): boolean;
9488 function equalWithPrecision(thickness1: IThickness, thickness2: IThickness): boolean;
9489 function parseThickness(value: any, defaultValue?: IThickness, resetValue?: any): IThickness;
9490 }
9491 module Vector {
9492 function isEmpty(vector: IVector): boolean;
9493 function equals(vector: IVector, other: IPoint): boolean;
9494 function clone(vector: IVector): IVector;
9495 function toString(vector: IVector): string;
9496 function getLength(vector: IVector): number;
9497 function getLengthSqr(vector: IVector): number;
9498 function scale(vector: IVector, scalar: number): IVector;
9499 function normalize(vector: IVector): IVector;
9500 function rotate90DegCW(vector: IVector): IVector;
9501 function rotate90DegCCW(vector: IVector): IVector;
9502 function rotate(vector: IVector, angle: number): IVector;
9503 function equal(vector1: IVector, vector2: IVector): boolean;
9504 function equalWithPrecision(vector1: IVector, vector2: IVector): boolean;
9505 function add(vect1: IVector, vect2: IVector): IVector;
9506 function subtract(vect1: IVector, vect2: IVector): IVector;
9507 function dotProduct(vect1: IVector, vect2: IVector): number;
9508 function getDeltaVector(p0: IPoint, p1: IPoint): IVector;
9509 }
9510 }
9511}
9512declare module powerbi.visuals {
9513 /** Utility class for slicer*/
9514 module SlicerUtil {
9515 /** CSS selectors for slicer elements. */
9516 module Selectors {
9517 const HeaderContainer: jsCommon.CssConstants.ClassAndSelector;
9518 const Header: jsCommon.CssConstants.ClassAndSelector;
9519 const HeaderText: jsCommon.CssConstants.ClassAndSelector;
9520 const Body: jsCommon.CssConstants.ClassAndSelector;
9521 const Label: jsCommon.CssConstants.ClassAndSelector;
9522 const LabelText: jsCommon.CssConstants.ClassAndSelector;
9523 const LabelImage: jsCommon.CssConstants.ClassAndSelector;
9524 const CountText: jsCommon.CssConstants.ClassAndSelector;
9525 const Clear: jsCommon.CssConstants.ClassAndSelector;
9526 const MultiSelectEnabled: jsCommon.CssConstants.ClassAndSelector;
9527 }
9528 /** Const declarations*/
9529 module DisplayNameKeys {
9530 const Clear: string;
9531 const SelectAll: string;
9532 }
9533 /** Helper class for slicer settings */
9534 module SettingsHelper {
9535 function areSettingsDefined(data: SlicerData): boolean;
9536 }
9537 /** Helper class for handling slicer default value */
9538 module DefaultValueHandler {
9539 function getIdentityFields(dataView: DataView): data.SQExpr[];
9540 }
9541 function tryRemoveValueFromRetainedList(value: DataViewScopeIdentity, selectedScopeIds: DataViewScopeIdentity[], caseInsensitive?: boolean): boolean;
9542 /** Helper class for creating and measuring slicer DOM elements */
9543 class DOMHelper {
9544 createSlicerHeader(hostServices: IVisualHostServices): HTMLElement;
9545 getHeaderTextProperties(settings: SlicerSettings): TextProperties;
9546 getSlicerBodyViewport(currentViewport: IViewport, settings: SlicerSettings, headerTextProperties: TextProperties): IViewport;
9547 updateSlicerBodyDimensions(currentViewport: IViewport, slicerBody: D3.Selection, settings: SlicerSettings): void;
9548 getHeaderHeight(settings: SlicerSettings, textProperties: TextProperties): number;
9549 getRowHeight(settings: SlicerSettings, textProperties: TextProperties): number;
9550 styleSlicerHeader(slicerHeader: D3.Selection, settings: SlicerSettings, headerText: string): void;
9551 setSlicerTextStyle(slicerText: D3.Selection, settings: SlicerSettings): void;
9552 getRowsOutlineWidth(outlineElement: string, outlineWeight: number): number;
9553 private setSlicerHeaderTextStyle(slicerHeader, settings);
9554 private getTextProperties(textSize, textProperties);
9555 }
9556 }
9557}
9558declare module powerbi.visuals {
9559 /**
9560 * Contains functions/constants to aid in adding tooltips.
9561 */
9562 module tooltipUtils {
9563 function tooltipUpdate(selection: D3.Selection, tooltips: string[]): void;
9564 }
9565}
9566declare module powerbi.visuals {
9567 /**
9568 * Contains functions/constants to aid in SVG manupilation.
9569 */
9570 module SVGUtil {
9571 /**
9572 * Very small values, when stringified, may be converted to scientific notation and cause a temporarily
9573 * invalid attribute or style property value.
9574 * For example, the number 0.0000001 is converted to the string "1e-7".
9575 * This is particularly noticeable when interpolating opacity values.
9576 * To avoid scientific notation, start or end the transition at 1e-6,
9577 * which is the smallest value that is not stringified in exponential notation.
9578 */
9579 const AlmostZero: number;
9580 /**
9581 * Creates a translate string for use with the SVG transform call.
9582 */
9583 function translate(x: number, y: number): string;
9584 /**
9585 * Creates a translateX string for use with the SVG transform call.
9586 */
9587 function translateXWithPixels(x: number): string;
9588 function translateWithPixels(x: number, y: number): string;
9589 /**
9590 * Creates a translate + rotate string for use with the SVG transform call.
9591 */
9592 function translateAndRotate(x: number, y: number, px: number, py: number, angle: number): string;
9593 /**
9594 * Creates a scale string for use in a CSS transform property.
9595 */
9596 function scale(scale: number): string;
9597 /**
9598 * Creates a translate + scale string for use with the SVG transform call.
9599 */
9600 function translateAndScale(x: number, y: number, ratio: number): string;
9601 /**
9602 * Creates a transform origin string for use in a CSS transform-origin property.
9603 */
9604 function transformOrigin(xOffset: string, yOffset: string): string;
9605 /**
9606 * Forces all D3 transitions to complete.
9607 * Normally, zero-delay transitions are executed after an instantaneous delay (<10ms).
9608 * This can cause a brief flicker if the browser renders the page twice: once at the end of the first event loop,
9609 * then again immediately on the first timer callback. By flushing the timer queue at the end of the first event loop,
9610 * you can run any zero-delay transitions immediately and avoid the flicker.
9611 *
9612 * These flickers are noticable on IE, and with a large number of webviews(not recommend you ever do this) on iOS.
9613 */
9614 function flushAllD3Transitions(): void;
9615 /**
9616 * Wrapper for flushAllD3Transitions.
9617 */
9618 function flushAllD3TransitionsIfNeeded(options: VisualInitOptions | AnimationOptions): void;
9619 /**
9620 * There is a known bug in IE10 that causes cryptic crashes for SVG elements with a null 'd' attribute:
9621 * https://github.com/mbostock/d3/issues/1737
9622 */
9623 function ensureDAttribute(pathElement: D3.D3Element): void;
9624 /**
9625 * In IE10, it is possible to return SVGPoints with NaN members.
9626 */
9627 function ensureValidSVGPoint(point: SVGPoint): void;
9628 /**
9629 * Parse the Transform string with value 'translate(x,y)'.
9630 * In Chrome for the translate(position) string the delimiter
9631 * is a comma and in IE it is a spaceso checking for both.
9632 */
9633 function parseTranslateTransform(input: string): {
9634 x: string;
9635 y: string;
9636 };
9637 /**
9638 * Create an arrow.
9639 */
9640 function createArrow(width: number, height: number, rotate: number): {
9641 path: string;
9642 transform: string;
9643 };
9644 /**
9645 * Use the ratio of the scaled bounding rect and the SVG DOM bounding box to get the x and y transform scale values
9646 * @deprecated This function is unreliable across browser implementations, prefer to use SVGScaleDetector if needed.
9647 */
9648 function getTransformScaleRatios(svgElement: SVGSVGElement): Point;
9649 }
9650 class SVGScaleDetector {
9651 private scaleDetectorElement;
9652 constructor(svgElement: D3.Selection);
9653 getScale(): Point;
9654 }
9655}
9656declare module powerbi.visuals {
9657 /**
9658 * Contains functions/constants to aid in text manupilation.
9659 */
9660 module TextUtil {
9661 /**
9662 * Remove breaking spaces from given string and replace by none breaking space (&nbsp).
9663 */
9664 function removeBreakingSpaces(str: string): string;
9665 /**
9666 * Remove ellipses from a given string
9667 */
9668 function removeEllipses(str: string): string;
9669 /**
9670 * Replace every whitespace (0x20) with Non-Breaking Space (0xA0)
9671 * @param {string} txt String to replace White spaces
9672 * @returns Text after replcing white spaces
9673 */
9674 function replaceSpaceWithNBSP(txt: string): string;
9675 }
9676}
9677declare module powerbi.visuals {
9678 interface GradientSettings {
9679 diverging: boolean;
9680 minColor: any;
9681 midColor?: any;
9682 maxColor: any;
9683 minValue?: number;
9684 midValue?: number;
9685 maxValue?: number;
9686 }
9687 module GradientUtils {
9688 import DataViewObjectPropertyDefinition = powerbi.data.DataViewObjectPropertyDefinition;
9689 function getFillRuleRole(objectDescs: powerbi.data.DataViewObjectDescriptors): string;
9690 function shouldShowGradient(visualConfig: any): boolean;
9691 function getUpdatedGradientSettings(gradientObject: data.DataViewObjectDefinitions): GradientSettings;
9692 function getGradientMeasureIndex(dataViewCategorical: DataViewCategorical): number;
9693 function getGradientValueColumn(dataViewCategorical: DataViewCategorical): DataViewValueColumn;
9694 function hasGradientRole(dataViewCategorical: DataViewCategorical): boolean;
9695 function getDefaultGradientSettings(): GradientSettings;
9696 function getDefaultFillRuleDefinition(): DataViewObjectPropertyDefinition;
9697 function updateFillRule(propertyName: string, propertyValue: any, definitions: powerbi.data.DataViewObjectDefinitions): void;
9698 function getGradientSettings(baseFillRule: FillRuleDefinition): GradientSettings;
9699 function getFillRule(objectDefinitions: data.DataViewObjectDefinitions): FillRuleDefinition;
9700 function getGradientSettingsFromRule(fillRule: FillRuleDefinition): GradientSettings;
9701 /** Returns a string representing the gradient to be used for the GradientBar directive. */
9702 function getGradientBarColors(gradientSettings: GradientSettings): string;
9703 }
9704}
9705declare module powerbi.visuals {
9706 interface VisualBackground {
9707 image?: ImageValue;
9708 transparency?: number;
9709 }
9710 module visualBackgroundHelper {
9711 function getDefaultColor(): string;
9712 function getDefaultTransparency(): number;
9713 function getDefaultShow(): boolean;
9714 function getDefaultValues(): {
9715 color: string;
9716 transparency: number;
9717 show: boolean;
9718 };
9719 function enumeratePlot(enumeration: ObjectEnumerationBuilder, background: VisualBackground): void;
9720 function renderBackgroundImage(background: VisualBackground, visualElement: JQuery, layout: Rect): void;
9721 }
9722}
9723declare module powerbi.visuals {
9724 /**
9725 * A helper class for building a VisualObjectInstanceEnumerationObject:
9726 * - Allows call chaining (e.g., builder.pushInstance({...}).pushInstance({...})
9727 * - Allows creating of containers (via pushContainer/popContainer)
9728 */
9729 class ObjectEnumerationBuilder {
9730 private instances;
9731 private containers;
9732 private containerIdx;
9733 pushInstance(instance: VisualObjectInstance): ObjectEnumerationBuilder;
9734 pushContainer(container: VisualObjectInstanceContainer): ObjectEnumerationBuilder;
9735 popContainer(): ObjectEnumerationBuilder;
9736 complete(): VisualObjectInstanceEnumerationObject;
9737 private canMerge(x, y);
9738 private extend(target, source, propertyName);
9739 static merge(x: VisualObjectInstanceEnumeration, y: VisualObjectInstanceEnumeration): VisualObjectInstanceEnumerationObject;
9740 static normalize(x: VisualObjectInstanceEnumeration): VisualObjectInstanceEnumerationObject;
9741 static getContainerForInstance(enumeration: VisualObjectInstanceEnumerationObject, instance: VisualObjectInstance): VisualObjectInstanceContainer;
9742 }
9743}
9744declare module powerbi.visuals {
9745 /** Helper class for Visual border styles */
9746 module VisualBorderUtil {
9747 /**
9748 * Gets The Boder Width string (e.g. 0px 1px 2px 3px)
9749 * @param {OutlineType} string Type of the Outline, one of Visuals.outline.<XX> const strings
9750 * @param {number} outlineWeight Weight of the outline in pixels
9751 * @returns String representing the Border Width
9752 */
9753 function getBorderWidth(outlineType: string, outlineWeight: number): string;
9754 }
9755}
9756declare module powerbi.visuals {
9757 interface I2DTransformMatrix {
9758 m00: number;
9759 m01: number;
9760 m02: number;
9761 m10: number;
9762 m11: number;
9763 m12: number;
9764 }
9765 /** Transformation matrix math wrapper */
9766 class Transform {
9767 private _inverse;
9768 matrix: I2DTransformMatrix;
9769 constructor(m?: I2DTransformMatrix);
9770 applyToPoint(point: IPoint): IPoint;
9771 applyToRect(rect: Rect): IRect;
9772 translate(xOffset: number, yOffset: number): void;
9773 scale(xScale: number, yScale: number): void;
9774 rotate(angleInRadians: number): void;
9775 add(other: Transform): void;
9776 getInverse(): Transform;
9777 }
9778 function createTranslateMatrix(xOffset: number, yOffset: number): I2DTransformMatrix;
9779 function createScaleMatrix(xScale: number, yScale: number): I2DTransformMatrix;
9780 function createRotationMatrix(angleInRads: number): I2DTransformMatrix;
9781 function createInverseMatrix(m: I2DTransformMatrix): I2DTransformMatrix;
9782}
9783declare module powerbi.visuals {
9784 interface TrendLine {
9785 points: IPoint[];
9786 show: boolean;
9787 lineColor: Fill;
9788 transparency: number;
9789 style: string;
9790 combineSeries: boolean;
9791 useHighlightValues: boolean;
9792 y2Axis: boolean;
9793 }
9794 module TrendLineHelper {
9795 const defaults: {
9796 lineColor: Fill;
9797 lineStyle: string;
9798 transparency: number;
9799 combineSeries: boolean;
9800 useHighlightValues: boolean;
9801 };
9802 function enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, trendLines: TrendLine[]): void;
9803 function isDataViewForRegression(dataView: DataView): boolean;
9804 function readDataView(dataView: DataView, sourceDataView: DataView, y2: boolean, colors: IDataColorPalette): TrendLine[];
9805 function darkenTrendLineColor(color: string): string;
9806 function render(trendLines: TrendLine[], graphicsContext: D3.Selection, axes: CartesianAxisProperties, viewport: IViewport): void;
9807 }
9808}
9809declare module powerbi.visuals {
9810 module visibilityHelper {
9811 /** Helper method that uses jQuery :visible selector to determine if visual is visible.
9812 Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.
9813 Elements with visibility: hidden or opacity: 0 are considered visible, since they still consume space in the layout.
9814 */
9815 function partiallyVisible(element: JQuery): boolean;
9816 }
9817}
9818declare module powerbi {
9819 module VisualObjectRepetition {
9820 /** Determines whether two repetitions are equal. */
9821 function equals(x: VisualObjectRepetition, y: VisualObjectRepetition): boolean;
9822 }
9823}
9824declare module powerbi.visuals {
9825 /** Helper module for converting a DataView into SlicerData. */
9826 module DataConversion {
9827 function convert(dataView: DataView, localizedSelectAllText: string, interactivityService: IInteractivityService | ISelectionHandler, hostServices: IVisualHostServices): SlicerData;
9828 }
9829}
9830declare module powerbi {
9831 import shapes = powerbi.visuals.shapes;
9832 import IRect = powerbi.visuals.IRect;
9833 /** Defines possible content positions. */
9834 const enum ContentPositions {
9835 /** Content position is not defined. */
9836 None = 0,
9837 /** Content aligned top left. */
9838 TopLeft = 1,
9839 /** Content aligned top center. */
9840 TopCenter = 2,
9841 /** Content aligned top right. */
9842 TopRight = 4,
9843 /** Content aligned middle left. */
9844 MiddleLeft = 8,
9845 /** Content aligned middle center. */
9846 MiddleCenter = 16,
9847 /** Content aligned middle right. */
9848 MiddleRight = 32,
9849 /** Content aligned bottom left. */
9850 BottomLeft = 64,
9851 /** Content aligned bottom center. */
9852 BottomCenter = 128,
9853 /** Content aligned bottom right. */
9854 BottomRight = 256,
9855 /** Content is placed inside the bounding rectangle in the center. */
9856 InsideCenter = 512,
9857 /** Content is placed inside the bounding rectangle at the base. */
9858 InsideBase = 1024,
9859 /** Content is placed inside the bounding rectangle at the end. */
9860 InsideEnd = 2048,
9861 /** Content is placed outside the bounding rectangle at the base. */
9862 OutsideBase = 4096,
9863 /** Content is placed outside the bounding rectangle at the end. */
9864 OutsideEnd = 8192,
9865 /** Content supports all possible positions. */
9866 All = 16383,
9867 }
9868 /**
9869 * Rectangle orientation. Rectangle orientation is used to define vertical or horizontal orientation
9870 * and starting/ending side of the rectangle.
9871 */
9872 enum RectOrientation {
9873 /** Rectangle with no specific orientation. */
9874 None = 0,
9875 /** Vertical rectangle with base at the bottom. */
9876 VerticalBottomTop = 1,
9877 /** Vertical rectangle with base at the top. */
9878 VerticalTopBottom = 2,
9879 /** Horizontal rectangle with base at the left. */
9880 HorizontalLeftRight = 3,
9881 /** Horizontal rectangle with base at the right. */
9882 HorizontalRightLeft = 4,
9883 }
9884 /**
9885 * Defines if panel elements are allowed to be positioned
9886 * outside of the panel boundaries.
9887 */
9888 enum OutsidePlacement {
9889 /** Elements can be positioned outside of the panel. */
9890 Allowed = 0,
9891 /** Elements can not be positioned outside of the panel. */
9892 Disallowed = 1,
9893 /** Elements can be partially outside of the panel. */
9894 Partial = 2,
9895 }
9896 /**
9897 * Defines an interface for information needed for default label positioning. Used in DataLabelsPanel.
9898 * Note the question marks: none of the elements are mandatory.
9899 */
9900 interface IDataLabelSettings {
9901 /** Distance from the anchor point. */
9902 anchorMargin?: number;
9903 /** Orientation of the anchor rectangle. */
9904 anchorRectOrientation?: RectOrientation;
9905 /** Preferable position for the label. */
9906 contentPosition?: ContentPositions;
9907 /** Defines the rules if the elements can be positioned outside panel bounds. */
9908 outsidePlacement?: OutsidePlacement;
9909 /** Defines the valid positions if repositionOverlapped is true. */
9910 validContentPositions?: ContentPositions;
9911 /** Defines maximum moving distance to reposition an element. */
9912 minimumMovingDistance?: number;
9913 /** Defines minimum moving distance to reposition an element. */
9914 maximumMovingDistance?: number;
9915 /** Opacity effect of the label. Use it for dimming. */
9916 opacity?: number;
9917 }
9918 /**
9919 * Defines an interface for information needed for label positioning.
9920 * None of the elements are mandatory, but at least anchorPoint OR anchorRect is needed.
9921 */
9922 interface IDataLabelInfo extends IDataLabelSettings {
9923 /** The point to which label is anchored. */
9924 anchorPoint?: shapes.IPoint;
9925 /** The rectangle to which label is anchored. */
9926 anchorRect?: IRect;
9927 /** Disable label rendering and processing. */
9928 hideLabel?: boolean;
9929 /**
9930 * Defines the visibility rank. This will not be processed by arrange phase,
9931 * but can be used for preprocessing the hideLabel value.
9932 */
9933 visibilityRank?: number;
9934 /** Defines the starting offset from AnchorRect. */
9935 offset?: number;
9936 /** Defines the callout line data. It is calculated and used during processing. */
9937 callout?: {
9938 start: shapes.IPoint;
9939 end: shapes.IPoint;
9940 };
9941 /** Source of the label. */
9942 source?: any;
9943 size?: shapes.ISize;
9944 }
9945 /** Interface for label rendering. */
9946 interface IDataLabelRenderer {
9947 renderLabelArray(labels: IArrangeGridElementInfo[]): void;
9948 }
9949 /** Interface used in internal arrange structures. */
9950 interface IArrangeGridElementInfo {
9951 element: IDataLabelInfo;
9952 rect: IRect;
9953 }
9954 /**
9955 * Arranges label elements using the anchor point or rectangle. Collisions
9956 * between elements can be automatically detected and as a result elements
9957 * can be repositioned or get hidden.
9958 */
9959 class DataLabelManager {
9960 movingStep: number;
9961 hideOverlapped: boolean;
9962 static DefaultAnchorMargin: number;
9963 static DefaultMaximumMovingDistance: number;
9964 static DefaultMinimumMovingDistance: number;
9965 static InflateAmount: number;
9966 private defaultDataLabelSettings;
9967 defaultSettings: IDataLabelSettings;
9968 /** Arranges the lables position and visibility*/
9969 hideCollidedLabels(viewport: IViewport, data: any[], layout: any, addTransform?: boolean): powerbi.visuals.LabelEnabledDataPoint[];
9970 /**
9971 * Merges the label element info with the panel element info and returns correct label info.
9972 * @param source The label info.
9973 */
9974 getLabelInfo(source: IDataLabelInfo): IDataLabelInfo;
9975 /**
9976 * (Private) Calculates element position using anchor point..
9977 */
9978 private calculateContentPositionFromPoint(anchorPoint, contentPosition, contentSize, offset);
9979 /** (Private) Calculates element position using anchor rect. */
9980 private calculateContentPositionFromRect(anchorRect, anchorRectOrientation, contentPosition, contentSize, offset);
9981 /** (Private) Calculates element inside center position using anchor rect. */
9982 private handleInsideCenterPosition(anchorRectOrientation, contentSize, anchorRect, offset);
9983 /** (Private) Calculates element inside end position using anchor rect. */
9984 private handleInsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
9985 /** (Private) Calculates element inside base position using anchor rect. */
9986 private handleInsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
9987 /** (Private) Calculates element outside end position using anchor rect. */
9988 private handleOutsideEndPosition(anchorRectOrientation, contentSize, anchorRect, offset);
9989 /** (Private) Calculates element outside base position using anchor rect. */
9990 private handleOutsideBasePosition(anchorRectOrientation, contentSize, anchorRect, offset);
9991 /** (Private) Calculates element position. */
9992 private calculateContentPosition(anchoredElementInfo, contentPosition, contentSize, offset);
9993 /** (Private) Check for collisions. */
9994 private hasCollisions(arrangeGrid, info, position, size);
9995 static isValid(rect: IRect): boolean;
9996 }
9997 /**
9998 * Utility class to speed up the conflict detection by collecting the arranged items in the DataLabelsPanel.
9999 */
10000 class DataLabelArrangeGrid {
10001 private grid;
10002 private cellSize;
10003 private rowCount;
10004 private colCount;
10005 private static ARRANGEGRID_MIN_COUNT;
10006 private static ARRANGEGRID_MAX_COUNT;
10007 /**
10008 * Creates new ArrangeGrid.
10009 * @param size The available size
10010 */
10011 constructor(size: shapes.ISize, elements: any[], layout: powerbi.visuals.ILabelLayout);
10012 /**
10013 * Register a new label element.
10014 * @param element The label element to register.
10015 * @param rect The label element position rectangle.
10016 */
10017 add(element: IDataLabelInfo, rect: IRect): void;
10018 /**
10019 * Checks for conflict of given rectangle in registered elements.
10020 * @param rect The rectengle to check.
10021 * @return True if conflict is detected.
10022 */
10023 hasConflict(rect: IRect): boolean;
10024 /**
10025 * Calculates the number of rows or columns in a grid
10026 * @param step is the largest label size (width or height)
10027 * @param length is the grid size (width or height)
10028 * @param minCount is the minimum allowed size
10029 * @param maxCount is the maximum allowed size
10030 * @return the number of grid rows or columns
10031 */
10032 private getGridRowColCount(step, length, minCount, maxCount);
10033 /**
10034 * Returns the grid index of a given recangle
10035 * @param rect The rectengle to check.
10036 * @return grid index as a thickness object.
10037 */
10038 private getGridIndexRect(rect);
10039 }
10040}
10041declare module powerbi {
10042 import shapes = powerbi.visuals.shapes;
10043 import ISize = shapes.ISize;
10044 import IRect = powerbi.visuals.IRect;
10045 import IPoint = shapes.IPoint;
10046 import SelectableDataPoint = powerbi.visuals.SelectableDataPoint;
10047 /**
10048 * Defines possible data label positions relative to rectangles
10049 */
10050 const enum RectLabelPosition {
10051 /** Position is not defined. */
10052 None = 0,
10053 /** Content is placed inside the parent rectangle in the center. */
10054 InsideCenter = 1,
10055 /** Content is placed inside the parent rectangle at the base. */
10056 InsideBase = 2,
10057 /** Content is placed inside the parent rectangle at the end. */
10058 InsideEnd = 4,
10059 /** Content is placed outside the parent rectangle at the base. */
10060 OutsideBase = 8,
10061 /** Content is placed outside the parent rectangle at the end. */
10062 OutsideEnd = 16,
10063 /** Content supports all possible positions. */
10064 All = 31,
10065 /** Content supports positions inside the rectangle */
10066 InsideAll = 7,
10067 }
10068 /**
10069 * Defines possible data label positions relative to points or circles
10070 */
10071 const enum NewPointLabelPosition {
10072 /** Position is not defined. */
10073 None = 0,
10074 Above = 1,
10075 Below = 2,
10076 Left = 4,
10077 Right = 8,
10078 BelowRight = 16,
10079 BelowLeft = 32,
10080 AboveRight = 64,
10081 AboveLeft = 128,
10082 Center = 256,
10083 All = 511,
10084 }
10085 /**
10086 * Rectangle orientation, defined by vertical vs horizontal and which direction
10087 * the "base" is at.
10088 */
10089 const enum NewRectOrientation {
10090 /** Rectangle with no specific orientation. */
10091 None = 0,
10092 /** Vertical rectangle with base at the bottom. */
10093 VerticalBottomBased = 1,
10094 /** Vertical rectangle with base at the top. */
10095 VerticalTopBased = 2,
10096 /** Horizontal rectangle with base at the left. */
10097 HorizontalLeftBased = 3,
10098 /** Horizontal rectangle with base at the right. */
10099 HorizontalRightBased = 4,
10100 }
10101 const enum LabelDataPointParentType {
10102 Point = 0,
10103 Rectangle = 1,
10104 Polygon = 2,
10105 }
10106 interface LabelParentRect {
10107 /** The rectangle this data label belongs to */
10108 rect: IRect;
10109 /** The orientation of the parent rectangle */
10110 orientation: NewRectOrientation;
10111 /** Valid positions to place the label ordered by preference */
10112 validPositions: RectLabelPosition[];
10113 }
10114 interface LabelParentPoint {
10115 /** The point this data label belongs to */
10116 point: IPoint;
10117 /** The radius of the point to be added to the offset (for circular geometry) */
10118 radius: number;
10119 /** Valid positions to place the label ordered by preference */
10120 validPositions: NewPointLabelPosition[];
10121 }
10122 interface LabelDataPoint {
10123 /** The measured size of the text */
10124 textSize: ISize;
10125 /** Is data label preferred? Preferred labels will be rendered first */
10126 isPreferred: boolean;
10127 /** Whether the parent type is a rectangle, point or polygon */
10128 parentType: LabelDataPointParentType;
10129 /** The parent geometry for the data label */
10130 parentShape: LabelParentRect | LabelParentPoint | LabelParentPolygon;
10131 /** Whether or not the label has a background */
10132 hasBackground?: boolean;
10133 /** Text to be displayed in the label */
10134 text: string;
10135 /** A text that represent the label tooltip */
10136 tooltip?: string;
10137 /** Color to use for the data label if drawn inside */
10138 insideFill: string;
10139 /** Color to use for the data label if drawn outside */
10140 outsideFill: string;
10141 /** The identity of the data point associated with the data label */
10142 identity: powerbi.visuals.SelectionId;
10143 /** The key of the data point associated with the data label (used if identity is not unique to each expected label) */
10144 key?: string;
10145 /** The font size of the data point associated with the data label */
10146 fontSize?: number;
10147 /** Second row of text to be displayed in the label, for additional information */
10148 secondRowText?: string;
10149 /** The calculated weight of the data point associated with the data label */
10150 weight?: number;
10151 /** Whether or not the data label has been rendered */
10152 hasBeenRendered?: boolean;
10153 /** Size of the label adjusted for the background, if necessary */
10154 labelSize?: ISize;
10155 }
10156 interface LabelDataPointsGroup {
10157 labelDataPoints: LabelDataPoint[];
10158 maxNumberOfLabels: number;
10159 }
10160 interface Label extends SelectableDataPoint {
10161 /** Text to be displayed in the label */
10162 text: string;
10163 /** Second row of text to be displayed in the label */
10164 secondRowText?: string;
10165 /** The bounding box for the label */
10166 boundingBox: IRect;
10167 /** Whether or not the data label should be rendered */
10168 isVisible: boolean;
10169 /** The fill color of the data label */
10170 fill: string;
10171 /** A unique key for data points (used if key cannot be obtained from the identity) */
10172 key?: string;
10173 /** The text size of the data label */
10174 fontSize?: number;
10175 /** A text anchor used to override the default label text-anchor (middle) */
10176 textAnchor?: string;
10177 /** points for reference line rendering */
10178 leaderLinePoints?: number[][];
10179 /** Whether or not the label has a background (and text position needs to be adjusted to take that into account) */
10180 hasBackground: boolean;
10181 /** A text that represent the label tooltip */
10182 tooltip?: string;
10183 }
10184 interface GridSubsection {
10185 xMin: number;
10186 xMax: number;
10187 yMin: number;
10188 yMax: number;
10189 }
10190 class LabelArrangeGrid {
10191 private grid;
10192 private viewport;
10193 private cellSize;
10194 private columnCount;
10195 private rowCount;
10196 /**
10197 * A multiplier applied to the largest width height to attempt to balance # of
10198 * labels in each cell and number of cells each label belongs to
10199 */
10200 private static cellSizeMultiplier;
10201 constructor(labelDataPointsGroups: LabelDataPointsGroup[], viewport: IViewport);
10202 /**
10203 * Add a rectangle to check collision against
10204 */
10205 add(rect: IRect): void;
10206 /**
10207 * Check whether the rect conflicts with the grid, either bleeding outside the
10208 * viewport or colliding with another rect added to the grid.
10209 */
10210 hasConflict(rect: IRect): boolean;
10211 /**
10212 * Attempt to position the given rect within the viewport. Returns
10213 * the adjusted rectangle or null if the rectangle couldn't fit,
10214 * conflicts with the viewport, or is too far outside the viewport
10215 */
10216 tryPositionInViewport(rect: IRect): IRect;
10217 /**
10218 * Checks for a collision between the given rect and others in the grid.
10219 * Returns true if there is a collision.
10220 */
10221 private hasCollision(rect);
10222 /**
10223 * Check to see if the given rect is inside the grid's viewport
10224 */
10225 private isWithinGridViewport(rect);
10226 /**
10227 * Checks to see if the rect is close enough to the viewport to be moved inside.
10228 * "Close" here is determined by the distance between the edge of the viewport
10229 * and the closest edge of the rect; if that distance is less than the appropriate
10230 * dimension of the rect, we will reposition the rect.
10231 */
10232 private isCloseToGridViewport(rect);
10233 /**
10234 * Attempt to move the rect inside the grid's viewport. Returns the resulting
10235 * rectangle with the same width/height adjusted to be inside the viewport or
10236 * null if it couldn't fit regardless.
10237 */
10238 private tryMoveInsideViewport(rect);
10239 private getContainingGridSubsection(rect);
10240 private static getCellCount(step, length, minCount, maxCount);
10241 private static bound(value, min, max);
10242 }
10243 interface DataLabelLayoutOptions {
10244 /** The amount of offset to start with when the data label is not centered */
10245 startingOffset: number;
10246 /** Maximum distance labels will be offset by */
10247 maximumOffset: number;
10248 /** The amount to increase the offset each attempt while laying out labels */
10249 offsetIterationDelta?: number;
10250 /** Horizontal padding used for checking whether a label is inside a parent shape */
10251 horizontalPadding?: number;
10252 /** Vertical padding used for checking whether a label is inside a parent shape */
10253 verticalPadding?: number;
10254 /** Should we draw reference lines in case the label offset is greater then the default */
10255 allowLeaderLines?: boolean;
10256 /** Should the layout system attempt to move the label inside the viewport when it outside, but close */
10257 attemptToMoveLabelsIntoViewport?: boolean;
10258 }
10259 class LabelLayout {
10260 /** Maximum distance labels will be offset by */
10261 private maximumOffset;
10262 /** The amount to increase the offset each attempt while laying out labels */
10263 private offsetIterationDelta;
10264 /** The amount of offset to start with when the data label is not centered */
10265 private startingOffset;
10266 /** Padding used for checking whether a label is inside a parent shape */
10267 private horizontalPadding;
10268 /** Padding used for checking whether a label is inside a parent shape */
10269 private verticalPadding;
10270 /** Should we draw leader lines in case the label offset is greater then the default */
10271 private allowLeaderLines;
10272 /** Should the layout system attempt to move the label inside the viewport when it outside, but close */
10273 private attemptToMoveLabelsIntoViewport;
10274 private static defaultOffsetIterationDelta;
10275 private static defaultHorizontalPadding;
10276 private static defaultVerticalPadding;
10277 constructor(options: DataLabelLayoutOptions);
10278 /**
10279 * Arrange takes a set of data labels and lays them out in order, assuming that
10280 * the given array has already been sorted with the most preferred labels at the
10281 * front, taking into considiration a maximum number of labels that are alowed
10282 * to display.
10283 *
10284 * Details:
10285 * - We iterate over offsets from the target position, increasing from 0 while
10286 * verifiying the maximum number of labels to display hasn't been reached
10287 * - For each offset, we iterate over each data label
10288 * - For each data label, we iterate over each position that is valid for
10289 * both the specific label and this layout
10290 * - When a valid position is found, we position the label there and no longer
10291 * reposition it.
10292 * - This prioritizes the earlier labels to be positioned closer to their
10293 * target points in the position they prefer.
10294 * - This prioritizes putting data labels close to a valid position over
10295 * placing them at their preferred position (it will place it at a less
10296 * preferred position if it will be a smaller offset)
10297 */
10298 layout(labelDataPointsGroups: LabelDataPointsGroup[], viewport: IViewport): Label[];
10299 private positionDataLabels(labelDataPoints, viewport, grid, maxLabelsToRender);
10300 private tryPositionForRectPositions(labelPoint, grid, currentLabelOffset, currentCenteredLabelOffset);
10301 /**
10302 * Tests a particular position/offset combination for the given data label.
10303 * If the label can be placed, returns the resulting bounding box for the data
10304 * label. If not, returns null.
10305 */
10306 private static tryPositionRect(grid, position, labelDataPoint, offset, centerOffset, adjustForViewport);
10307 private tryPositionForPointPositions(labelPoint, grid, currentLabelOffset, drawLeaderLines);
10308 private static tryPositionPoint(grid, position, labelDataPoint, offset, adjustForViewport);
10309 }
10310 /**
10311 * (Private) Contains methods for calculating the bounding box of a data label
10312 */
10313 module DataLabelRectPositioner {
10314 function getLabelRect(labelDataPoint: LabelDataPoint, position: RectLabelPosition, offset: number): IRect;
10315 function canFitWithinParent(labelDataPoint: LabelDataPoint, horizontalPadding: number, verticalPadding: number): boolean;
10316 function isLabelWithinParent(labelRect: IRect, labelPoint: LabelDataPoint, horizontalPadding: number, verticalPadding: number): boolean;
10317 function topInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10318 function bottomInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10319 function rightInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10320 function leftInside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10321 function topOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10322 function bottomOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10323 function rightOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10324 function leftOutside(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10325 function middleHorizontal(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10326 function middleVertical(labelSize: ISize, parentRect: IRect, offset: number): IRect;
10327 }
10328 module DataLabelPointPositioner {
10329 const cos45: number;
10330 const sin45: number;
10331 function getLabelRect(labelSize: ISize, parentPoint: LabelParentPoint, position: NewPointLabelPosition, offset: number): IRect;
10332 function above(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10333 function below(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10334 function left(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10335 function right(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10336 function belowLeft(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10337 function belowRight(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10338 function aboveLeft(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10339 function aboveRight(labelSize: ISize, parentPoint: IPoint, offset: number): IRect;
10340 function center(labelSize: ISize, parentPoint: IPoint): IRect;
10341 function getLabelLeaderLineEndingPoint(boundingBox: IRect, position: NewPointLabelPosition, parentShape: LabelParentPoint): number[][];
10342 }
10343}
10344declare module powerbi {
10345 import ISize = powerbi.visuals.shapes.ISize;
10346 import IRect = powerbi.visuals.IRect;
10347 import VisualDataLabelsSettings = powerbi.visuals.VisualDataLabelsSettings;
10348 import DonutArcDescriptor = powerbi.visuals.DonutArcDescriptor;
10349 interface DonutChartProperties {
10350 viewport: IViewport;
10351 dataLabelsSettings: VisualDataLabelsSettings;
10352 radius: number;
10353 arc: D3.Svg.Arc;
10354 outerArc: D3.Svg.Arc;
10355 outerArcRadiusRatio: number;
10356 innerArcRadiusRatio: number;
10357 }
10358 interface DonutLabelDataPoint extends LabelDataPoint {
10359 dataLabel: string;
10360 dataLabelSize: ISize;
10361 categoryLabel: string;
10362 categoryLabelSize: ISize;
10363 donutArcDescriptor: DonutArcDescriptor;
10364 alternativeScale: number;
10365 angle: number;
10366 linesSize: ISize[];
10367 leaderLinePoints: number[][];
10368 }
10369 interface DonutLabelRect {
10370 textRect: IRect;
10371 diagonalLineRect: IRect;
10372 horizontalLineRect: IRect;
10373 }
10374 class DonutLabelLayout {
10375 /** Maximum distance labels will be offset by */
10376 private maximumOffset;
10377 /** The amount to increase the offset each attempt while laying out labels */
10378 private offsetIterationDelta;
10379 /** The amount of offset to start with when the data label is not centered */
10380 private startingOffset;
10381 private donutChartProperties;
10382 private center;
10383 private outerRadius;
10384 private innerRadius;
10385 private additionalCharsWidth;
10386 constructor(options: DataLabelLayoutOptions, donutChartProperties: DonutChartProperties);
10387 /**
10388 * Arrange takes a set of data labels and lays them out them in order, assuming that
10389 * the given array has already been sorted with the most preferred labels at the
10390 * front.
10391 *
10392 * Details:
10393 * - We iterate over offsets from the target position, increasing from 0
10394 * - For each offset, we iterate over each data label
10395 * - For each data label, we iterate over each position that is valid for
10396 * both the specific label and this layout
10397 * - When a valid position is found, we position the label there and no longer
10398 * reposition it.
10399 * - This prioritizes the earlier labels to be positioned closer to their
10400 * target points in the position they prefer.
10401 * - This prioritizes putting data labels close to a valid position over
10402 * placing them at their preferred position (it will place it at a less
10403 * preferred position if it will be a smaller offset)
10404 */
10405 layout(labelDataPoints: DonutLabelDataPoint[]): Label[];
10406 private positionLabels(labelDataPoints, grid);
10407 /**
10408 * We try to move the label 25% up/down if the label is truncated or it collides with other labels.
10409 * after we moved it once we check that the new position doesn't failed (collides with other labels).
10410 */
10411 private tryPositionForDonut(labelPoint, grid, currentLabelOffset);
10412 private generateCandidate(labelDataPoint, candidatePosition, grid, currentLabelOffset);
10413 private tryAllPositions(labelDataPoint, grid, defaultPosition, currentLabelOffset);
10414 private buildLabel(labelLayout, grid);
10415 private static tryPositionPoint(grid, position, labelDataPoint, offset, center, viewport);
10416 /**
10417 * Returns an array of valid positions for hidden and truncated labels.
10418 * For truncated labels will return positions with more available space.
10419 * For hidden labels will return all possible positions by the order we draw labels (clockwise)
10420 */
10421 private getLabelPointPositions(labelPoint, isTruncated);
10422 /**
10423 * Returns a new DonutLabelDataPoint after splitting it into two lines
10424 */
10425 private splitDonutDataPoint(labelPoint);
10426 private generateCandidateAngleForPosition(d, position);
10427 private getPointPositionForAngle(angle);
10428 private score(labelPoint, point);
10429 }
10430}
10431declare module powerbi {
10432 import IPoint = powerbi.visuals.IPoint;
10433 import IRect = powerbi.visuals.IRect;
10434 import Polygon = powerbi.visuals.shapes.Polygon;
10435 import Transform = powerbi.visuals.Transform;
10436 interface LabelParentPolygon {
10437 /** The point this data label belongs to */
10438 polygon: Polygon;
10439 /** Valid positions to place the label ordered by preference */
10440 validPositions: NewPointLabelPosition[];
10441 }
10442 interface FilledMapLabel extends Label {
10443 absoluteBoundingBoxCenter: IPoint;
10444 originalPixelOffset: number;
10445 originalPosition?: NewPointLabelPosition;
10446 originalAbsoluteCentroid?: IPoint;
10447 absoluteStemSource?: IPoint;
10448 isPlacedInsidePolygon: boolean;
10449 }
10450 class FilledMapLabelLayout {
10451 private labels;
10452 layout(labelDataPoints: LabelDataPoint[], viewport: IViewport, polygonInfoTransform: Transform, redrawDataLabels: boolean): Label[];
10453 getLabelPolygon(mapDataPoint: LabelDataPoint, position: NewPointLabelPosition, pointPosition: IPoint, offset: number): IRect;
10454 private getLabelBoundingBox(dataPointSize, position, pointPosition, offset);
10455 private getLabelByPolygonPositions(labelPoint, polygonInfoTransform, grid, shapesGrid);
10456 private setLeaderLinePoints(stemSource, stemDestination);
10457 private calculateStemSource(polygonInfoTransform, inverseTransorm, polygon, labelBoundingBox, position, pixelCentroid);
10458 private calculateStemDestination(labelBoundingBox, position);
10459 private tryPositionForPolygonPosition(position, labelDataPoint, polygonInfoTransform, offset, inverseTransorm);
10460 /**
10461 * Tests a particular position/offset combination for the given data label.
10462 * If the label can be placed, returns the resulting bounding box for the data
10463 * label. If not, returns null.
10464 */
10465 private tryPlaceLabelOutsidePolygon(grid, position, labelDataPoint, offset, pixelCentroid, shapesGrid, inverseTransform);
10466 private updateLabelOffsets(polygonInfoTransform);
10467 private getAbsoluteRectangle(inverseTransorm, rect);
10468 }
10469 class LabelPolygonArrangeGrid {
10470 private grid;
10471 private viewport;
10472 private cellSize;
10473 private columnCount;
10474 private rowCount;
10475 /**
10476 * A multiplier applied to the largest width height to attempt to balance # of
10477 * polygons in each cell and number of cells each polygon belongs to
10478 */
10479 private static cellSizeMultiplier;
10480 constructor(polygons: Polygon[], viewport: IViewport);
10481 hasConflict(absolutLabelRect: IRect, pixelLabelRect: IRect): boolean;
10482 private add(polygon);
10483 private getContainingGridSubsection(rect);
10484 private static getCellCount(step, length, minCount, maxCount);
10485 private static bound(value, min, max);
10486 }
10487}
10488declare module powerbi.visuals {
10489 function createColorAllocatorFactory(): IColorAllocatorFactory;
10490}
10491declare module powerbi.visuals {
10492 class DefaultVisualHostServices implements IVisualHostServices {
10493 static initialize(): void;
10494 /**
10495 * Create locale options.
10496 *
10497 * Note: Public for testability.
10498 */
10499 static createLocaleOptions(): visuals.ValueFormatterLocalizationOptions;
10500 static createTooltipLocaleOptions(): powerbi.visuals.TooltipLocalizationOptions;
10501 getLocalizedString(stringId: string): string;
10502 onDragStart(): void;
10503 canSelect(): boolean;
10504 onSelect(): void;
10505 onContextMenu(): void;
10506 loadMoreData(): void;
10507 persistProperties(changes: VisualObjectInstance[] | VisualObjectInstancesToPersist): void;
10508 onCustomSort(args: CustomSortEventArgs): void;
10509 getViewMode(): powerbi.ViewMode;
10510 setWarnings(warnings: IVisualWarning[]): void;
10511 setToolbar($toolbar: JQuery): void;
10512 shouldRetainSelection(): boolean;
10513 geocoder(): IGeocoder;
10514 geolocation(): IGeolocation;
10515 promiseFactory(): IPromiseFactory;
10516 analyzeFilter(options: FilterAnalyzerOptions): AnalyzedFilter;
10517 getIdentityDisplayNames(dentities: DataViewScopeIdentity[]): DisplayNameIdentityPair[];
10518 setIdentityDisplayNames(displayNamesIdentityPairs: DisplayNameIdentityPair[]): void;
10519 private static beautify(format);
10520 private static describeUnit(exponent);
10521 }
10522 const defaultVisualHostServices: IVisualHostServices;
10523}
10524declare module powerbi.visuals {
10525 interface SelectableDataPoint {
10526 selected: boolean;
10527 identity: SelectionId;
10528 }
10529 /**
10530 * Factory method to create an IInteractivityService instance.
10531 */
10532 function createInteractivityService(hostServices: IVisualHostServices): IInteractivityService;
10533 /**
10534 * Creates a clear an svg rect to catch clear clicks.
10535 */
10536 function appendClearCatcher(selection: D3.Selection): D3.Selection;
10537 function isCategoryColumnSelected(propertyId: DataViewObjectPropertyIdentifier, categories: DataViewCategoricalColumn, idx: number): boolean;
10538 function dataHasSelection(data: SelectableDataPoint[]): boolean;
10539 interface IInteractiveBehavior {
10540 bindEvents(behaviorOptions: any, selectionHandler: ISelectionHandler): void;
10541 renderSelection(hasSelection: boolean): void;
10542 }
10543 /**
10544 * An optional options bag for binding to the interactivityService
10545 */
10546 interface InteractivityServiceOptions {
10547 isLegend?: boolean;
10548 isLabels?: boolean;
10549 overrideSelectionFromData?: boolean;
10550 hasSelectionOverride?: boolean;
10551 slicerDefaultValueHandler?: SlicerDefaultValueHandler;
10552 }
10553 /**
10554 * Responsible for managing interactivity between the hosting visual and its peers
10555 */
10556 interface IInteractivityService {
10557 /** Binds the visual to the interactivityService */
10558 bind(dataPoints: SelectableDataPoint[], behavior: IInteractiveBehavior, behaviorOptions: any, iteractivityServiceOptions?: InteractivityServiceOptions): any;
10559 /** Clears the selection */
10560 clearSelection(): void;
10561 /** Sets the selected state on the given data points. */
10562 applySelectionStateToData(dataPoints: SelectableDataPoint[]): boolean;
10563 /** Checks whether there is at least one item selected */
10564 hasSelection(): boolean;
10565 /** Checks whether there is at least one item selected within the legend */
10566 legendHasSelection(): boolean;
10567 /** Checks whether the selection mode is inverted or normal */
10568 isSelectionModeInverted(): boolean;
10569 /** Sets whether the selection mode is inverted or normal */
10570 setSelectionModeInverted(inverted: boolean): void;
10571 setDefaultValueMode(useDefaultValue: boolean): void;
10572 isDefaultValueEnabled(): boolean;
10573 }
10574 interface ISelectionHandler {
10575 /** Handles a selection event by selecting the given data point */
10576 handleSelection(dataPoint: SelectableDataPoint, multiSelect: boolean): void;
10577 /** Handles a request for a context menu. */
10578 handleContextMenu(dataPoint: SelectableDataPoint, position: IPoint): void;
10579 /** Handles a selection clear, clearing all selection state */
10580 handleClearSelection(): void;
10581 /** Toggles the selection mode between normal and inverted; returns true if the new mode is inverted */
10582 toggleSelectionModeInversion(): boolean;
10583 /** Sends the selection state to the host */
10584 persistSelectionFilter(filterPropertyIdentifier: DataViewObjectPropertyIdentifier): void;
10585 }
10586 class InteractivityService implements IInteractivityService, ISelectionHandler {
10587 private hostService;
10588 private renderSelectionInVisual;
10589 private renderSelectionInLegend;
10590 private renderSelectionInLabels;
10591 private selectedIds;
10592 private isInvertedSelectionMode;
10593 private hasSelectionOverride;
10594 private behavior;
10595 private slicerDefaultValueHandler;
10596 private useDefaultValue;
10597 selectableDataPoints: SelectableDataPoint[];
10598 selectableLegendDataPoints: SelectableDataPoint[];
10599 selectableLabelsDataPoints: SelectableDataPoint[];
10600 constructor(hostServices: IVisualHostServices);
10601 /** Binds the vsiual to the interactivityService */
10602 bind(dataPoints: SelectableDataPoint[], behavior: IInteractiveBehavior, behaviorOptions: any, options?: InteractivityServiceOptions): void;
10603 /**
10604 * Sets the selected state of all selectable data points to false and invokes the behavior's select command.
10605 */
10606 clearSelection(): void;
10607 applySelectionStateToData(dataPoints: SelectableDataPoint[]): boolean;
10608 /**
10609 * Checks whether there is at least one item selected.
10610 */
10611 hasSelection(): boolean;
10612 legendHasSelection(): boolean;
10613 labelsHasSelection(): boolean;
10614 isSelectionModeInverted(): boolean;
10615 setSelectionModeInverted(inverted: boolean): void;
10616 handleSelection(dataPoint: SelectableDataPoint, multiSelect: boolean): void;
10617 handleContextMenu(dataPoint: SelectableDataPoint, point: IPoint): void;
10618 handleClearSelection(): void;
10619 toggleSelectionModeInversion(): boolean;
10620 persistSelectionFilter(filterPropertyIdentifier: DataViewObjectPropertyIdentifier): void;
10621 setDefaultValueMode(useDefaultValue: boolean): void;
10622 isDefaultValueEnabled(): boolean;
10623 private renderAll();
10624 /** Marks a data point as selected and syncs selection with the host. */
10625 private select(d, multiSelect);
10626 private selectInverted(d, multiSelect);
10627 private removeId(toRemove);
10628 /** Note: Public for UnitTesting */
10629 createChangeForFilterProperty(filterPropertyIdentifier: DataViewObjectPropertyIdentifier): VisualObjectInstancesToPersist;
10630 private sendContextMenuToHost(dataPoint, position);
10631 private sendSelectionToHost();
10632 private getSelectorsByColumn(selectionIds);
10633 private takeSelectionStateFromDataPoints(dataPoints);
10634 /**
10635 * Syncs the selection state for all data points that have the same category. Returns
10636 * true if the selection state was out of sync and corrections were made; false if
10637 * the data is already in sync with the service.
10638 *
10639 * If the data is not compatible with the current service's current selection state,
10640 * the state is cleared and the cleared selection is sent to the host.
10641 *
10642 * Ignores series for now, since we don't support series selection at the moment.
10643 */
10644 private syncSelectionState();
10645 private syncSelectionStateInverted();
10646 private applyToAllSelectableDataPoints(action);
10647 private static updateSelectableDataPointsBySelectedIds(selectableDataPoints, selectedIds);
10648 private static checkDatapointAgainstSelectedIds(datapoint, selectedIds);
10649 private removeSelectionIdsWithOnlyMeasures();
10650 private removeSelectionIdsExceptOnlyMeasures();
10651 }
10652}
10653declare module powerbi.visuals.services {
10654 function createGeocoder(): IGeocoder;
10655 interface BingAjaxService {
10656 (url: string, settings: JQueryAjaxSettings): any;
10657 }
10658 const safeCharacters: string;
10659 /** Note: Used for test mockup */
10660 let BingAjaxCall: BingAjaxService;
10661 const CategoryTypeArray: string[];
10662 function isCategoryType(value: string): boolean;
10663 const BingEntities: {
10664 Continent: string;
10665 Sovereign: string;
10666 CountryRegion: string;
10667 AdminDivision1: string;
10668 AdminDivision2: string;
10669 PopulatedPlace: string;
10670 Postcode: string;
10671 Postcode1: string;
10672 Neighborhood: string;
10673 Address: string;
10674 };
10675 interface ILocation {
10676 latitude: number;
10677 longitude: number;
10678 }
10679 interface ILocationRect {
10680 northWest: ILocation;
10681 southEast: ILocation;
10682 }
10683 interface GeocodeCallback {
10684 (error: Error, coordinate: IGeocodeCoordinate): void;
10685 }
10686 interface IGeocodeQuery {
10687 query: string;
10688 category: string;
10689 levelOfDetail?: number;
10690 longitude?: number;
10691 latitude?: number;
10692 }
10693 class GeocodeQuery implements IGeocodeQuery {
10694 query: string;
10695 category: string;
10696 key: string;
10697 constructor(query: string, category: string);
10698 getBingEntity(): string;
10699 getUrl(): string;
10700 }
10701 class GeocodePointQuery extends GeocodeQuery {
10702 latitude: number;
10703 longitude: number;
10704 constructor(latitude: number, longitude: number);
10705 getUrl(): string;
10706 }
10707 class GeocodeBoundaryQuery extends GeocodeQuery {
10708 latitude: number;
10709 longitude: number;
10710 levelOfDetail: number;
10711 maxGeoData: number;
10712 constructor(latitude: number, longitude: number, category: any, levelOfDetail: any, maxGeoData?: number);
10713 getBingEntity(): string;
10714 getUrl(): string;
10715 }
10716 function geocodeCore(geocodeQuery: GeocodeQuery): any;
10717 function geocode(query: string, category?: string): any;
10718 function geocodeBoundary(latitude: number, longitude: number, category?: string, levelOfDetail?: number, maxGeoData?: number): any;
10719 function geocodePoint(latitude: number, longitude: number): any;
10720 function reset(): void;
10721}
10722declare module powerbi.visuals.services {
10723 interface IGeocodingCache {
10724 getCoordinates(key: string): IGeocodeCoordinate;
10725 registerCoordinates(key: string, coordinate: IGeocodeCoordinate): void;
10726 registerCoordinates(key: string, coordinate: IGeocodeBoundaryCoordinate): void;
10727 }
10728 function createGeocodingCache(maxCacheSize: number, maxCacheSizeOverflow: number, localStorageService?: IStorageService): IGeocodingCache;
10729}
10730declare module powerbi.visuals.services {
10731 function createGeolocation(): IGeolocation;
10732}
10733declare module powerbi.visuals {
10734 interface IVisualPluginService {
10735 getPlugin(type: string): IVisualPlugin;
10736 getVisuals(): IVisualPlugin[];
10737 capabilities(type: string): VisualCapabilities;
10738 removeAnyCustomVisuals(): void;
10739 requireSandbox(plugin: IVisualPlugin): boolean;
10740 isCustomVisual(visual: string): boolean;
10741 isScriptVisual(type: string): boolean;
10742 isScriptVisualQueryable(): boolean;
10743 shouldDisableVisual(type: string, mapDisabled: boolean): boolean;
10744 getInteractivityOptions(visualType: string): InteractivityOptions;
10745 }
10746 interface MinervaVisualFeatureSwitches {
10747 /**
10748 * This feature switch enables the data-dot & column combo charts.
10749 */
10750 dataDotChartEnabled?: boolean;
10751 /**
10752 * Visual should prefer to request a higher volume of data.
10753 */
10754 preferHigherDataVolume?: boolean;
10755 sandboxVisualsEnabled?: boolean;
10756 /**
10757 * R visual is enabled for consumption.
10758 * When turned on, R script will be executed against local R (for PBID) or AML (for PBI.com).
10759 * When turned off, R script will not be executed and the visual is treated as a static image visual.
10760 */
10761 scriptVisualEnabled?: boolean;
10762 /**
10763 * R visual is enabled for authoring.
10764 * When turned on, R visual will appear in the visual gallery.
10765 */
10766 scriptVisualAuthoringEnabled?: boolean;
10767 isLabelInteractivityEnabled?: boolean;
10768 sunburstVisualEnabled?: boolean;
10769 filledMapDataLabelsEnabled?: boolean;
10770 lineChartLabelDensityEnabled?: boolean;
10771 /**
10772 * Enables button to center map to the current location
10773 */
10774 mapCurrentLocationEnabled?: boolean;
10775 /**
10776 * Enables conditional formatting of the background color of cells for table visuals.
10777 */
10778 conditionalFormattingEnabled?: boolean;
10779 }
10780 interface SmallViewPortProperties {
10781 cartesianSmallViewPortProperties: CartesianSmallViewPortProperties;
10782 gaugeSmallViewPortProperties: GaugeSmallViewPortProperties;
10783 funnelSmallViewPortProperties: FunnelSmallViewPortProperties;
10784 DonutSmallViewPortProperties: DonutSmallViewPortProperties;
10785 }
10786 interface CreateDashboardOptions {
10787 tooltipsEnabled: boolean;
10788 }
10789 module visualPluginFactory {
10790 class VisualPluginService implements IVisualPluginService {
10791 private plugins;
10792 protected featureSwitches: MinervaVisualFeatureSwitches;
10793 constructor(featureSwitches: MinervaVisualFeatureSwitches);
10794 /**
10795 * Gets metadata for all registered.
10796 */
10797 getVisuals(): IVisualPlugin[];
10798 getPlugin(type: string): IVisualPlugin;
10799 capabilities(type: string): VisualCapabilities;
10800 requireSandbox(plugin: IVisualPlugin): boolean;
10801 removeAnyCustomVisuals(): void;
10802 isCustomVisual(visual: string): boolean;
10803 isScriptVisual(type: string): boolean;
10804 shouldDisableVisual(type: string, mapDisabled: boolean): boolean;
10805 isScriptVisualQueryable(): boolean;
10806 getInteractivityOptions(visualType: string): InteractivityOptions;
10807 }
10808 function createPlugin(visualPlugins: jsCommon.IStringDictionary<IVisualPlugin>, base: IVisualPlugin, create: IVisualFactoryMethod, modifyPluginFn?: (plugin: IVisualPlugin) => void): void;
10809 class PlaygroundVisualPluginService extends VisualPluginService {
10810 private visualPlugins;
10811 constructor();
10812 getVisuals(): IVisualPlugin[];
10813 getPlugin(type: string): IVisualPlugin;
10814 capabilities(type: string): VisualCapabilities;
10815 }
10816 /**
10817 * This plug-in service is used when displaying visuals on the dashboard.
10818 */
10819 class DashboardPluginService extends VisualPluginService {
10820 private visualPlugins;
10821 constructor(featureSwitches: MinervaVisualFeatureSwitches, options: CreateDashboardOptions);
10822 getPlugin(type: string): IVisualPlugin;
10823 requireSandbox(plugin: IVisualPlugin): boolean;
10824 }
10825 class InsightsPluginService extends VisualPluginService {
10826 private visualPlugins;
10827 constructor(featureSwitches: MinervaVisualFeatureSwitches);
10828 getPlugin(type: string): IVisualPlugin;
10829 requireSandbox(plugin: IVisualPlugin): boolean;
10830 }
10831 class MobileVisualPluginService extends VisualPluginService {
10832 private visualPlugins;
10833 private smallViewPortProperties;
10834 static MinHeightLegendVisible: number;
10835 static MinHeightAxesVisible: number;
10836 static MinHeightGaugeSideNumbersVisible: number;
10837 static GaugeMarginsOnSmallViewPort: number;
10838 static MinHeightFunnelCategoryLabelsVisible: number;
10839 static MaxHeightToScaleDonutLegend: number;
10840 constructor(smallViewPortProperties?: SmallViewPortProperties, featureSwitches?: MinervaVisualFeatureSwitches);
10841 getPlugin(type: string): IVisualPlugin;
10842 requireSandbox(plugin: IVisualPlugin): boolean;
10843 private getMapThrottleInterval();
10844 getInteractivityOptions(visualType: string): InteractivityOptions;
10845 private getMobileOverflowString(visualType);
10846 private isChartSupportInteractivity(visualType);
10847 }
10848 function create(): IVisualPluginService;
10849 function createVisualPluginService(featureSwitch: MinervaVisualFeatureSwitches): IVisualPluginService;
10850 function createDashboard(featureSwitches: MinervaVisualFeatureSwitches, options: CreateDashboardOptions): IVisualPluginService;
10851 function createInsights(featureSwitches: MinervaVisualFeatureSwitches): IVisualPluginService;
10852 function createMobile(smallViewPortProperties?: SmallViewPortProperties, featureSwitches?: MinervaVisualFeatureSwitches): IVisualPluginService;
10853 }
10854}
10855declare module powerbi.visuals.controls {
10856 function fire(eventHandlers: any, eventArgs: any): void;
10857 class ScrollbarButton {
10858 static MIN_WIDTH: number;
10859 static ARROW_COLOR: string;
10860 private _element;
10861 private _polygon;
10862 private _svg;
10863 private _owner;
10864 private _direction;
10865 private _timerHandle;
10866 private _mouseUpWrapper;
10867 constructor(owner: Scrollbar, direction: number);
10868 element: HTMLDivElement;
10869 private createView();
10870 private onMouseDown(event);
10871 private onMouseUp(event);
10872 arrange(width: number, height: number, angle: number): void;
10873 }
10874 /** Scrollbar base class */
10875 class Scrollbar {
10876 static DefaultScrollbarWidth: string;
10877 private static ScrollbarBackgroundFirstTimeMousedownHoldDelay;
10878 private static ScrollbarBackgroundMousedownHoldDelay;
10879 private static MouseWheelRange;
10880 static className: string;
10881 static barClassName: string;
10882 static arrowClassName: string;
10883 MIN_BAR_SIZE: number;
10884 min: number;
10885 max: number;
10886 viewMin: number;
10887 viewSize: number;
10888 smallIncrement: number;
10889 _onscroll: any[];
10890 private _actualWidth;
10891 private _actualHeight;
10892 private _actualButtonWidth;
10893 private _actualButtonHeight;
10894 private _width;
10895 private _height;
10896 private _visible;
10897 private _element;
10898 private _minButton;
10899 private _maxButton;
10900 private _middleBar;
10901 private _timerHandle;
10902 private _screenToOffsetScale;
10903 private _screenPrevMousePos;
10904 private _screenMinMousePos;
10905 private _screenMaxMousePos;
10906 private _backgroundMouseUpWrapper;
10907 private _middleBarMouseMoveWrapper;
10908 private _middleBarMouseUpWrapper;
10909 private _touchPanel;
10910 private _offsetTouchStartPos;
10911 private _offsetTouchPrevPos;
10912 private _touchStarted;
10913 private _allowMouseDrag;
10914 constructor(parentElement: HTMLElement, layoutKind: TablixLayoutKind);
10915 scrollBy(delta: number): void;
10916 scrollUp(): void;
10917 scrollDown(): void;
10918 scrollPageUp(): void;
10919 scrollPageDown(): void;
10920 width: string;
10921 height: string;
10922 refresh(): void;
10923 element: HTMLDivElement;
10924 maxButton: ScrollbarButton;
10925 middleBar: HTMLDivElement;
10926 _scrollSmallIncrement(direction: any): void;
10927 visible: boolean;
10928 isInMouseCapture: boolean;
10929 show(value: boolean): void;
10930 _getMouseOffset(event: MouseEvent): {
10931 x: number;
10932 y: number;
10933 };
10934 _getOffsetXDelta(event: MouseEvent): number;
10935 _getOffsetYDelta(event: MouseEvent): number;
10936 _getOffsetXTouchDelta(event: MouseEvent): number;
10937 _getOffsetYTouchDelta(event: MouseEvent): number;
10938 initTouch(panel: HTMLElement, allowMouseDrag?: boolean): void;
10939 onTouchStart(e: any): void;
10940 onTouchMove(e: any): void;
10941 onTouchEnd(e: any): void;
10942 onTouchMouseDown(e: MouseEvent): void;
10943 _getOffsetTouchDelta(e: MouseEvent): number;
10944 onTouchMouseMove(e: MouseEvent): void;
10945 onTouchMouseUp(e: MouseEvent, bubble?: boolean): void;
10946 registerElementForMouseWheelScrolling(element: HTMLElement): void;
10947 private createView(parentElement, layoutKind);
10948 private scrollTo(pos);
10949 _scrollByPage(event: MouseEvent): void;
10950 _getRunningSize(net: boolean): number;
10951 _getOffsetDelta(event: MouseEvent): number;
10952 private scroll(event);
10953 actualWidth: number;
10954 actualHeight: number;
10955 actualButtonWidth: number;
10956 actualButtonHeight: number;
10957 arrange(): void;
10958 _calculateButtonWidth(): number;
10959 _calculateButtonHeight(): number;
10960 _getMinButtonAngle(): number;
10961 _getMaxButtonAngle(): number;
10962 _setMaxButtonPosition(): void;
10963 invalidateArrange(): void;
10964 private onHoldBackgroundMouseDown(event);
10965 private onBackgroundMouseDown(event);
10966 private onBackgroundMouseUp(event);
10967 private getPinchZoomY();
10968 private onMiddleBarMouseDown(event);
10969 private onMiddleBarMouseMove(event);
10970 private onMiddleBarMouseUp(event);
10971 _getScreenContextualLeft(element: HTMLElement): number;
10972 _getScreenContextualRight(element: HTMLElement): number;
10973 onMouseWheel(e: MouseWheelEvent): void;
10974 onFireFoxMouseWheel(e: MouseWheelEvent): void;
10975 private mouseWheel(delta);
10976 _getScreenMousePos(event: MouseEvent): any;
10977 static addDocumentMouseUpEvent(func: any): void;
10978 static removeDocumentMouseUpEvent(func: any): void;
10979 static addDocumentMouseMoveEvent(func: any): void;
10980 static removeDocumentMouseMoveEvent(func: any): void;
10981 }
10982 /** Horizontal Scrollbar */
10983 class HorizontalScrollbar extends Scrollbar {
10984 constructor(parentElement: HTMLElement, layoutKind: TablixLayoutKind);
10985 _calculateButtonWidth(): number;
10986 _calculateButtonHeight(): number;
10987 _getMinButtonAngle(): number;
10988 _getMaxButtonAngle(): number;
10989 _setMaxButtonPosition(): void;
10990 refresh(): void;
10991 show(visible: boolean): void;
10992 _scrollByPage(event: MouseEvent): void;
10993 _getRunningSize(net: boolean): number;
10994 _getOffsetDelta(event: MouseEvent): number;
10995 _getOffsetTouchDelta(e: MouseEvent): number;
10996 _getScreenContextualLeft(element: HTMLElement): number;
10997 _getScreenContextualRight(element: HTMLElement): number;
10998 _getScreenMousePos(event: MouseEvent): number;
10999 }
11000 /** Vertical Scrollbar */
11001 class VerticalScrollbar extends Scrollbar {
11002 constructor(parentElement: HTMLElement, layoutKind: TablixLayoutKind);
11003 _calculateButtonWidth(): number;
11004 _calculateButtonHeight(): number;
11005 _getMinButtonAngle(): number;
11006 _getMaxButtonAngle(): number;
11007 _setMaxButtonPosition(): void;
11008 refresh(): void;
11009 show(visible: boolean): void;
11010 _scrollByPage(event: MouseEvent): void;
11011 _getRunningSize(net: boolean): number;
11012 _getOffsetDelta(event: MouseEvent): number;
11013 _getOffsetTouchDelta(e: MouseEvent): number;
11014 _getScreenContextualLeft(element: HTMLElement): number;
11015 _getScreenContextualRight(element: HTMLElement): number;
11016 _getScreenMousePos(event: MouseEvent): number;
11017 }
11018}
11019declare module powerbi.visuals.controls.internal {
11020 /** This class is responsible for tablix header resizing */
11021 class TablixResizer {
11022 private _element;
11023 private _handler;
11024 private _elementMouseDownWrapper;
11025 private _elementMouseMoveWrapper;
11026 private _elementMouseOutWrapper;
11027 private _elementMouseDoubleClickOutWrapper;
11028 private _documentMouseMoveWrapper;
11029 private _documentMouseUpWrapper;
11030 private _startMousePosition;
11031 private _originalCursor;
11032 static resizeHandleSize: number;
11033 static resizeCursor: string;
11034 constructor(element: HTMLElement, handler: ITablixResizeHandler);
11035 static addDocumentMouseUpEvent(listener: EventListener): void;
11036 static removeDocumentMouseUpEvent(listener: EventListener): void;
11037 static addDocumentMouseMoveEvent(listener: EventListener): void;
11038 static removeDocumentMouseMoveEvent(listener: EventListener): void;
11039 static getMouseCoordinates(event: MouseEvent): {
11040 x: number;
11041 y: number;
11042 };
11043 static getMouseCoordinateDelta(previous: {
11044 x: number;
11045 y: number;
11046 }, current: {
11047 x: number;
11048 y: number;
11049 }): {
11050 x: number;
11051 y: number;
11052 };
11053 initialize(): void;
11054 uninitialize(): void;
11055 cell: TablixCell;
11056 element: HTMLElement;
11057 _hotSpot(position: {
11058 x: number;
11059 y: number;
11060 }): boolean;
11061 private onElementMouseDown(event);
11062 private onElementMouseMove(event);
11063 private onElementMouseOut(event);
11064 private onElementMouseDoubleClick(event);
11065 private onDocumentMouseMove(event);
11066 private onDocumentMouseUp(event);
11067 }
11068 class TablixDomResizer extends TablixResizer {
11069 private _cell;
11070 constructor(cell: TablixCell, element: HTMLElement, handler: ITablixResizeHandler);
11071 cell: TablixCell;
11072 _hotSpot(position: {
11073 x: number;
11074 y: number;
11075 }): boolean;
11076 }
11077 class TablixCellPresenter {
11078 static _dragResizeDisabledAttributeName: string;
11079 private _owner;
11080 private _tableCell;
11081 /** Outer DIV */
11082 private _contentElement;
11083 /** Inner DIV */
11084 private _contentHost;
11085 private _resizer;
11086 layoutKind: TablixLayoutKind;
11087 constructor(fitProportionally: boolean, layoutKind: TablixLayoutKind);
11088 initialize(owner: TablixCell): void;
11089 owner: TablixCell;
11090 registerTableCell(tableCell: HTMLTableCellElement): void;
11091 tableCell: HTMLTableCellElement;
11092 /**
11093 * Outer DIV
11094 */
11095 contentElement: HTMLElement;
11096 /**
11097 * Inner DIV
11098 */
11099 contentHost: HTMLElement;
11100 registerClickHandler(handler: (e: MouseEvent) => any): void;
11101 unregisterClickHandler(): void;
11102 onContainerWidthChanged(value: number): void;
11103 onContinerHeightChanged(height: number): void;
11104 onColumnSpanChanged(value: number): void;
11105 onRowSpanChanged(value: number): void;
11106 onTextAlignChanged(value: string): void;
11107 onClear(): void;
11108 onHorizontalScroll(width: number, offset: number): void;
11109 onVerticalScroll(height: number, offset: number): void;
11110 onInitializeScrolling(): void;
11111 enableHorizontalResize(enable: boolean, handler: ITablixResizeHandler): void;
11112 /**
11113 * In order to allow dragging of the tableCell we need to
11114 * disable dragging of the container of the cell in IE.
11115 */
11116 disableDragResize(): void;
11117 }
11118 class TablixRowPresenter {
11119 private _row;
11120 private _tableRow;
11121 private _fitProportionally;
11122 constructor(fitProportionally: boolean);
11123 initialize(row: TablixRow): void;
11124 createCellPresenter(layoutKind: controls.TablixLayoutKind): TablixCellPresenter;
11125 registerRow(tableRow: HTMLTableRowElement): void;
11126 onAppendCell(cell: TablixCell): void;
11127 onInsertCellBefore(cell: TablixCell, refCell: TablixCell): void;
11128 onRemoveCell(cell: TablixCell): void;
11129 getHeight(): number;
11130 getCellHeight(cell: ITablixCell): number;
11131 getCellContentHeight(cell: ITablixCell): number;
11132 tableRow: HTMLTableRowElement;
11133 }
11134 class DashboardRowPresenter extends TablixRowPresenter {
11135 private _gridPresenter;
11136 constructor(gridPresenter: DashboardTablixGridPresenter, fitProportionally: boolean);
11137 getCellHeight(cell: ITablixCell): number;
11138 getCellContentHeight(cell: ITablixCell): number;
11139 }
11140 class CanvasRowPresenter extends TablixRowPresenter {
11141 getCellHeight(cell: ITablixCell): number;
11142 getCellContentHeight(cell: ITablixCell): number;
11143 }
11144 class TablixColumnPresenter {
11145 protected _column: TablixColumn;
11146 initialize(column: TablixColumn): void;
11147 getWidth(): number;
11148 getCellWidth(cell: ITablixCell): number;
11149 getCellContentWidth(cell: ITablixCell): number;
11150 }
11151 class DashboardColumnPresenter extends TablixColumnPresenter {
11152 private _gridPresenter;
11153 constructor(gridPresenter: DashboardTablixGridPresenter);
11154 getCellWidth(cell: ITablixCell): number;
11155 getCellContentWidth(cell: ITablixCell): number;
11156 }
11157 class CanvasColumnPresenter extends TablixColumnPresenter {
11158 private _gridPresenter;
11159 private _columnIndex;
11160 constructor(gridPresenter: CanvasTablixGridPresenter, index: number);
11161 getCellWidth(cell: ITablixCell): number;
11162 getCellContentWidth(cell: ITablixCell): number;
11163 }
11164 class TablixGridPresenter {
11165 protected _table: HTMLTableElement;
11166 protected _owner: TablixGrid;
11167 private _footerTable;
11168 private _columnWidthManager;
11169 constructor(columnWidthManager?: TablixColumnWidthManager);
11170 initialize(owner: TablixGrid, gridHost: HTMLElement, footerHost: HTMLElement, control: TablixControl): void;
11171 getWidth(): number;
11172 getHeight(): number;
11173 getScreenToCssRatioX(): number;
11174 getScreenToCssRatioY(): number;
11175 createRowPresenter(): TablixRowPresenter;
11176 createColumnPresenter(index: number): TablixColumnPresenter;
11177 onAppendRow(row: TablixRow): void;
11178 onInsertRowBefore(row: TablixRow, refRow: TablixRow): void;
11179 onRemoveRow(row: TablixRow): void;
11180 onAddFooterRow(row: TablixRow): void;
11181 onClear(): void;
11182 onFillColumnsProportionallyChanged(value: boolean): void;
11183 invokeColumnResizeEndCallback(columnIndex: number, width: number): void;
11184 getPersistedCellWidth(columnIndex: number): number;
11185 }
11186 class DashboardTablixGridPresenter extends TablixGridPresenter {
11187 private _sizeComputationManager;
11188 constructor(sizeComputationManager: SizeComputationManager);
11189 createRowPresenter(): TablixRowPresenter;
11190 createColumnPresenter(index: number): TablixColumnPresenter;
11191 sizeComputationManager: SizeComputationManager;
11192 getWidth(): number;
11193 getHeight(): number;
11194 }
11195 class CanvasTablixGridPresenter extends TablixGridPresenter {
11196 constructor(columnWidthManager: TablixColumnWidthManager);
11197 createRowPresenter(): TablixRowPresenter;
11198 createColumnPresenter(index: number): TablixColumnPresenter;
11199 getWidth(): number;
11200 getHeight(): number;
11201 }
11202}
11203declare module powerbi.visuals.controls.internal {
11204 /**
11205 * Base class for Tablix realization manager.
11206 */
11207 class TablixDimensionRealizationManager {
11208 private _realizedLeavesCount;
11209 private _adjustmentFactor;
11210 private _itemsToRealizeCount;
11211 private _itemsEstimatedContextualWidth;
11212 private _binder;
11213 constructor(binder: ITablixBinder);
11214 _getOwner(): DimensionLayoutManager;
11215 binder: ITablixBinder;
11216 adjustmentFactor: number;
11217 itemsToRealizeCount: number;
11218 itemsEstimatedContextualWidth: number;
11219 onStartRenderingIteration(): void;
11220 onEndRenderingIteration(gridContextualWidth: number, filled: boolean): void;
11221 onEndRenderingSession(): void;
11222 onCornerCellRealized(item: any, cell: ITablixCell): void;
11223 onHeaderRealized(item: any, cell: ITablixCell, leaf: boolean): void;
11224 needsToRealize: boolean;
11225 _getEstimatedItemsToRealizeCount(): void;
11226 _getSizeAdjustment(gridContextualWidth: number): number;
11227 }
11228 /**
11229 * DOM implementation for Row Tablix realization manager.
11230 */
11231 class RowRealizationManager extends TablixDimensionRealizationManager {
11232 private _owner;
11233 owner: RowLayoutManager;
11234 _getOwner(): DimensionLayoutManager;
11235 _getEstimatedItemsToRealizeCount(): void;
11236 private estimateRowsToRealizeCount();
11237 getEstimatedRowHierarchyWidth(): number;
11238 private updateRowHiearchyEstimatedWidth(items, firstVisibleIndex, levels);
11239 _getSizeAdjustment(gridContextualWidth: number): number;
11240 }
11241 /**
11242 * DOM implementation for Column Tablix realization manager.
11243 */
11244 class ColumnRealizationManager extends TablixDimensionRealizationManager {
11245 private _owner;
11246 owner: ColumnLayoutManager;
11247 _getOwner(): DimensionLayoutManager;
11248 _getEstimatedItemsToRealizeCount(): void;
11249 private rowRealizationManager;
11250 private getEstimatedRowHierarchyWidth();
11251 private estimateColumnsToRealizeCount(rowHierarchyWidth);
11252 _getSizeAdjustment(gridContextualWidth: number): number;
11253 }
11254 class RowWidths {
11255 items: RowWidth[];
11256 leafCount: any;
11257 constructor();
11258 }
11259 class RowWidth {
11260 maxLeafWidth: number;
11261 maxNonLeafWidth: number;
11262 }
11263}
11264declare module powerbi.visuals.controls.internal {
11265 interface ITablixResizeHandler {
11266 onStartResize(cell: TablixCell, currentX: number, currentY: number): void;
11267 onResize(cell: TablixCell, deltaX: number, deltaY: number): void;
11268 onEndResize(cell: TablixCell): any;
11269 onReset(cell: TablixCell): any;
11270 }
11271 /**
11272 * Internal interface to abstract the tablix row/column.
11273 */
11274 interface ITablixGridItem {
11275 calculateSize(): number;
11276 onResize(size: number): void;
11277 onResizeEnd(size: number): void;
11278 fixSize(): void;
11279 /**
11280 * In case the parent column/row header size is bigger than the sum of the children,
11281 * the size of the last item is adjusted to compensate the difference.
11282 */
11283 setAligningContextualWidth(size: number): void;
11284 getAligningContextualWidth(): number;
11285 getContextualWidth(): number;
11286 getContentContextualWidth(): number;
11287 getIndex(grid: TablixGrid): number;
11288 getHeaders(): TablixCell[];
11289 getOtherDimensionHeaders(): TablixCell[];
11290 getOtherDimensionOwner(cell: TablixCell): ITablixGridItem;
11291 getCellIContentContextualWidth(cell: TablixCell): number;
11292 getCellContextualSpan(cell: TablixCell): number;
11293 }
11294 class TablixCell implements ITablixCell {
11295 private _horizontalOffset;
11296 private _verticalOffset;
11297 private _colSpan;
11298 private _rowSpan;
11299 private _textAlign;
11300 private _containerWidth;
11301 private _containerHeight;
11302 private _scrollable;
11303 _column: TablixColumn;
11304 _row: TablixRow;
11305 type: TablixCellType;
11306 item: any;
11307 _presenter: TablixCellPresenter;
11308 extension: TablixCellPresenter;
11309 position: internal.TablixUtils.CellPosition;
11310 contentHeight: number;
11311 contentWidth: number;
11312 constructor(presenter: TablixCellPresenter, extension: TablixCellPresenter, row: TablixRow);
11313 unfixRowHeight(): void;
11314 colSpan: number;
11315 rowSpan: number;
11316 getCellSpanningHeight(): number;
11317 textAlign: string;
11318 horizontalOffset: number;
11319 verticalOffset: number;
11320 private isScrollable();
11321 clear(): void;
11322 private initializeScrolling();
11323 prepare(scrollable: boolean): void;
11324 scrollVertically(height: number, offset: number): void;
11325 scrollHorizontally(width: number, offset: number): void;
11326 setContainerWidth(value: number): void;
11327 containerWidth: number;
11328 setContainerHeight(value: number): void;
11329 containerHeight: number;
11330 applyStyle(style: TablixUtils.CellStyle): void;
11331 enableHorizontalResize(enable: boolean, handler: ITablixResizeHandler): void;
11332 }
11333 class TablixColumn implements ITablixGridItem {
11334 _realizedColumnHeaders: TablixCell[];
11335 _realizedCornerCells: TablixCell[];
11336 _realizedRowHeaders: TablixCell[];
11337 _realizedBodyCells: TablixCell[];
11338 private _items;
11339 private _itemType;
11340 private _footerCell;
11341 private _containerWidth;
11342 private _width;
11343 private _sizeFixed;
11344 private _aligningWidth;
11345 private _fixedToAligningWidth;
11346 private _presenter;
11347 private _owner;
11348 private _columnIndex;
11349 constructor(presenter: TablixColumnPresenter, columnIndex: number);
11350 initialize(owner: TablixGrid): void;
11351 owner: TablixGrid;
11352 private getType();
11353 private getColumnHeadersOrCorners();
11354 private columnHeadersOrCornersEqual(newType, headers, hierarchyNavigator);
11355 itemType: TablixCellType;
11356 getLeafItem(): any;
11357 columnHeaderOrCornerEquals(type1: TablixCellType, item1: any, type2: TablixCellType, item2: any, hierarchyNavigator: ITablixHierarchyNavigator): boolean;
11358 OnLeafRealized(hierarchyNavigator: ITablixHierarchyNavigator): void;
11359 private clearSpanningCellsWidth(cells);
11360 addCornerCell(cell: TablixCell): void;
11361 addRowHeader(cell: TablixCell): void;
11362 addColumnHeader(cell: TablixCell, isLeaf: boolean): void;
11363 addBodyCell(cell: TablixCell): void;
11364 footer: TablixCell;
11365 onResize(width: number): void;
11366 onResizeEnd(width: number): void;
11367 fixSize(): void;
11368 clearSize(): void;
11369 getContentContextualWidth(): number;
11370 getCellIContentContextualWidth(cell: TablixCell): number;
11371 getCellSpanningWidthWithScrolling(cell: ITablixCell, tablixGrid: TablixGrid): number;
11372 getScrollingOffset(): number;
11373 getContextualWidth(): number;
11374 calculateSize(): number;
11375 setAligningContextualWidth(size: number): void;
11376 getAligningContextualWidth(): number;
11377 private setContainerWidth(value);
11378 getTablixCell(): TablixCell;
11379 getIndex(grid: TablixGrid): number;
11380 getHeaders(): TablixCell[];
11381 getOtherDimensionHeaders(): TablixCell[];
11382 getCellContextualSpan(cell: TablixCell): number;
11383 getOtherDimensionOwner(cell: TablixCell): ITablixGridItem;
11384 }
11385 class TablixRow implements ITablixGridItem {
11386 private _allocatedCells;
11387 _realizedRowHeaders: TablixCell[];
11388 _realizedColumnHeaders: TablixCell[];
11389 _realizedBodyCells: TablixCell[];
11390 _realizedCornerCells: TablixCell[];
11391 private _realizedCellsCount;
11392 private _heightFixed;
11393 private _containerHeight;
11394 private _height;
11395 private _presenter;
11396 private _owner;
11397 constructor(presenter: TablixRowPresenter);
11398 initialize(owner: TablixGrid): void;
11399 presenter: TablixRowPresenter;
11400 owner: TablixGrid;
11401 releaseUnusedCells(owner: TablixControl): void;
11402 releaseAllCells(owner: TablixControl): void;
11403 private releaseCells(owner, startIndex);
11404 moveScrollableCellsToEnd(count: number): void;
11405 moveScrollableCellsToStart(count: number): void;
11406 getOrCreateCornerCell(column: TablixColumn): TablixCell;
11407 getOrCreateRowHeader(column: TablixColumn, scrollable: boolean, leaf: boolean): TablixCell;
11408 getOrCreateColumnHeader(column: TablixColumn, scrollable: boolean, leaf: boolean): TablixCell;
11409 getOrCreateBodyCell(column: TablixColumn, scrollable: boolean): TablixCell;
11410 getOrCreateFooterRowHeader(column: TablixColumn): TablixCell;
11411 getOrCreateFooterBodyCell(column: TablixColumn, scrollable: boolean): TablixCell;
11412 getRowHeaderLeafIndex(): number;
11413 getAllocatedCellAt(index: number): TablixCell;
11414 moveCellsBy(delta: number): void;
11415 getRealizedCellCount(): number;
11416 getRealizedHeadersCount(): number;
11417 getRealizedHeaderAt(index: number): TablixCell;
11418 getTablixCell(): TablixCell;
11419 getOrCreateEmptySpaceCell(): TablixCell;
11420 private createCell(row);
11421 private getOrCreateCell();
11422 onResize(height: number): void;
11423 onResizeEnd(height: number): void;
11424 fixSize(): void;
11425 unfixSize(): void;
11426 getContentContextualWidth(): number;
11427 getCellIContentContextualWidth(cell: TablixCell): number;
11428 getCellSpanningHeight(cell: ITablixCell): number;
11429 getContextualWidth(): number;
11430 sizeFixed(): boolean;
11431 calculateSize(): number;
11432 setAligningContextualWidth(size: number): void;
11433 getAligningContextualWidth(): number;
11434 private setContentHeight();
11435 getIndex(grid: TablixGrid): number;
11436 getHeaders(): TablixCell[];
11437 getOtherDimensionHeaders(): TablixCell[];
11438 getCellContextualSpan(cell: TablixCell): number;
11439 getOtherDimensionOwner(cell: TablixCell): ITablixGridItem;
11440 }
11441 class TablixGrid {
11442 private _owner;
11443 private _rows;
11444 private _realizedRows;
11445 private _columns;
11446 private _realizedColumns;
11447 private _footerRow;
11448 private _emptySpaceHeaderCell;
11449 private _emptyFooterSpaceCell;
11450 _presenter: TablixGridPresenter;
11451 private _fillColumnsProportionally;
11452 constructor(presenter: TablixGridPresenter);
11453 initialize(owner: TablixControl, gridHost: HTMLElement, footerHost: HTMLElement): void;
11454 owner: TablixControl;
11455 fillColumnsProportionally: boolean;
11456 realizedColumns: TablixColumn[];
11457 realizedRows: TablixRow[];
11458 footerRow: TablixRow;
11459 emptySpaceHeaderCell: TablixCell;
11460 emptySpaceFooterCell: TablixCell;
11461 ShowEmptySpaceCells(rowSpan: number, width: number): void;
11462 HideEmptySpaceCells(): void;
11463 onStartRenderingSession(clear: boolean): void;
11464 onStartRenderingIteration(): void;
11465 onEndRenderingIteration(): void;
11466 getOrCreateRow(rowIndex: number): TablixRow;
11467 getOrCreateFootersRow(): TablixRow;
11468 moveRowsToEnd(moveFromIndex: number, count: number): void;
11469 moveRowsToStart(moveToIndex: number, count: number): void;
11470 moveColumnsToEnd(moveFromIndex: number, count: number): void;
11471 moveColumnsToStart(moveToIndex: number, count: number): void;
11472 getOrCreateColumn(columnIndex: number): TablixColumn;
11473 private initializeColumns();
11474 private clearColumns();
11475 private initializeRows();
11476 private clearRows();
11477 getWidth(): number;
11478 getHeight(): number;
11479 }
11480}
11481declare module powerbi.visuals.controls.internal {
11482 /**
11483 * This class is used for layouts that don't or cannot
11484 * rely on DOM measurements. Instead they compute all required
11485 * widths and heights and store it in this structure.
11486 */
11487 class SizeComputationManager {
11488 private static TablixMinimumColumnWidth;
11489 private _viewport;
11490 private _columnCount;
11491 private _cellWidth;
11492 private _cellHeight;
11493 private _scalingFactor;
11494 hasImageContent: boolean;
11495 visibleWidth: number;
11496 visibleHeight: number;
11497 gridWidth: number;
11498 gridHeight: number;
11499 rowHeight: number;
11500 cellWidth: number;
11501 cellHeight: number;
11502 contentWidth: number;
11503 contentHeight: number;
11504 updateColumnCount(columnCount: number): void;
11505 updateRowHeight(rowHeight: number): void;
11506 updateScalingFactor(scalingFactor: number): void;
11507 updateViewport(viewport: IViewport): void;
11508 private computeColumnWidth(totalColumnCount);
11509 private computeColumnHeight();
11510 private fitToColumnCount(maxAllowedColumnCount, totalColumnCount);
11511 }
11512 class DimensionLayoutManager implements IDimensionLayoutManager {
11513 static _pixelPrecision: number;
11514 static _scrollOffsetPrecision: number;
11515 _grid: TablixGrid;
11516 _gridOffset: number;
11517 protected _contextualWidthToFill: number;
11518 private _owner;
11519 private _realizationManager;
11520 private _alignToEnd;
11521 private _lastScrollOffset;
11522 private _isScrolling;
11523 private _fixedSizeEnabled;
11524 private _done;
11525 private _measureEnabled;
11526 constructor(owner: TablixLayoutManager, grid: TablixGrid, realizationManager: TablixDimensionRealizationManager);
11527 owner: TablixLayoutManager;
11528 realizationManager: TablixDimensionRealizationManager;
11529 fixedSizeEnabled: boolean;
11530 onCornerCellRealized(item: any, cell: ITablixCell, leaf: boolean): void;
11531 onHeaderRealized(item: any, cell: ITablixCell, leaf: any): void;
11532 needsToRealize: boolean;
11533 getVisibleSizeRatio(): number;
11534 alignToEnd: boolean;
11535 done: boolean;
11536 _requiresMeasure(): boolean;
11537 startScrollingSession(): void;
11538 endScrollingSession(): void;
11539 isScrolling(): boolean;
11540 isResizing(): boolean;
11541 getOtherHierarchyContextualHeight(): number;
11542 _isAutoSized(): boolean;
11543 onStartRenderingSession(): void;
11544 onEndRenderingSession(): void;
11545 /**
11546 * Implementing classes must override this to send dimentions to TablixControl.
11547 */
11548 _sendDimensionsToControl(): void;
11549 measureEnabled: boolean;
11550 getFooterContextualWidth(): number;
11551 onStartRenderingIteration(clear: boolean, contextualWidth: number): void;
11552 allItemsRealized: boolean;
11553 onEndRenderingIteration(): void;
11554 private getScrollDeltaWithinPage();
11555 private swapElements();
11556 _getRealizedItems(): ITablixGridItem[];
11557 getRealizedItemsCount(): number;
11558 _moveElementsToBottom(moveFromIndex: number, count: any): void;
11559 _moveElementsToTop(moveToIndex: number, count: any): void;
11560 isScrollingWithinPage(): boolean;
11561 getGridContextualWidth(): number;
11562 private updateScrollbar(gridContextualWidth);
11563 getViewSize(gridContextualWidth: number): number;
11564 isScrollableHeader(item: any, items: any, index: number): boolean;
11565 reachedEnd(): boolean;
11566 scrollBackwardToFill(gridContextualWidth: number): number;
11567 private getItemContextualWidth(index);
11568 private getItemContextualWidthWithScrolling(index);
11569 getSizeWithScrolling(size: number, index: number): number;
11570 getGridContextualWidthFromItems(): number;
11571 private getMeaurementError(gridContextualWidth);
11572 private scrollForwardToAlignEnd(gridContextualWidth);
11573 dimension: TablixDimension;
11574 otherLayoutManager: DimensionLayoutManager;
11575 contextualWidthToFill: number;
11576 getGridScale(): number;
11577 otherScrollbarContextualWidth: number;
11578 getActualContextualWidth(gridContextualWidth: number): number;
11579 protected canScroll(gridContextualWidth: number): boolean;
11580 calculateSizes(): void;
11581 protected _calculateSize(item: ITablixGridItem): number;
11582 calculateContextualWidths(): void;
11583 calculateSpans(): void;
11584 updateNonScrollableItemsSpans(): void;
11585 updateScrollableItemsSpans(): void;
11586 fixSizes(): void;
11587 private updateSpans(otherRealizedItem, cells);
11588 private updateLastChildSize(spanningCell, item, totalSpanSize);
11589 }
11590 class ResizeState {
11591 item: any;
11592 itemType: TablixCellType;
11593 column: TablixColumn;
11594 startColumnWidth: number;
11595 resizingDelta: number;
11596 animationFrame: number;
11597 scale: number;
11598 constructor(column: TablixColumn, width: number, scale: number);
11599 getNewSize(): number;
11600 }
11601 class ColumnLayoutManager extends DimensionLayoutManager implements ITablixResizeHandler {
11602 static minColumnWidth: number;
11603 private _resizeState;
11604 constructor(owner: TablixLayoutManager, grid: TablixGrid, realizationManager: ColumnRealizationManager);
11605 dimension: TablixDimension;
11606 isResizing(): boolean;
11607 fillProportionally: boolean;
11608 getGridScale(): number;
11609 otherScrollbarContextualWidth: number;
11610 _getRealizedItems(): ITablixGridItem[];
11611 _moveElementsToBottom(moveFromIndex: number, count: any): void;
11612 _moveElementsToTop(moveToIndex: number, count: any): void;
11613 _requiresMeasure(): boolean;
11614 getGridContextualWidth(): number;
11615 private getFirstVisibleColumn();
11616 _isAutoSized(): boolean;
11617 applyScrolling(): void;
11618 private scroll(firstVisibleColumn, width, offset);
11619 private scrollCells(cells, width, offset);
11620 private scrollBodyCells(rows, width, offset);
11621 onStartResize(cell: TablixCell, currentX: number, currentY: number): void;
11622 onResize(cell: TablixCell, deltaX: number, deltaY: number): void;
11623 onEndResize(cell: TablixCell): void;
11624 onReset(cell: TablixCell): void;
11625 updateItemToResizeState(realizedColumns: TablixColumn[]): void;
11626 private performResizing();
11627 private endResizing();
11628 /**
11629 * Sends column related data (pixel size, column count, etc) to TablixControl.
11630 */
11631 _sendDimensionsToControl(): void;
11632 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
11633 getEstimatedBodyCellWidth(content: string): number;
11634 }
11635 class DashboardColumnLayoutManager extends ColumnLayoutManager {
11636 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
11637 getEstimatedBodyCellWidth(content: string): number;
11638 protected canScroll(gridContextualWidth: number): boolean;
11639 protected _calculateSize(item: ITablixGridItem): number;
11640 private ignoreColumn(headerIndex);
11641 }
11642 class CanvasColumnLayoutManager extends ColumnLayoutManager {
11643 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
11644 getEstimatedBodyCellWidth(content: string): number;
11645 calculateContextualWidths(): void;
11646 protected canScroll(gridContextualWidth: number): boolean;
11647 protected _calculateSize(item: ITablixGridItem): number;
11648 }
11649 class RowLayoutManager extends DimensionLayoutManager {
11650 constructor(owner: TablixLayoutManager, grid: TablixGrid, realizationManager: RowRealizationManager);
11651 dimension: TablixDimension;
11652 getGridScale(): number;
11653 otherScrollbarContextualWidth: number;
11654 startScrollingSession(): void;
11655 _getRealizedItems(): ITablixGridItem[];
11656 _moveElementsToBottom(moveFromIndex: number, count: any): void;
11657 _moveElementsToTop(moveToIndex: number, count: any): void;
11658 _requiresMeasure(): boolean;
11659 getGridContextualWidth(): number;
11660 private getFirstVisibleRow();
11661 _isAutoSized(): boolean;
11662 applyScrolling(): void;
11663 private scroll(firstVisibleRow, height, offset);
11664 private scrollCells(cells, height, offset);
11665 getFooterContextualWidth(): number;
11666 calculateContextualWidths(): void;
11667 fixSizes(): void;
11668 /**
11669 * Sends row related data (pixel size, column count, etc) to TablixControl.
11670 */
11671 _sendDimensionsToControl(): void;
11672 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
11673 }
11674 class DashboardRowLayoutManager extends RowLayoutManager {
11675 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
11676 protected canScroll(gridContextualWidth: number): boolean;
11677 protected _calculateSize(item: ITablixGridItem): number;
11678 private getHeaderWidth(headerIndex);
11679 }
11680 class CanvasRowLayoutManager extends RowLayoutManager {
11681 getEstimatedHeaderWidth(label: string, headerIndex: number): number;
11682 protected canScroll(gridContextualWidth: number): boolean;
11683 protected _calculateSize(item: ITablixGridItem): number;
11684 }
11685 class TablixLayoutManager {
11686 protected _owner: TablixControl;
11687 protected _container: HTMLElement;
11688 protected _columnLayoutManager: ColumnLayoutManager;
11689 protected _rowLayoutManager: RowLayoutManager;
11690 private _binder;
11691 private _scrollingDimension;
11692 private _gridHost;
11693 private _footersHost;
11694 private _grid;
11695 private _allowHeaderResize;
11696 private _columnWidthsToPersist;
11697 constructor(binder: ITablixBinder, grid: TablixGrid, columnLayoutManager: ColumnLayoutManager, rowLayoutManager: RowLayoutManager);
11698 initialize(owner: TablixControl): void;
11699 owner: TablixControl;
11700 binder: ITablixBinder;
11701 columnWidthsToPersist: number[];
11702 getTablixClassName(): string;
11703 getLayoutKind(): TablixLayoutKind;
11704 getOrCreateColumnHeader(item: any, items: any, rowIndex: number, columnIndex: number): ITablixCell;
11705 getOrCreateRowHeader(item: any, items: any, rowIndex: number, columnIndex: number): ITablixCell;
11706 getOrCreateCornerCell(item: any, rowLevel: number, columnLevel: number): ITablixCell;
11707 getOrCreateBodyCell(cellItem: any, rowItem: any, rowItems: any, rowIndex: number, columnIndex: number): ITablixCell;
11708 getOrCreateFooterBodyCell(cellItem: any, columnIndex: number): ITablixCell;
11709 getOrCreateFooterRowHeader(item: any, items: any): ITablixCell;
11710 getVisibleWidth(): number;
11711 getVisibleHeight(): number;
11712 updateColumnCount(rowDimension: TablixRowDimension, columnDimension: TablixColumnDimension): void;
11713 updateViewport(viewport: IViewport): void;
11714 getEstimatedRowHeight(): number;
11715 getCellWidth(cell: ITablixCell): number;
11716 getContentWidth(cell: ITablixCell): number;
11717 adjustContentSize(hasImage: boolean): void;
11718 /**
11719 * This call makes room for parent header cells where neccessary.
11720 * Since HTML cells that span vertically displace other rows,
11721 * room has to be made for spanning headers that leave an exiting
11722 * row to enter the new row that it starts from and removed when
11723 * returning to an entering row.
11724 */
11725 private alignRowHeaderCells(item, currentRow);
11726 grid: TablixGrid;
11727 rowLayoutManager: DimensionLayoutManager;
11728 columnLayoutManager: DimensionLayoutManager;
11729 protected showEmptySpaceHeader(): boolean;
11730 onStartRenderingSession(scrollingDimension: TablixDimension, parentElement: HTMLElement, clear: boolean): void;
11731 onEndRenderingSession(): void;
11732 onStartRenderingIteration(clear: boolean): void;
11733 onEndRenderingIteration(): boolean;
11734 onCornerCellRealized(item: any, cell: ITablixCell): void;
11735 onRowHeaderRealized(item: any, cell: ITablixCell): void;
11736 onRowHeaderFooterRealized(item: any, cell: ITablixCell): void;
11737 onColumnHeaderRealized(item: any, cell: ITablixCell): void;
11738 onBodyCellRealized(item: any, cell: ITablixCell): void;
11739 onBodyCellFooterRealized(item: any, cell: ITablixCell): void;
11740 setAllowHeaderResize(value: boolean): void;
11741 enableCellHorizontalResize(isLeaf: boolean, cell: TablixCell): void;
11742 getEstimatedTextWidth(label: string): number;
11743 measureSampleText(parentElement: HTMLElement): void;
11744 }
11745 class DashboardTablixLayoutManager extends TablixLayoutManager {
11746 private _characterHeight;
11747 private _sizeComputationManager;
11748 constructor(binder: ITablixBinder, sizeComputationManager: SizeComputationManager, grid: TablixGrid, rowRealizationManager: RowRealizationManager, columnRealizationManager: ColumnRealizationManager);
11749 static createLayoutManager(binder: ITablixBinder): DashboardTablixLayoutManager;
11750 getTablixClassName(): string;
11751 getLayoutKind(): TablixLayoutKind;
11752 protected showEmptySpaceHeader(): boolean;
11753 measureSampleText(parentElement: HTMLElement): void;
11754 getVisibleWidth(): number;
11755 getVisibleHeight(): number;
11756 getCellWidth(cell: ITablixCell): number;
11757 getContentWidth(cell: ITablixCell): number;
11758 getEstimatedTextWidth(label: string): number;
11759 adjustContentSize(hasImage: boolean): void;
11760 updateColumnCount(rowDimension: TablixRowDimension, columnDimension: TablixColumnDimension): void;
11761 updateViewport(viewport: IViewport): void;
11762 getEstimatedRowHeight(): number;
11763 }
11764 class CanvasTablixLayoutManager extends TablixLayoutManager {
11765 private characterWidth;
11766 private characterHeight;
11767 constructor(binder: ITablixBinder, grid: TablixGrid, rowRealizationManager: RowRealizationManager, columnRealizationManager: ColumnRealizationManager);
11768 static createLayoutManager(binder: ITablixBinder, columnWidthManager: TablixColumnWidthManager): CanvasTablixLayoutManager;
11769 getTablixClassName(): string;
11770 getLayoutKind(): TablixLayoutKind;
11771 measureSampleText(parentElement: HTMLElement): void;
11772 protected showEmptySpaceHeader(): boolean;
11773 getVisibleWidth(): number;
11774 getVisibleHeight(): number;
11775 getCellWidth(cell: ITablixCell): number;
11776 getContentWidth(cell: ITablixCell): number;
11777 getEstimatedTextWidth(text: string): number;
11778 updateColumnCount(rowDimension: TablixRowDimension, columnDimension: TablixColumnDimension): void;
11779 updateViewport(viewport: IViewport): void;
11780 getEstimatedRowHeight(): number;
11781 }
11782}
11783declare module powerbi.visuals.controls {
11784 module HTMLElementUtils {
11785 function clearChildren(element: HTMLElement): void;
11786 function setElementTop(element: HTMLElement, top: number): void;
11787 function setElementLeft(element: HTMLElement, left: number): void;
11788 function setElementHeight(element: HTMLElement, height: number): void;
11789 function setElementWidth(element: HTMLElement, width: number): void;
11790 function getElementWidth(element: HTMLElement): number;
11791 function getElementHeight(element: HTMLElement): number;
11792 function isAutoSize(size: number): boolean;
11793 function getAccumulatedScale(element: HTMLElement): number;
11794 /**
11795 * Get scale of element, return 1 when not scaled.
11796 */
11797 function getScale(element: any): number;
11798 }
11799}
11800declare module powerbi.visuals.controls.internal {
11801 module TablixObjects {
11802 const ObjectGeneral: string;
11803 const ObjectGrid: string;
11804 const ObjectColumnHeaders: string;
11805 const ObjectRowHeaders: string;
11806 const ObjectValues: string;
11807 const ObjectTotal: string;
11808 const ObjectSubTotals: string;
11809 interface ObjectValueGetterFunction {
11810 <T>(objects: DataViewObjects, propertyId: DataViewObjectPropertyIdentifier, defaultValue?: T): T;
11811 }
11812 /**
11813 * Represents a DataViewObjects property related to the Tablix
11814 */
11815 class TablixProperty {
11816 objectName: string;
11817 propertyName: string;
11818 defaultValue: any;
11819 private getterFuntion;
11820 /**
11821 * Creates a new TablixProperty
11822 * @param {string} objectName Object Name
11823 * @param {string} propertyName Property Name
11824 * @param {any} defaultValue Default value of the Property
11825 * @param {ObjectValueGetterFunction} getterFuntion Function used to get the Property value from the Objects
11826 */
11827 constructor(objectName: string, propertyName: string, defaultValue: any, getterFuntion: ObjectValueGetterFunction);
11828 /**
11829 * Gets the PropertyIdentifier for the Property
11830 * @returns PropertyIdentifier for the Property
11831 */
11832 getPropertyID(): DataViewObjectPropertyIdentifier;
11833 /**
11834 * Gets the value of the Property from the Objects
11835 * @param {DataViewObjects} objects DataView Objects to get the value from
11836 * @param {boolean} useDefault True to fall back to the Default value if the Property is missing from the objects. False to return undefined
11837 * @returns Value of the property
11838 */
11839 getValue<T>(objects: DataViewObjects): T;
11840 }
11841 const PropColumnFormatString: TablixProperty;
11842 const PropGeneralAutoSizeColumns: TablixProperty;
11843 const PropGeneralTextSize: TablixProperty;
11844 const PropGeneralTableTotals: TablixProperty;
11845 const PropGeneralMatrixRowSubtotals: TablixProperty;
11846 const PropGeneralMatrixColumnSubtotals: TablixProperty;
11847 const PropGridVertical: TablixProperty;
11848 const PropGridVerticalColor: TablixProperty;
11849 const PropGridVerticalWeight: TablixProperty;
11850 const PropGridHorizontalTable: TablixProperty;
11851 const PropGridHorizontalMatrix: TablixProperty;
11852 const PropGridHorizontalColor: TablixProperty;
11853 const PropGridHorizontalWeight: TablixProperty;
11854 const PropGridRowPadding: TablixProperty;
11855 const PropGridOutlineColor: TablixProperty;
11856 const PropGridOutlineWeight: TablixProperty;
11857 const PropGridImageHeight: TablixProperty;
11858 const PropColumnsFontColor: TablixProperty;
11859 const PropColumnsBackColor: TablixProperty;
11860 const PropColumnsOutline: TablixProperty;
11861 const PropRowsFontColor: TablixProperty;
11862 const PropRowsBackColor: TablixProperty;
11863 const PropRowsOutline: TablixProperty;
11864 const PropValuesBackColor: TablixProperty;
11865 const PropValuesFontColorPrimary: TablixProperty;
11866 const PropValuesBackColorPrimary: TablixProperty;
11867 const PropValuesFontColorSecondary: TablixProperty;
11868 const PropValuesBackColorSecondary: TablixProperty;
11869 const PropValuesOutline: TablixProperty;
11870 const PropValuesUrlIconProp: TablixProperty;
11871 const PropTotalFontColor: TablixProperty;
11872 const PropTotalBackColor: TablixProperty;
11873 const PropTotalOutline: TablixProperty;
11874 const PropSubTotalsFontColor: TablixProperty;
11875 const PropSubTotalsBackColor: TablixProperty;
11876 const PropSubTotalsOutline: TablixProperty;
11877 /**
11878 * Get the DataViewObject from the DataView
11879 * @param {DataView} dataview The DataView
11880 * @returns DataViewObjects (dataView.metadata.objects)
11881 */
11882 function getMetadadataObjects(dataview: DataView): DataViewObjects;
11883 function enumerateObjectRepetition(enumeration: VisualObjectRepetition[], dataView: DataView, tablixType: TablixType): void;
11884 function enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions, enumeration: ObjectEnumerationBuilder, dataView: DataView, tablixType: TablixType): void;
11885 function enumerateGeneralOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects, tablixType: TablixType, dataView: DataView): void;
11886 function enumerateGridOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects, tablixType: TablixType): void;
11887 function enumerateColumnHeadersOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
11888 function enumerateRowHeadersOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
11889 function enumerateValuesOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects, tablixType: TablixType): void;
11890 function enumerateTotalOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
11891 function enumerateSubTotalsOptions(enumeration: ObjectEnumerationBuilder, objects: DataViewObjects): void;
11892 function getTableObjects(dataView: DataView): TablixFormattingPropertiesTable;
11893 function getMatrixObjects(dataView: DataView): TablixFormattingPropertiesMatrix;
11894 /**
11895 * Generate default objects for the Table/Matrix to set default styling
11896 * @param {TablixType} tablixType Tablix Type: table | matrix
11897 * @returns DataViewObjects that can be attached to the DataViewMetadata
11898 */
11899 function generateTablixDefaultObjects(tablixType: TablixType): data.DataViewObjectDefinitions;
11900 function getTextSizeInPx(textSize: number): string;
11901 function shouldShowTableTotals(objects: DataViewObjects): boolean;
11902 function shouldShowRowSubtotals(objects: DataViewObjects): boolean;
11903 function shouldShowColumnSubtotals(objects: DataViewObjects): boolean;
11904 function shouldShowColumnSubtotalsOption(dataView: DataView): boolean;
11905 function isDiscourageAggregationAcrossGroups(levels: DataViewHierarchyLevel[]): boolean;
11906 }
11907 module TablixUtils {
11908 const CssClassTablixDiv: string;
11909 const CssClassContentElement: string;
11910 const CssClassContentHost: string;
11911 const CssClassTablixHeader: string;
11912 const CssClassTablixColumnHeaderLeaf: string;
11913 const CssClassTablixValueNumeric: string;
11914 const CssClassTablixValueTotal: string;
11915 const CssClassValueURLIcon: string;
11916 const CssClassValueURLIconContainer: string;
11917 const CssClassMatrixRowHeaderLeaf: string;
11918 const CssClassMatrixRowHeaderSubTotal: string;
11919 const CssClassTableFooter: string;
11920 const CssClassTableBodyCell: string;
11921 const CssClassTableBodyCellBottom: string;
11922 const StringNonBreakingSpace: string;
11923 const UnitOfMeasurement: string;
11924 const CellPaddingLeft: number;
11925 const CellPaddingRight: number;
11926 const CellPaddingLeftMatrixTotal: number;
11927 const FontFamilyCell: string;
11928 const FontFamilyHeader: string;
11929 const FontFamilyTotal: string;
11930 const FontColorCells: string;
11931 const FontColorHeaders: string;
11932 interface Surround<T> {
11933 top?: T;
11934 right?: T;
11935 bottom?: T;
11936 left?: T;
11937 }
11938 class EdgeSettings {
11939 /**
11940 * Weight in pixels. 0 to remove border. Undefined to fall back to CSS
11941 */
11942 weight: number;
11943 color: string;
11944 constructor(weight?: number, color?: string);
11945 applyParams(shown: boolean, weight: number, color?: string): void;
11946 getCSS(): string;
11947 }
11948 /**
11949 * Style parameters for each Cell
11950 */
11951 class CellStyle {
11952 /**
11953 * Font family of the cell. If undefined, it will be cleared to fall back to table font family
11954 */
11955 fontFamily: string;
11956 /**
11957 * Font color of the cell. If undefined, it will be cleared to fall back to table font color
11958 */
11959 fontColor: string;
11960 /**
11961 * Background color of the cell. If undefined, it will be cleared to fall back to default (transparent)
11962 */
11963 backColor: string;
11964 /**
11965 * Indicates whether the Cell contains an Image or not. Affecting cell height.
11966 */
11967 hasImage: boolean;
11968 /**
11969 * Settings for Borders
11970 */
11971 borders: Surround<EdgeSettings>;
11972 /**
11973 * Settings for Padding
11974 */
11975 paddings: Surround<number>;
11976 constructor();
11977 /**
11978 * Sets the Inline style for the Cell
11979 * @param {ITablixCell} cell Cell to set style to
11980 */
11981 applyStyle(cell: ITablixCell): void;
11982 getExtraTop(): number;
11983 getExtraBottom(): number;
11984 getExtraRight(): number;
11985 getExtraLeft(): number;
11986 }
11987 /**
11988 * Index within a dimension (row/column)
11989 */
11990 class DimensionPosition {
11991 /**
11992 * Global index within all leaf nodes
11993 */
11994 index: number;
11995 /**
11996 * Index within siblings for same parent
11997 */
11998 indexInSiblings: number;
11999 /**
12000 * Is last globally
12001 */
12002 isLast: boolean;
12003 /**
12004 * Is first globally
12005 */
12006 isFirst: boolean;
12007 }
12008 /**
12009 * Poistion information about the cell
12010 */
12011 class CellPosition {
12012 row: DimensionPosition;
12013 column: DimensionPosition;
12014 constructor();
12015 isMatch(position: CellPosition): boolean;
12016 }
12017 class TablixVisualCell {
12018 dataPoint: any;
12019 position: TablixUtils.CellPosition;
12020 columnMetadata: DataViewMetadataColumn;
12021 isTotal: boolean;
12022 backColor: string;
12023 private formatter;
12024 constructor(dataPoint: any, isTotal: boolean, columnMetadata: DataViewMetadataColumn, formatter: ICustomValueColumnFormatter);
12025 textContent: string;
12026 domContent: JQuery;
12027 isNumeric: boolean;
12028 isUrl: boolean;
12029 isImage: boolean;
12030 isValidUrl: boolean;
12031 isMatch(item: TablixVisualCell): boolean;
12032 }
12033 function createTable(): HTMLTableElement;
12034 function createDiv(): HTMLDivElement;
12035 function resetCellCssClass(cell: controls.ITablixCell): void;
12036 function addCellCssClass(cell: controls.ITablixCell, style: string): void;
12037 /**
12038 * Clears all inline styles (border, fontColor, background) and resets CSS classes
12039 * Performed with unbind-<Cell>
12040 */
12041 function clearCellStyle(cell: controls.ITablixCell): void;
12042 function clearCellTextAndTooltip(cell: controls.ITablixCell): void;
12043 function setCellTextAndTooltip(cell: controls.ITablixCell, text: string): void;
12044 function isValidSortClick(e: MouseEvent): boolean;
12045 function appendATagToBodyCell(value: string, cell: controls.ITablixCell, urlIcon?: boolean): void;
12046 function appendImgTagToBodyCell(value: string, cell: controls.ITablixCell, imageHeight: number): void;
12047 function createKpiDom(kpi: DataViewKpiColumnMetadata, kpiValue: string): JQuery;
12048 function isValidStatusGraphic(kpi: DataViewKpiColumnMetadata, kpiValue: string): boolean;
12049 function getCustomSortEventArgs(queryName: string, sortDirection: SortDirection): CustomSortEventArgs;
12050 function reverseSort(sortDirection: SortDirection): SortDirection;
12051 function createColumnHeaderWithSortIcon(item: DataViewMetadataColumn, cell: controls.ITablixCell): void;
12052 function removeSortIcons(cell: controls.ITablixCell): void;
12053 }
12054}
12055declare module powerbi.visuals.controls {
12056 interface ITablixHierarchyNavigator {
12057 /**
12058 * Returns the depth of the column hierarchy.
12059 */
12060 getColumnHierarchyDepth(): number;
12061 /**
12062 * Returns the depth of the Row hierarchy.
12063 */
12064 getRowHierarchyDepth(): number;
12065 /**
12066 * Returns the leaf count of a hierarchy.
12067 *
12068 * @param hierarchy Object representing the hierarchy.
12069 */
12070 getLeafCount(hierarchy: any): number;
12071 /**
12072 * Returns the leaf member of a hierarchy at the specified index.
12073 *
12074 * @param hierarchy Object representing the hierarchy.
12075 * @param index Index of leaf member.
12076 */
12077 getLeafAt(hierarchy: any, index: number): any;
12078 /**
12079 * Returns the specified hierarchy member parent.
12080 *
12081 * @param item Hierarchy member.
12082 */
12083 getParent(item: any): any;
12084 /**
12085 * Returns the index of the hierarchy member relative to its parent.
12086 *
12087 * @param item Hierarchy member.
12088 */
12089 getIndex(item: any): number;
12090 /**
12091 * Checks whether a hierarchy member is a leaf.
12092 *
12093 * @param item Hierarchy member.
12094 */
12095 isLeaf(item: any): boolean;
12096 isRowHierarchyLeaf(cornerItem: any): boolean;
12097 isColumnHierarchyLeaf(cornerItem: any): boolean;
12098 isFirstItem(item: any, items: any): boolean;
12099 /**
12100 * Checks whether a hierarchy member is the last item within its parent.
12101 *
12102 * @param item Hierarchy member.
12103 * @param items A collection of hierarchy members.
12104 */
12105 isLastItem(item: any, items: any): boolean;
12106 /**
12107 * Checks if the item and all its ancestors are the first items in their parent's children
12108 */
12109 areAllParentsFirst(item: any, items: any): boolean;
12110 /**
12111 * Checks if the item and all its ancestors are the last items in their parent's children
12112 */
12113 areAllParentsLast(item: any, items: any): boolean;
12114 /**
12115 * Gets the children members of a hierarchy member.
12116 *
12117 * @param item Hierarchy member.
12118 */
12119 getChildren(item: any): any;
12120 /**
12121 * Gets the difference between current level and min children level. Not necessarily 1
12122 *
12123 * @param item Hierarchy member.
12124 */
12125 getChildrenLevelDifference(item: any): number;
12126 /**
12127 * Gets the members count in a specified collection.
12128 *
12129 * @param items Hierarchy member.
12130 */
12131 getCount(items: any): number;
12132 /**
12133 * Gets the member at the specified index.
12134 *
12135 * @param items A collection of hierarchy members.
12136 * @param index Index of member to return.
12137 */
12138 getAt(items: any, index: number): any;
12139 /**
12140 * Gets the hierarchy member level.
12141 *
12142 * @param item Hierarchy member.
12143 */
12144 getLevel(item: any): number;
12145 /**
12146 * Returns the intersection between a row and a column item.
12147 *
12148 * @param rowItem A row member.
12149 * @param columnItem A column member.
12150 */
12151 getIntersection(rowItem: any, columnItem: any): any;
12152 /**
12153 * Returns the corner cell between a row and a column level.
12154 *
12155 * @param rowLevel A level in the row hierarchy.
12156 * @param columnLevel A level in the column hierarchy.
12157 */
12158 getCorner(rowLevel: number, columnLevel: number): any;
12159 headerItemEquals(item1: any, item2: any): boolean;
12160 bodyCellItemEquals(item1: any, item2: any): boolean;
12161 cornerCellItemEquals(item1: any, item2: any): boolean;
12162 }
12163}
12164declare module powerbi.visuals.controls {
12165 interface ITablixBinder {
12166 onStartRenderingSession(): void;
12167 onEndRenderingSession(): void;
12168 /** Binds the row hierarchy member to the DOM element. */
12169 bindRowHeader(item: any, cell: ITablixCell): void;
12170 unbindRowHeader(item: any, cell: ITablixCell): void;
12171 /** Binds the column hierarchy member to the DOM element. */
12172 bindColumnHeader(item: any, cell: ITablixCell): void;
12173 unbindColumnHeader(item: any, cell: ITablixCell): void;
12174 /** Binds the intersection between a row and a column hierarchy member to the DOM element. */
12175 bindBodyCell(item: any, cell: ITablixCell): void;
12176 unbindBodyCell(item: any, cell: ITablixCell): void;
12177 /** Binds the corner cell to the DOM element. */
12178 bindCornerCell(item: any, cell: ITablixCell): void;
12179 unbindCornerCell(item: any, cell: ITablixCell): void;
12180 bindEmptySpaceHeaderCell(cell: ITablixCell): void;
12181 unbindEmptySpaceHeaderCell(cell: ITablixCell): void;
12182 bindEmptySpaceFooterCell(cell: ITablixCell): void;
12183 unbindEmptySpaceFooterCell(cell: ITablixCell): void;
12184 /** Measurement Helper */
12185 getHeaderLabel(item: any): string;
12186 getCellContent(item: any): string;
12187 hasRowGroups(): boolean;
12188 }
12189}
12190declare module powerbi.visuals.controls {
12191 const enum TablixCellType {
12192 CornerCell = 0,
12193 RowHeader = 1,
12194 ColumnHeader = 2,
12195 BodyCell = 3,
12196 }
12197 interface ITablixCell {
12198 type: TablixCellType;
12199 item: any;
12200 colSpan: number;
12201 rowSpan: number;
12202 textAlign: string;
12203 extension: internal.TablixCellPresenter;
12204 position: internal.TablixUtils.CellPosition;
12205 contentHeight: number;
12206 contentWidth: number;
12207 containerHeight: number;
12208 containerWidth: number;
12209 unfixRowHeight(): any;
12210 applyStyle(style: internal.TablixUtils.CellStyle): void;
12211 }
12212 interface IDimensionLayoutManager {
12213 measureEnabled: boolean;
12214 getRealizedItemsCount(): number;
12215 needsToRealize: boolean;
12216 }
12217}
12218declare module powerbi.visuals.controls {
12219 const TablixDefaultTextSize: number;
12220 interface TablixRenderArgs {
12221 rowScrollOffset?: number;
12222 columnScrollOffset?: number;
12223 scrollingDimension?: TablixDimension;
12224 }
12225 interface GridDimensions {
12226 rowCount?: number;
12227 columnCount?: number;
12228 rowHierarchyWidth?: number;
12229 rowHierarchyHeight?: number;
12230 rowHierarchyContentHeight?: number;
12231 columnHierarchyWidth?: number;
12232 columnHierarchyHeight?: number;
12233 footerHeight?: number;
12234 }
12235 const enum TablixLayoutKind {
12236 /**
12237 * The default layout is based on DOM measurements and used on the canvas.
12238 */
12239 Canvas = 0,
12240 /**
12241 * The DashboardTile layout must not rely on any kind of DOM measurements
12242 * since the tiles are created when the dashboard is not visible and the
12243 * visual is not rendered; thus no measurements are available.
12244 */
12245 DashboardTile = 1,
12246 }
12247 interface TablixOptions {
12248 interactive?: boolean;
12249 enableTouchSupport?: boolean;
12250 layoutKind?: TablixLayoutKind;
12251 fontSize?: string;
12252 }
12253 class TablixControl {
12254 private static UnitOfMeasurement;
12255 private static TablixContainerClassName;
12256 private static TablixTableAreaClassName;
12257 private static TablixFooterClassName;
12258 private static DefaultFontSize;
12259 private static MaxRenderIterationCount;
12260 private hierarchyTablixNavigator;
12261 private binder;
12262 private columnDim;
12263 private rowDim;
12264 private controlLayoutManager;
12265 private containerElement;
12266 private mainDiv;
12267 private footerDiv;
12268 private scrollBarElementWidth;
12269 private touchManager;
12270 private columnTouchDelegate;
12271 private rowTouchDelegate;
12272 private bodyTouchDelegate;
12273 private footerTouchDelegate;
12274 private touchInterpreter;
12275 private footerTouchInterpreter;
12276 private gridDimensions;
12277 private lastRenderingArgs;
12278 private _autoSizeWidth;
12279 private _autoSizeHeight;
12280 private viewPort;
12281 private maximumWidth;
12282 private maximumHeight;
12283 private minimumWidth;
12284 private minimumHeight;
12285 private textFontSize;
12286 private textFontFamily;
12287 private textFontColor;
12288 private options;
12289 private isTouchEnabled;
12290 private renderIterationCount;
12291 constructor(hierarchyNavigator: ITablixHierarchyNavigator, layoutManager: internal.TablixLayoutManager, binder: ITablixBinder, parentDomElement: HTMLElement, options: TablixOptions);
12292 private InitializeTouchSupport();
12293 private InitializeScrollbars();
12294 container: HTMLElement;
12295 contentHost: HTMLElement;
12296 footerHost: HTMLElement;
12297 className: string;
12298 hierarchyNavigator: ITablixHierarchyNavigator;
12299 getBinder(): ITablixBinder;
12300 autoSizeWidth: boolean;
12301 autoSizeHeight: boolean;
12302 maxWidth: number;
12303 viewport: IViewport;
12304 maxHeight: number;
12305 minWidth: number;
12306 minHeight: number;
12307 fontSize: string;
12308 fontFamily: string;
12309 fontColor: string;
12310 scrollbarWidth: number;
12311 updateModels(resetScrollOffsets: boolean, rowModel: any, columnModel: any): void;
12312 updateColumnDimensions(rowHierarchyWidth: number, columnHierarchyWidth: number, count: number): void;
12313 updateRowDimensions(columnHierarchyHeight: number, rowHierarchyHeight: number, rowHierarchyContentHeight: number, count: number, footerHeight: any): void;
12314 private updateTouchDimensions();
12315 private onMouseWheel(e);
12316 private onFireFoxMouseWheel(e);
12317 private determineDimensionToScroll();
12318 layoutManager: internal.TablixLayoutManager;
12319 columnDimension: TablixColumnDimension;
12320 rowDimension: TablixRowDimension;
12321 refresh(clear: boolean): void;
12322 _onScrollAsync(dimension: TablixDimension): void;
12323 private performPendingScroll(dimension);
12324 private updateHorizontalPosition();
12325 updateFooterVisibility(): void;
12326 private updateVerticalPosition();
12327 private alreadyRendered(scrollingDimension);
12328 private render(clear, scrollingDimension);
12329 private updateContainerDimensions();
12330 private cornerCellMatch(item, cell);
12331 private renderCorner();
12332 _unbindCell(cell: ITablixCell): void;
12333 private onTouchEvent(args);
12334 }
12335}
12336declare module powerbi.visuals.controls {
12337 class TablixDimension {
12338 _hierarchyNavigator: ITablixHierarchyNavigator;
12339 _otherDimension: any;
12340 _owner: TablixControl;
12341 _binder: ITablixBinder;
12342 _tablixLayoutManager: internal.TablixLayoutManager;
12343 _layoutManager: IDimensionLayoutManager;
12344 model: any;
12345 modelDepth: number;
12346 scrollOffset: number;
12347 private _scrollStep;
12348 private _firstVisibleScrollIndex;
12349 private _scrollbar;
12350 _scrollItems: any[];
12351 constructor(tablixControl: TablixControl);
12352 _onStartRenderingIteration(): void;
12353 _onEndRenderingIteration(): void;
12354 getValidScrollOffset(scrollOffset: number): number;
12355 makeScrollOffsetValid(): void;
12356 getIntegerScrollOffset(): number;
12357 getFractionScrollOffset(): number;
12358 scrollbar: Scrollbar;
12359 getFirstVisibleItem(level: number): any;
12360 getFirstVisibleChild(item: any): any;
12361 getFirstVisibleChildIndex(item: any): number;
12362 _initializeScrollbar(parentElement: HTMLElement, touchDiv: HTMLDivElement, layoutKind: TablixLayoutKind): void;
12363 getItemsCount(): number;
12364 getDepth(): number;
12365 private onScroll();
12366 otherDimension: TablixDimension;
12367 layoutManager: IDimensionLayoutManager;
12368 _createScrollbar(parentElement: HTMLElement, layoutKind: TablixLayoutKind): Scrollbar;
12369 private updateScrollPosition();
12370 }
12371 class TablixRowDimension extends TablixDimension {
12372 private _footer;
12373 constructor(tablixControl: TablixControl);
12374 setFooter(footerHeader: any): void;
12375 hasFooter(): boolean;
12376 /**
12377 * This method first populates the footer followed by each row and their correlating body cells from top to bottom.
12378 */
12379 _render(): void;
12380 _createScrollbar(parentElement: HTMLElement, layoutKind: TablixLayoutKind): Scrollbar;
12381 /**
12382 * This function is a recursive call (with its recursive behavior in addNode()) that will navigate
12383 * through the row hierarchy in DFS (Depth First Search) order and continue into a single row
12384 * upto its estimated edge.
12385 */
12386 private addNodes(items, rowIndex, depth, firstVisibleIndex);
12387 getFirstVisibleChildLeaf(item: any): any;
12388 private bindRowHeader(item, cell);
12389 /**
12390 * This method can be thought of as the continuation of addNodes() as it continues the DFS (Depth First Search)
12391 * started from addNodes(). This function also handles ending the recursion with "_needsToRealize" being set to
12392 * false.
12393 *
12394 * Once the body cells are reached, populating is done linearly with addBodyCells().
12395 */
12396 private addNode(item, items, rowIndex, depth);
12397 private rowHeaderMatch(item, cell);
12398 private addBodyCells(item, items, rowIndex);
12399 private bindBodyCell(item, cell);
12400 private addFooterRowHeader(item);
12401 private addFooterBodyCells(rowItem);
12402 private bodyCelMatch(item, cell);
12403 }
12404 class TablixColumnDimension extends TablixDimension {
12405 constructor(tablixControl: TablixControl);
12406 _render(): void;
12407 _createScrollbar(parentElement: HTMLElement, layoutKind: TablixLayoutKind): Scrollbar;
12408 private addNodes(items, columnIndex, depth, firstVisibleIndex);
12409 private addNode(item, items, columnIndex, depth);
12410 columnHeaderMatch(item: any, cell: ITablixCell): boolean;
12411 }
12412}
12413declare module powerbi.visuals.controls {
12414 /**
12415 * This class represents the touch region of the column headers (this can also apply to footer/total).
12416 * This class is reponsible for interpreting gestures in terms of pixels to changes in column position.
12417 *
12418 * Unlike the table body, this can only scroll in one direction.
12419 */
12420 class ColumnTouchDelegate implements TouchUtils.ITouchHandler, TouchUtils.IPixelToItem {
12421 /**
12422 * Used to termine if the touch event is within bounds.
12423 */
12424 private dim;
12425 /**
12426 * Average pixel width of columns in table.
12427 */
12428 private averageSize;
12429 /**
12430 * Used for 'firing' a scroll event following a received gesture.
12431 */
12432 private tablixControl;
12433 /**
12434 * Stores the event handler of TablixControl for scroll events.
12435 */
12436 private handlers;
12437 /**
12438 * @constructor
12439 * @param region Location and area of the touch region in respect to its HTML element.
12440 */
12441 constructor(region: TouchUtils.Rectangle);
12442 dimension: TouchUtils.Rectangle;
12443 /**
12444 * Sets the amount of columns to be shifted per delta in pixels.
12445 *
12446 * @param xRatio Column to pixel ratio (# columns / # pixels).
12447 */
12448 setScrollDensity(xRatio: number): void;
12449 /**
12450 * Resize element.
12451 *
12452 * @param x X location from upper left of listened HTML element.
12453 * @param y Y location from upper left of listened HTML element.
12454 * @param width Width of area to listen for events.
12455 * @param height Height of area to listen for events.
12456 */
12457 resize(x: number, y: number, width: number, height: number): void;
12458 /**
12459 * @see IPixelToItem.
12460 */
12461 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchUtils.TouchEvent;
12462 /**
12463 * Fires event to Tablix Control to scroll with the event passed from the TouchManager.
12464 *
12465 * @param e Event recieved from touch manager.
12466 */
12467 touchEvent(e: TouchUtils.TouchEvent): void;
12468 /**
12469 * Asigns handler for scrolling when scroll event is fired.
12470 *
12471 * @param tablixObj TablixControl that's handling the fired event.
12472 * @param handlerCall The call to be made (EXAMPLE: handlerCall = object.method;).
12473 */
12474 setHandler(tablixObj: TablixControl, handlerCall: (args: any[]) => void): void;
12475 }
12476 /**
12477 * This class represents the touch region of the row headers (left or right side aligned).
12478 * This class is reponsible for interpreting gestures in terms of pixels to changes in row position.
12479 *
12480 * Unlike the table body, this can only scroll in one direction.
12481 */
12482 class RowTouchDelegate implements TouchUtils.ITouchHandler, TouchUtils.IPixelToItem {
12483 /**
12484 * Used to termine if the touch event is within bounds.
12485 */
12486 private dim;
12487 /**
12488 * Average pixel height of rows in table.
12489 */
12490 private averageSize;
12491 /**
12492 * Used for 'firing' a scroll event following a recieved gesture.
12493 */
12494 private tablixControl;
12495 /**
12496 * Stores the event handler of TablixControl for scroll events.
12497 */
12498 private handlers;
12499 /**
12500 * @constructor
12501 * @param region Location and area of the touch region in respect to its HTML element.
12502 */
12503 constructor(region: TouchUtils.Rectangle);
12504 dimension: TouchUtils.Rectangle;
12505 /**
12506 * Sets the amount of rows to be shifted per delta in pixels.
12507 *
12508 * @param yRatio Row to pixel ratio (# rows / # pixels).
12509 */
12510 setScrollDensity(yRatio: number): void;
12511 /**
12512 * Resize element.
12513 * @param x X location from upper left of listened HTML element.
12514 * @param y Y location from upper left of listened HTML element.
12515 * @param width Width of area to listen for events.
12516 * @param height Height of area to listen for events.
12517 */
12518 resize(x: number, y: number, width: number, height: number): void;
12519 /**
12520 * @see: IPixelToItem
12521 */
12522 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchUtils.TouchEvent;
12523 /**
12524 * Fires event to Tablix Control to scroll with the event passed from the TouchManager.
12525 *
12526 * @param e Event recieved from touch manager.
12527 */
12528 touchEvent(e: TouchUtils.TouchEvent): void;
12529 /**
12530 * Asigns handler for scrolling when scroll event is fired.
12531 *
12532 * @param tablixObj TablixControl that's handling the fired event.
12533 * @param handlerCall The call to be made (EXAMPLE: handlerCall = object.method;).
12534 */
12535 setHandler(tablixObj: TablixControl, handlerCall: (args: any[]) => void): void;
12536 }
12537 /**
12538 * This class represents the touch region covering the body of the table.
12539 * This class is reponsible for interpreting gestures in terms of pixels to
12540 * changes in row and column position.
12541 */
12542 class BodyTouchDelegate implements TouchUtils.ITouchHandler, TouchUtils.IPixelToItem {
12543 private static DefaultAverageSizeX;
12544 private static DefaultAverageSizeY;
12545 /**
12546 * Used to termine if the touch event is within bounds.
12547 */
12548 private dim;
12549 /**
12550 * Average pixel width of columns in table.
12551 */
12552 private averageSizeX;
12553 /**
12554 * Average pixel height of rows in table.
12555 */
12556 private averageSizeY;
12557 /**
12558 * Used for 'firing' a scroll event following a recieved gesture.
12559 */
12560 private tablixControl;
12561 /**
12562 * Stores the event handler of TablixControl for scroll events.
12563 */
12564 private handlers;
12565 /**
12566 * @constructor
12567 * @param region Location and area of the touch region in respect to its HTML element.
12568 */
12569 constructor(region: TouchUtils.Rectangle);
12570 /**
12571 * Returns dimension.
12572 *
12573 * @return The dimentions of the region this delegate listens to.
12574 */
12575 dimension: TouchUtils.Rectangle;
12576 /**
12577 * Sets the amount of rows and columns to be shifted per delta in pixels.
12578 *
12579 * @param xRatio Column to pixel ratio (# columns / # pixels)
12580 * @param yRatio Row to pixel ratio (# rows / # pixels)
12581 */
12582 setScrollDensity(xRatio: number, yRatio: number): void;
12583 /**
12584 * Resize element.
12585 *
12586 * @param x X location from upper left of listened HTML element.
12587 * @param y Y location from upper left of listened HTML element.
12588 * @param width Width of area to listen for events.
12589 * @param height Height of area to listen for events.
12590 */
12591 resize(x: number, y: number, width: number, height: number): void;
12592 /**
12593 * @see: IPixelToItem.
12594 */
12595 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchUtils.TouchEvent;
12596 /**
12597 * Fires event to Tablix Control to scroll with the event passed from the TouchManager.
12598 *
12599 * @param e Event recieved from touch manager.
12600 */
12601 touchEvent(e: TouchUtils.TouchEvent): void;
12602 /**
12603 * Asigns handler for scrolling when scroll event is fired.
12604 *
12605 * @param tablixObj TablixControl that's handling the fired event.
12606 * @param handlerCall The call to be made (EXAMPLE: handlerCall = object.method;).
12607 */
12608 setHandler(tablixObj: TablixControl, handlerCall: (args: any[]) => void): void;
12609 }
12610}
12611declare module powerbi.visuals.controls.TouchUtils {
12612 class Point {
12613 x: number;
12614 y: number;
12615 constructor(x?: number, y?: number);
12616 offset(offsetX: number, offsetY: number): void;
12617 }
12618 class Rectangle extends Point {
12619 width: number;
12620 height: number;
12621 constructor(x?: number, y?: number, width?: number, height?: number);
12622 point: Point;
12623 contains(p: Point): boolean;
12624 static contains(rect: Rectangle, p: Point): boolean;
12625 static isEmpty(rect: Rectangle): boolean;
12626 }
12627 const enum SwipeDirection {
12628 /**
12629 * Swipe gesture moves along the y-axis at an angle within an established threshold.
12630 */
12631 Vertical = 0,
12632 /**
12633 * Swipe gesture moves along the x-axis at an angle within an established threshold.
12634 */
12635 Horizontal = 1,
12636 /**
12637 * Swipe gesture does not stay within the thresholds of either x or y-axis.
12638 */
12639 FreeForm = 2,
12640 }
12641 enum MouseButton {
12642 NoClick = 0,
12643 LeftClick = 1,
12644 RightClick = 2,
12645 CenterClick = 3,
12646 }
12647 /**
12648 * Interface serves as a way to convert pixel point to any needed unit of
12649 * positioning over two axises such as row/column positioning.
12650 */
12651 interface IPixelToItem {
12652 getPixelToItem(x: number, y: number, dx: number, dy: number, down: boolean): TouchEvent;
12653 }
12654 /**
12655 * Interface for listening to a simple touch event that's abstracted away
12656 * from any platform specific traits.
12657 */
12658 interface ITouchHandler {
12659 touchEvent(e: TouchEvent): void;
12660 }
12661 /**
12662 * A simple touch event class that's abstracted away from any platform specific traits.
12663 */
12664 class TouchEvent {
12665 /**
12666 * X-axis (not neccessarily in pixels (see IPixelToItem)).
12667 */
12668 private _x;
12669 /**
12670 * Y-axis (not neccessarily in pixels (see IPixelToItem)).
12671 */
12672 private _y;
12673 /**
12674 * Delta of x-axis (not neccessarily in pixels (see IPixelToItem)).
12675 */
12676 private _dx;
12677 /**
12678 * Delta of y-axis (not neccessarily in pixels (see IPixelToItem)).
12679 */
12680 private _dy;
12681 /**
12682 * Determines if the mouse button is pressed.
12683 */
12684 private isMouseButtonDown;
12685 /**
12686 * @constructor
12687 * @param x X Location of mouse.
12688 * @param y Y Location of mouse.
12689 * @param isMouseDown Indicates if the mouse button is held down or a finger press on screen.
12690 * @param dx (optional) The change in x of the gesture.
12691 * @param dy (optional) The change in y of the gesture.
12692 */
12693 constructor(x: number, y: number, isMouseDown: boolean, dx?: number, dy?: number);
12694 x: number;
12695 y: number;
12696 dx: number;
12697 dy: number;
12698 /**
12699 * Returns a boolean indicating if the mouse button is held down.
12700 *
12701 * @return: True if the the mouse button is held down,
12702 * otherwise false.
12703 */
12704 isMouseDown: boolean;
12705 }
12706 /**
12707 * This interface defines the datamembers stored for each touch region.
12708 */
12709 interface ITouchHandlerSet {
12710 handler: ITouchHandler;
12711 region: Rectangle;
12712 lastPoint: TouchEvent;
12713 converter: IPixelToItem;
12714 }
12715 /**
12716 * This class "listens" to the TouchEventInterpreter to recieve touch events and sends it to all
12717 * "Touch Delegates" with TouchRegions that contain the mouse event. Prior to sending off the
12718 * event, its position is put in respect to the delegate's TouchRegion and converted to the appropriate
12719 * unit (see IPixelToItem).
12720 */
12721 class TouchManager {
12722 /**
12723 * List of touch regions and their correlating data memebers.
12724 */
12725 private touchList;
12726 /**
12727 * Boolean to enable thresholds for fixing to an axis when scrolling.
12728 */
12729 private scrollThreshold;
12730 /**
12731 * Boolean to enable locking to an axis when gesture is fixed to an axis.
12732 */
12733 private lockThreshold;
12734 /**
12735 * The current direction of the swipe.
12736 */
12737 private swipeDirection;
12738 /**
12739 * The count of consecutive events match the current swipe direction.
12740 */
12741 private matchingDirectionCount;
12742 /**
12743 * The last recieved mouse event.
12744 */
12745 private lastTouchEvent;
12746 /**
12747 * Default constructor.
12748 *
12749 * The default behavior is to enable thresholds and lock to axis.
12750 */
12751 constructor();
12752 lastEvent: TouchEvent;
12753 /**
12754 * @param region Rectangle indicating the locations of the touch region.
12755 * @param handler Handler for recieved touch events.
12756 * @param converter Converts from pixels to the wanted item of measure (rows, columns, etc).
12757 *
12758 * EXAMPLE: dx -> from # of pixels to the right to # of columns moved to the right.
12759 */
12760 addTouchRegion(region: Rectangle, handler: ITouchHandler, converter: IPixelToItem): void;
12761 /**
12762 * Sends a mouse up event to all regions with their last event as a mouse down event.
12763 */
12764 upAllTouches(): void;
12765 touchEvent(e: TouchEvent): void;
12766 /**
12767 * @param e Position of event used to find touched regions
12768 * @return Array of regions that contain the event point.
12769 */
12770 private _findRegions(e);
12771 /**
12772 * @return Array of regions that contain a mouse down event. (see ITouchHandlerSet.lastPoint).
12773 */
12774 private _getActive();
12775 }
12776 /**
12777 * This class is responsible for establishing connections to handle touch events
12778 * and to interpret those events so they're compatible with the touch abstractions.
12779 *
12780 * Touch events with platform specific handles should be done here.
12781 */
12782 class TouchEventInterpreter {
12783 /**
12784 * HTML element that touch events are drawn from.
12785 */
12786 private touchPanel;
12787 /**
12788 * Boolean enabling mouse drag.
12789 */
12790 private allowMouseDrag;
12791 /**
12792 * Touch events are interpreted and passed on this manager.
12793 */
12794 private manager;
12795 /**
12796 * @see TablixLayoutManager.
12797 */
12798 private scale;
12799 /**
12800 * Used for mouse location when a secondary div is used along side the primary with this one being the primary.
12801 */
12802 private touchReferencePoint;
12803 /**
12804 * Rectangle containing the targeted Div.
12805 */
12806 private rect;
12807 private documentMouseMoveWrapper;
12808 private documentMouseUpWrapper;
12809 /**
12810 * Those setting related to swipe detection
12811 * touchStartTime - the time that the user touched down the screen.
12812 */
12813 private touchStartTime;
12814 /**
12815 * The page y value of the touch event when the user touched down.
12816 */
12817 private touchStartPageY;
12818 /**
12819 * The last page y value befoer the user raised up his finger.
12820 */
12821 private touchLastPageY;
12822 /**
12823 * The last page x value befoer the user raised up his finger.
12824 */
12825 private touchLastPageX;
12826 /**
12827 * An indicator whether we are now running the slide affect.
12828 */
12829 private sliding;
12830 constructor(manager: TouchManager);
12831 initTouch(panel: HTMLElement, touchReferencePoint?: HTMLElement, allowMouseDrag?: boolean): void;
12832 private getXYByClient(pageX, pageY, rect);
12833 onTouchStart(e: any): void;
12834 onTouchMove(e: any): void;
12835 onTouchEnd(e: any): void;
12836 onTouchMouseDown(e: MouseEvent): void;
12837 onTouchMouseMove(e: MouseEvent): void;
12838 onTouchMouseUp(e: MouseEvent, bubble?: boolean): void;
12839 private getSwipeInfo();
12840 private didUserSwipe(swipeInfo);
12841 /**
12842 * In case of swipe - auto advance to the swipe direction in 2 steps.
12843 */
12844 private startSlideAffect(swipeInfo);
12845 private didUserChangeDirection(swipeInfo);
12846 private slide(point, slideDist, swipeInfo);
12847 private clearSlide();
12848 private upAllTouches();
12849 private clearTouchEvents();
12850 }
12851}
12852declare module powerbi.visuals.controls {
12853 enum TablixType {
12854 Matrix = 0,
12855 Table = 1,
12856 }
12857 /**
12858 * General section of Formatting Properties for Tablix
12859 */
12860 interface TablixFormattingPropertiesGeneral {
12861 /** Property that drives whether columns should use automatically calculated (based on content) sizes for width or use persisted sizes.
12862 Default is true i.e. automatically calculate width based on column content */
12863 autoSizeColumnWidth: boolean;
12864 /**
12865 * Font size for the whole tablix
12866 * Default is 8
12867 */
12868 textSize: number;
12869 }
12870 /**
12871 * General section of Formatting Properties for Table
12872 */
12873 interface TablixFormattingPropertiesGeneralTable extends TablixFormattingPropertiesGeneral {
12874 totals?: boolean;
12875 }
12876 /**
12877 * General section of Formatting Properties for Matrix
12878 */
12879 interface TablixFormattingPropertiesGeneralMatrix extends TablixFormattingPropertiesGeneral {
12880 /**
12881 * Show/Hide Subtotal Rows
12882 */
12883 rowSubtotals?: boolean;
12884 /**
12885 * Show/Hide Subtotal Columns
12886 */
12887 columnSubtotals?: boolean;
12888 }
12889 /**
12890 * Grid section of Formatting Properties for Tablix
12891 */
12892 interface TablixFormattingPropertiesGrid {
12893 /**
12894 * Show/Hide vertical gridlines
12895 */
12896 gridVertical?: boolean;
12897 /**
12898 * vertical gridlines color
12899 */
12900 gridVerticalColor?: string;
12901 /**
12902 * vertical gridlines Weight
12903 */
12904 gridVerticalWeight?: number;
12905 /**
12906 * Show/Hide horizontal gridlines
12907 */
12908 gridHorizontal?: boolean;
12909 /**
12910 * horizontal gridlines color
12911 */
12912 gridHorizontalColor?: string;
12913 /**
12914 * horizontal gridlines Weight
12915 */
12916 gridHorizontalWeight?: number;
12917 /**
12918 * Color of the outline. Shared across all regions
12919 */
12920 outlineColor?: string;
12921 /**
12922 * Weight outline. Shared across all regions
12923 */
12924 outlineWeight?: number;
12925 /**
12926 * Weight outline. Shared across all regions
12927 */
12928 rowPadding?: number;
12929 /**
12930 * Maximum height of images in pixels
12931 */
12932 imageHeight?: number;
12933 }
12934 /**
12935 * Common Formatting Properties for Tablix regions (Column Headers, Row Headers, Total, SubTotals)
12936 */
12937 interface TablixFormattingPropertiesRegion {
12938 fontColor?: string;
12939 backColor?: string;
12940 outline: string;
12941 }
12942 interface TablixFormattingPropertiesValues {
12943 fontColorPrimary?: string;
12944 backColorPrimary?: string;
12945 fontColorSecondary?: string;
12946 backColorSecondary?: string;
12947 outline: string;
12948 }
12949 /**
12950 * Formatting Properties for Table Values region
12951 */
12952 interface TablixFormattingPropertiesValuesTable extends TablixFormattingPropertiesValues {
12953 urlIcon?: boolean;
12954 }
12955 /**
12956 * Formatting Properties for Table Visual
12957 */
12958 interface TablixFormattingPropertiesTable {
12959 general?: TablixFormattingPropertiesGeneralTable;
12960 grid?: TablixFormattingPropertiesGrid;
12961 columnHeaders?: TablixFormattingPropertiesRegion;
12962 values?: TablixFormattingPropertiesValuesTable;
12963 total?: TablixFormattingPropertiesRegion;
12964 }
12965 /**
12966 * Formatting Properties for Matrix Visual
12967 */
12968 interface TablixFormattingPropertiesMatrix {
12969 general?: TablixFormattingPropertiesGeneralMatrix;
12970 grid?: TablixFormattingPropertiesGrid;
12971 columnHeaders?: TablixFormattingPropertiesRegion;
12972 rowHeaders?: TablixFormattingPropertiesRegion;
12973 values?: TablixFormattingPropertiesValues;
12974 subtotals?: TablixFormattingPropertiesRegion;
12975 }
12976}
12977declare module powerbi.visuals.controls {
12978 /**
12979 * Column Width Object identifying a certain column and its width
12980 */
12981 interface ColumnWidthObject {
12982 /**
12983 * QueryName of the Column
12984 */
12985 queryName: string;
12986 /**
12987 * Width of the column in px. -1 means it's fixed but unknown.
12988 */
12989 width: number;
12990 }
12991 /**
12992 * Handler for Column Width Changed event
12993 */
12994 interface ColumnWidthCallbackType {
12995 (index: number, width: number): void;
12996 }
12997 /**
12998 * Handler for requesting host to persist Column Width Objects
12999 */
13000 interface HostPersistCallBack {
13001 (visualObjectInstances: VisualObjectInstancesToPersist): void;
13002 }
13003 class TablixColumnWidthManager {
13004 /**
13005 * PropertyID for Column Widths (General > columnWidth)
13006 */
13007 static columnWidthProp: DataViewObjectPropertyIdentifier;
13008 /**
13009 * Array holding widths for all columns. Index is the index for the column in the visual Table/Matrix
13010 * Width will be a number for fixed size columns, undefined for autosized columns
13011 */
13012 private columnWidthObjects;
13013 /**
13014 * Visual Object Instances to be persisted. Containing autoSizeProperty and any width to remove/merge
13015 */
13016 private visualObjectInstancesToPersist;
13017 /**
13018 * True if the Tablix is a Matrix
13019 */
13020 private isMatrix;
13021 /**
13022 * Array of all leaf nodes (Row Groupings + Columns/Values instances)
13023 */
13024 private matrixLeafNodes;
13025 /**
13026 * Current DataView
13027 */
13028 private currentDataView;
13029 /**
13030 * Current value of AutoSizeColumns after last DataView Update
13031 */
13032 private currentAutoColumnSizePropertyValue;
13033 /**
13034 * Previous DataView
13035 */
13036 private previousDataView;
13037 /**
13038 * Previous value of AutoSizeColumns before last DataView Update
13039 */
13040 private previousAutoColumnSizePropertyValue;
13041 /**
13042 * Handler for requesting host to persist Column Width Objects
13043 */
13044 private hostPersistCallBack;
13045 constructor(dataView: DataView, isMatrix: boolean, hostPersistCallBack: HostPersistCallBack, matrixLeafNodes?: MatrixVisualNode[]);
13046 /**
13047 * Update the current DataView
13048 * @param {dataView} DataView new DataView
13049 * @param {MatrixVisualNode[]} matrixLeafNodes? (Optional)Matrix Leaf Nodes
13050 */
13051 updateDataView(dataView: DataView, matrixLeafNodes?: MatrixVisualNode[]): void;
13052 /**
13053 * Destroy columnWidthObjects and construct it again from the currently displayed Columns
13054 */
13055 private updateColumnWidthObjects();
13056 private updateTableColumnWidthObjects();
13057 private updateMatrixColumnWidthObjects();
13058 /**
13059 * Update the column widths after a dataViewChange
13060 */
13061 updateTablixColumnWidths(): void;
13062 /**
13063 * Read the Column Widths from the Columns metadata
13064 * @param {DataViewMetadataColumn[]} columnMetaData Columns metadata
13065 */
13066 private deserializeColumnWidths(columnMetaData);
13067 /**
13068 * Returns a value indicating that autoSizeColumns was flipped from true to false
13069 */
13070 shouldPersistAllColumnWidths(): boolean;
13071 /**
13072 * Returns a value indicating that autoSizeColumns was flipped from false to true
13073 */
13074 shouldClearAllColumnWidths(): boolean;
13075 /**
13076 * Returns the current columnWidthObjects
13077 * @returns current columnWidthObjects including undefined widths for autosized columns
13078 */
13079 getColumnWidthObjects(): controls.ColumnWidthObject[];
13080 /**
13081 * Returns the current columnWidthObjects for only the fixed-size columns
13082 * @returns Returns the current columnWidthObjects excluding auto-sized columns
13083 */
13084 getFixedColumnWidthObjects(): controls.ColumnWidthObject[];
13085 /**
13086 * 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
13087 * @param {number} index index of the Column
13088 * @returns Column persisted width in pixel
13089 */
13090 getPersistedColumnWidth(index: number): number;
13091 /**
13092 * Call the host to persist the data
13093 * @param {boolean} generateInstances
13094 */
13095 private callHostToPersist(generateInstances);
13096 /**
13097 * Remove all persisted columns widths and Update visualObjectInstancesToPersist
13098 */
13099 private autoSizeAllColumns();
13100 /**
13101 * Remove persisted column width for a specific column and Update visualObjectInstancesToPersist
13102 */
13103 private onColumnAutosized(queryName);
13104 /**
13105 * Handler for a column width change by the user
13106 * @param {number} index zero-based index of the column, including hidden row header for table
13107 * @param {number} width new width
13108 */
13109 onColumnWidthChanged(index: number, width: number): void;
13110 /**
13111 * Persist all column widths, called when autoSizeColumns flipped to false
13112 * @param {number[]} widthsToPersist Widths to persist, including an empty row header for table
13113 */
13114 persistAllColumnWidths(widthsToPersist: number[]): void;
13115 /**
13116 * Construct a ColumnAutoSize object
13117 * @returns ColumnAutoSize object
13118 */
13119 private getAutoSizeColumnWidthObject();
13120 /**
13121 * Generate visualObjectInstances with autoSizeColumns and Column Widths
13122 */
13123 private generateVisualObjectInstancesToPersist();
13124 }
13125}
13126declare module powerbi.visuals {
13127 interface AnimatedTextConfigurationSettings {
13128 align?: string;
13129 maxFontSize?: number;
13130 }
13131 /**
13132 * Base class for values that are animated when resized.
13133 */
13134 class AnimatedText {
13135 /** Note: Public for testability */
13136 static formatStringProp: DataViewObjectPropertyIdentifier;
13137 protected animator: IGenericAnimator;
13138 private name;
13139 /** Note: Public for testability */
13140 svg: D3.Selection;
13141 currentViewport: IViewport;
13142 value: any;
13143 hostServices: IVisualHostServices;
13144 style: IVisualStyle;
13145 visualConfiguration: AnimatedTextConfigurationSettings;
13146 metaDataColumn: DataViewMetadataColumn;
13147 private mainText;
13148 constructor(name: string);
13149 getMetaDataColumn(dataView: DataView): void;
13150 getAdjustedFontHeight(availableWidth: number, textToMeasure: string, seedFontHeight: number): number;
13151 private getAdjustedFontHeightCore(textProperties, availableWidth, seedFontHeight, iteration);
13152 clear(): void;
13153 doValueTransition(startValue: any, endValue: any, displayUnitSystemType: DisplayUnitSystemType, animationOptions: AnimationOptions, duration: number, forceUpdate: boolean, formatter?: IValueFormatter): void;
13154 setTextColor(color: string): void;
13155 getSeedFontHeight(boundingWidth: number, boundingHeight: number): number;
13156 getTranslateX(width: number): number;
13157 getTranslateY(height: number): number;
13158 getTextAnchor(): string;
13159 protected getFormatString(column: DataViewMetadataColumn): string;
13160 }
13161}
13162declare module powerbi.visuals {
13163 /**
13164 * Renders a number that can be animate change in value.
13165 */
13166 class AnimatedNumber extends AnimatedText implements IVisual {
13167 private options;
13168 private dataViews;
13169 private formatter;
13170 constructor(svg?: D3.Selection, animator?: IGenericAnimator);
13171 init(options: VisualInitOptions): void;
13172 updateViewportDependantProperties(): void;
13173 update(options: VisualUpdateOptions): void;
13174 setFormatter(formatter?: IValueFormatter): void;
13175 onDataChanged(options: VisualDataChangedOptions): void;
13176 onResizing(viewport: IViewport): void;
13177 canResizeTo(viewport: IViewport): boolean;
13178 private updateInternal(target, suppressAnimations, forceUpdate?, formatter?);
13179 }
13180}
13181declare module powerbi.visuals {
13182 interface BasicShapeDataViewObjects extends DataViewObjects {
13183 general: BasicShapeDataViewObject;
13184 line: LineObject;
13185 fill: FillObject;
13186 rotation: RotationObject;
13187 }
13188 interface LineObject extends DataViewObject {
13189 lineColor: Fill;
13190 roundEdge: number;
13191 weight: number;
13192 transparency: number;
13193 }
13194 interface FillObject extends DataViewObject {
13195 transparency: number;
13196 fillColor: Fill;
13197 show: boolean;
13198 }
13199 interface RotationObject extends DataViewObject {
13200 angle: number;
13201 }
13202 interface BasicShapeDataViewObject extends DataViewObject {
13203 shapeType: string;
13204 shapeSvg: string;
13205 }
13206 interface BasicShapeData {
13207 shapeType: string;
13208 lineColor: string;
13209 lineTransparency: number;
13210 lineWeight: number;
13211 showFill: boolean;
13212 fillColor: string;
13213 shapeTransparency: number;
13214 roundEdge: number;
13215 angle: number;
13216 }
13217 class BasicShapeVisual implements IVisual {
13218 private currentViewport;
13219 private element;
13220 private data;
13221 private selection;
13222 static DefaultShape: string;
13223 static DefaultStrokeColor: string;
13224 static DefaultFillColor: string;
13225 static DefaultFillShowValue: boolean;
13226 static DefaultFillTransValue: number;
13227 static DefaultWeightValue: number;
13228 static DefaultLineTransValue: number;
13229 static DefaultRoundEdgeValue: number;
13230 static DefaultAngle: number;
13231 /**property for the shape line color */
13232 shapeType: string;
13233 /**property for the shape line color */
13234 lineColor: string;
13235 /**property for the shape line transparency */
13236 lineTransparency: number;
13237 /**property for the shape line weight */
13238 lineWeight: number;
13239 /**property for the shape round edge */
13240 roundEdge: number;
13241 /**property for showing the fill properties */
13242 showFill: boolean;
13243 /**property for the shape line color */
13244 fillColor: string;
13245 /**property for the shape fill transparency */
13246 shapeTransparency: number;
13247 /**property for the shape angle */
13248 angle: number;
13249 init(options: VisualInitOptions): void;
13250 constructor(options?: VisualInitOptions);
13251 update(options: VisualUpdateOptions): void;
13252 private getDataFromDataView(dataViewObject);
13253 private scaleTo360Deg(angle);
13254 private getValueFromColor(color);
13255 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
13256 render(): void;
13257 }
13258}
13259declare module powerbi.visuals {
13260 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
13261 const DEFAULT_AXIS_COLOR: string;
13262 const enum CartesianChartType {
13263 Line = 0,
13264 Area = 1,
13265 StackedArea = 2,
13266 ClusteredColumn = 3,
13267 StackedColumn = 4,
13268 ClusteredBar = 5,
13269 StackedBar = 6,
13270 HundredPercentStackedBar = 7,
13271 HundredPercentStackedColumn = 8,
13272 Scatter = 9,
13273 ComboChart = 10,
13274 DataDot = 11,
13275 Waterfall = 12,
13276 LineClusteredColumnCombo = 13,
13277 LineStackedColumnCombo = 14,
13278 DataDotClusteredColumnCombo = 15,
13279 DataDotStackedColumnCombo = 16,
13280 }
13281 interface CalculateScaleAndDomainOptions {
13282 viewport: IViewport;
13283 margin: IMargin;
13284 showCategoryAxisLabel: boolean;
13285 showValueAxisLabel: boolean;
13286 forceMerge: boolean;
13287 categoryAxisScaleType: string;
13288 valueAxisScaleType: string;
13289 trimOrdinalDataOnOverflow: boolean;
13290 playAxisControlLayout?: IRect;
13291 forcedTickCount?: number;
13292 forcedYDomain?: any[];
13293 forcedXDomain?: any[];
13294 ensureXDomain?: NumberRange;
13295 ensureYDomain?: NumberRange;
13296 categoryAxisDisplayUnits?: number;
13297 categoryAxisPrecision?: number;
13298 valueAxisDisplayUnits?: number;
13299 valueAxisPrecision?: number;
13300 }
13301 interface MergedValueAxisResult {
13302 domain: number[];
13303 merged: boolean;
13304 tickCount: number;
13305 }
13306 interface CartesianSmallViewPortProperties {
13307 hideLegendOnSmallViewPort: boolean;
13308 hideAxesOnSmallViewPort: boolean;
13309 MinHeightLegendVisible: number;
13310 MinHeightAxesVisible: number;
13311 }
13312 interface AxisRenderingOptions {
13313 axisLabels: ChartAxesLabels;
13314 viewport: IViewport;
13315 margin: IMargin;
13316 hideXAxisTitle: boolean;
13317 hideYAxisTitle: boolean;
13318 hideY2AxisTitle?: boolean;
13319 xLabelColor?: Fill;
13320 yLabelColor?: Fill;
13321 y2LabelColor?: Fill;
13322 fontSize: number;
13323 }
13324 interface CartesianConstructorOptions {
13325 chartType: CartesianChartType;
13326 isScrollable?: boolean;
13327 animator?: IGenericAnimator;
13328 cartesianSmallViewPortProperties?: CartesianSmallViewPortProperties;
13329 behavior?: IInteractiveBehavior;
13330 isLabelInteractivityEnabled?: boolean;
13331 tooltipsEnabled?: boolean;
13332 lineChartLabelDensityEnabled?: boolean;
13333 trimOrdinalDataOnOverflow?: boolean;
13334 }
13335 interface ICartesianVisual {
13336 init(options: CartesianVisualInitOptions): void;
13337 setData(dataViews: DataView[]): void;
13338 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
13339 overrideXScale(xProperties: IAxisProperties): void;
13340 render(suppressAnimations: boolean, resizeMode?: ResizeMode): CartesianVisualRenderResult;
13341 calculateLegend(): LegendData;
13342 hasLegend(): boolean;
13343 onClearSelection(): void;
13344 enumerateObjectInstances?(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
13345 getVisualCategoryAxisIsScalar?(): boolean;
13346 getSupportedCategoryAxisType?(): string;
13347 getPreferredPlotArea?(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
13348 setFilteredData?(startIndex: number, endIndex: number): CartesianData;
13349 supportsTrendLine?(): boolean;
13350 }
13351 interface CartesianVisualConstructorOptions {
13352 isScrollable: boolean;
13353 interactivityService?: IInteractivityService;
13354 animator?: IGenericAnimator;
13355 isLabelInteractivityEnabled?: boolean;
13356 tooltipsEnabled?: boolean;
13357 lineChartLabelDensityEnabled?: boolean;
13358 }
13359 interface CartesianVisualRenderResult {
13360 dataPoints: SelectableDataPoint[];
13361 behaviorOptions: any;
13362 labelDataPoints: LabelDataPoint[];
13363 labelsAreNumeric: boolean;
13364 labelDataPointGroups?: LabelDataPointsGroup[];
13365 }
13366 interface CartesianDataPoint {
13367 categoryValue: any;
13368 value: number;
13369 categoryIndex: number;
13370 seriesIndex: number;
13371 highlight?: boolean;
13372 }
13373 interface CartesianSeries {
13374 data: CartesianDataPoint[];
13375 }
13376 interface CartesianData {
13377 series: CartesianSeries[];
13378 categoryMetadata: DataViewMetadataColumn;
13379 categories: any[];
13380 hasHighlights?: boolean;
13381 }
13382 interface CartesianVisualInitOptions extends VisualInitOptions {
13383 svg: D3.Selection;
13384 cartesianHost: ICartesianVisualHost;
13385 chartType?: CartesianChartType;
13386 labelsContext?: D3.Selection;
13387 }
13388 interface ICartesianVisualHost {
13389 updateLegend(data: LegendData): void;
13390 getSharedColors(): IDataColorPalette;
13391 triggerRender(suppressAnimations: boolean): void;
13392 }
13393 interface ChartAxesLabels {
13394 x: string;
13395 y: string;
13396 y2?: string;
13397 }
13398 const enum AxisLinesVisibility {
13399 ShowLinesOnXAxis = 1,
13400 ShowLinesOnYAxis = 2,
13401 ShowLinesOnBothAxis = 3,
13402 }
13403 interface CategoryLayout {
13404 categoryCount: number;
13405 categoryThickness: number;
13406 outerPaddingRatio: number;
13407 isScalar?: boolean;
13408 }
13409 interface CategoryLayoutOptions {
13410 availableWidth: number;
13411 categoryCount: number;
13412 domain: any;
13413 trimOrdinalDataOnOverflow: boolean;
13414 isScalar?: boolean;
13415 isScrollable?: boolean;
13416 }
13417 interface CartesianAxisProperties {
13418 x: IAxisProperties;
13419 y1: IAxisProperties;
13420 y2?: IAxisProperties;
13421 }
13422 interface ReferenceLineOptions {
13423 graphicContext: D3.Selection;
13424 referenceLineProperties: DataViewObject;
13425 axes: CartesianAxisProperties;
13426 viewport: IViewport;
13427 classAndSelector: ClassAndSelector;
13428 defaultColor: string;
13429 isHorizontal: boolean;
13430 }
13431 interface ReferenceLineDataLabelOptions {
13432 referenceLineProperties: DataViewObject;
13433 axes: CartesianAxisProperties;
13434 viewport: IViewport;
13435 defaultColor: string;
13436 isHorizontal: boolean;
13437 key: string;
13438 }
13439 /**
13440 * Renders a data series as a cartestian visual.
13441 */
13442 class CartesianChart implements IVisual {
13443 static MinOrdinalRectThickness: number;
13444 static MinScalarRectThickness: number;
13445 static OuterPaddingRatio: number;
13446 static InnerPaddingRatio: number;
13447 static TickLabelPadding: number;
13448 private static ClassName;
13449 private static PlayAxisBottomMargin;
13450 private static FontSize;
13451 private static FontSizeString;
13452 static AxisTextProperties: TextProperties;
13453 private element;
13454 private chartAreaSvg;
13455 private clearCatcher;
13456 private type;
13457 private hostServices;
13458 private layers;
13459 private legend;
13460 private legendMargins;
13461 private layerLegendData;
13462 private hasSetData;
13463 private visualInitOptions;
13464 private legendObjectProperties;
13465 private categoryAxisProperties;
13466 private valueAxisProperties;
13467 private xAxisReferenceLines;
13468 private y1AxisReferenceLines;
13469 private cartesianSmallViewPortProperties;
13470 private interactivityService;
13471 private behavior;
13472 private sharedColorPalette;
13473 private isLabelInteractivityEnabled;
13474 private tooltipsEnabled;
13475 private lineChartLabelDensityEnabled;
13476 private trimOrdinalDataOnOverflow;
13477 private isMobileChart;
13478 private trendLines;
13479 private xRefLine;
13480 private y1RefLine;
13481 animator: IGenericAnimator;
13482 private axes;
13483 private scrollableAxes;
13484 private svgAxes;
13485 private svgBrush;
13486 private renderedPlotArea;
13487 private dataViews;
13488 private currentViewport;
13489 private background;
13490 private static getAxisVisibility(type);
13491 constructor(options: CartesianConstructorOptions);
13492 init(options: VisualInitOptions): void;
13493 private isPlayAxis();
13494 static getIsScalar(objects: DataViewObjects, propertyId: DataViewObjectPropertyIdentifier, type: ValueTypeDescriptor): boolean;
13495 static getAdditionalTelemetry(dataView: DataView): any;
13496 static detectScalarMapping(dataViewMapping: data.CompiledDataViewMapping): boolean;
13497 private populateObjectProperties(dataViews);
13498 private updateInternal(options, dataChanged);
13499 onDataChanged(options: VisualDataChangedOptions): void;
13500 onResizing(viewport: IViewport, resizeMode?: ResizeMode): void;
13501 scrollTo(position: number): void;
13502 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
13503 private supportsTrendLines(layerIndex?);
13504 private shouldShowLegendCard();
13505 private getAxisScaleOptions(axisType);
13506 private getCategoryAxisValues(enumeration);
13507 private getValueAxisValues(enumeration);
13508 onClearSelection(): void;
13509 private extractMetadataObjects(dataViews);
13510 private createAndInitLayers(objects);
13511 private renderLegend();
13512 private hideLegends();
13513 private render(suppressAnimations, resizeMode?);
13514 /**
13515 * Gets any minimum domain extents.
13516 * Reference lines and trend lines may enforce minimum extents on X and/or Y domains.
13517 */
13518 private getMinimumDomainExtents();
13519 private getPlotAreaRect(axesLayout, legendMargins);
13520 private renderBackgroundImage(layout);
13521 private hideAxisLabels(legendMargins);
13522 private calculateInteractivityRightMargin();
13523 private renderPlotArea(layers, axesLayout, suppressAnimations, legendMargins, resizeMode?);
13524 private renderTrendLines(axesLayout);
13525 private renderReferenceLines(axesLayout);
13526 private getReferenceLineLabels(axes, plotArea);
13527 private renderDataLabels(labelDataPointGroups, labelsAreNumeric, plotArea, suppressAnimations, isCombo);
13528 private renderLayers(layers, plotArea, axes, suppressAnimations, resizeMode?);
13529 /**
13530 * Returns the actual viewportWidth if visual is not scrollable.
13531 * @return If visual is scrollable, returns the plot area needed to draw all the datapoints.
13532 */
13533 static getPreferredPlotArea(categoryCount: number, categoryThickness: number, viewport: IViewport, isScrollable: boolean, isScalar: boolean, margin?: IMargin, noOuterPadding?: boolean): IViewport;
13534 /**
13535 * Returns preferred Category span if the visual is scrollable.
13536 */
13537 static getPreferredCategorySpan(categoryCount: number, categoryThickness: number, noOuterPadding?: boolean): number;
13538 /**
13539 * Note: Public for testing access.
13540 */
13541 static getLayout(data: ColumnChartData, options: CategoryLayoutOptions): CategoryLayout;
13542 /**
13543 * Returns the thickness for each category.
13544 * For clustered charts, you still need to divide by
13545 * the number of series to get column width after calling this method.
13546 * For linear or time scales, category thickness accomodates for
13547 * the minimum interval between consequtive points.
13548 * For all types, return value has accounted for outer padding,
13549 * but not inner padding.
13550 */
13551 static getCategoryThickness(seriesList: CartesianSeries[], numCategories: number, plotLength: number, domain: number[], isScalar: boolean, trimOrdinalDataOnOverflow: boolean): number;
13552 private static getMinInterval(seriesList);
13553 }
13554 const enum AxisLocation {
13555 X = 0,
13556 Y1 = 1,
13557 Y2 = 2,
13558 }
13559 interface CartesianAxesLayout {
13560 axes: CartesianAxisProperties;
13561 margin: IMargin;
13562 marginLimits: IMargin;
13563 axisLabels: ChartAxesLabels;
13564 viewport: IViewport;
13565 plotArea: IViewport;
13566 preferredPlotArea: IViewport;
13567 tickLabelMargins: any;
13568 tickPadding: IMargin;
13569 rotateXTickLabels90?: boolean;
13570 }
13571 class SvgCartesianAxes {
13572 private axes;
13573 static AxisPadding: IMargin;
13574 private axisGraphicsContext;
13575 private xAxisGraphicsContext;
13576 private y1AxisGraphicsContext;
13577 private y2AxisGraphicsContext;
13578 private svgScrollable;
13579 private axisGraphicsContextScrollable;
13580 private labelRegion;
13581 private labelBackgroundRegion;
13582 private categoryAxisProperties;
13583 private valueAxisProperties;
13584 private static AxisGraphicsContext;
13585 private static TickPaddingRotatedX;
13586 private static AxisLabelFontSize;
13587 private static Y2TickSize;
13588 constructor(axes: CartesianAxes);
13589 getScrollableRegion(): D3.Selection;
13590 getLabelsRegion(): D3.Selection;
13591 getLabelBackground(): D3.Selection;
13592 getXAxis(): D3.Selection;
13593 getY1Axis(): D3.Selection;
13594 getY2Axis(): D3.Selection;
13595 update(categoryAxisProperties: DataViewObject, valueAxisProperties: DataViewObject): void;
13596 init(svg: D3.Selection): void;
13597 private static updateAnimatedTickTooltips(axisSelection, values);
13598 private static updateTickTooltips(axisSelection, values);
13599 renderAxes(axesLayout: CartesianAxesLayout, duration: number, easing?: string): void;
13600 private renderAxesLabels(options);
13601 private translateAxes(viewport, margin);
13602 /**
13603 * Within the context of the given selection (g), find the offset of
13604 * the zero tick using the d3 attached datum of g.tick elements.
13605 * 'Classed' is undefined for transition selections
13606 */
13607 private static darkenZeroLine(g);
13608 private static setAxisLabelColor(g, fill);
13609 }
13610 class CartesianAxes {
13611 private static YAxisLabelPadding;
13612 private static XAxisLabelPadding;
13613 private static MaxMarginFactor;
13614 private static MinimumMargin;
13615 private categoryAxisProperties;
13616 private valueAxisProperties;
13617 private maxMarginFactor;
13618 private yAxisOrientation;
13619 private scrollbarWidth;
13620 private trimOrdinalDataOnOverflow;
13621 showLinesOnX: boolean;
13622 showLinesOnY: boolean;
13623 isScrollable: boolean;
13624 isXScrollBarVisible: boolean;
13625 isYScrollBarVisible: boolean;
13626 categoryAxisHasUnitType: boolean;
13627 valueAxisHasUnitType: boolean;
13628 secondaryValueAxisHasUnitType: boolean;
13629 private layout;
13630 constructor(isScrollable: boolean, scrollbarWidth: number, trimOrdinalDataOnOverflow: boolean);
13631 shouldShowY1OnRight(): boolean;
13632 isYAxisCategorical(): boolean;
13633 hasCategoryAxis(): boolean;
13634 hasY2Axis(): boolean;
13635 getYAxisOrientation(): string;
13636 setAxisLinesVisibility(axisLinesVisibility: AxisLinesVisibility): void;
13637 setMaxMarginFactor(factor: number): void;
13638 update(dataViews: DataView[]): void;
13639 addWarnings(warnings: IVisualWarning[]): void;
13640 /**
13641 * Computes the Cartesian Chart axes from the set of layers.
13642 */
13643 private calculateAxes(layers, viewport, margin, playAxisControlLayout, textProperties, scrollbarVisible, existingAxisProperties, hideAxisTitles, ensureXDomain?, ensureYDomain?);
13644 /**
13645 * Negotiate the axes regions, the plot area, and determine if we need a scrollbar for ordinal categories.
13646 * @param layers an array of Cartesian layout layers (column, line, etc.)
13647 * @param parentViewport the full viewport for the visual
13648 * @param padding the D3 axis padding values
13649 * @param playAxisControlLayout if this is a playable Cartesian chart, includes the layout for the play controls (start/stop, time slider)
13650 * @param hideAxisLabels forces axis titles to be hidden
13651 * @param textProperties text properties to be used by text measurement
13652 * @param interactivityRightMargin extra right margin for the interactivity
13653 * @param ensureXDomain if non null, includes values that must be part of the axis domain
13654 * @param ensureYDomain if non null, includes values that must be part of the axis domain
13655 */
13656 negotiateAxes(layers: ICartesianVisual[], parentViewport: IViewport, padding: IMargin, playAxisControlLayout: IRect, hideAxisLabels: boolean, textProperties: TextProperties, interactivityRightMargin: number, ensureXDomain?: NumberRange, ensureYDomain?: NumberRange): CartesianAxesLayout;
13657 private getPreferredPlotArea(axes, layers, isScalar);
13658 private willAllCategoriesFitInPlotArea(plotArea, preferredPlotArea);
13659 private updateAxisMargins(axes, tickLabelMargins, padding, showY1OnRight, renderY1Axis, renderY2Axis, interactivityRightMargin);
13660 isLogScaleAllowed(axisType: AxisLocation): boolean;
13661 axesHaveTicks(viewport: IViewport): boolean;
13662 shouldRenderAxisTitle(axisProperties: IAxisProperties, defaultValue: boolean, secondary: boolean): boolean;
13663 shouldRenderAxis(axisProperties: IAxisProperties, secondary?: boolean): boolean;
13664 private getAxisProperty(axisProperties, propertyName, defaultValue);
13665 private addUnitTypeToAxisLabels(axes);
13666 private static getUnitType(formatter);
13667 }
13668 class SharedColorPalette implements IDataColorPalette {
13669 private palette;
13670 private preferredScale;
13671 private rotated;
13672 constructor(palette: IDataColorPalette);
13673 getColorScaleByKey(scaleKey: string): IColorScale;
13674 getNewColorScale(): IColorScale;
13675 getColorByIndex(index: number): IColorInfo;
13676 getSentimentColors(): IColorInfo[];
13677 getBasePickerColors(): IColorInfo[];
13678 clearPreferredScale(): void;
13679 rotateScale(): void;
13680 private setPreferredScale(scaleKey);
13681 }
13682}
13683declare module powerbi.visuals {
13684 interface ColumnChartConstructorOptions extends CartesianVisualConstructorOptions {
13685 chartType: ColumnChartType;
13686 animator: IColumnChartAnimator;
13687 }
13688 interface ColumnChartData extends CartesianData {
13689 categoryFormatter: IValueFormatter;
13690 series: ColumnChartSeries[];
13691 valuesMetadata: DataViewMetadataColumn[];
13692 legendData: LegendData;
13693 hasHighlights: boolean;
13694 categoryMetadata: DataViewMetadataColumn;
13695 scalarCategoryAxis: boolean;
13696 labelSettings: VisualDataLabelsSettings;
13697 axesLabels: ChartAxesLabels;
13698 hasDynamicSeries: boolean;
13699 isMultiMeasure: boolean;
13700 defaultDataPointColor?: string;
13701 showAllDataPoints?: boolean;
13702 }
13703 interface ColumnChartSeries extends CartesianSeries {
13704 displayName: string;
13705 key: string;
13706 index: number;
13707 data: ColumnChartDataPoint[];
13708 identity: SelectionId;
13709 color: string;
13710 labelSettings: VisualDataLabelsSettings;
13711 }
13712 interface ColumnChartDataPoint extends CartesianDataPoint, SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
13713 categoryValue: number;
13714 /** Adjusted for 100% stacked if applicable */
13715 value: number;
13716 /** The top (column) or right (bar) of the rectangle, used for positioning stacked rectangles */
13717 position: number;
13718 valueAbsolute: number;
13719 /** Not adjusted for 100% stacked */
13720 valueOriginal: number;
13721 seriesIndex: number;
13722 labelSettings: VisualDataLabelsSettings;
13723 categoryIndex: number;
13724 color: string;
13725 /** The original values from the highlighted rect, used in animations */
13726 originalValue: number;
13727 originalPosition: number;
13728 originalValueAbsolute: number;
13729 /**
13730 * True if this data point is a highlighted portion and overflows (whether due to the highlight
13731 * being greater than original or of a different sign), so it needs to be thinner to accomodate.
13732 */
13733 drawThinner?: boolean;
13734 key: string;
13735 lastSeries?: boolean;
13736 chartType: ColumnChartType;
13737 }
13738 enum ColumnChartType {
13739 clusteredBar,
13740 clusteredColumn,
13741 hundredPercentStackedBar,
13742 hundredPercentStackedColumn,
13743 stackedBar,
13744 stackedColumn,
13745 }
13746 interface ColumnAxisOptions {
13747 xScale: D3.Scale.Scale;
13748 yScale: D3.Scale.Scale;
13749 seriesOffsetScale?: D3.Scale.Scale;
13750 columnWidth: number;
13751 /** Used by clustered only since categoryWidth !== columnWidth */
13752 categoryWidth?: number;
13753 isScalar: boolean;
13754 margin: IMargin;
13755 }
13756 interface IColumnLayout {
13757 shapeLayout: {
13758 width: (d: ColumnChartDataPoint) => number;
13759 x: (d: ColumnChartDataPoint) => number;
13760 y: (d: ColumnChartDataPoint) => number;
13761 height: (d: ColumnChartDataPoint) => number;
13762 };
13763 shapeLayoutWithoutHighlights: {
13764 width: (d: ColumnChartDataPoint) => number;
13765 x: (d: ColumnChartDataPoint) => number;
13766 y: (d: ColumnChartDataPoint) => number;
13767 height: (d: ColumnChartDataPoint) => number;
13768 };
13769 zeroShapeLayout: {
13770 width: (d: ColumnChartDataPoint) => number;
13771 x: (d: ColumnChartDataPoint) => number;
13772 y: (d: ColumnChartDataPoint) => number;
13773 height: (d: ColumnChartDataPoint) => number;
13774 };
13775 }
13776 interface ColumnChartContext {
13777 height: number;
13778 width: number;
13779 duration: number;
13780 hostService: IVisualHostServices;
13781 margin: IMargin;
13782 /** A group for graphics can be placed that won't be clipped to the data area of the chart. */
13783 unclippedGraphicsContext: D3.Selection;
13784 /** A SVG for graphics that should be clipped to the data area, e.g. data bars, columns, lines */
13785 mainGraphicsContext: D3.Selection;
13786 layout: CategoryLayout;
13787 animator: IColumnChartAnimator;
13788 onDragStart?: (datum: ColumnChartDataPoint) => void;
13789 interactivityService: IInteractivityService;
13790 viewportHeight: number;
13791 viewportWidth: number;
13792 is100Pct: boolean;
13793 isComboChart: boolean;
13794 }
13795 interface IColumnChartStrategy {
13796 setData(data: ColumnChartData): void;
13797 setupVisualProps(columnChartProps: ColumnChartContext): void;
13798 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
13799 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
13800 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
13801 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
13802 getClosestColumnIndex(x: number, y: number): number;
13803 }
13804 interface IColumnChartConverterStrategy {
13805 getLegend(colors: IDataColorPalette, defaultLegendLabelColor: string, defaultColor?: string): LegendSeriesInfo;
13806 getValueBySeriesAndCategory(series: number, category: number): number;
13807 getMeasureNameByIndex(series: number, category: number): string;
13808 hasHighlightValues(series: number): boolean;
13809 getHighlightBySeriesAndCategory(series: number, category: number): number;
13810 }
13811 interface LegendSeriesInfo {
13812 legend: LegendData;
13813 seriesSources: DataViewMetadataColumn[];
13814 seriesObjects: DataViewObjects[][];
13815 }
13816 interface ColumnChartDrawInfo {
13817 eventGroup: D3.Selection;
13818 shapesSelection: D3.Selection;
13819 viewport: IViewport;
13820 axisOptions: ColumnAxisOptions;
13821 labelDataPoints: LabelDataPoint[];
13822 }
13823 /**
13824 * Renders a stacked and clustered column chart.
13825 */
13826 class ColumnChart implements ICartesianVisual {
13827 private static ColumnChartClassName;
13828 static clusteredValidLabelPositions: RectLabelPosition[];
13829 static stackedValidLabelPositions: RectLabelPosition[];
13830 static SeriesClasses: jsCommon.CssConstants.ClassAndSelector;
13831 private svg;
13832 private unclippedGraphicsContext;
13833 private mainGraphicsContext;
13834 private xAxisProperties;
13835 private yAxisProperties;
13836 private currentViewport;
13837 private data;
13838 private style;
13839 private colors;
13840 private chartType;
13841 private columnChart;
13842 private hostService;
13843 private cartesianVisualHost;
13844 private interactivity;
13845 private margin;
13846 private options;
13847 private lastInteractiveSelectedColumnIndex;
13848 private interactivityService;
13849 private dataView;
13850 private categoryAxisType;
13851 private animator;
13852 private isScrollable;
13853 private tooltipsEnabled;
13854 private element;
13855 private isComboChart;
13856 constructor(options: ColumnChartConstructorOptions);
13857 static customizeQuery(options: CustomizeQueryOptions): void;
13858 static getSortableRoles(options: VisualSortableOptions): string[];
13859 updateVisualMetadata(x: IAxisProperties, y: IAxisProperties, margin: any): void;
13860 init(options: CartesianVisualInitOptions): void;
13861 private getCategoryLayout(numCategoryValues, options);
13862 static converter(dataView: DataView, colors: IDataColorPalette, is100PercentStacked?: boolean, isScalar?: boolean, dataViewMetadata?: DataViewMetadata, chartType?: ColumnChartType, interactivityService?: IInteractivityService, tooltipsEnabled?: boolean): ColumnChartData;
13863 private static canSupportOverflow(chartType, seriesCount);
13864 private static createDataPoints(dataView, categories, categoryIdentities, legend, seriesObjectsList, converterStrategy, defaultLabelSettings, is100PercentStacked?, isScalar?, isCategoryAlsoSeries?, categoryObjectsList?, defaultDataPointColor?, chartType?, categoryMetadata?, tooltipsEnabled?);
13865 private static getDataPointColor(legendItem, categoryIndex, dataPointObjects?);
13866 private static getStackedLabelColor(isNegative, seriesIndex, seriesCount, categoryIndex, rawValues);
13867 static sliceSeries(series: ColumnChartSeries[], endIndex: number, startIndex?: number): ColumnChartSeries[];
13868 static getInteractiveColumnChartDomElement(element: JQuery): HTMLElement;
13869 setData(dataViews: DataView[]): void;
13870 private setChartStrategy();
13871 calculateLegend(): LegendData;
13872 hasLegend(): boolean;
13873 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
13874 private enumerateDataLabels(enumeration);
13875 private getLabelSettingsOptions(enumeration, labelSettings, series?, showAll?);
13876 private enumerateDataPoints(enumeration);
13877 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
13878 getPreferredPlotArea(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
13879 private ApplyInteractivity(chartContext);
13880 private selectColumn(indexOfColumnSelected, force?);
13881 private createInteractiveLegendDataPoints(columnIndex);
13882 overrideXScale(xProperties: IAxisProperties): void;
13883 render(suppressAnimations: boolean): CartesianVisualRenderResult;
13884 onClearSelection(): void;
13885 getVisualCategoryAxisIsScalar(): boolean;
13886 getSupportedCategoryAxisType(): string;
13887 setFilteredData(startIndex: number, endIndex: number): CartesianData;
13888 static getLabelFill(labelColor: string, isInside: boolean, isCombo: boolean): string;
13889 supportsTrendLine(): boolean;
13890 static isBar(chartType: ColumnChartType): boolean;
13891 static isColumn(chartType: ColumnChartType): boolean;
13892 static isClustered(chartType: ColumnChartType): boolean;
13893 static isStacked(chartType: ColumnChartType): boolean;
13894 static isStacked100(chartType: ColumnChartType): boolean;
13895 }
13896}
13897declare module powerbi.visuals {
13898 class ClusteredColumnChartStrategy implements IColumnChartStrategy {
13899 private static classes;
13900 private data;
13901 private graphicsContext;
13902 private seriesOffsetScale;
13903 private width;
13904 private height;
13905 private margin;
13906 private xProps;
13907 private yProps;
13908 private categoryLayout;
13909 private viewportHeight;
13910 private viewportWidth;
13911 private columnsCenters;
13912 private columnSelectionLineHandle;
13913 private animator;
13914 private interactivityService;
13915 private layout;
13916 private isComboChart;
13917 setupVisualProps(columnChartProps: ColumnChartContext): void;
13918 setData(data: ColumnChartData): void;
13919 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
13920 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
13921 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
13922 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
13923 getClosestColumnIndex(x: number, y: number): number;
13924 /**
13925 * Get the chart's columns centers (x value).
13926 */
13927 private getColumnsCenters();
13928 private moveHandle(selectedColumnIndex);
13929 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
13930 private createLabelDataPoints();
13931 }
13932 class ClusteredBarChartStrategy implements IColumnChartStrategy {
13933 private static classes;
13934 private data;
13935 private graphicsContext;
13936 private seriesOffsetScale;
13937 private width;
13938 private height;
13939 private margin;
13940 private xProps;
13941 private yProps;
13942 private categoryLayout;
13943 private viewportHeight;
13944 private viewportWidth;
13945 private barsCenters;
13946 private columnSelectionLineHandle;
13947 private animator;
13948 private interactivityService;
13949 private layout;
13950 private isComboChart;
13951 setupVisualProps(barChartProps: ColumnChartContext): void;
13952 setData(data: ColumnChartData): void;
13953 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
13954 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
13955 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
13956 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
13957 getClosestColumnIndex(x: number, y: number): number;
13958 /**
13959 * Get the chart's columns centers (y value).
13960 */
13961 private getBarsCenters();
13962 private moveHandle(selectedColumnIndex);
13963 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
13964 private createLabelDataPoints();
13965 }
13966}
13967declare module powerbi.visuals {
13968 class StackedColumnChartStrategy implements IColumnChartStrategy {
13969 private static classes;
13970 private data;
13971 private graphicsContext;
13972 private width;
13973 private height;
13974 private margin;
13975 private xProps;
13976 private yProps;
13977 private categoryLayout;
13978 private columnsCenters;
13979 private columnSelectionLineHandle;
13980 private animator;
13981 private interactivityService;
13982 private viewportHeight;
13983 private viewportWidth;
13984 private layout;
13985 private isComboChart;
13986 setupVisualProps(columnChartProps: ColumnChartContext): void;
13987 setData(data: ColumnChartData): void;
13988 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, xReferenceLineValue?: number): IAxisProperties;
13989 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, y1ReferenceLineValue?: number): IAxisProperties;
13990 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
13991 selectColumn(selectedColumnIndex: number, lastSelectedColumnIndex: number): void;
13992 getClosestColumnIndex(x: number, y: number): number;
13993 /**
13994 * Get the chart's columns centers (x value).
13995 */
13996 private getColumnsCenters();
13997 private moveHandle(selectedColumnIndex);
13998 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
13999 private createLabelDataPoints();
14000 }
14001 class StackedBarChartStrategy implements IColumnChartStrategy {
14002 private static classes;
14003 private data;
14004 private graphicsContext;
14005 private width;
14006 height: number;
14007 private margin;
14008 private xProps;
14009 private yProps;
14010 private categoryLayout;
14011 private barsCenters;
14012 private columnSelectionLineHandle;
14013 private animator;
14014 private interactivityService;
14015 private viewportHeight;
14016 private viewportWidth;
14017 private layout;
14018 private isComboChart;
14019 setupVisualProps(barChartProps: ColumnChartContext): void;
14020 setData(data: ColumnChartData): void;
14021 setYScale(is100Pct: boolean, forcedTickCount?: number, forcedYDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureYDomain?: NumberRange): IAxisProperties;
14022 setXScale(is100Pct: boolean, forcedTickCount?: number, forcedXDomain?: any[], axisScaleType?: string, axisDisplayUnits?: number, axisPrecision?: number, ensureXDomain?: NumberRange): IAxisProperties;
14023 drawColumns(useAnimation: boolean): ColumnChartDrawInfo;
14024 selectColumn(selectedColumnIndex: number, lastInteractiveSelectedColumnIndex: number): void;
14025 getClosestColumnIndex(x: number, y: number): number;
14026 /**
14027 * Get the chart's columns centers (y value).
14028 */
14029 private getBarsCenters();
14030 private moveHandle(selectedColumnIndex);
14031 static getLayout(data: ColumnChartData, axisOptions: ColumnAxisOptions): IColumnLayout;
14032 private createLabelDataPoints();
14033 }
14034}
14035declare module powerbi.visuals.samples {
14036 interface HelloViewModel {
14037 text: string;
14038 color: string;
14039 size: number;
14040 selector: SelectionId;
14041 toolTipInfo: TooltipDataItem[];
14042 }
14043 class HelloIVisual implements IVisual {
14044 static capabilities: VisualCapabilities;
14045 private static DefaultText;
14046 private root;
14047 private svgText;
14048 private dataView;
14049 private selectiionManager;
14050 static converter(dataView: DataView): HelloViewModel;
14051 init(options: VisualInitOptions): void;
14052 update(options: VisualUpdateOptions): void;
14053 private static getFill(dataView);
14054 private static getSize(dataView);
14055 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
14056 destroy(): void;
14057 }
14058}
14059declare module powerbi.visuals {
14060 interface ComboChartDataViewObjects extends DataViewObjects {
14061 general: ComboChartDataViewObject;
14062 }
14063 interface ComboChartDataViewObject extends DataViewObject {
14064 visualType1: string;
14065 visualType2: string;
14066 }
14067 /**
14068 * This module only supplies the capabilities for comboCharts.
14069 * Implementation is in cartesianChart and the various ICartesianVisual implementations.
14070 */
14071 module ComboChart {
14072 const capabilities: VisualCapabilities;
14073 /**
14074 * Handles the case of a column layer in a combo chart. In this case, the column layer is enumearated last.
14075 */
14076 function enumerateDataPoints(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions, layers: ICartesianVisual[]): void;
14077 function customizeQuery(options: CustomizeQueryOptions): void;
14078 function getSortableRoles(options: VisualSortableOptions): string[];
14079 function isComboChart(chartType: CartesianChartType): boolean;
14080 }
14081}
14082declare module powerbi.visuals {
14083 class DataColorPalette implements IDataColorPalette {
14084 private scales;
14085 private colors;
14086 private sentimentColors;
14087 private basePickerColors;
14088 /**
14089 * Creates a DataColorPalette using the given theme, or the default theme.
14090 */
14091 constructor(colors?: IColorInfo[], sentimentcolors?: IColorInfo[]);
14092 getColorScaleByKey(key: string): IColorScale;
14093 getNewColorScale(): IColorScale;
14094 getColorByIndex(index: number): IColorInfo;
14095 getSentimentColors(): IColorInfo[];
14096 getBasePickerColors(): IColorInfo[];
14097 getAllColors(): IColorInfo[];
14098 private createScale();
14099 }
14100 class D3ColorScale implements IColorScale {
14101 private scale;
14102 constructor(scale: D3.Scale.OrdinalScale);
14103 getColor(key: any): IColorInfo;
14104 clearAndRotateScale(): void;
14105 clone(): IColorScale;
14106 getDomain(): any[];
14107 static createFromColors(colors: IColorInfo[]): D3ColorScale;
14108 }
14109}
14110/**
14111 * IMPORTANT: This chart is not currently enabled in the PBI system and is under development.
14112 */
14113declare module powerbi.visuals {
14114 interface IDataDotChartConfiguration {
14115 xAxisProperties: IAxisProperties;
14116 yAxisProperties: IAxisProperties;
14117 margin: any;
14118 }
14119 interface DataDotChartData {
14120 series: DataDotChartSeries;
14121 hasHighlights: boolean;
14122 hasDynamicSeries: boolean;
14123 }
14124 interface DataDotChartSeries extends CartesianSeries {
14125 xCol: DataViewMetadataColumn;
14126 yCol: DataViewMetadataColumn;
14127 data: DataDotChartDataPoint[];
14128 }
14129 interface DataDotChartDataPoint extends CartesianDataPoint, SelectableDataPoint {
14130 highlight: boolean;
14131 }
14132 interface DataDotChartConstructorOptions extends CartesianVisualConstructorOptions {
14133 }
14134 /**
14135 * The data dot chart shows a set of circles with the data value inside them.
14136 * The circles are regularly spaced similar to column charts.
14137 * The radius of all dots is the same across the chart.
14138 * This is most often combined with a column chart to create the 'chicken pox' chart.
14139 * If any of the data values do not fit within the circles, then the data values are hidden
14140 * and the y axis for the dots is displayed instead.
14141 * This chart only supports a single series of data.
14142 * This chart does not display a legend.
14143 */
14144 class DataDotChart implements ICartesianVisual {
14145 static formatStringProp: DataViewObjectPropertyIdentifier;
14146 private static ClassName;
14147 private static DotClassName;
14148 private static DotClassSelector;
14149 private static DotColorKey;
14150 private static DotLabelClassName;
14151 private static DotLabelClassSelector;
14152 private static DotLabelVerticalOffset;
14153 private static DotLabelTextAnchor;
14154 private options;
14155 private svg;
14156 private element;
14157 private mainGraphicsG;
14158 private mainGraphicsContext;
14159 private currentViewport;
14160 private hostService;
14161 private cartesianVisualHost;
14162 private style;
14163 private colors;
14164 private isScrollable;
14165 private xAxisProperties;
14166 private yAxisProperties;
14167 private margin;
14168 private data;
14169 private dataViewCategorical;
14170 private clippedData;
14171 private interactivityService;
14172 private interactivity;
14173 constructor(options: DataDotChartConstructorOptions);
14174 init(options: CartesianVisualInitOptions): void;
14175 setData(dataViews: DataView[]): void;
14176 setFilteredData(startIndex: number, endIndex: number): any;
14177 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
14178 private static createClippedDataIfOverflowed(data, categoryCount);
14179 private static hasDataPoint(series);
14180 private lookupXValue(index, type);
14181 overrideXScale(xProperties: IAxisProperties): void;
14182 render(suppressAnimations: boolean): CartesianVisualRenderResult;
14183 calculateLegend(): LegendData;
14184 hasLegend(): boolean;
14185 private createLegendDataPoints(columnIndex);
14186 onClearSelection(): void;
14187 static converter(dataView: DataView, blankCategoryValue: string, interactivityService: IInteractivityService): DataDotChartData;
14188 }
14189}
14190declare module powerbi.visuals {
14191 import ClassAndSelector = jsCommon.CssConstants.ClassAndSelector;
14192 interface FunnelChartConstructorOptions {
14193 animator?: IFunnelAnimator;
14194 funnelSmallViewPortProperties?: FunnelSmallViewPortProperties;
14195 behavior?: FunnelWebBehavior;
14196 tooltipsEnabled?: boolean;
14197 }
14198 interface FunnelPercent {
14199 value: number;
14200 percent: number;
14201 isTop: boolean;
14202 }
14203 /**
14204 * value and highlightValue may be modified in the converter to
14205 * allow rendering non-standard values, such as negatives.
14206 * Store the original values for non-rendering, user-facing elements
14207 * e.g. data labels
14208 */
14209 interface FunnelSlice extends SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
14210 value: number;
14211 originalValue: number;
14212 label: string;
14213 key: string;
14214 categoryOrMeasureIndex: number;
14215 highlight?: boolean;
14216 highlightValue?: number;
14217 originalHighlightValue?: number;
14218 color: string;
14219 }
14220 interface FunnelData {
14221 slices: FunnelSlice[];
14222 categoryLabels: string[];
14223 valuesMetadata: DataViewMetadataColumn[];
14224 hasHighlights: boolean;
14225 highlightsOverflow: boolean;
14226 dataLabelsSettings: VisualDataLabelsSettings;
14227 percentBarLabelSettings: VisualDataLabelsSettings;
14228 canShowDataLabels: boolean;
14229 hasNegativeValues: boolean;
14230 allValuesAreNegative: boolean;
14231 }
14232 interface FunnelAxisOptions {
14233 maxScore: number;
14234 valueScale: D3.Scale.LinearScale;
14235 categoryScale: D3.Scale.OrdinalScale;
14236 maxWidth: number;
14237 margin: IMargin;
14238 rangeStart: number;
14239 rangeEnd: number;
14240 barToSpaceRatio: number;
14241 categoryLabels: string[];
14242 }
14243 interface IFunnelLayout {
14244 percentBarLayout: {
14245 mainLine: {
14246 x2: (d: FunnelPercent) => number;
14247 transform: (d: FunnelPercent) => string;
14248 };
14249 leftTick: {
14250 y2: (d: FunnelPercent) => number;
14251 transform: (d: FunnelPercent) => string;
14252 };
14253 rightTick: {
14254 y2: (d: FunnelPercent) => number;
14255 transform: (d: FunnelPercent) => string;
14256 };
14257 text: {
14258 x: (d: FunnelPercent) => number;
14259 y: (d: FunnelPercent) => number;
14260 style: () => string;
14261 transform: (d: FunnelPercent) => string;
14262 fill: string;
14263 maxWidth: number;
14264 };
14265 };
14266 shapeLayout: {
14267 width: (d: FunnelSlice) => number;
14268 height: (d: FunnelSlice) => number;
14269 x: (d: FunnelSlice) => number;
14270 y: (d: FunnelSlice) => number;
14271 };
14272 shapeLayoutWithoutHighlights: {
14273 width: (d: FunnelSlice) => number;
14274 height: (d: FunnelSlice) => number;
14275 x: (d: FunnelSlice) => number;
14276 y: (d: FunnelSlice) => number;
14277 };
14278 zeroShapeLayout: {
14279 width: (d: FunnelSlice) => number;
14280 height: (d: FunnelSlice) => number;
14281 x: (d: FunnelSlice) => number;
14282 y: (d: FunnelSlice) => number;
14283 };
14284 interactorLayout: {
14285 width: (d: FunnelSlice) => number;
14286 height: (d: FunnelSlice) => number;
14287 x: (d: FunnelSlice) => number;
14288 y: (d: FunnelSlice) => number;
14289 };
14290 }
14291 interface IFunnelChartSelectors {
14292 funnel: {
14293 bars: ClassAndSelector;
14294 highlights: ClassAndSelector;
14295 interactors: ClassAndSelector;
14296 };
14297 percentBar: {
14298 root: ClassAndSelector;
14299 mainLine: ClassAndSelector;
14300 leftTick: ClassAndSelector;
14301 rightTick: ClassAndSelector;
14302 text: ClassAndSelector;
14303 };
14304 }
14305 interface FunnelSmallViewPortProperties {
14306 hideFunnelCategoryLabelsOnSmallViewPort: boolean;
14307 minHeightFunnelCategoryLabelsVisible: number;
14308 }
14309 /**
14310 * Renders a funnel chart.
14311 */
14312 class FunnelChart implements IVisual {
14313 static DefaultBarOpacity: number;
14314 static DimmedBarOpacity: number;
14315 static PercentBarToBarRatio: number;
14316 static TickPadding: number;
14317 static InnerTickSize: number;
14318 static MinimumInteractorSize: number;
14319 static InnerTextClassName: string;
14320 static Selectors: IFunnelChartSelectors;
14321 static FunnelBarHighlightClass: string;
14322 static YAxisPadding: number;
14323 private static VisualClassName;
14324 private static DefaultFontFamily;
14325 private static BarToSpaceRatio;
14326 private static MaxBarHeight;
14327 private static MinBarThickness;
14328 private static LabelFunnelPadding;
14329 private static InnerTextMinimumPadding;
14330 private static OverflowingHighlightWidthRatio;
14331 private static MaxMarginFactor;
14332 private svg;
14333 private funnelGraphicsContext;
14334 private percentGraphicsContext;
14335 private clearCatcher;
14336 private axisGraphicsContext;
14337 private currentViewport;
14338 private colors;
14339 private data;
14340 private hostServices;
14341 private margin;
14342 private options;
14343 private interactivityService;
14344 private behavior;
14345 private defaultDataPointColor;
14346 private labelPositionObjects;
14347 private dataViews;
14348 private funnelSmallViewPortProperties;
14349 private tooltipsEnabled;
14350 /**
14351 * Note: Public for testing.
14352 */
14353 animator: IFunnelAnimator;
14354 constructor(options?: FunnelChartConstructorOptions);
14355 private static isValidValueColumn(valueColumn);
14356 private static getFirstValidValueColumn(values);
14357 static converter(dataView: DataView, colors: IDataColorPalette, hostServices: IVisualHostServices, defaultDataPointColor?: string, tooltipsEnabled?: boolean): FunnelData;
14358 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
14359 private static getLabelSettingsOptions(enumeration, labelSettings, isDataLabels, positionObject?);
14360 private enumerateDataPoints(enumeration);
14361 init(options: VisualInitOptions): void;
14362 private updateViewportProperties();
14363 update(options: VisualUpdateOptions): void;
14364 onDataChanged(options: VisualDataChangedOptions): void;
14365 onResizing(viewport: IViewport): void;
14366 private getMaxLabelLength(labels, properties);
14367 private updateInternal(suppressAnimations);
14368 private getUsableVerticalSpace();
14369 private isHidingPercentBars();
14370 private isSparklines();
14371 private setUpAxis();
14372 private getPercentBarTextHeight();
14373 onClearSelection(): void;
14374 static getLayout(data: FunnelData, axisOptions: FunnelAxisOptions): IFunnelLayout;
14375 static drawDefaultAxis(graphicsContext: D3.Selection, axisOptions: FunnelAxisOptions, isHidingPercentBars: boolean): void;
14376 static drawDefaultShapes(data: FunnelData, slices: FunnelSlice[], graphicsContext: D3.Selection, layout: IFunnelLayout, hasSelection: boolean): D3.UpdateSelection;
14377 static getFunnelSliceValue(slice: FunnelSlice, asOriginal?: boolean): number;
14378 static drawInteractorShapes(slices: FunnelSlice[], graphicsContext: D3.Selection, layout: IFunnelLayout): D3.UpdateSelection;
14379 private static drawPercentBarComponents(graphicsContext, data, layout, percentLabelSettings);
14380 static drawPercentBars(data: FunnelData, graphicsContext: D3.Selection, layout: IFunnelLayout, isHidingPercentBars: boolean): void;
14381 private showCategoryLabels();
14382 private static addFunnelPercentsToTooltip(pctFormatString, tooltipInfo, hostServices, percentOfFirst?, percentOfPrevious?, highlight?);
14383 private static getTextProperties(fontSize?);
14384 }
14385}
14386declare module powerbi.visuals {
14387 interface GaugeData extends TooltipEnabledDataPoint {
14388 percent: number;
14389 adjustedTotal: number;
14390 total: number;
14391 metadataColumn: DataViewMetadataColumn;
14392 targetSettings: GaugeTargetSettings;
14393 dataLabelsSettings: VisualDataLabelsSettings;
14394 calloutValueLabelsSettings: VisualDataLabelsSettings;
14395 dataPointSettings: GaugeDataPointSettings;
14396 }
14397 interface GaugeTargetSettings {
14398 min: number;
14399 max: number;
14400 target: number;
14401 }
14402 interface GaugeTargetData extends GaugeTargetSettings {
14403 total: number;
14404 tooltipItems: TooltipDataItem[];
14405 }
14406 interface GaugeDataPointSettings {
14407 fillColor: string;
14408 targetColor: string;
14409 }
14410 interface GaugeSmallViewPortProperties {
14411 hideGaugeSideNumbersOnSmallViewPort: boolean;
14412 smallGaugeMarginsOnSmallViewPort: boolean;
14413 MinHeightGaugeSideNumbersVisible: number;
14414 GaugeMarginsOnSmallViewPort: number;
14415 }
14416 interface GaugeVisualProperties {
14417 radius: number;
14418 innerRadiusOfArc: number;
14419 innerRadiusFactor: number;
14420 left: number;
14421 top: number;
14422 height: number;
14423 width: number;
14424 margin: IMargin;
14425 transformString: string;
14426 }
14427 interface AnimatedNumberProperties {
14428 transformString: string;
14429 viewport: IViewport;
14430 }
14431 interface GaugeConstructorOptions {
14432 gaugeSmallViewPortProperties?: GaugeSmallViewPortProperties;
14433 animator?: IGenericAnimator;
14434 tooltipsEnabled?: boolean;
14435 }
14436 interface GaugeDataViewObjects extends DataViewObjects {
14437 axis: GaugeDataViewObject;
14438 }
14439 interface GaugeDataViewObject extends DataViewObject {
14440 min?: number;
14441 max?: number;
14442 target?: number;
14443 }
14444 /**
14445 * Renders a number that can be animate change in value.
14446 */
14447 class Gauge implements IVisual {
14448 private static MIN_VALUE;
14449 private static MAX_VALUE;
14450 private static MinDistanceFromBottom;
14451 private static MinWidthForTargetLabel;
14452 private static DefaultTopBottomMargin;
14453 private static DefaultLeftRightMargin;
14454 private static ReducedLeftRightMargin;
14455 private static DEFAULT_MAX;
14456 private static DEFAULT_MIN;
14457 private static VisualClassName;
14458 private static DefaultStyleProperties;
14459 private static DefaultTargetSettings;
14460 private static DefaultDataPointSettings;
14461 private static InnerRadiusFactor;
14462 private static KpiBandDistanceFromMainArc;
14463 private static MainGaugeGroupClassName;
14464 private static LabelText;
14465 private static TargetConnector;
14466 private static TargetText;
14467 /** Note: Public for testability */
14468 static formatStringProp: DataViewObjectPropertyIdentifier;
14469 private svg;
14470 private mainGraphicsContext;
14471 private currentViewport;
14472 private element;
14473 private style;
14474 private data;
14475 private color;
14476 private backgroundArc;
14477 private foregroundArc;
14478 private kpiArcs;
14479 private kpiArcPaths;
14480 private foregroundArcPath;
14481 private backgroundArcPath;
14482 private targetLine;
14483 private targetConnector;
14484 private targetText;
14485 private options;
14486 private lastAngle;
14487 private margin;
14488 private animatedNumberGrapicsContext;
14489 private animatedNumber;
14490 private settings;
14491 private targetSettings;
14492 private gaugeVisualProperties;
14493 private gaugeSmallViewPortProperties;
14494 private showTargetLabel;
14495 private tooltipsEnabled;
14496 private hostService;
14497 private dataViews;
14498 animator: IGenericAnimator;
14499 constructor(options?: GaugeConstructorOptions);
14500 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
14501 private getDataLabelSettingsOptions(enumeration, labelSettings);
14502 private enumerateAxis(enumeration);
14503 private enumerateDataPoint(enumeration);
14504 private static getGaugeObjectsProperties(dataView);
14505 init(options: VisualInitOptions): void;
14506 update(options: VisualUpdateOptions): void;
14507 private updateCalloutValue(suppressAnimations);
14508 onDataChanged(options: VisualDataChangedOptions): void;
14509 onResizing(viewport: IViewport): void;
14510 private static getValidSettings(targetData);
14511 private static getGaugeData(dataView);
14512 private static overrideGaugeSettings(settings, gaugeObjectsSettings);
14513 /** Note: Made public for testability */
14514 static converter(dataView: DataView, tooltipsEnabled?: boolean): GaugeData;
14515 private static convertDataLabelSettings(dataview, objectName);
14516 private static convertDataPointSettings(dataView, targetSettings);
14517 static getMetaDataColumn(dataView: DataView): DataViewMetadataColumn;
14518 private initKpiBands();
14519 private updateKpiBands(radius, innerRadiusFactor, tString, kpiAngleAttr);
14520 private removeTargetElements();
14521 private getTargetRatio();
14522 private updateTargetLine(radius, innerRadius, left, top);
14523 /** Note: public for testability */
14524 getAnimatedNumberProperties(radius: number, innerRadiusFactor: number, top: number, left: number): AnimatedNumberProperties;
14525 /** Note: public for testability */
14526 getGaugeVisualProperties(): GaugeVisualProperties;
14527 /** Note: public for testability */
14528 drawViewPort(drawOptions: GaugeVisualProperties): void;
14529 private createTicks();
14530 private updateInternal(suppressAnimations);
14531 private updateVisualStyles();
14532 private updateVisualConfigurations();
14533 private appendTextAlongArc(ticks, radius, height, width, margin);
14534 private truncateTextIfNeeded(text, positionX, onRight);
14535 private getFormatter(dataLabelSettings, value2?);
14536 private appendTargetTextAlongArc(radius, height, width, margin);
14537 private arcTween(transition, arr);
14538 private showMinMaxLabelsOnBottom();
14539 private setMargins();
14540 private showSideNumbersLabelText();
14541 }
14542}
14543declare module powerbi.visuals {
14544 interface ImageDataViewObjects extends DataViewObjects {
14545 general: ImageDataViewObject;
14546 imageScaling: ImageScalingDataViewObject;
14547 }
14548 interface ImageDataViewObject extends DataViewObject {
14549 imageUrl: string;
14550 }
14551 interface ImageScalingDataViewObject extends DataViewObject {
14552 imageScalingType: string;
14553 }
14554 class ImageVisual implements IVisual {
14555 private element;
14556 private imageBackgroundElement;
14557 private scalingType;
14558 init(options: VisualInitOptions): void;
14559 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
14560 private enumerateImageScaling();
14561 update(options: VisualUpdateOptions): void;
14562 }
14563}
14564declare module powerbi.visuals {
14565 interface KPIStatusWithHistoryData {
14566 dataPoints: KPIStatusWithHistoryDataPoint[];
14567 directionType: string;
14568 goals: number[];
14569 formattedGoalString: string;
14570 actual: number;
14571 targetExists: boolean;
14572 historyExists: boolean;
14573 indicatorExists: boolean;
14574 trendExists: boolean;
14575 formattedValue: string;
14576 showGoal: boolean;
14577 showDistanceFromGoal: boolean;
14578 showTrendLine: boolean;
14579 }
14580 interface KPIStatusWithHistoryDataPoint {
14581 x: number;
14582 y: number;
14583 actual: number;
14584 goals: number[];
14585 }
14586 class KPIStatusWithHistory implements IVisual {
14587 static directionTypeStringProp: DataViewObjectPropertyIdentifier;
14588 static showKPIGoal: DataViewObjectPropertyIdentifier;
14589 static showKPIDistance: DataViewObjectPropertyIdentifier;
14590 static showKPITrendLine: DataViewObjectPropertyIdentifier;
14591 static indicatorDisplayUnitsProp: DataViewObjectPropertyIdentifier;
14592 static indicatorPrecisionProp: DataViewObjectPropertyIdentifier;
14593 static status: {
14594 INCREASE: string;
14595 DROP: string;
14596 IN_BETWEEN: string;
14597 NOGOAL: string;
14598 };
14599 static statusBandingType: {
14600 Below: string;
14601 Above: string;
14602 };
14603 static actualTextConsts: {
14604 VERTICAL_OFFSET_FROM_HALF_HEIGHT: number;
14605 FONT_WIDTH_FACTOR: number;
14606 RIGHT_MARGIN: number;
14607 };
14608 static kpiRedClass: string;
14609 static kpiYellowClass: string;
14610 static kpiGreenClass: string;
14611 static kpiTextGreyClass: string;
14612 static kpiGraphGreyClass: string;
14613 static allColorClasses: string;
14614 static trendAreaFilePercentage: number;
14615 static estimatedIconHeightInPx: number;
14616 static indicatorTextSizeInPx: number;
14617 private svg;
14618 private dataView;
14619 private mainGroupElement;
14620 private kpiActualText;
14621 private absoluteGoalDistanceText;
14622 private areaFill;
14623 private host;
14624 private exclamationMarkIcon;
14625 private successMarkIcon;
14626 private betweenIcon;
14627 private rootElement;
14628 private indicatorTextContainer;
14629 private textContainer;
14630 private static getLocalizedString;
14631 private static defaultCardFormatSetting;
14632 private static defaultLabelSettings;
14633 init(options: VisualInitOptions): void;
14634 update(options: VisualUpdateOptions): void;
14635 private initIcons();
14636 private render(kpiViewModel, viewport);
14637 private setShowDataMissingWarning(show);
14638 private static getDefaultFormatSettings();
14639 private static getFormatString(column);
14640 private static getProp_Show_KPIGoal(dataView);
14641 private static getProp_Show_KPITrendLine(dataView);
14642 private static getProp_Show_KPIDistance(dataView);
14643 private static getProp_KPIDirection(dataView);
14644 private static getProp_Indicator_DisplayUnits(dataView);
14645 private static getProp_Indicator_Precision(dataView);
14646 private static initDefaultLabelSettings();
14647 private static getFormattedValue(metaDataColumn, theValue, precision, displayUnits, displayUnitSystemType?);
14648 private static getFormattedGoalString(metaDataColumn, goals, precision, displayUnits);
14649 static converter(dataView: DataView, viewPort: powerbi.IViewport, directionType: string): KPIStatusWithHistoryData;
14650 static getColumnsByRole(values: DataViewValueColumns, roleString: string): DataViewValueColumn[];
14651 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
14652 destroy(): void;
14653 }
14654}
14655declare module powerbi.visuals {
14656 interface LineChartConstructorOptions extends CartesianVisualConstructorOptions {
14657 chartType?: LineChartType;
14658 lineChartLabelDensityEnabled?: boolean;
14659 }
14660 interface LineChartDataLabelsSettings extends PointDataLabelsSettings {
14661 labelDensity: number;
14662 }
14663 interface ILineChartConfiguration {
14664 xAxisProperties: IAxisProperties;
14665 yAxisProperties: IAxisProperties;
14666 margin: any;
14667 }
14668 interface LineChartCategoriesData extends LineChartDataPoint {
14669 }
14670 interface LineChartData extends CartesianData {
14671 series: LineChartSeries[];
14672 isScalar?: boolean;
14673 dataLabelsSettings: LineChartDataLabelsSettings;
14674 axesLabels: ChartAxesLabels;
14675 hasDynamicSeries?: boolean;
14676 defaultSeriesColor?: string;
14677 categoryData?: LineChartCategoriesData[];
14678 }
14679 interface LineChartSeries extends CartesianSeries, SelectableDataPoint {
14680 displayName: string;
14681 key: string;
14682 lineIndex: number;
14683 color: string;
14684 xCol: DataViewMetadataColumn;
14685 yCol: DataViewMetadataColumn;
14686 data: LineChartDataPoint[];
14687 labelSettings: LineChartDataLabelsSettings;
14688 }
14689 interface LineChartDataPoint extends CartesianDataPoint, TooltipEnabledDataPoint, SelectableDataPoint, LabelEnabledDataPoint {
14690 value: number;
14691 categoryIndex: number;
14692 seriesIndex: number;
14693 key: string;
14694 labelSettings: LineChartDataLabelsSettings;
14695 pointColor?: string;
14696 stackedValue?: number;
14697 weight?: number;
14698 }
14699 interface HoverLineDataPoint {
14700 color: string;
14701 label: string;
14702 category: string;
14703 measure: any;
14704 value: number;
14705 stackedValue: number;
14706 }
14707 const enum LineChartType {
14708 default = 1,
14709 area = 2,
14710 smooth = 4,
14711 lineShadow = 8,
14712 stackedArea = 16,
14713 }
14714 /**
14715 * Renders a data series as a line visual.
14716 */
14717 class LineChart implements ICartesianVisual {
14718 private static ClassName;
14719 private static MainGraphicsContextClassName;
14720 private static CategorySelector;
14721 private static CategoryValuePoint;
14722 private static CategoryPointSelector;
14723 private static CategoryAreaSelector;
14724 private static HoverLineCircleDot;
14725 private static LineClassSelector;
14726 private static PointRadius;
14727 private static CircleRadius;
14728 private static PathElementName;
14729 private static CircleElementName;
14730 private static CircleClassName;
14731 private static LineElementName;
14732 private static RectOverlayName;
14733 private static ScalarOuterPadding;
14734 private static interactivityStrokeWidth;
14735 private static pathXAdjustment;
14736 static AreaFillOpacity: number;
14737 static DimmedAreaFillOpacity: number;
14738 private isInteractiveChart;
14739 private isScrollable;
14740 private tooltipsEnabled;
14741 private lineClassAndSelector;
14742 private element;
14743 private cartesainSVG;
14744 private mainGraphicsContext;
14745 private mainGraphicsSVG;
14746 private hoverLineContext;
14747 private options;
14748 private dataViewCat;
14749 private colors;
14750 private host;
14751 private data;
14752 private clippedData;
14753 private lineType;
14754 private cartesianVisualHost;
14755 private xAxisProperties;
14756 private yAxisProperties;
14757 private margin;
14758 private currentViewport;
14759 private selectionCircles;
14760 private dragHandle;
14761 private hoverLine;
14762 private lastInteractiveSelectedColumnIndex;
14763 private scaleDetector;
14764 private interactivityService;
14765 private animator;
14766 private lineChartLabelDensityEnabled;
14767 private previousCategoryCount;
14768 private shouldAdjustMouseCoordsOnPathsForStroke;
14769 private static validLabelPositions;
14770 private static validStackedLabelPositions;
14771 private overlayRect;
14772 private isComboChart;
14773 private lastDragMoveXPosition;
14774 private deferDragMoveOperation;
14775 static customizeQuery(options: CustomizeQueryOptions): void;
14776 static getSortableRoles(options: VisualSortableOptions): string[];
14777 static converter(dataView: DataView, blankCategoryValue: string, colors: IDataColorPalette, isScalar: boolean, interactivityService?: IInteractivityService, shouldCalculateStacked?: boolean, isComboChart?: boolean, tooltipsEnabled?: boolean): LineChartData;
14778 static getInteractiveLineChartDomElement(element: JQuery): HTMLElement;
14779 private static getColor(colorHelper, hasDynamicSeries, values, grouped, seriesIndex, groupedIdentity);
14780 private static createStackedValueDomain(data);
14781 constructor(options: LineChartConstructorOptions);
14782 init(options: CartesianVisualInitOptions): void;
14783 setData(dataViews: DataView[]): void;
14784 calculateLegend(): LegendData;
14785 hasLegend(): boolean;
14786 setFilteredData(startIndex: number, endIndex: number): CartesianData;
14787 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
14788 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
14789 private enumerateDataPoints(enumeration);
14790 private enumerateDataLabels(enumeration);
14791 supportsTrendLine(): boolean;
14792 private getLabelSettingsOptions(enumeration, labelSettings, series?, showAll?);
14793 overrideXScale(xProperties: IAxisProperties): void;
14794 onClearSelection(): void;
14795 render(suppressAnimations: boolean): CartesianVisualRenderResult;
14796 private renderNew(duration);
14797 private renderOld(duration);
14798 /**
14799 * Note: Public for tests.
14800 */
14801 getSeriesTooltipInfo(pointData: HoverLineDataPoint[]): TooltipDataItem[];
14802 /**
14803 * Note: Public for tests.
14804 */
14805 getTooltipInfoForCombo(tooltipEvent: TooltipEvent, pointX: number): TooltipDataItem[];
14806 /**
14807 * Note: Public for tests.
14808 */
14809 getCategoryIndexFromTooltipEvent(tooltipEvent: TooltipEvent, pointX: number): number;
14810 getVisualCategoryAxisIsScalar(): boolean;
14811 getSupportedCategoryAxisType(): string;
14812 getPreferredPlotArea(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
14813 private getCategoryCount(origCatgSize);
14814 private getAvailableWidth();
14815 private getAvailableHeight();
14816 private static sliceSeries(series, newLength, startIndex?);
14817 private getXOfFirstCategory();
14818 private hasDataPoint(series);
14819 private getXValue(d);
14820 /**
14821 * This checks to see if a data point is isolated, which means
14822 * the previous and next data point are both null.
14823 */
14824 private shouldDrawCircle(d, i);
14825 selectColumnForTooltip(columnIndex: number, force?: boolean): HoverLineDataPoint[];
14826 private setHoverLineForTooltip(chartX);
14827 private setDotsForTooltip(chartX, dataPoints);
14828 /**
14829 * Updates the hover line and the legend with the selected colums (given by columnIndex).
14830 * This is for the Mobile renderer with InteractiveLegend
14831 */
14832 selectColumn(columnIndex: number, force?: boolean): void;
14833 private setHoverLine(chartX, columnIndex);
14834 private getChartX(columnIndex);
14835 /**
14836 * Finds the index of the category of the given x coordinate given.
14837 * pointX is in non-scaled screen-space, and offsetX is in render-space.
14838 * offsetX does not need any scaling adjustment.
14839 * @param {number} pointX The mouse coordinate in screen-space, without scaling applied
14840 * @param {number} offsetX Any left offset in d3.scale render-space
14841 * @return {number}
14842 */
14843 private findIndex(pointX, offsetX?);
14844 private getPosition(x, pathElement);
14845 private createTooltipDataPoints(columnIndex);
14846 private createLegendDataPoints(columnIndex);
14847 private createLabelDataPoints();
14848 /**
14849 * Adjust a mouse coordinate originating from a path; used to fix
14850 * an inconsistency between Internet Explorer and other browsers.
14851 *
14852 * Internet explorer places the origin for the coordinate system of
14853 * mouse events based on the stroke, so that the very edge of the stroke
14854 * is zero. Chrome places the 0 on the edge of the path so that the
14855 * edge of the stroke is -(strokeWidth / 2). We adjust coordinates
14856 * to match Chrome.
14857 *
14858 * TODO: Firefox is similar to IE, but does a very poor job at it, so
14859 * the edge is inacurate.
14860 *
14861 * @param value The x coordinate to be adjusted
14862 */
14863 private adjustPathXCoordinate(x);
14864 private showLabelPerSeries();
14865 }
14866}
14867declare module powerbi.visuals {
14868 interface MapConstructionOptions {
14869 filledMap?: boolean;
14870 geocoder?: IGeocoder;
14871 mapControlFactory?: IMapControlFactory;
14872 behavior?: MapBehavior;
14873 tooltipsEnabled?: boolean;
14874 filledMapDataLabelsEnabled?: boolean;
14875 disableZooming?: boolean;
14876 disablePanning?: boolean;
14877 isLegendScrollable?: boolean;
14878 viewChangeThrottleInterval?: number;
14879 enableCurrentLocation?: boolean;
14880 }
14881 interface IMapControlFactory {
14882 createMapControl(element: HTMLElement, options?: Microsoft.Maps.MapOptions): Microsoft.Maps.Map;
14883 ensureMap(locale: string, action: () => void): void;
14884 }
14885 interface MapData {
14886 dataPoints: MapDataPoint[];
14887 geocodingCategory: string;
14888 hasDynamicSeries: boolean;
14889 hasSize: boolean;
14890 }
14891 /**
14892 * The main map data point, which exists for each category
14893 */
14894 interface MapDataPoint {
14895 geocodingQuery: string;
14896 value: number;
14897 categoryValue: string;
14898 subDataPoints: MapSubDataPoint[];
14899 location?: IGeocodeCoordinate;
14900 paths?: IGeocodeBoundaryPolygon[];
14901 radius?: number;
14902 }
14903 /**
14904 * SubDataPoint that carries series-based data. For category only maps
14905 * there will only be one of these on each MapDataPoint; for dynamic series,
14906 * there will be one per series for each MapDataPoint.
14907 */
14908 interface MapSubDataPoint {
14909 value: number;
14910 fill: string;
14911 stroke: string;
14912 identity: SelectionId;
14913 tooltipInfo: TooltipDataItem[];
14914 }
14915 interface MapRendererData {
14916 bubbleData?: MapBubble[];
14917 sliceData?: MapSlice[][];
14918 shapeData?: MapShape[];
14919 }
14920 interface MapVisualDataPoint extends TooltipEnabledDataPoint, SelectableDataPoint {
14921 x: number;
14922 y: number;
14923 radius: number;
14924 fill: string;
14925 stroke: string;
14926 strokeWidth: number;
14927 labeltext: string;
14928 labelFill: string;
14929 }
14930 interface MapBubble extends MapVisualDataPoint {
14931 }
14932 interface MapSlice extends MapVisualDataPoint {
14933 value: number;
14934 startAngle?: number;
14935 endAngle?: number;
14936 }
14937 interface MapShape extends TooltipEnabledDataPoint, SelectableDataPoint {
14938 absolutePointArray: Float64Array;
14939 path: string;
14940 fill: string;
14941 stroke: string;
14942 strokeWidth: number;
14943 key: string;
14944 labeltext: string;
14945 displayLabel: boolean;
14946 catagoryLabeltext?: string;
14947 labelFormatString: string;
14948 }
14949 /**
14950 * Used because data points used in D3 pie layouts are placed within a container with pie information.
14951 */
14952 interface MapSliceContainer {
14953 data: MapSlice;
14954 }
14955 /** Note: public for UnitTest */
14956 interface IMapDataPointRenderer {
14957 init(mapControl: Microsoft.Maps.Map, mapDiv: JQuery, addClearCatcher: boolean): void;
14958 setData(data: MapData): void;
14959 getDataPointCount(): number;
14960 converter(viewPort: IViewport, dataView: DataView, labelSettings: PointDataLabelsSettings, interactivityService: IInteractivityService, tooltipsEnabled: boolean): MapRendererData;
14961 updateInternal(data: MapRendererData, viewport: IViewport, dataChanged: boolean, interactivityService: IInteractivityService, redrawDataLabels: boolean): MapBehaviorOptions;
14962 updateInternalDataLabels(viewport: IViewport, redrawDataLabels: boolean): void;
14963 getDataPointPadding(): number;
14964 clearDataPoints(): void;
14965 }
14966 interface DataViewMetadataAutoGeneratedColumn extends DataViewMetadataColumn {
14967 /**
14968 * Indicates that the column was added manually.
14969 */
14970 isAutoGeneratedColumn?: boolean;
14971 }
14972 const MaxLevelOfDetail: number;
14973 const MinLevelOfDetail: number;
14974 const DefaultFillOpacity: number;
14975 const DefaultBackgroundColor: string;
14976 const LeaderLineColor: string;
14977 class MapBubbleDataPointRenderer implements IMapDataPointRenderer {
14978 private mapControl;
14979 private mapData;
14980 private maxDataPointRadius;
14981 private svg;
14982 private clearSvg;
14983 private clearCatcher;
14984 private bubbleGraphicsContext;
14985 private sliceGraphicsContext;
14986 private labelGraphicsContext;
14987 private labelBackgroundGraphicsContext;
14988 private sliceLayout;
14989 private arc;
14990 private dataLabelsSettings;
14991 private tooltipsEnabled;
14992 private static validLabelPositions;
14993 private mapRendererData;
14994 private root;
14995 constructor(tooltipsEnabled: boolean);
14996 init(mapControl: Microsoft.Maps.Map, mapDiv: JQuery, addClearCatcher: boolean): void;
14997 setData(data: MapData): void;
14998 clearDataPoints(): void;
14999 getDataPointCount(): number;
15000 getDataPointPadding(): number;
15001 private clearMaxDataPointRadius();
15002 private setMaxDataPointRadius(dataPointRadius);
15003 getDefaultMap(geocodingCategory: string, dataPointCount: number): void;
15004 converter(viewport: IViewport, dataView: DataView, labelSettings: PointDataLabelsSettings, interactivityService: IInteractivityService, tooltipsEnabled?: boolean): MapRendererData;
15005 updateInternal(data: MapRendererData, viewport: IViewport, dataChanged: boolean, interactivityService: IInteractivityService, redrawDataLabels: boolean): MapBehaviorOptions;
15006 updateInternalDataLabels(viewport: IViewport, redrawDataLabels: boolean): void;
15007 private createLabelDataPoints();
15008 }
15009 interface FilledMapParams {
15010 level: number;
15011 maxPolygons: number;
15012 strokeWidth: number;
15013 }
15014 class MapShapeDataPointRenderer implements IMapDataPointRenderer {
15015 private mapControl;
15016 private svg;
15017 private clearSvg;
15018 private clearCatcher;
15019 private polygonInfo;
15020 private mapData;
15021 private shapeGraphicsContext;
15022 private labelGraphicsContext;
15023 private labelBackgroundGraphicsContext;
15024 private maxShapeDimension;
15025 private mapRendererData;
15026 private dataLabelsSettings;
15027 private filledMapDataLabelsEnabled;
15028 private tooltipsEnabled;
15029 private labelLayout;
15030 private static validLabelPolygonPositions;
15031 private root;
15032 static getFilledMapParams(category: string, dataCount: number): FilledMapParams;
15033 static buildPaths(locations: IGeocodeBoundaryPolygon[]): IGeocodeBoundaryPolygon[];
15034 constructor(fillMapDataLabelsEnabled: boolean, tooltipsEnabled: boolean);
15035 init(mapControl: Microsoft.Maps.Map, mapDiv: JQuery, addClearCatcher: boolean): void;
15036 setData(data: MapData): void;
15037 clearDataPoints(): void;
15038 getDataPointCount(): number;
15039 converter(viewport: IViewport, dataView: DataView, labelSettings: PointDataLabelsSettings, interactivityService?: IInteractivityService): MapRendererData;
15040 updateInternal(data: MapRendererData, viewport: IViewport, dataChanged: boolean, interactivityService: IInteractivityService, redrawDataLabels: boolean): MapBehaviorOptions;
15041 getDataPointPadding(): number;
15042 static getIndexOfLargestShape(paths: IGeocodeBoundaryPolygon[]): number;
15043 updateInternalDataLabels(viewport: IViewport, redrawDataLabels: boolean): void;
15044 private clearMaxShapeDimension();
15045 private setMaxShapeDimension(width, height);
15046 private createLabelDataPoints();
15047 private drawLabelStems(labelsContext, dataLabels, showText, showCategory);
15048 }
15049 /** Note: public for UnitTest */
15050 interface SimpleRange {
15051 min: number;
15052 max: number;
15053 }
15054 class Map implements IVisual {
15055 currentViewport: IViewport;
15056 private pendingGeocodingRender;
15057 private mapControl;
15058 private minLongitude;
15059 private maxLongitude;
15060 private minLatitude;
15061 private maxLatitude;
15062 private style;
15063 private colors;
15064 private dataPointRenderer;
15065 private geocodingCategory;
15066 private legend;
15067 private legendHeight;
15068 private legendData;
15069 private element;
15070 private dataView;
15071 private dataLabelsSettings;
15072 private static MapContainer;
15073 static StrokeDarkenColorValue: number;
15074 private interactivityService;
15075 private behavior;
15076 private defaultDataPointColor;
15077 private showAllDataPoints;
15078 private dataPointsToEnumerate;
15079 private hasDynamicSeries;
15080 private geoTaggingAnalyzerService;
15081 private isFilledMap;
15082 private host;
15083 private geocoder;
15084 private mapControlFactory;
15085 private tooltipsEnabled;
15086 private filledMapDataLabelsEnabled;
15087 private disableZooming;
15088 private disablePanning;
15089 private locale;
15090 private isLegendScrollable;
15091 private viewChangeThrottleInterval;
15092 private root;
15093 private enableCurrentLocation;
15094 private isCurrentLocation;
15095 private boundsHaveBeenUpdated;
15096 private geocodingContext;
15097 constructor(options: MapConstructionOptions);
15098 init(options: VisualInitOptions): void;
15099 private createCurrentLocation(element);
15100 private addDataPoint(dataPoint);
15101 private scheduleRedraw();
15102 private enqueueGeoCode(dataPoint);
15103 private completeGeoCode(dataPoint, location);
15104 private enqueueGeoCodeAndGeoShape(dataPoint, params);
15105 private completeGeoCodeAndGeoShape(dataPoint, params, location);
15106 private enqueueGeoShape(dataPoint, params);
15107 private completeGeoShape(dataPoint, params, result);
15108 private getOptimumLevelOfDetail(width, height);
15109 private getViewCenter(levelOfDetail);
15110 private resetBounds();
15111 private updateBounds(latitude, longitude);
15112 static legendObject(dataView: DataView): DataViewObject;
15113 static isLegendHidden(dataView: DataView): boolean;
15114 static legendPosition(dataView: DataView): LegendPosition;
15115 static getLegendFontSize(dataView: DataView): number;
15116 static isShowLegendTitle(dataView: DataView): boolean;
15117 private legendTitle();
15118 private renderLegend(legendData);
15119 /** Note: public for UnitTest */
15120 static calculateGroupSizes(categorical: DataViewCategorical, grouped: DataViewValueColumnGroup[], groupSizeTotals: number[], sizeMeasureIndex: number, currentValueScale: SimpleRange): SimpleRange;
15121 /** Note: public for UnitTest */
15122 static calculateRadius(range: SimpleRange, value?: number): number;
15123 /** Note: public for UnitTest */
15124 static getGeocodingCategory(categorical: DataViewCategorical, geoTaggingAnalyzerService: IGeoTaggingAnalyzerService): string;
15125 /** Note: public for UnitTest */
15126 static hasSizeField(values: DataViewValueColumns, defaultIndexIfNoRole?: number): boolean;
15127 static shouldEnumerateDataPoints(dataView: DataView, usesSizeForGradient: boolean): boolean;
15128 static shouldEnumerateCategoryLabels(isFilledMap: boolean, filledMapDataLabelsEnabled: boolean): boolean;
15129 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
15130 static enumerateDataPoints(enumeration: ObjectEnumerationBuilder, dataPoints: LegendDataPoint[], colors: IDataColorPalette, hasDynamicSeries: boolean, defaultDataPointColor: string, showAllDataPoints: boolean, bubbleData: MapBubble[]): void;
15131 static enumerateLegend(enumeration: ObjectEnumerationBuilder, dataView: DataView, legend: ILegend, legendTitle: string): void;
15132 onDataChanged(options: VisualDataChangedOptions): void;
15133 static converter(dataView: DataView, colorHelper: ColorHelper, geoTaggingAnalyzerService: IGeoTaggingAnalyzerService, isFilledMap: boolean): MapData;
15134 static createLegendData(dataView: DataView, colorHelper: ColorHelper): LegendData;
15135 private swapLogoContainerChildElement();
15136 onResizing(viewport: IViewport): void;
15137 private initialize(container);
15138 private onViewChanged();
15139 private onViewChangeEnded();
15140 private getMapViewPort();
15141 static removeTransform3d(mapRoot: JQuery): void;
15142 private updateInternal(dataChanged, redrawDataLabels);
15143 private updateMapView(center, levelOfDetail);
15144 private updateOffsets(dataChanged, redrawDataLabels);
15145 onClearSelection(): void;
15146 private clearDataPoints();
15147 private getDefaultMapControlFactory();
15148 private static removeHillShading();
15149 }
15150}
15151declare module powerbi.visuals {
15152 interface CardItemData {
15153 caption: string;
15154 details: string;
15155 showURL: boolean;
15156 showImage: boolean;
15157 showKPI: boolean;
15158 columnIndex: number;
15159 }
15160 interface CardSettings {
15161 outlineSettings: OutlineSettings;
15162 barSettings: OutlineSettings;
15163 cardPadding: number;
15164 cardBackground: string;
15165 }
15166 interface OutlineSettings {
15167 outline: string;
15168 color: string;
15169 weight: number;
15170 }
15171 interface MultiRowCardData {
15172 dataModel: CardData[];
15173 dataColumnCount: number;
15174 cardTitleSettings: VisualDataLabelsSettings;
15175 dataLabelsSettings: VisualDataLabelsSettings;
15176 categoryLabelsSettings: VisualDataLabelsSettings;
15177 cardSettings: CardSettings;
15178 }
15179 interface CardData {
15180 title?: string;
15181 showTitleAsURL?: boolean;
15182 showTitleAsImage?: boolean;
15183 showTitleAsKPI?: boolean;
15184 cardItemsData: CardItemData[];
15185 }
15186 class MultiRowCard implements IVisual {
15187 private currentViewport;
15188 private options;
15189 private dataView;
15190 private style;
15191 private element;
15192 private listView;
15193 /**
15194 * This includes card height with margin that will be passed to list view.
15195 */
15196 private interactivity;
15197 private isInteractivityOverflowHidden;
15198 private waitingForData;
15199 private cardHasTitle;
15200 private isSingleRowCard;
15201 private maxColPerRow;
15202 private data;
15203 /**
15204 * Note: Public for testability.
15205 */
15206 static formatStringProp: DataViewObjectPropertyIdentifier;
15207 private static MultiRowCardRoot;
15208 private static Card;
15209 private static Title;
15210 private static CardItemContainer;
15211 private static Caption;
15212 private static Details;
15213 private static TitleUrlSelector;
15214 private static CaptionUrlSelector;
15215 private static TitleImageSelector;
15216 private static CaptionImageSelector;
15217 private static KPITitle;
15218 private static ValuesRole;
15219 /**
15220 * Cards have specific styling so defined inline styles and also to support theming and improve performance.
15221 */
15222 private static DefaultStyle;
15223 private static tileMediaQueries;
15224 init(options: VisualInitOptions): void;
15225 onDataChanged(options: VisualDataChangedOptions): void;
15226 private static getCardSettings(dataView);
15227 onResizing(viewport: IViewport): void;
15228 static converter(dataView: DataView, columnCount: number, maxCards: number, isDashboardVisual?: boolean): MultiRowCardData;
15229 static getSortableRoles(options: VisualSortableOptions): string[];
15230 private initializeCardRowSelection();
15231 private getBorderStyles(border);
15232 private getMaxColPerRow();
15233 private getRowIndex(fieldIndex);
15234 private getStyle();
15235 private getSurroundSettings(outlineSettings);
15236 private getCustomStyles();
15237 private static getTextProperties(isTitle, fontSizeInPt);
15238 private hideColumn(fieldIndex);
15239 private getColumnWidth(fieldIndex, columnCount);
15240 private isLastRowItem(fieldIndex, columnCount);
15241 /**
15242 * This contains the card column wrapping logic.
15243 * Determines how many columns can be shown per each row inside a Card.
15244 * To place the fields evenly along the card,
15245 * the width of each card item is calculated based on the available viewport width.
15246 */
15247 private setCardDimensions();
15248 private onLoadMoreData();
15249 private static getDataLabelSettingsOptions(enumeration, labelSettings, show?);
15250 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
15251 private enumerateCard(enumeration);
15252 }
15253}
15254declare module powerbi.visuals {
15255 interface TextboxDataViewObjects extends DataViewObjects {
15256 general: TextboxDataViewObject;
15257 }
15258 interface TextboxDataViewObject extends DataViewObject {
15259 paragraphs: Paragraphs;
15260 }
15261 /** Represents a rich text box that supports view & edit mode. */
15262 class Textbox implements IVisual {
15263 private static ClassName;
15264 private editor;
15265 private element;
15266 private host;
15267 private viewport;
15268 private readOnly;
15269 private paragraphs;
15270 init(options: VisualInitOptions): void;
15271 onResizing(viewport: IViewport): void;
15272 onDataChanged(options: VisualDataChangedOptions): void;
15273 destroy(): void;
15274 focus(): boolean;
15275 onViewModeChanged(viewMode: ViewMode): void;
15276 setSelection(start: number, end: number): void;
15277 private refreshView();
15278 private saveContents();
15279 private updateSize();
15280 }
15281 module RichText {
15282 let defaultFont: string;
15283 const defaultFontSize: string;
15284 /**
15285 * Given a font family returns the value we should use for the font-family css property.
15286 */
15287 function getCssFontFamily(font: string): string;
15288 /**
15289 * Convert built-in font families back into their proper font families (e.g. wf_segoe-ui_normal -> Segoe UI)
15290 */
15291 function getFontFamilyForBuiltInFont(font: string): string;
15292 class QuillWrapper {
15293 private editor;
15294 private $editorDiv;
15295 private $toolbarDiv;
15296 private $container;
15297 private dependenciesLoaded;
15298 private localizationProvider;
15299 private host;
15300 private static textChangeThrottle;
15301 static preventDefaultKeys: number[];
15302 static loadQuillResources: boolean;
15303 private static quillJsFiles;
15304 private static quillCssFiles;
15305 private QuillPackage;
15306 initialized: boolean;
15307 readOnly: boolean;
15308 textChanged: (delta, source) => void;
15309 /**
15310 * JavaScript and CSS resources are typically resolved asynchronously.
15311 * This means we potentially defer certain events which typically occur
15312 * synchronously until resources are loaded.
15313 * Setting the global loadQuillResources flag to true will override
15314 * this behavior and cause the wrapper to assume these resources are already loaded
15315 * and not try to load them asynchronously (e.g. for use in unit tests).
15316 */
15317 constructor(readOnly: boolean, host: IVisualHostServices);
15318 addModule(name: any, options: any): any;
15319 getElement(): JQuery;
15320 getContents(): quill.Delta;
15321 setContents(contents: quill.Delta | quill.Op[]): void;
15322 resize(viewport: IViewport): void;
15323 setReadOnly(readOnly: boolean): void;
15324 setSelection(start: number, end: number): void;
15325 getSelection(): quill.Range;
15326 focus(): void;
15327 destroy(): void;
15328 getSelectionAtCursor(): quill.Range;
15329 getWord(): string;
15330 insertLinkAtCursor(link: string, index: number): number;
15331 getEditorContainer(): JQuery;
15332 private getTextWithoutTrailingBreak();
15333 private rebuildQuillEditor();
15334 private onTextChanged(delta, source);
15335 }
15336 }
15337}
15338declare module powerbi.visuals {
15339 const cheerMeterProps: {
15340 dataPoint: {
15341 defaultColor: DataViewObjectPropertyIdentifier;
15342 fill: DataViewObjectPropertyIdentifier;
15343 };
15344 };
15345 interface TeamData {
15346 name: string;
15347 value: number;
15348 color: string;
15349 identity: SelectionId;
15350 }
15351 interface CheerData {
15352 teamA: TeamData;
15353 teamB: TeamData;
15354 background: string;
15355 }
15356 class CheerMeter implements IVisual {
15357 static capabilities: VisualCapabilities;
15358 private static DefaultFontFamily;
15359 private static DefaultFontColor;
15360 private static DefaultBackgroundColor;
15361 private static PaddingBetweenText;
15362 private textOne;
15363 private textTwo;
15364 private svg;
15365 private isFirstTime;
15366 private data;
15367 private selectionManager;
15368 static converter(dataView: DataView): CheerData;
15369 init(options: VisualInitOptions): void;
15370 update(options: VisualUpdateOptions): void;
15371 private getRecomendedFontProperties(text1, text2, parentViewport);
15372 private calculateLayout(data, viewport);
15373 private ensureStartState(layout, viewport);
15374 private clearSelection();
15375 private clearSelectionUI();
15376 private updateSelectionUI(ids);
15377 private draw(data, duration, viewport);
15378 destroy(): void;
15379 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
15380 }
15381}
15382declare module powerbi.visuals {
15383 interface ScatterChartConstructorOptions extends CartesianVisualConstructorOptions {
15384 }
15385 interface ScatterChartDataPoint extends SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
15386 x: any;
15387 y: any;
15388 size: any;
15389 radius: RadiusData;
15390 fill: string;
15391 formattedCategory: jsCommon.Lazy<string>;
15392 fontSize?: number;
15393 }
15394 interface ScatterChartDataPointSeries {
15395 identityKey: string;
15396 dataPoints?: ScatterChartDataPoint[];
15397 hasSize?: boolean;
15398 fill?: string;
15399 }
15400 interface RadiusData {
15401 sizeMeasure: DataViewValueColumn;
15402 index: number;
15403 }
15404 interface DataRange {
15405 minRange: number;
15406 maxRange: number;
15407 delta: number;
15408 }
15409 interface ScatterChartData extends PlayableChartData, ScatterBehaviorChartData {
15410 xCol: DataViewMetadataColumn;
15411 yCol: DataViewMetadataColumn;
15412 dataPoints: ScatterChartDataPoint[];
15413 dataPointSeries: ScatterChartDataPointSeries[];
15414 legendData: LegendData;
15415 axesLabels: ChartAxesLabels;
15416 size?: DataViewMetadataColumn;
15417 sizeRange: NumberRange;
15418 dataLabelsSettings: PointDataLabelsSettings;
15419 defaultDataPointColor?: string;
15420 showAllDataPoints?: boolean;
15421 hasDynamicSeries?: boolean;
15422 fillPoint?: boolean;
15423 colorBorder?: boolean;
15424 colorByCategory?: boolean;
15425 }
15426 interface ScatterChartViewModel {
15427 xAxisProperties: IAxisProperties;
15428 yAxisProperties: IAxisProperties;
15429 viewport: IViewport;
15430 data: ScatterChartData;
15431 drawBubbles: boolean;
15432 isPlay: boolean;
15433 fillMarkers: boolean;
15434 hasSelection: boolean;
15435 animationDuration: number;
15436 animationOptions: AnimationOptions;
15437 easeType: string;
15438 suppressDataPointRendering: boolean;
15439 }
15440 interface ScatterConverterOptions {
15441 viewport: IViewport;
15442 colors: any;
15443 interactivityService?: any;
15444 categoryAxisProperties?: any;
15445 valueAxisProperties?: any;
15446 }
15447 /** Styles to apply to scatter chart data point marker */
15448 interface ScatterMarkerStyle {
15449 'stroke-opacity': number;
15450 stroke: string;
15451 fill: string;
15452 'fill-opacity': number;
15453 }
15454 interface CartesianExtents {
15455 minX: number;
15456 maxX: number;
15457 minY: number;
15458 maxY: number;
15459 }
15460 class ScatterChart implements ICartesianVisual {
15461 private static BubbleRadius;
15462 static DefaultBubbleOpacity: number;
15463 static DimmedBubbleOpacity: number;
15464 static StrokeDarkenColorValue: number;
15465 static dataLabelLayoutStartingOffset: number;
15466 static dataLabelLayoutOffsetIterationDelta: number;
15467 static dataLabelLayoutMaximumOffset: number;
15468 private static AreaOf300By300Chart;
15469 private static MinSizeRange;
15470 private static MaxSizeRange;
15471 private static ClassName;
15472 static NoAnimationThreshold: number;
15473 static NoRenderResizeThreshold: number;
15474 private svg;
15475 private element;
15476 private currentViewport;
15477 private style;
15478 private data;
15479 private dataView;
15480 private host;
15481 private margin;
15482 private colors;
15483 private options;
15484 private interactivity;
15485 private cartesianVisualHost;
15486 private isMobileChart;
15487 private interactivityService;
15488 private categoryAxisProperties;
15489 private valueAxisProperties;
15490 private animator;
15491 private tooltipsEnabled;
15492 private xAxisProperties;
15493 private yAxisProperties;
15494 private renderer;
15495 private playAxis;
15496 constructor(options: ScatterChartConstructorOptions);
15497 init(options: CartesianVisualInitOptions): void;
15498 static getAdditionalTelemetry(dataView: DataView): any;
15499 private static getObjectProperties(dataView, dataLabelsSettings?);
15500 static converter(dataView: DataView, options: ScatterConverterOptions, playFrameInfo?: PlayFrameInfo, tooltipsEnabled?: boolean): ScatterChartData;
15501 private static getSizeRangeForGroups(dataViewValueGroups, sizeColumnIndex);
15502 private static createDataPointSeries(reader, dataValues, metadata, categories, categoryValues, categoryFormatter, categoryIdentities, categoryObjects, colorPalette, viewport, hasDynamicSeries, labelSettings, gradientValueColumn, defaultDataPointColor, categoryQueryName, colorByCategory, playFrameInfo, tooltipsEnabled);
15503 static createLazyFormattedCategory(formatter: IValueFormatter, value: string): jsCommon.Lazy<string>;
15504 private static createSeriesLegend(dataValues, colorPalette, categorical, formatString, defaultDataPointColor);
15505 static getBubbleRadius(radiusData: RadiusData, sizeRange: NumberRange, viewport: IViewport): number;
15506 static getMeasureValue(measureIndex: number, seriesValues: DataViewValueColumn[]): DataViewValueColumn;
15507 private static getMetadata(grouped, source);
15508 /** Create a new viewmodel with default data. */
15509 static getDefaultData(): ScatterChartData;
15510 private renderAtFrame(data);
15511 setData(dataViews: DataView[]): void;
15512 private mergeSizeRanges(playData);
15513 calculateLegend(): LegendData;
15514 hasLegend(): boolean;
15515 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
15516 private hasSizeMeasure();
15517 private enumerateDataPoints(enumeration);
15518 supportsTrendLine(): boolean;
15519 private static getExtents(data);
15520 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
15521 overrideXScale(xProperties: IAxisProperties): void;
15522 render(suppressAnimations: boolean, resizeMode?: ResizeMode): CartesianVisualRenderResult;
15523 static getStrokeFill(d: ScatterChartDataPoint, colorBorder: boolean): string;
15524 static getBubblePixelAreaSizeRange(viewPort: IViewport, minSizeRange: number, maxSizeRange: number): DataRange;
15525 static project(value: number, actualSizeDataRange: DataRange, bubblePixelAreaSizeRange: DataRange): number;
15526 static projectSizeToPixels(size: number, actualSizeDataRange: DataRange, bubblePixelAreaSizeRange: DataRange): number;
15527 static rangeContains(range: DataRange, value: number): boolean;
15528 static getMarkerFillOpacity(hasSize: boolean, shouldEnableFill: boolean, hasSelection: boolean, isSelected: boolean): number;
15529 static getMarkerStrokeOpacity(hasSize: boolean, colorBorder: boolean, hasSelection: boolean, isSelected: boolean): number;
15530 static getMarkerStrokeFill(hasSize: boolean, colorBorder: boolean, fill: string): string;
15531 static getMarkerStyle(d: ScatterChartDataPoint, colorBorder: boolean, hasSelection: boolean, fillMarkers: boolean): ScatterMarkerStyle;
15532 static getSeriesStyle(hasSize: boolean, colorBorder: boolean, hasSelection: boolean, fillMarkers: boolean, fill: string): ScatterMarkerStyle;
15533 static getBubbleOpacity(d: ScatterChartDataPoint, hasSelection: boolean): number;
15534 onClearSelection(): void;
15535 getSupportedCategoryAxisType(): string;
15536 static sortBubbles(a: ScatterChartDataPoint, b: ScatterChartDataPoint): number;
15537 }
15538}
15539declare module powerbi.visuals {
15540 interface PlayConstructorOptions extends CartesianVisualConstructorOptions {
15541 }
15542 interface PlayInitOptions extends CartesianVisualInitOptions {
15543 }
15544 interface PlayChartDataPoint {
15545 frameIndex?: number;
15546 }
15547 interface PlayChartData<T extends PlayableChartData> {
15548 frameData: PlayChartFrameData[];
15549 allViewModels: T[];
15550 currentViewModel: T;
15551 currentFrameIndex: number;
15552 labelData: PlayAxisTickLabelData;
15553 }
15554 interface PlayChartFrameData {
15555 escapedText: string;
15556 text: string;
15557 }
15558 interface PlayChartViewModel<TData extends PlayableChartData, TViewModel> {
15559 data: PlayChartData<TData>;
15560 viewModel: TViewModel;
15561 viewport: IViewport;
15562 }
15563 interface PlayableChartData {
15564 dataPoints: any[];
15565 }
15566 interface PlayAxisTickLabelInfo {
15567 label: string;
15568 labelWidth: number;
15569 }
15570 interface PlayAxisTickLabelData {
15571 labelInfo: PlayAxisTickLabelInfo[];
15572 anyWordBreaks: boolean;
15573 labelFieldName?: string;
15574 }
15575 interface PlayChartRenderResult<TData extends PlayableChartData, TViewModel> {
15576 allDataPoints: SelectableDataPoint[];
15577 viewModel: PlayChartViewModel<TData, TViewModel>;
15578 }
15579 interface PlayChartRenderFrameDelegate<T> {
15580 (data: T): void;
15581 }
15582 interface PlayFrameInfo {
15583 label: string;
15584 column: DataViewMetadataColumn;
15585 }
15586 interface VisualDataConverterDelegate<T> {
15587 (dataView: DataView, playFrameInfo?: PlayFrameInfo): T;
15588 }
15589 interface ITraceLineRenderer {
15590 render(selectedPoints: SelectableDataPoint[], shouldAnimate: boolean): void;
15591 remove(): void;
15592 }
15593 class PlayAxis<T extends PlayableChartData> {
15594 private element;
15595 private svg;
15596 private playData;
15597 private renderDelegate;
15598 private isPlaying;
15599 private lastViewport;
15600 private ridiculousFlagForPersistProperties;
15601 private playControl;
15602 private host;
15603 private interactivityService;
15604 private isMobileChart;
15605 private static PlayCallout;
15606 private static calloutOffsetMultiplier;
15607 constructor(options: PlayConstructorOptions);
15608 init(options: PlayInitOptions): void;
15609 setData(dataView: DataView, visualConverter: VisualDataConverterDelegate<T>): PlayChartData<T>;
15610 render<TViewModel>(suppressAnimations: boolean, viewModel: TViewModel, viewport: IViewport, margin: IMargin): PlayChartRenderResult<T, TViewModel>;
15611 private updateCallout(viewport, margin);
15612 play(): void;
15613 private playNextFrame(playData, startFrame?, endFrame?);
15614 stop(): void;
15615 remove(): void;
15616 setRenderFunction(fn: PlayChartRenderFrameDelegate<T>): void;
15617 getCartesianExtents(existingExtents: CartesianExtents, getExtents: (T) => CartesianExtents): CartesianExtents;
15618 setPlayControlPosition(playControlLayout: IRect): void;
15619 private moveToFrameAndRender(frameIndex);
15620 isCurrentlyPlaying(): boolean;
15621 }
15622 module PlayChart {
15623 const FrameStepDuration: number;
15624 const FrameAnimationDuration: number;
15625 const ClassName: string;
15626 function convertMatrixToCategorical(sourceDataView: DataView, frame: number): DataView;
15627 function converter<T extends PlayableChartData>(dataView: DataView, visualConverter: VisualDataConverterDelegate<T>): PlayChartData<T>;
15628 function getDefaultPlayData<T extends PlayableChartData>(): PlayChartData<T>;
15629 function getMinMaxForAllFrames<T extends PlayableChartData>(playData: PlayChartData<T>, getExtents: (T) => CartesianExtents): CartesianExtents;
15630 function isDataViewPlayable(dataView: DataView, playRole?: string): boolean;
15631 /** Render trace-lines for selected data points. */
15632 function renderTraceLines(allDataPoints: SelectableDataPoint[], traceLineRenderer: ITraceLineRenderer, shouldAnimate: boolean): void;
15633 }
15634}
15635declare module powerbi.visuals {
15636 interface CheckboxStyle {
15637 transform: string;
15638 'transform-origin': string;
15639 'font-size': string;
15640 }
15641 class VerticalSlicerRenderer implements ISlicerRenderer, SlicerDefaultValueHandler {
15642 private element;
15643 private currentViewport;
15644 private dataView;
15645 private header;
15646 private body;
15647 private container;
15648 private listView;
15649 private data;
15650 private settings;
15651 private behavior;
15652 private hostServices;
15653 private textProperties;
15654 private domHelper;
15655 constructor(options?: SlicerConstructorOptions);
15656 getDefaultValue(): data.SQConstantExpr;
15657 getIdentityFields(): data.SQExpr[];
15658 init(slicerInitOptions: SlicerInitOptions): IInteractivityService;
15659 render(options: SlicerRenderOptions): void;
15660 private updateSelectionStyle();
15661 private onEnterSelection(rowSelection);
15662 private onUpdateSelection(rowSelection, interactivityService);
15663 }
15664}
15665declare module powerbi.visuals {
15666 class HorizontalSlicerRenderer implements ISlicerRenderer, SlicerDefaultValueHandler {
15667 private element;
15668 private currentViewport;
15669 private data;
15670 private interactivityService;
15671 private behavior;
15672 private hostServices;
15673 private dataView;
15674 private container;
15675 private header;
15676 private body;
15677 private bodyViewport;
15678 private itemsContainer;
15679 private rightNavigationArrow;
15680 private leftNavigationArrow;
15681 private dataStartIndex;
15682 private itemsToDisplay;
15683 private textProperties;
15684 private maxItemWidth;
15685 private totalItemWidth;
15686 private loadMoreData;
15687 private domHelper;
15688 constructor(options?: SlicerConstructorOptions);
15689 getDefaultValue(): data.SQConstantExpr;
15690 getIdentityFields(): data.SQExpr[];
15691 init(slicerInitOptions: SlicerInitOptions): IInteractivityService;
15692 render(options: SlicerRenderOptions): void;
15693 private renderCore();
15694 private updateStyle();
15695 private renderItems(defaultSettings);
15696 private bindInteractivityService();
15697 private normalizePosition(points);
15698 private bindNavigationEvents();
15699 private registerMouseClickEvents();
15700 private registerMouseWheelScrollEvents();
15701 private onMouseWheel(wheelDelta);
15702 private scrollRight();
15703 private scrollLeft();
15704 private isLastRowItem(fieldIndex, columnsToDisplay);
15705 private getScaledTextWidth(textSize);
15706 private isMaxWidthCalculated();
15707 private calculateAndSetMaxItemWidth();
15708 private calculateAndSetTotalItemWidth();
15709 private getNumberOfItemsToDisplay(widthAvailable);
15710 private getDataPointsCount();
15711 }
15712}
15713declare module powerbi.visuals {
15714 import DOMHelper = SlicerUtil.DOMHelper;
15715 import SlicerOrientation = slicerOrientation.Orientation;
15716 interface SlicerDefaultValueHandler {
15717 getDefaultValue(): data.SQConstantExpr;
15718 getIdentityFields(): data.SQExpr[];
15719 }
15720 interface SlicerConstructorOptions {
15721 domHelper?: DOMHelper;
15722 behavior?: IInteractiveBehavior;
15723 }
15724 interface ISlicerRenderer {
15725 init(options: SlicerInitOptions): IInteractivityService;
15726 render(options: SlicerRenderOptions): void;
15727 }
15728 interface SlicerRenderOptions {
15729 dataView: DataView;
15730 data: SlicerData;
15731 viewport: IViewport;
15732 resetScrollbarPosition?: boolean;
15733 }
15734 interface SlicerData {
15735 categorySourceName: string;
15736 slicerDataPoints: SlicerDataPoint[];
15737 slicerSettings: SlicerSettings;
15738 hasSelectionOverride?: boolean;
15739 defaultValue?: DefaultValueDefinition;
15740 }
15741 interface SlicerDataPoint extends SelectableDataPoint {
15742 value: string;
15743 tooltip: string;
15744 isSelectAllDataPoint?: boolean;
15745 count: number;
15746 isImage?: boolean;
15747 }
15748 interface SlicerSettings {
15749 general: {
15750 outlineColor: string;
15751 outlineWeight: number;
15752 orientation: SlicerOrientation;
15753 };
15754 header: {
15755 borderBottomWidth: number;
15756 show: boolean;
15757 outline: string;
15758 fontColor: string;
15759 background?: string;
15760 textSize: number;
15761 };
15762 slicerText: {
15763 color: string;
15764 outline: string;
15765 background?: string;
15766 textSize: number;
15767 };
15768 selection: {
15769 selectAllCheckboxEnabled: boolean;
15770 singleSelect: boolean;
15771 };
15772 }
15773 interface SlicerInitOptions {
15774 visualInitOptions: VisualInitOptions;
15775 loadMoreData: () => void;
15776 }
15777 class Slicer implements IVisual {
15778 private element;
15779 private currentViewport;
15780 private dataView;
15781 private slicerData;
15782 private settings;
15783 private interactivityService;
15784 private behavior;
15785 private hostServices;
15786 private slicerRenderer;
15787 private slicerOrientation;
15788 private waitingForData;
15789 private domHelper;
15790 private initOptions;
15791 static DefaultStyleProperties(): SlicerSettings;
15792 constructor(options?: SlicerConstructorOptions);
15793 init(options: VisualInitOptions): void;
15794 onDataChanged(options: VisualDataChangedOptions): void;
15795 onResizing(finalViewport: IViewport): void;
15796 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[];
15797 loadMoreData(): void;
15798 onClearSelection(): void;
15799 private render(resetScrollbarPosition, stopWaitingForData?);
15800 private orientationHasChanged(slicerOrientation);
15801 private initializeSlicerRenderer(slicerOrientation);
15802 private initializeVerticalSlicer();
15803 private initializeHorizontalSlicer();
15804 private createInitOptions();
15805 }
15806}
15807declare module powerbi.visuals {
15808 import TablixFormattingProperties = powerbi.visuals.controls.TablixFormattingPropertiesTable;
15809 import TablixUtils = controls.internal.TablixUtils;
15810 interface DataViewVisualTable extends DataViewTable {
15811 visualRows?: DataViewVisualTableRow[];
15812 formattingProperties?: TablixFormattingProperties;
15813 }
15814 interface DataViewVisualTableRow {
15815 index: number;
15816 values: DataViewTableRow;
15817 }
15818 interface TableDataAdapter {
15819 update(table: DataViewTable): void;
15820 }
15821 interface TableTotal {
15822 totalCells: any[];
15823 }
15824 class TableHierarchyNavigator implements controls.ITablixHierarchyNavigator, TableDataAdapter {
15825 private tableDataView;
15826 private formatter;
15827 constructor(tableDataView: DataViewVisualTable, formatter: ICustomValueColumnFormatter);
15828 /**
15829 * Returns the depth of the Columnm hierarchy.
15830 */
15831 getColumnHierarchyDepth(): number;
15832 /**
15833 * Returns the depth of the Row hierarchy.
15834 */
15835 getRowHierarchyDepth(): number;
15836 /**
15837 * Returns the leaf count of a hierarchy.
15838 */
15839 getLeafCount(hierarchy: any): number;
15840 /**
15841 * Returns the leaf member of a hierarchy at a specified index.
15842 */
15843 getLeafAt(hierarchy: any, index: number): any;
15844 /**
15845 * Returns the specified hierarchy member parent.
15846 */
15847 getParent(item: any): any;
15848 /**
15849 * Returns the index of the hierarchy member relative to its parent.
15850 */
15851 getIndex(item: any): number;
15852 private isRow(item);
15853 private getColumnIndex(item);
15854 /**
15855 * Checks whether a hierarchy member is a leaf.
15856 */
15857 isLeaf(item: any): boolean;
15858 isRowHierarchyLeaf(cornerItem: any): boolean;
15859 isColumnHierarchyLeaf(cornerItem: any): boolean;
15860 isFirstItem(item: MatrixVisualNode, items: MatrixVisualNode[]): boolean;
15861 areAllParentsFirst(item: any, items: any): boolean;
15862 /**
15863 * Checks whether a hierarchy member is the last item within its parent.
15864 */
15865 isLastItem(item: any, items: any[]): boolean;
15866 areAllParentsLast(item: any, items: any[]): boolean;
15867 /**
15868 * Gets the children members of a hierarchy member.
15869 */
15870 getChildren(item: any): any;
15871 getChildrenLevelDifference(item: any): number;
15872 /**
15873 * Gets the members count in a specified collection.
15874 */
15875 getCount(items: any): number;
15876 /**
15877 * Gets the member at the specified index.
15878 */
15879 getAt(items: any, index: number): any;
15880 /**
15881 * Gets the hierarchy member level.
15882 */
15883 getLevel(item: any): number;
15884 /**
15885 * Returns the intersection between a row and a column item.
15886 */
15887 getIntersection(rowItem: any, columnItem: DataViewMetadataColumn): TablixUtils.TablixVisualCell;
15888 /**
15889 * Returns the corner cell between a row and a column level.
15890 */
15891 getCorner(rowLevel: number, columnLevel: number): TablixUtils.TablixVisualCell;
15892 headerItemEquals(item1: any, item2: any): boolean;
15893 bodyCellItemEquals(item1: TablixUtils.TablixVisualCell, item2: TablixUtils.TablixVisualCell): boolean;
15894 cornerCellItemEquals(item1: any, item2: any): boolean;
15895 update(table: DataViewVisualTable): void;
15896 static getIndex(items: any[], item: any): number;
15897 }
15898 interface TableBinderOptions {
15899 onBindRowHeader?(item: any): void;
15900 onColumnHeaderClick?(queryName: string, sortDirection: SortDirection): void;
15901 layoutKind?: controls.TablixLayoutKind;
15902 }
15903 /**
15904 * Note: Public for testability.
15905 */
15906 class TableBinder implements controls.ITablixBinder {
15907 private options;
15908 private formattingProperties;
15909 private tableDataView;
15910 private textHeightHeader;
15911 private textHeightValue;
15912 private textHeightTotal;
15913 constructor(options: TableBinderOptions);
15914 onDataViewChanged(dataView: DataViewVisualTable): void;
15915 private updateTextHeights();
15916 onStartRenderingSession(): void;
15917 onEndRenderingSession(): void;
15918 /**
15919 * Row Header.
15920 */
15921 bindRowHeader(item: any, cell: controls.ITablixCell): void;
15922 unbindRowHeader(item: any, cell: controls.ITablixCell): void;
15923 /**
15924 * Column Header.
15925 */
15926 bindColumnHeader(item: DataViewMetadataColumn, cell: controls.ITablixCell): void;
15927 private setColumnHeaderStyle(cell, style);
15928 unbindColumnHeader(item: any, cell: controls.ITablixCell): void;
15929 /**
15930 * Body Cell.
15931 */
15932 bindBodyCell(item: TablixUtils.TablixVisualCell, cell: controls.ITablixCell): void;
15933 private setBodyStyle(item, cell, style);
15934 private setFooterStyle(cell, style);
15935 unbindBodyCell(item: TablixUtils.TablixVisualCell, cell: controls.ITablixCell): void;
15936 /**
15937 * Corner Cell.
15938 */
15939 bindCornerCell(item: any, cell: controls.ITablixCell): void;
15940 unbindCornerCell(item: any, cell: controls.ITablixCell): void;
15941 bindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
15942 unbindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
15943 bindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
15944 unbindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
15945 /**
15946 * Measurement Helper.
15947 */
15948 getHeaderLabel(item: DataViewMetadataColumn): string;
15949 getCellContent(item: any): string;
15950 hasRowGroups(): boolean;
15951 private sortIconsEnabled();
15952 }
15953 interface TableConstructorOptions {
15954 isConditionalFormattingEnabled?: boolean;
15955 isTouchEnabled?: boolean;
15956 }
15957 class Table implements IVisual {
15958 private static preferredLoadMoreThreshold;
15959 private element;
15960 private currentViewport;
15961 private style;
15962 private formatter;
15963 private isInteractive;
15964 private isTouchEnabled;
15965 private getLocalizedString;
15966 private hostServices;
15967 private tablixControl;
15968 private hierarchyNavigator;
15969 private waitingForData;
15970 private lastAllowHeaderResize;
15971 private waitingForSort;
15972 private columnWidthManager;
15973 private dataView;
15974 private isConditionalFormattingEnabled;
15975 /**
15976 * Flag indicating that we are persisting objects, so that next onDataChanged can be safely ignored.
15977 */
15978 persistingObjects: boolean;
15979 constructor(options?: TableConstructorOptions);
15980 static customizeQuery(options: CustomizeQueryOptions): void;
15981 static getSortableRoles(): string[];
15982 init(options: VisualInitOptions): void;
15983 /**
15984 * Note: Public for testability.
15985 */
15986 static converter(dataView: DataView): DataViewVisualTable;
15987 onResizing(finalViewport: IViewport): void;
15988 getColumnWidthManager(): controls.TablixColumnWidthManager;
15989 onDataChanged(options: VisualDataChangedOptions): void;
15990 private createColumnWidthManager();
15991 private persistColumnWidths(objectInstances);
15992 private updateViewport(newViewport);
15993 private refreshControl(clear);
15994 private getLayoutKind();
15995 private createOrUpdateHierarchyNavigator(visualTable);
15996 private createTablixControl(textSize);
15997 private createControl(dataNavigator, textSize);
15998 private updateInternal(textSize, previousDataView, visualTable);
15999 private shouldClearControl(previousDataView, newDataView);
16000 private createTotalsRow(dataView);
16001 private onBindRowHeader(item);
16002 private onColumnHeaderClick(queryName, sortDirection);
16003 /**
16004 * Note: Public for testability.
16005 */
16006 needsMoreData(item: any): boolean;
16007 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
16008 enumerateObjectRepetition(): VisualObjectRepetition[];
16009 private shouldAllowHeaderResize();
16010 onViewModeChanged(viewMode: ViewMode): void;
16011 private verifyHeaderResize();
16012 }
16013}
16014declare module powerbi.visuals {
16015 import TablixFormattingPropertiesMatrix = powerbi.visuals.controls.TablixFormattingPropertiesMatrix;
16016 import TablixUtils = controls.internal.TablixUtils;
16017 /**
16018 * Extension of the Matrix node for Matrix visual.
16019 */
16020 interface MatrixVisualNode extends DataViewMatrixNode {
16021 /**
16022 * Index of the node in its parent's children collection.
16023 *
16024 * Note: For size optimization, we could also look this item up in the parent's
16025 * children collection, but we may need to pay the perf penalty.
16026 */
16027 index?: number;
16028 /**
16029 * Global index of the node as a leaf node.
16030 * If the node is not a leaf, the value is undefined.
16031 */
16032 leafIndex?: number;
16033 /**
16034 * Parent of the node.
16035 * Undefined for outermost nodes (children of the one root node).
16036 */
16037 parent?: MatrixVisualNode;
16038 /**
16039 * Children of the same parent
16040 */
16041 siblings?: MatrixVisualNode[];
16042 /**
16043 * queryName of the node.
16044 * If the node is not a leaf, the value is undefined.
16045 */
16046 queryName?: string;
16047 }
16048 interface MatrixCornerItem {
16049 metadata: DataViewMetadataColumn;
16050 isColumnHeaderLeaf: boolean;
16051 isRowHeaderLeaf: boolean;
16052 }
16053 class MatrixVisualBodyItem extends TablixUtils.TablixVisualCell {
16054 isMeasure: boolean;
16055 isValidUrl: boolean;
16056 isValidImage: boolean;
16057 }
16058 /**
16059 * Interface for refreshing Matrix Data View.
16060 */
16061 interface MatrixDataAdapter {
16062 update(dataViewMatrix?: DataViewMatrix, updateColumns?: boolean): void;
16063 }
16064 interface IMatrixHierarchyNavigator extends controls.ITablixHierarchyNavigator, MatrixDataAdapter {
16065 getDataViewMatrix(): DataViewMatrix;
16066 getLeafCount(hierarchy: MatrixVisualNode[]): number;
16067 getLeafAt(hierarchy: MatrixVisualNode[], index: number): any;
16068 getLeafIndex(item: MatrixVisualNode): number;
16069 getParent(item: MatrixVisualNode): MatrixVisualNode;
16070 getIndex(item: MatrixVisualNode): number;
16071 isLeaf(item: MatrixVisualNode): boolean;
16072 isRowHierarchyLeaf(item: any): boolean;
16073 isColumnHierarchyLeaf(item: any): boolean;
16074 isLastItem(item: MatrixVisualNode, items: MatrixVisualNode[]): boolean;
16075 getChildren(item: MatrixVisualNode): MatrixVisualNode[];
16076 getCount(items: MatrixVisualNode[]): number;
16077 getAt(items: MatrixVisualNode[], index: number): MatrixVisualNode;
16078 getLevel(item: MatrixVisualNode): number;
16079 getIntersection(rowItem: MatrixVisualNode, columnItem: MatrixVisualNode): MatrixVisualBodyItem;
16080 getCorner(rowLevel: number, columnLevel: number): MatrixCornerItem;
16081 headerItemEquals(item1: MatrixVisualNode, item2: MatrixVisualNode): boolean;
16082 }
16083 /**
16084 * Factory method used by unit tests.
16085 */
16086 function createMatrixHierarchyNavigator(matrix: DataViewMatrix, formatter: ICustomValueColumnFormatter): IMatrixHierarchyNavigator;
16087 interface MatrixBinderOptions {
16088 onBindRowHeader?(item: MatrixVisualNode): void;
16089 totalLabel?: string;
16090 onColumnHeaderClick?(queryName: string, sortDirection: SortDirection): void;
16091 showSortIcons?: boolean;
16092 }
16093 class MatrixBinder implements controls.ITablixBinder {
16094 private formattingProperties;
16095 private hierarchyNavigator;
16096 private options;
16097 private textHeightHeader;
16098 private textHeightValue;
16099 private textHeightTotal;
16100 constructor(hierarchyNavigator: IMatrixHierarchyNavigator, options: MatrixBinderOptions);
16101 onDataViewChanged(formattingProperties: TablixFormattingPropertiesMatrix): void;
16102 private updateTextHeights();
16103 onStartRenderingSession(): void;
16104 onEndRenderingSession(): void;
16105 /**
16106 * Row Header.
16107 */
16108 bindRowHeader(item: MatrixVisualNode, cell: controls.ITablixCell): void;
16109 private setRowHeaderStyle(cell, style);
16110 unbindRowHeader(item: any, cell: controls.ITablixCell): void;
16111 /**
16112 * Column Header.
16113 */
16114 bindColumnHeader(item: MatrixVisualNode, cell: controls.ITablixCell): void;
16115 private setColumnHeaderStyle(cell, style);
16116 unbindColumnHeader(item: MatrixVisualNode, cell: controls.ITablixCell): void;
16117 private bindHeader(item, cell, metadata, style, overwriteSubtotalLabel?);
16118 private registerColumnHeaderClickHandler(columnMetadata, cell);
16119 private unregisterColumnHeaderClickHandler(cell);
16120 /**
16121 * Body Cell.
16122 */
16123 bindBodyCell(item: MatrixVisualBodyItem, cell: controls.ITablixCell): void;
16124 private setBodyCellStyle(cell, item, style);
16125 unbindBodyCell(item: MatrixVisualBodyItem, cell: controls.ITablixCell): void;
16126 /**
16127 * Corner Cell.
16128 */
16129 bindCornerCell(item: MatrixCornerItem, cell: controls.ITablixCell): void;
16130 private setCornerCellsStyle(cell, style);
16131 unbindCornerCell(item: MatrixCornerItem, cell: controls.ITablixCell): void;
16132 bindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
16133 unbindEmptySpaceHeaderCell(cell: controls.ITablixCell): void;
16134 bindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
16135 unbindEmptySpaceFooterCell(cell: controls.ITablixCell): void;
16136 /**
16137 * Measurement Helper.
16138 */
16139 getHeaderLabel(item: MatrixVisualNode): string;
16140 getCellContent(item: MatrixVisualBodyItem): string;
16141 hasRowGroups(): boolean;
16142 private static getNodeLabel(node);
16143 /**
16144 * Returns the column metadata of the column that needs to be sorted for the specified matrix corner node.
16145 *
16146 * @return Column metadata or null if the specified corner node does not represent a sortable header.
16147 */
16148 private getSortableCornerColumnMetadata(item);
16149 private getRowHeaderMetadata(item);
16150 private getColumnHeaderMetadata(item);
16151 private getHierarchyMetadata(hierarchy, level);
16152 /**
16153 * Returns the column metadata of the column that needs to be sorted for the specified header node.
16154 *
16155 * @return Column metadata or null if the specified header node does not represent a sortable header.
16156 */
16157 private getSortableHeaderColumnMetadata(item);
16158 }
16159 interface MatrixConstructorOptions {
16160 isTouchEnabled?: boolean;
16161 }
16162 class Matrix implements IVisual {
16163 private static preferredLoadMoreThreshold;
16164 /**
16165 * Note: Public only for testing.
16166 */
16167 static TotalLabel: string;
16168 private element;
16169 private currentViewport;
16170 private style;
16171 private dataView;
16172 private formatter;
16173 private isInteractive;
16174 private isTouchEnabled;
16175 private hostServices;
16176 private hierarchyNavigator;
16177 private waitingForData;
16178 private tablixControl;
16179 private lastAllowHeaderResize;
16180 private waitingForSort;
16181 private columnWidthManager;
16182 /**
16183 * Flag indicating that we are persisting objects, so that next onDataChanged can be safely ignored.
16184 */
16185 persistingObjects: boolean;
16186 constructor(options?: MatrixConstructorOptions);
16187 static customizeQuery(options: CustomizeQueryOptions): void;
16188 static getSortableRoles(): string[];
16189 init(options: VisualInitOptions): void;
16190 static converter(dataView: DataView): TablixFormattingPropertiesMatrix;
16191 onResizing(finalViewport: IViewport): void;
16192 getColumnWidthManager(): controls.TablixColumnWidthManager;
16193 onDataChanged(options: VisualDataChangedOptions): void;
16194 private createColumnWidthManager();
16195 private persistColumnWidths(objectInstances);
16196 private updateViewport(newViewport);
16197 private refreshControl(clear);
16198 private getLayoutKind();
16199 private createOrUpdateHierarchyNavigator();
16200 private createTablixControl(textSize);
16201 private createControl(matrixNavigator, textSize);
16202 private updateInternal(textSize, previousDataView);
16203 private shouldClearControl(previousDataView, newDataView);
16204 private onBindRowHeader(item);
16205 private onColumnHeaderClick(queryName, sortDirection);
16206 /**
16207 * Note: Public for testability.
16208 */
16209 needsMoreData(item: MatrixVisualNode): boolean;
16210 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
16211 private shouldAllowHeaderResize();
16212 onViewModeChanged(viewMode: ViewMode): void;
16213 private verifyHeaderResize();
16214 }
16215}
16216declare module powerbi.visuals {
16217 interface TreemapConstructorOptions {
16218 animator?: ITreemapAnimator;
16219 isScrollable: boolean;
16220 behavior?: TreemapWebBehavior;
16221 tooltipsEnabled?: boolean;
16222 }
16223 interface TreemapData {
16224 root: TreemapNode;
16225 hasHighlights: boolean;
16226 legendData: LegendData;
16227 dataLabelsSettings: VisualDataLabelsSettings;
16228 legendObjectProperties?: DataViewObject;
16229 dataWasCulled: boolean;
16230 }
16231 /**
16232 * Treemap node (we extend D3 node (GraphNode) because treemap layout methods rely on the type).
16233 */
16234 interface TreemapNode extends D3.Layout.GraphNode, SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
16235 key: any;
16236 highlightMultiplier?: number;
16237 highlightValue?: number;
16238 color: string;
16239 highlightedTooltipInfo?: TooltipDataItem[];
16240 }
16241 interface ITreemapLayout {
16242 shapeClass: (d: TreemapNode) => string;
16243 shapeLayout: {
16244 x: (d: TreemapNode) => number;
16245 y: (d: TreemapNode) => number;
16246 width: (d: TreemapNode) => number;
16247 height: (d: TreemapNode) => number;
16248 };
16249 highlightShapeClass: (d: TreemapNode) => string;
16250 highlightShapeLayout: {
16251 x: (d: TreemapNode) => number;
16252 y: (d: TreemapNode) => number;
16253 width: (d: TreemapNode) => number;
16254 height: (d: TreemapNode) => number;
16255 };
16256 zeroShapeLayout: {
16257 x: (d: TreemapNode) => number;
16258 y: (d: TreemapNode) => number;
16259 width: (d: TreemapNode) => number;
16260 height: (d: TreemapNode) => number;
16261 };
16262 majorLabelClass: (d: TreemapNode) => string;
16263 majorLabelLayout: {
16264 x: (d: TreemapNode) => number;
16265 y: (d: TreemapNode) => number;
16266 };
16267 majorLabelText: (d: TreemapNode) => string;
16268 minorLabelClass: (d: TreemapNode) => string;
16269 minorLabelLayout: {
16270 x: (d: TreemapNode) => number;
16271 y: (d: TreemapNode) => number;
16272 };
16273 minorLabelText: (d: TreemapNode) => string;
16274 areMajorLabelsEnabled: () => boolean;
16275 areMinorLabelsEnabled: () => boolean;
16276 }
16277 /**
16278 * Renders an interactive treemap visual from categorical data.
16279 */
16280 class Treemap implements IVisual {
16281 static DimmedShapeOpacity: number;
16282 private static ClassName;
16283 static LabelsGroupClassName: string;
16284 static MajorLabelClassName: string;
16285 static MinorLabelClassName: string;
16286 static ShapesClassName: string;
16287 static TreemapNodeClassName: string;
16288 static RootNodeClassName: string;
16289 static ParentGroupClassName: string;
16290 static NodeGroupClassName: string;
16291 static HighlightNodeClassName: string;
16292 private static TextMargin;
16293 private static MinorLabelTextSize;
16294 private static MinTextWidthForMinorLabel;
16295 private static MajorLabelTextSize;
16296 private static MinTextWidthForMajorLabel;
16297 private static MajorLabelTextProperties;
16298 private static ValuesRoleName;
16299 /**
16300 * A rect with an area of 9 is a treemap rectangle of only
16301 * a single pixel in the middle with a 1 pixel stroke on each edge.
16302 */
16303 private static CullableArea;
16304 private svg;
16305 private treemap;
16306 private shapeGraphicsContext;
16307 private labelGraphicsContext;
16308 private currentViewport;
16309 private legend;
16310 private data;
16311 private style;
16312 private colors;
16313 private element;
16314 private options;
16315 private isScrollable;
16316 private hostService;
16317 private tooltipsEnabled;
16318 /**
16319 * Note: Public for testing.
16320 */
16321 animator: ITreemapAnimator;
16322 private interactivityService;
16323 private behavior;
16324 private dataViews;
16325 static getLayout(labelsSettings: VisualDataLabelsSettings, alternativeScale: number): ITreemapLayout;
16326 constructor(options?: TreemapConstructorOptions);
16327 init(options: VisualInitOptions): void;
16328 /**
16329 * Note: Public for testing purposes.
16330 */
16331 static converter(dataView: DataView, colors: IDataColorPalette, labelSettings: VisualDataLabelsSettings, interactivityService: IInteractivityService, viewport: IViewport, legendObjectProperties?: DataViewObject, tooltipsEnabled?: boolean): TreemapData;
16332 private static getValuesFromCategoricalDataView(data, hasHighlights);
16333 private static getCullableValue(totalValue, viewport);
16334 update(options: VisualUpdateOptions): void;
16335 onDataChanged(options: VisualDataChangedOptions): void;
16336 onResizing(viewport: IViewport): void;
16337 onClearSelection(): void;
16338 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
16339 private enumerateDataPoints(enumeration, data);
16340 private enumerateLegend(data);
16341 private static checkValueForShape(value);
16342 private calculateTreemapSize();
16343 private initViewportDependantProperties(duration?);
16344 private static hasChildrenWithIdentity(node);
16345 private static canDisplayMajorLabel(node);
16346 private static canDisplayMinorLabel(node, labelSettings);
16347 private static createMajorLabelText(node, labelsSettings, alternativeScale, formattersCache);
16348 private static createMinorLabelText(node, labelsSettings, alternativeScale, formattersCache);
16349 static getFill(d: TreemapNode, isHighlightRect: boolean): string;
16350 static getFillOpacity(d: TreemapNode, hasSelection: boolean, hasHighlights: boolean, isHighlightRect: boolean): string;
16351 private updateInternal(suppressAnimations);
16352 private renderLegend();
16353 private static getNodeClass(d, highlight?);
16354 private static createTreemapShapeLayout(isHighlightRect?);
16355 private static createTreemapZeroShapeLayout();
16356 static drawDefaultShapes(context: D3.Selection, nodes: D3.Layout.GraphNode[], hasSelection: boolean, hasHighlights: boolean, layout: ITreemapLayout): D3.UpdateSelection;
16357 static drawDefaultHighlightShapes(context: D3.Selection, nodes: D3.Layout.GraphNode[], hasSelection: boolean, hasHighlights: boolean, layout: ITreemapLayout): D3.UpdateSelection;
16358 static drawDefaultMajorLabels(context: D3.Selection, nodes: D3.Layout.GraphNode[], labelSettings: VisualDataLabelsSettings, layout: ITreemapLayout): D3.UpdateSelection;
16359 static drawDefaultMinorLabels(context: D3.Selection, nodes: D3.Layout.GraphNode[], labelSettings: VisualDataLabelsSettings, layout: ITreemapLayout): D3.UpdateSelection;
16360 static cleanMinorLabels(context: D3.Selection): void;
16361 }
16362}
16363declare module powerbi.visuals {
16364 interface CardStyleText {
16365 textSize: number;
16366 color: string;
16367 paddingTop?: number;
16368 }
16369 interface CardStyleValue extends CardStyleText {
16370 fontFamily: string;
16371 }
16372 interface CardStyle {
16373 card: {
16374 maxFontSize: number;
16375 };
16376 label: CardStyleText;
16377 value: CardStyleValue;
16378 }
16379 interface CardConstructorOptions {
16380 isScrollable?: boolean;
16381 displayUnitSystemType?: DisplayUnitSystemType;
16382 animator?: IGenericAnimator;
16383 }
16384 interface CardFormatSetting {
16385 textSize: number;
16386 labelSettings: VisualDataLabelsSettings;
16387 wordWrap: boolean;
16388 }
16389 class Card extends AnimatedText implements IVisual {
16390 private static cardClassName;
16391 private static Label;
16392 private static Value;
16393 private static KPIImage;
16394 private static cardTextProperties;
16395 static DefaultStyle: CardStyle;
16396 private animationOptions;
16397 private displayUnitSystemType;
16398 private isScrollable;
16399 private graphicsContext;
16400 private labelContext;
16401 private cardFormatSetting;
16402 private kpiImage;
16403 constructor(options?: CardConstructorOptions);
16404 init(options: VisualInitOptions): void;
16405 onDataChanged(options: VisualDataChangedOptions): void;
16406 onResizing(viewport: IViewport): void;
16407 private updateViewportProperties();
16408 private setTextProperties(text, fontSize);
16409 private getCardFormatTextSize();
16410 getAdjustedFontHeight(availableWidth: number, textToMeasure: string, seedFontHeight: number): number;
16411 clear(valueOnly?: boolean): void;
16412 private updateInternal(target, suppressAnimations, forceUpdate?);
16413 private displayStatusGraphic(statusGraphicInfo, translateX, translateY, labelTextSizeInPx);
16414 private getDefaultFormatSettings();
16415 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
16416 }
16417}
16418declare module powerbi.visuals {
16419 class OwlGauge implements IVisual {
16420 private static owlBodySvg;
16421 private static owlTailSvg;
16422 private static visualBgSvg;
16423 private static owlBodyHeightMultiplier;
16424 private static owlTailHeightMultiplier;
16425 private static visualBgHeightMultiplier;
16426 private static OwlDemoMode;
16427 static capabilities: VisualCapabilities;
16428 static converter(dataView: DataView): any;
16429 private static getGaugeData(dataView);
16430 private rootElem;
16431 private svgBgElem;
16432 private svgBodyElem;
16433 private svgTailElem;
16434 init(options: VisualInitOptions): void;
16435 update(options: VisualUpdateOptions): void;
16436 private updateGauge(percentage);
16437 private happinessLevel;
16438 private updateViewportSize(width, height);
16439 }
16440}
16441declare module powerbi.visuals {
16442 import IStringResourceProvider = jsCommon.IStringResourceProvider;
16443 class NoMapLocationWarning implements IVisualWarning {
16444 code: string;
16445 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16446 }
16447 class FilledMapWithoutValidGeotagCategoryWarning implements IVisualWarning {
16448 code: string;
16449 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16450 }
16451 class GeometryCulledWarning implements IVisualWarning {
16452 code: string;
16453 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16454 }
16455 class NegativeValuesNotSupportedWarning implements IVisualWarning {
16456 code: string;
16457 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16458 }
16459 class AllNegativeValuesWarning implements IVisualWarning {
16460 code: string;
16461 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16462 }
16463 class NaNNotSupportedWarning implements IVisualWarning {
16464 code: string;
16465 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16466 }
16467 class InfinityValuesNotSupportedWarning implements IVisualWarning {
16468 code: string;
16469 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16470 }
16471 class ValuesOutOfRangeWarning implements IVisualWarning {
16472 code: string;
16473 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16474 }
16475 class ZeroValueWarning implements IVisualWarning {
16476 code: string;
16477 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16478 }
16479 class VisualKPIDataMissingWarning implements IVisualWarning {
16480 code: string;
16481 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16482 }
16483 class ScriptVisualRefreshWarning implements IVisualWarning {
16484 code: string;
16485 getMessages(resourceProvider: IStringResourceProvider): IVisualErrorMessage;
16486 }
16487}
16488declare module powerbi.visuals {
16489 interface WaterfallChartData extends CartesianData {
16490 series: WaterfallChartSeries[];
16491 categories: any[];
16492 valuesMetadata: DataViewMetadataColumn;
16493 legend: LegendData;
16494 hasHighlights: boolean;
16495 categoryMetadata: DataViewMetadataColumn;
16496 positionMax: number;
16497 positionMin: number;
16498 sentimentColors: WaterfallChartSentimentColors;
16499 dataLabelsSettings: VisualDataLabelsSettings;
16500 axesLabels: ChartAxesLabels;
16501 }
16502 interface WaterfallChartSeries extends CartesianSeries {
16503 data: WaterfallChartDataPoint[];
16504 }
16505 interface WaterfallChartDataPoint extends CartesianDataPoint, SelectableDataPoint, TooltipEnabledDataPoint, LabelEnabledDataPoint {
16506 position: number;
16507 color: string;
16508 highlight: boolean;
16509 key: string;
16510 isTotal?: boolean;
16511 }
16512 interface WaterfallChartConstructorOptions extends CartesianVisualConstructorOptions {
16513 }
16514 interface WaterfallChartSentimentColors {
16515 increaseFill: Fill;
16516 decreaseFill: Fill;
16517 totalFill: Fill;
16518 }
16519 interface WaterfallLayout extends CategoryLayout, ILabelLayout {
16520 categoryWidth: number;
16521 }
16522 class WaterfallChart implements ICartesianVisual {
16523 static formatStringProp: DataViewObjectPropertyIdentifier;
16524 private static WaterfallClassName;
16525 private static MainGraphicsContextClassName;
16526 private static IncreaseLabel;
16527 private static DecreaseLabel;
16528 private static TotalLabel;
16529 private static CategoryValueClasses;
16530 private static WaterfallConnectorClasses;
16531 private static defaultTotalColor;
16532 private static validLabelPositions;
16533 private static validZeroLabelPosition;
16534 private svg;
16535 private mainGraphicsContext;
16536 private labelGraphicsContext;
16537 private mainGraphicsSVG;
16538 private xAxisProperties;
16539 private yAxisProperties;
16540 private currentViewport;
16541 private margin;
16542 private data;
16543 private element;
16544 private isScrollable;
16545 private tooltipsEnabled;
16546 /**
16547 * Note: If we overflowed horizontally then this holds the subset of data we should render.
16548 */
16549 private clippedData;
16550 private style;
16551 private colors;
16552 private hostServices;
16553 private cartesianVisualHost;
16554 private interactivity;
16555 private options;
16556 private interactivityService;
16557 private layout;
16558 constructor(options: WaterfallChartConstructorOptions);
16559 init(options: CartesianVisualInitOptions): void;
16560 static converter(dataView: DataView, palette: IDataColorPalette, hostServices: IVisualHostServices, dataLabelSettings: VisualDataLabelsSettings, sentimentColors: WaterfallChartSentimentColors, interactivityService: IInteractivityService, tooltipsEnabled?: boolean): WaterfallChartData;
16561 setData(dataViews: DataView[]): void;
16562 enumerateObjectInstances(enumeration: ObjectEnumerationBuilder, options: EnumerateVisualObjectInstancesOptions): void;
16563 private enumerateSentimentColors(enumeration);
16564 calculateLegend(): LegendData;
16565 hasLegend(): boolean;
16566 private static createClippedDataIfOverflowed(data, renderableDataCount);
16567 calculateAxesProperties(options: CalculateScaleAndDomainOptions): IAxisProperties[];
16568 private static getDisplayUnitValueFromAxisFormatter(yAxisProperties, labelSettings);
16569 private static lookupXValue(data, index, type);
16570 static getXAxisCreationOptions(data: WaterfallChartData, width: number, layout: CategoryLayout, options: CalculateScaleAndDomainOptions): CreateAxisOptions;
16571 static getYAxisCreationOptions(data: WaterfallChartData, height: number, options: CalculateScaleAndDomainOptions): CreateAxisOptions;
16572 getPreferredPlotArea(isScalar: boolean, categoryCount: number, categoryThickness: number): IViewport;
16573 getVisualCategoryAxisIsScalar(): boolean;
16574 overrideXScale(xProperties: IAxisProperties): void;
16575 setFilteredData(startIndex: number, endIndex: number): any;
16576 private createRects(data);
16577 private createConnectors(data);
16578 render(suppressAnimations: boolean): CartesianVisualRenderResult;
16579 onClearSelection(): void;
16580 getSupportedCategoryAxisType(): string;
16581 static getRectTop(scale: D3.Scale.GenericScale<any>, pos: number, value: number): number;
16582 private getAvailableWidth();
16583 private getAvailableHeight();
16584 private getSentimentColorsFromObjects(objects);
16585 createLabelDataPoints(): LabelDataPoint[];
16586 }
16587}
16588declare module powerbi.visuals {
16589 import TouchUtils = powerbi.visuals.controls.TouchUtils;
16590 interface TooltipDataItem {
16591 displayName: string;
16592 value: string;
16593 color?: string;
16594 header?: string;
16595 }
16596 interface TooltipOptions {
16597 opacity: number;
16598 animationDuration: number;
16599 offsetX: number;
16600 offsetY: number;
16601 }
16602 interface TooltipEnabledDataPoint {
16603 tooltipInfo?: TooltipDataItem[];
16604 }
16605 interface TooltipCategoryDataItem {
16606 value?: any;
16607 metadata: DataViewMetadataColumn[];
16608 }
16609 interface TooltipSeriesDataItem {
16610 value?: any;
16611 highlightedValue?: any;
16612 metadata: DataViewValueColumn;
16613 }
16614 interface TooltipLocalizationOptions {
16615 highlightedValueDisplayName: string;
16616 }
16617 interface TooltipEvent {
16618 data: any;
16619 coordinates: number[];
16620 elementCoordinates: number[];
16621 context: HTMLElement;
16622 isTouchEvent: boolean;
16623 }
16624 class ToolTipComponent {
16625 tooltipOptions: TooltipOptions;
16626 private static DefaultTooltipOptions;
16627 private tooltipContainer;
16628 private isTooltipVisible;
16629 private currentTooltipData;
16630 private customScreenWidth;
16631 private customScreenHeight;
16632 static parentContainerSelector: string;
16633 static highlightedValueDisplayNameResorceKey: string;
16634 static localizationOptions: TooltipLocalizationOptions;
16635 constructor(tooltipOptions?: TooltipOptions);
16636 isTooltipComponentVisible(): boolean;
16637 /** Note: For tests only */
16638 setTestScreenSize(width: number, height: number): void;
16639 show(tooltipData: TooltipDataItem[], clickedArea: TouchUtils.Rectangle): void;
16640 move(tooltipData: TooltipDataItem[], clickedArea: TouchUtils.Rectangle): void;
16641 hide(): void;
16642 private createTooltipContainer();
16643 private setTooltipContent(tooltipData);
16644 private getTooltipPosition(clickedArea, clickedScreenArea);
16645 private setPosition(clickedArea);
16646 private setArrowPosition(clickedArea, clickedScreenArea);
16647 private getArrowElement();
16648 private getClickedScreenArea(clickedArea);
16649 }
16650 module TooltipManager {
16651 let ShowTooltips: boolean;
16652 let ToolTipInstance: ToolTipComponent;
16653 function addTooltip(selection: D3.Selection, getTooltipInfoDelegate: (tooltipEvent: TooltipEvent) => TooltipDataItem[], reloadTooltipDataOnMouseMove?: boolean, onMouseOutDelegate?: () => void): void;
16654 function showDelayedTooltip(tooltipEvent: TooltipEvent, getTooltipInfoDelegate: (tooltipEvent: TooltipEvent) => TooltipDataItem[], delayInMs: number): number;
16655 function hideDelayedTooltip(delayInMs: number): number;
16656 function setLocalizedStrings(localizationOptions: TooltipLocalizationOptions): void;
16657 }
16658 module TooltipBuilder {
16659 function createTooltipInfo(formatStringProp: DataViewObjectPropertyIdentifier, dataViewCat: DataViewCategorical, categoryValue: any, value?: any, categories?: DataViewCategoryColumn[], seriesData?: TooltipSeriesDataItem[], seriesIndex?: number, categoryIndex?: number, highlightedValue?: any, gradientValueColumn?: DataViewValueColumn): TooltipDataItem[];
16660 function createGradientToolTipData(gradientValueColumn: DataViewValueColumn, categoryIndex: number): TooltipSeriesDataItem;
16661 }
16662}
16663declare module powerbi.visuals {
16664 module visualStyles {
16665 function create(dataColors?: IDataColorPalette): IVisualStyle;
16666 }
16667}
16668declare module powerbi.visuals {
16669 interface DonutSmallViewPortProperties {
16670 maxHeightToScaleDonutLegend: number;
16671 }
16672 interface DonutConstructorOptions {
16673 sliceWidthRatio?: number;
16674 animator?: IDonutChartAnimator;
16675 isScrollable?: boolean;
16676 disableGeometricCulling?: boolean;
16677 behavior?: IInteractiveBehavior;
16678 tooltipsEnabled?: boolean;
16679 smallViewPortProperties?: DonutSmallViewPortProperties;
16680 }
16681 /**
16682 * Used because data points used in D3 pie layouts are placed within a container with pie information.
16683 */
16684 interface DonutArcDescriptor extends D3.Layout.ArcDescriptor {
16685 data: DonutDataPoint;
16686 }
16687 interface DonutDataPoint extends SelectableDataPoint, TooltipEnabledDataPoint {
16688 measure: number;
16689 measureFormat?: string;
16690 percentage: number;
16691 highlightRatio?: number;
16692 highlightValue?: number;
16693 label: string;
16694 index: number;
16695 /** Data points that may be drilled into */
16696 internalDataPoints?: DonutDataPoint[];
16697 color: string;
16698 strokeWidth: number;
16699 labelFormatString: string;
16700 /** This is set to true only when it's the last slice and all slices have the same color*/
16701 isLastInDonut?: boolean;
16702 }
16703 interface DonutData {
16704 dataPointsToDeprecate: DonutDataPoint[];
16705 dataPoints: DonutArcDescriptor[];
16706 unCulledDataPoints: DonutDataPoint[];
16707 dataPointsToEnumerate?: LegendDataPoint[];
16708 legendData: LegendData;
16709 hasHighlights: boolean;
16710 dataLabelsSettings: VisualDataLabelsSettings;
16711 legendObjectProperties?: DataViewObject;
16712 maxValue?: number;
16713 visibleGeometryCulled?: boolean;
16714 defaultDataPointColor?: string;
16715 }
16716 interface DonutLayout {
16717 shapeLayout: {
16718 d: (d: DonutArcDescriptor) => string;
16719 };
16720 highlightShapeLayout: {
16721 d: (d: DonutArcDescriptor) => string;
16722 };
16723 zeroShapeLayout: {
16724 d: (d: DonutArcDescriptor) => string;
16725 };
16726 }
16727 /**
16728 * Renders a donut chart.
16729 */
16730 class DonutChart implements IVisual {
16731 private static ClassName;
16732 private static InteractiveLegendClassName;
16733 private static InteractiveLegendArrowClassName;
16734 private static DrillDownAnimationDuration;
16735 private static OuterArcRadiusRatio;
16736 private static InnerArcRadiusRatio;
16737 private static OpaqueOpacity;
16738 private static SemiTransparentOpacity;
16739 private static defaultSliceWidthRatio;
16740 private static invisibleArcLengthInPixels;
16741 private static sliceClass;
16742 private static sliceHighlightClass;
16743 private static twoPi;
16744 static InteractiveLegendContainerHeight: number;
16745 static EffectiveZeroValue: number;
16746 static PolylineOpacity: number;
16747 private dataViews;
16748 private sliceWidthRatio;
16749 private svg;
16750 private mainGraphicsContext;
16751 private labelGraphicsContext;
16752 private clearCatcher;
16753 private legendContainer;
16754 private interactiveLegendArrow;
16755 private parentViewport;
16756 private currentViewport;
16757 private formatter;
16758 private data;
16759 private pie;
16760 private arc;
16761 private outerArc;
16762 private radius;
16763 private previousRadius;
16764 private key;
16765 private colors;
16766 private style;
16767 private drilled;
16768 private allowDrilldown;
16769 private options;
16770 private isInteractive;
16771 private interactivityState;
16772 private chartRotationAnimationDuration;
16773 private interactivityService;
16774 private behavior;
16775 private legend;
16776 private hasSetData;
16777 private isScrollable;
16778 private disableGeometricCulling;
16779 private hostService;
16780 private settings;
16781 private tooltipsEnabled;
16782 private donutProperties;
16783 private maxHeightToScaleDonutLegend;
16784 /**
16785 * Note: Public for testing.
16786 */
16787 animator: IDonutChartAnimator;
16788 constructor(options?: DonutConstructorOptions);
16789 static converter(dataView: DataView, colors: IDataColorPalette, defaultDataPointColor?: string, viewport?: IViewport, disableGeometricCulling?: boolean, interactivityService?: IInteractivityService, tooltipsEnabled?: boolean): DonutData;
16790 init(options: VisualInitOptions): void;
16791 update(options: VisualUpdateOptions): void;
16792 onDataChanged(options: VisualDataChangedOptions): void;
16793 onResizing(viewport: IViewport): void;
16794 enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstanceEnumeration;
16795 private enumerateDataPoints(enumeration);
16796 private enumerateLegend(enumeration);
16797 setInteractiveChosenSlice(sliceIndex: number): void;
16798 private calculateRadius();
16799 private getScaleForLegendArrow();
16800 private initViewportDependantProperties(duration?);
16801 private initDonutProperties();
16802 private mergeDatasets(first, second);
16803 private updateInternal(data, suppressAnimations, duration?);
16804 private createLabels();
16805 private createLabelDataPoints();
16806 private createLabelDataPoint(d, alternativeScale, measureFormatterCache);
16807 private renderLegend();
16808 private addInteractiveLegendArrow();
16809 private calculateSliceAngles();
16810 private assignInteractions(slices, highlightSlices, data);
16811 setDrilldown(selection?: DonutDataPoint): void;
16812 private assignInteractiveChartInteractions(slice);
16813 /**
16814 * Get the angle (in degrees) of the drag event coordinates.
16815 * The angle is calculated against the plane of the center of the donut
16816 * (meaning, when the center of the donut is at (0,0) coordinates).
16817 */
16818 private getAngleFromDragEvent();
16819 private interactiveDragStart();
16820 private interactiveDragMove();
16821 private interactiveDragEnd();
16822 private updateInternalToMove(data, duration?);
16823 static drawDefaultShapes(graphicsContext: D3.Selection, donutData: DonutData, layout: DonutLayout, colors: IDataColorPalette, radius: number, hasSelection: boolean, sliceWidthRatio: number, defaultColor?: string): D3.UpdateSelection;
16824 static drawDefaultHighlightShapes(graphicsContext: D3.Selection, donutData: DonutData, layout: DonutLayout, colors: IDataColorPalette, radius: number, sliceWidthRatio: number): D3.UpdateSelection;
16825 /**
16826 Set true to the last data point when all slices have the same color
16827 */
16828 static isSingleColor(dataPoints: DonutArcDescriptor[]): void;
16829 static drawStrokeForDonutChart(radius: number, innerArcRadiusRatio: number, d: DonutArcDescriptor, sliceWidthRatio: number, highlightRatio?: number): string;
16830 onClearSelection(): void;
16831 static getLayout(radius: number, sliceWidthRatio: number, viewport: IViewport): DonutLayout;
16832 private static getHighlightRadius(radius, sliceWidthRatio, highlightRatio);
16833 static cullDataByViewport(dataPoints: DonutDataPoint[], maxValue: number, viewport: IViewport): DonutDataPoint[];
16834 }
16835}
16836declare module powerbi.visuals {
16837 interface ScriptVisualDataViewObjects extends DataViewObjects {
16838 script: ScriptObject;
16839 }
16840 interface ScriptObject extends DataViewObject {
16841 provider: string;
16842 source: string;
16843 }
16844 interface ScriptVisualOptions {
16845 canRefresh: boolean;
16846 }
16847 class ScriptVisual implements IVisual {
16848 private element;
16849 private imageBackgroundElement;
16850 private hostServices;
16851 private canRefresh;
16852 constructor(options: ScriptVisualOptions);
16853 init(options: VisualInitOptions): void;
16854 update(options: VisualUpdateOptions): void;
16855 onResizing(finalViewport: IViewport): void;
16856 private getImageUrl(dataView);
16857 private ensureHtmlElement();
16858 }
16859}
16860declare module powerbi.visuals.plugins {
16861 const animatedNumber: IVisualPlugin;
16862 let areaChart: IVisualPlugin;
16863 let barChart: IVisualPlugin;
16864 let basicShape: IVisualPlugin;
16865 let card: IVisualPlugin;
16866 let multiRowCard: IVisualPlugin;
16867 let clusteredBarChart: IVisualPlugin;
16868 let clusteredColumnChart: IVisualPlugin;
16869 let columnChart: IVisualPlugin;
16870 let comboChart: IVisualPlugin;
16871 let dataDotChart: IVisualPlugin;
16872 let dataDotClusteredColumnComboChart: IVisualPlugin;
16873 let dataDotStackedColumnComboChart: IVisualPlugin;
16874 let donutChart: IVisualPlugin;
16875 let funnel: IVisualPlugin;
16876 let gauge: IVisualPlugin;
16877 let hundredPercentStackedBarChart: IVisualPlugin;
16878 let hundredPercentStackedColumnChart: IVisualPlugin;
16879 let image: IVisualPlugin;
16880 let lineChart: IVisualPlugin;
16881 let lineStackedColumnComboChart: IVisualPlugin;
16882 let lineClusteredColumnComboChart: IVisualPlugin;
16883 let map: IVisualPlugin;
16884 let filledMap: IVisualPlugin;
16885 let treemap: IVisualPlugin;
16886 let pieChart: IVisualPlugin;
16887 let scatterChart: IVisualPlugin;
16888 let stackedAreaChart: IVisualPlugin;
16889 let table: IVisualPlugin;
16890 let matrix: IVisualPlugin;
16891 let slicer: IVisualPlugin;
16892 let textbox: IVisualPlugin;
16893 let waterfallChart: IVisualPlugin;
16894 let cheerMeter: IVisualPlugin;
16895 let consoleWriter: IVisualPlugin;
16896 let helloIVisual: IVisualPlugin;
16897 let owlGauge: IVisualPlugin;
16898 let scriptVisual: IVisualPlugin;
16899 let kpi: IVisualPlugin;
16900}
16901declare module powerbi.visuals {
16902 module CanvasBackgroundHelper {
16903 function getDefaultColor(): string;
16904 function getDefaultValues(): {
16905 color: string;
16906 };
16907 }
16908}