-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspotfire-api-1-3.d.ts
1645 lines (1569 loc) · 56.5 KB
/
spotfire-api-1-3.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright © 2021. TIBCO Software Inc.
* This file is subject to the license terms contained
* in the license file that is distributed with this file.
*/
export as namespace Spotfire;
/**
* Predicate to determine if a current read operation for {@link DataView.allRows} should be aborted when there is new, non-streaming, data available. If this predicate returns true the {@link DataView.allRows} promise will be rejected and no rows will be returned.
* @public
*/
export declare type AbortPredicate = (currentRowCount: number) => boolean;
/**
* Represents a property owned by the Spotfire document.
* These can be either document properties, data table properties or data column properties.
* @public
*/
export declare interface AnalysisProperty<T extends AnalysisPropertyDataType = AnalysisPropertyDataType>
extends AnalysisPropertyValue<T> {
/**
* Set the value of this instance.
* @param value - The value to set.
*/
set(value: T | T[] | null): void;
}
/**
* Represents the data types possible to store in a document, table or column {@link AnalysisProperty}.
* @public
*/
export declare type AnalysisPropertyDataType = string | number | boolean | Date | TimeSpan | Time;
/**
* Represents the values held by a {@link AnalysisProperty}.
* @public
*/
export declare interface AnalysisPropertyValue<T extends AnalysisPropertyDataType = AnalysisPropertyDataType> {
/**
* Gets the name of this instance.
*/
name: string;
/**
* Gets the value held by this instance. Will throw if the value is a list, i.e. {@link AnalysisPropertyValue.isList} returns true;
*/
value<T2 extends T>(): T2 | null;
/**
* Gets the value held by this instance. Will throw if the value is not a list, i.e. {@link AnalysisPropertyValue.isList} returns false;
*/
valueList<T2 extends T>(): T2[];
/**
* Get the Spotfire internal data type of the property.
*/
dataType: DataType;
/**
* Gets a value indicating whether the property is a list.
*/
isList: boolean;
}
/**
* Represents an axis of the Mod Visualization.
* @public
*/
export declare interface Axis extends AxisValues {
/**
* Sets the full axis expression to the specified `value`.
*/
setExpression(value: string): void;
}
/**
* Represents one element of a multi-part axis expression.
* @public
*/
export declare interface AxisPart {
/**
* Gets the expression of this part.
*/
expression: string;
/**
* Gets the display name of this part.
*/
displayName: string;
}
/**
* Represents the values held by an {@link Axis}.
* @public
*/
export declare interface AxisValues {
/**
* Gets the name of this instance.
*/
name: string;
/**
* Gets the {@link AxisPart}s that this axis has. The parts are derived from the current {@link AxisValues.expression}.
*/
parts: AxisPart[];
/**
* Gets the full expression of this instance, including multi-part delimiters and
* surrounding "\<\>" brackets if the axis is in categorical mode.
*/
expression: string;
/**
* Gets a value indicating whether the axis is categorical or continuous.
*/
isCategorical: boolean;
}
/**
* Represents a data column in a Spotfire data table.
* @public
*/
export declare interface Column extends ColumnValues {
/**
* Provides access to the properties of this instance. See {@link AnalysisProperty}.
*/
properties(): Readable<AnalysisPropertyValue[]>;
/**
* Provides access to the {@link AnalysisProperty} with the specified `name`.
*/
property(name: string): Readable<AnalysisPropertyValue>;
}
/**
* Represents the values held by a {@link Column}.
* @public
*/
export declare interface ColumnValues {
/**
* Gets the name of this instance.
*/
name: string;
/**
* Gets the data type of this instance.
*/
dataType: DataType;
}
/**
* Represents an object with methods to show a context menu.
* @public
*/
export declare interface ContextMenu {
/**
* Shows a context menu with the specified `items`. The context menu closes when the user clicks one of the
* items or outside the context menu.
* @param x - The horizontal pixel coordinate where to show the context menu.
* @param y - The vertical pixel coordinate where to show the context menu.
* @param items - Defines the content of the context menu.
* @returns A Promise that, when resolved, provides the {@link ContextMenuItem} that was clicked by the user,
* or `undefined` if the user clicked outside the context menu.
*/
show(x: number, y: number, items: ContextMenuItem[]): Promise<ContextMenuItem>;
}
/**
* Represents an item in a context menu shown by calling {@link ContextMenu.show}.
* @public
*/
export declare interface ContextMenuItem {
/**
* Specifies the text to show in this item.
*/
text: string;
/**
* Specifies whether this item is enabled.
*/
enabled: boolean;
/**
* Specifies the tooltip to show for this item. If not defined, no tooltip will be shown when hovering the this item.
*/
tooltip?: string;
/**
* Specifies a value indicating whether this item is checked. If not defined, this item will not be rendered in a checked state.
*/
checked?: boolean;
}
/**
* Provides access points to launch Spotfire controls and UI component relevant for a Mod Visualization.
* @public
*/
export declare interface Controls {
/**
* Gets an object with methods to show a context menu.
*/
contextMenu: ContextMenu;
/**
* Gets an object with methods to show and hide a Spotfire tooltip.
*/
tooltip: Tooltip;
/**
* Gets an object with methods to show and hide the Spotfire progress indicator.
*/
progress: Progress;
/**
* Gets an object that can be used to create and show a Spotfire popout dialog.
*/
popout: Popout;
/**
* Gets an object that can be used to show an error overlay native Spotfire style.
*/
errorOverlay: ErrorOverlay;
}
/**
* Represents a data table in the Spotfire document.
* @public
*/
export declare interface DataTable extends DataTableValues {
/**
* Provides access to the columns of this instance. See {@link Column}.
*/
columns(): Readable<Column[]>;
/**
* Provides access to the {@link Column} with the specified `name`.
*/
column(name: string): ReadableProxy<Column>;
/**
* Provides access to the properties of this instance. See {@link AnalysisProperty}.
*/
properties(): Readable<AnalysisPropertyValue[]>;
/**
* Provides access to the {@link AnalysisProperty} with the specified `name`.
*/
property(name: string): Readable<AnalysisPropertyValue>;
}
/**
* Represents the values held by a {@link DataTable}.
* @public
*/
export declare interface DataTableValues {
/**
* Gets the name of this instance.
*/
name: string;
/**
* Gets the number of columns in this instance.
*/
columnCount: number;
/**
* Gets the unique id for this instance.
* The id is stable during the data table life cycle, thus it can be used to store as a reference to this data table in a {@link ModProperty} or {@link AnalysisProperty}.
* @version 1.1
*/
id: string;
}
/**
* Represents the data type of a value.
* @public
*/
export declare interface DataType {
/**
* Gets the name of this DataType.
*/
name:
| "String"
| "Integer"
| "LongInteger"
| "Real"
| "SingleReal"
| "Currency"
| "Boolean"
| "Date"
| "DateTime"
| "Time"
| "TimeSpan"
| "Binary";
/**
* Gets a value indicating whether the data type is numeric or not, that is,
* Integer, Currency, Real, LongInteger, or SingleReal.
*/
isNumber(): boolean;
/**
* Gets a value indicating whether the data type is represents by Date or not, that is, Date, or DateTime.
*/
isDate(): boolean;
/**
* Gets a value indicating whether the data type is represents by {@link Time} or not.
*/
isTime(): boolean;
/**
* Gets a value indicating whether the data type is represents by {@link TimeSpan} or not.
*/
isTimeSpan(): boolean;
}
/**
* Represents a view of the data from which the visualization can be rendered.
*
* This object contains the result of the query made by Spotfire against the DataTable
* currently used by the Mod Visualization, using the Filtering, Marking, expressions
* on the Axes and other relevant settings.
* @public
*/
export declare interface DataView {
/**
* Mark a set of rows.
* The full set will be the union of all mark operations performed within one transaction (see {@link Mod.transaction}).
* All mark operations must have the same marking operation.
* @param rows - The rows to be selected.
* @param operation - Optional {@link MarkingOperation}. Default value is `Replace`.
*/
mark(rows: DataViewRow[], markingOperation?: MarkingOperation): void;
/**
* Clears the current marking
*/
clearMarking(): void;
/**
* Gets the marking information, or null if marking is not enabled.
*/
marking(): Promise<MarkingInfo | null>;
/**
* Gets a value indicating whether the dataView has expired.
* The dataview has expired when there has been changes to the document,
* for example marking or filtering.
* When true, there will be a new dataview available on the next read.
*/
hasExpired(): Promise<boolean>;
/**
* Gets any errors generated while creating the dataview.
* Returns empty array if none occurred.
*/
getErrors(): Promise<string[]>;
/**
* Gets metadata for a specific categorical axis in the {@link DataView}.
* Categorical axes are defined in the manifest file as categorical or dual.
* When this method fails to return a valid axis getting the corresponding call to {@link DataViewRow.categorical} will throw an error.
* Returns null for axes with empty expressions or for dual mode axes that currently are in continuous mode.
* Throws if the axis does not exist or the axes mode is continuous.
* @param name - The axis name.
*/
categoricalAxis(name: string): Promise<DataViewCategoricalAxis | null>;
/**
* Gets metadata for a specific continuous axis in the {@link DataView}.
* Continuous axes are defined in the manifest file as continuous or dual.
* When this method fails to return a valid axis getting the corresponding call to {@link DataViewRow.continuous} will throw an error.
* Returns null for axes with empty expressions or for dual mode axes that currently are in categorical mode.
* Throws if the axis does not exist or the axes mode is categorical.
* @param name - The axis name.
*/
continuousAxis(name: string): Promise<DataViewContinuousAxis | null>;
/**
* Gets metadata of all axes currently present in the {@link DataView}.
* Axes with empty expression are omitted.
*/
axes(): Promise<DataViewAxis[]>;
/**
* Gets a hierarchy for a categorical axis.
*
* If the axis has an empty expression the hierarchy will contain one single root node.
* Returns null for dual mode axes that currently are in continuous mode.
* Throws if the axis does not exist or the axes mode is continuous.
* @param name - The name of the axis to get the hierarchy for.
*/
hierarchy(name: string): Promise<DataViewHierarchy | null>;
/**
* Gets the total number of rows of the {@link DataView} without actually getting all the rows. Use this function to determine whether or not the mod will be able to handle the amount of data rows.
* When there are errors in the mod configuration there will be no rows available and this method will return undefined.
*/
rowCount(): Promise<number | undefined>;
/**
* Gets all rows from the data view as one asynchronous operation.
* The allRows function has a built in cache and can be called multiple times with the same dataView and it will return the same list of rows.
* @param abortPredicate - Optional. Predicate to determine whether the operation should be aborted when there is new, non-streaming, data available. If this predicate returns true the promise will be rejected.
* The default behavior is that reading will be aborted when new non-streaming update is available.
* @returns null if reading data was aborted, otherwise a {@link DataViewRow}[].
*/
allRows(abortPredicate?: AbortPredicate): Promise<DataViewRow[] | null>;
}
/**
* Contains metadata computed for an {@link Axis}.
* @public
*/
export declare interface DataViewAxis {
/**
* Gets the name of this axis.
*/
name: string;
/**
* Gets a value indicating whether this axis is an instance of {@link DataViewContinuousAxis} or {@link DataViewCategoricalAxis} .
*/
isCategorical: boolean;
}
/**
* Represents metadata computed for a categorical {@link Axis}.
* @public
*/
export declare interface DataViewCategoricalAxis extends DataViewAxis {
/**
* Gets the hierarchy of this axis.
*/
hierarchy: DataViewHierarchy;
}
/**
* Represents a value of a categorical axis for one row in a data view.
* @public
*/
export declare interface DataViewCategoricalValue {
/**
* Gets an array representing the full path of the value in the hierarchy defined by the axis expression.
* The first element is the top level of the hierarchy and the last element is the leaf level.
*/
value(): DataViewCategoricalValuePathElement[];
/**
* Gets a formatted string that can be used to display this value.
* This string is built by concatenating the {@link DataViewCategoricalValuePathElement.formattedValue} for each element found in the {@link DataViewCategoricalValue.value} array.
* @param separator - The separator used for concatenation. The default separator is " » ".
*/
formattedValue(separator?: string): string;
/**
* Gets the index among the leaf nodes of the associated {@link DataViewHierarchy} of this {@link DataViewCategoricalAxis}.
* This, for example, can be used to determine the position on a scale where to render the visual element.
*/
leafIndex: number;
}
/**
* Represents an element in the `path` of a {@link DataViewCategoricalValue}.
* @public
*/
export declare interface DataViewCategoricalValuePathElement {
/**
* Gets a formatted string that can be used to display this value.
* The formatting settings in Spotfire are used to create this string.
*/
formattedValue(): string;
/**
* Gets a key that uniquely identifies this element.
*
* In many cases this will be the same as {@link DataViewCategoricalValuePathElement.formattedValue} and {@link DataViewCategoricalValuePathElement.value}.
* However there are cases when those values can contain duplicates. For instance when working with cube data,
* or when using formatters and display values.
*
* They key is suitable to be used for identifying objects when implementing rendering transitions.
*
* The key can be null when the corresponding {@link DataViewCategoricalValuePathElement.value} is null.
*/
key: string | null;
/**
* Gets the value of this element, or null if this element represents a missing or invalid data point.
*
* The type of the returned value can be determined from the {@link DataViewHierarchy.levels} in the {@link DataViewHierarchy} of
* the associated {@link DataViewCategoricalAxis}.
*/
value<T extends DataViewValueType>(): T | null;
}
/**
* Color information for a {@link DataViewRow}.
* @public
*/
export declare interface DataViewColorInfo {
/** The hex code for the color. */
hexCode: string;
}
/**
* Represents metadata computed for continuous {@link Axis}.
* @public
*/
export declare interface DataViewContinuousAxis extends DataViewAxis {
/**
* Gets the data type of the values computed by this axis.
*/
dataType: DataType;
}
/**
* Represents a value of a continuous axis for one row in a data view.
* @public
*/
export declare interface DataViewContinuousValue<T extends DataViewValueType = DataViewValueType> {
/**
* Gets the value of this instance. The type depending on the type of the
* expression on the associated {@link DataViewContinuousAxis}.
*
* This method will return `null` when the underlying data value is missing or invalid.
*/
value<T2 extends DataViewValueType = T>(): T2 | null;
/**
* Gets a formatted string that can be used to display this value.
* The formatting settings in Spotfire are used to create this string.
*/
formattedValue(): string;
}
/**
* Represents a hierarchy for a {@link DataViewCategoricalAxis}.
* @public
*/
export declare interface DataViewHierarchy {
/**
* Gets the name of this hierarchy, the same as the associated {@link DataViewCategoricalAxis}.
*/
name: string;
/**
* Gets a value indicating whether the hierarchy is empty, i.e. the axis expression is empty, or not.
* For convenience, an empty hierarchy will have one single node that may contain all rows in the dataview.
*/
isEmpty: boolean;
/**
* Gets the levels of this hierarchy. The root node has no corresponding level.
*/
levels: DataViewHierarchyLevel[];
/**
* Gets the total number of leaf nodes in the hierarchy.
*/
leafCount: number;
/**
* Gets the virtual root node of the hierarchy. The level of the root node is -1. Spotfire does not usually render the root node in visualization.
* @param abortPredicate - Optional. Predicate to determine whether the operation should be aborted when there is new, non-streaming, data available. If this predicate returns true the promise will be rejected.
* The default behavior is that reading will be aborted when new non-streaming update is available.
* @returns null if reading data was aborted, otherwise a {@link DataViewHierarchyNode}.
*/
root(abortPredicate?: AbortPredicate): Promise<DataViewHierarchyNode | null>;
}
/**
* Represents the levels of a hierarchy.
* @public
*/
export declare interface DataViewHierarchyLevel {
/**
* The name of the hierarchy level, derived from the expression on the {@link Axis}.
*/
name: string;
/**
* Gets the data type of the values in this level of the hierarchy.
*/
dataType: DataType;
}
/**
* Represents a node in a {@link DataViewHierarchy}.
* @public
*/
export declare interface DataViewHierarchyNode {
/**
* Gets a formatted string that can be used to display this value.
* The formatting settings in Spotfire are used to create this string.
*/
formattedValue(): string;
/**
* Gets the full path, top down to this node, of the formatted values. The virtual root node is omitted.
* @param separator - The separator. The default separator is " » ".
*/
formattedPath(separator?: string): string;
/**
* Gets the key for this hierarchy node. The key is guaranteed to be unique for the node among its siblings.
*
* In many cases this will be the same as {@link DataViewHierarchyNode.formattedValue} or {@link DataViewHierarchyNode.value}.
* However there are cases when those values can contain duplicates. For instance when working with cube data,
* or when using formatters and display values.
*
* They key is suitable to be used for identifying objects when implementing rendering transitions.
*
* The key can be null when the corresponding {@link DataViewHierarchyNode.value} is null.
*/
key: string | null;
/**
* Gets the value of this node, or null if this node represents a missing or invalid data point.
*
* The type of the returned value can be determined from the {@link DataViewHierarchy.levels} in the associated {@link DataViewHierarchy}.
*/
value<T extends DataViewValueType>(): T | null;
/**
* Gets the parent of the hierarchy node, or `undefined` for root level nodes.
*/
parent?: DataViewHierarchyNode;
/**
* Gets the children of this node, or `undefined` if this node is a leaf node.
*/
children?: DataViewHierarchyNode[];
/**
* Computes an array of all leaf nodes in the sub tree of the hierarchy spanned from this node.
*/
leaves(): DataViewHierarchyNode[];
/**
* Gets the index of the leaf node among all leaf nodes in the hierarchy. This is undefined for non leaf nodes.
*/
leafIndex?: number;
/**
* Marks all {@link DataViewRow}s corresponding to the sub tree of the hierarchy spanned from this node.
* See {@link DataView.mark} for more details.
* @param operation - The marking operation.
*/
mark(operation?: MarkingOperation): void;
/**
* Computes the number of {@link DataViewRow}s corresponding to the sub tree of the hierarchy spanned from this node.
*/
rowCount(): number;
/**
* Computes the number of leaf nodes in the sub tree of the hierarchy spanned from this node.
*/
leafCount(): number;
/**
* Computes the number of marked {@link DataViewRow}s in the sub tree of the hierarchy spanned from this node.
*/
markedRowCount(): number;
/**
* Gets the level in the hierarchy where this node occurs. The root node of the hierarchy tree has level -1.
*/
level: number;
/**
* Computes the {@link DataViewRow}s corresponding to the sub tree of the hierarchy spanned from this node.
*/
rows(): DataViewRow[];
}
/**
* Represents an object that provides access to a {@link DataView}.
* @public
*/
export declare type DataViewProxy = DataViewProxyMethods & Readable<DataView>;
/**
* Represents the methods available on a {@link DataViewProxy}.
* @public
*/
export declare interface DataViewProxyMethods {
/**
* Clears the current marking
*/
clearMarking(): void;
}
/**
* Represents a row of data in a {@link DataView}. Each row can be thought of as a data point that the mod visualization renders.
* @public
*/
export declare interface DataViewRow {
/**
* Gets a value indicating whether this row is marked.
*/
isMarked(): boolean;
/**
* Gets a {@link DataViewCategoricalValue} representing the value of the axis with the specified `axisName`.
* This method will throw an error if there is no categorical axis by that name or if the expression is empty.
* Use {@link DataView.categoricalAxis} to check the current existence of a categorical value.
* @param axisName - The name of the axis to get the value for.
*/
categorical(axisName: string): DataViewCategoricalValue;
/**
* Gets a {@link DataViewContinuousValue} representing the value of the axis with the specified `axisName`.
* This method will throw an error if there is no continuous axis by that name or if the expression is empty.
* Use {@link DataView.continuousAxis} to check the current existence of a continuous value.
* @param axisName - The name of the axis to get the value for.
*/
continuous<T extends DataViewValueType>(axisName: string): DataViewContinuousValue<T>;
/**
* Gets the leaf {@link DataViewHierarchyNode} for the specified axis,
* or null for dual mode axes with continuous axis expression.
* This method will throw an error for continuous mode axes
* or if there is no axis by that name.
* @param axisName - The name of the axis
* @version 1.1
*/
leafNode(axisName: string): DataViewHierarchyNode | null;
/**
* Calculates an element id for this row, suitable for identifying rows between data views.
* When stable identifiers is not used, only rows in immediately following data view are guaranteed to re-use previous id.
* If a row is filtered out in a new data view, this row is thus not guaranteed to yield the same id when it re-appears.
*
* @note A stable element id is only stable in the current session, thus it should not be stored in the document,
* e.g. as a {@link ModProperty} or {@link AnalysisProperty}.
* @version 1.1
*
* @param useStableId - When true, the id will be a (longer) stable id guaranteed to be the same over time.
* @param omitAxisNames - Axis names to omit when creating the identifier. Can be used to group multiple elements split by these axes, for example to create animation effects in one data view.
*/
elementId(useStableId?: boolean, omitAxisNames?: string[]): string;
/**
* Gets the {@link DataViewColorInfo} for the row, if a color axis is defined in the mod manifest.
* The underlying data value can be retrieved by using {@link DataViewRow.categorical}("Color") or {@link DataViewRow.continuous}("Color"), depending on the mode of the color axis.
*/
color(): DataViewColorInfo;
/**
* Performs the specified marking operation in the current marking.
*
* **Note** All mark operations within one {@link Mod.transaction} must have the same {@link MarkingOperation}.
*
* See {@link DataView.mark} for more details.
* @param operation - Optional {@link MarkingOperation}. Default value is `Replace`.
*/
mark(operation?: MarkingOperation): void;
}
/**
* Represents the type of a {@link DataView} value. The actual type that a given value has depends on the
* type of the expression on the associated axis.
* @public
*/
export declare type DataViewValueType = number | string | boolean | Date | Time | TimeSpan;
/**
* Provides access to show an error overlay covering the entire Mod shown by Spotfire.
* @public
*/
export declare interface ErrorOverlay {
/**
* Show error message. Showing any error message will hide the Mods UI.
* @param messages - The error messages. Each message will be shown in its own paragraph.
* @param category - Optional error categorization. Useful if multiple error message are to be shown. Error messages will be sorted based on the category.
*/
show(messages: string[], category?: string): void;
/**
* Show error message. Showing any error message will hide the Mods UI.
* @param messages - The error message.
* @param category - Optional error categorization. Useful if multiple error message are to be shown. Error messages will be sorted based on the category.
*/
show(message: string, category?: string): void;
/**
* Clear the error message. If no other error messages are currently visible the Mods UI will be shown.
* @param category - Optional error categorization.
*/
hide(category?: string): void;
}
/**
* From readableArray, an array of Readable of some value type, extract an array of this value type.
* @public
*/
export declare type ExtractValueType<readableArray extends ReadonlyArray<Readable<any>>> = {
[readableName in keyof readableArray]: readableArray[readableName] extends Readable<infer readableNameType>
? readableNameType
: never;
};
/**
* Represents information about a font that is used in the Mod Visualization.
* @public
*/
export declare interface FontInfo {
/**
* Gets the value to use for the `font-family` CSS property.
*/
fontFamily: string;
/**
* Gets the font size in pixels.
*/
fontSize: number;
/**
* Gets the value to use for the `font-style` CSS property.
*/
fontStyle: string;
/**
* Gets the value to use for the `font-weight` CSS property.
*/
fontWeight: string;
/**
* Gets the value to use for the `color` CSS property.
*/
color: string;
}
/**
* Represents the general styling information that applies to the Mod Visualization.
* @public
*/
export declare interface GeneralStylingInfo {
/**
* Gets and object describing the font that shall be used by the Mod Visualization.
*/
font: FontInfo;
/**
* Gets the value to use for the `background-color` CSS property of the Mod Visualization.
*/
backgroundColor: string;
}
/**
* Initializes the Mod API. The specified `onLoaded` callback is called when the initialization is complete.
* @example
* ```
* Spotfire.initialize(async (mod) => {
* console.log("Mod API loaded.");
* });
* ```
* The initialize method will invoke the provided callback with an instance of the mod API, to be used by the mod developer.
*
* The initialize method needs to be invoked in order for the mod to function. Even if the mod only displays static content, the API must be initialized in order for events and export to work.
* @public
* @param onLoaded - Callback that is called when the mod API is initialized and ready to be interacted with.
*/
export declare function initialize(onLoaded: OnLoadCallback): void;
/**
* Represents the styling information that applies to scale lines in the Mod Visualization.
* @public
*/
export declare interface LineStylingInfo {
/**
* Gets the stroke to use for scale lines. This value is valid a CSS color or the value `"none"`.
*/
stroke: string;
}
/**
* Marking information for a {@link DataView}.
* @public
*/
export declare interface MarkingInfo {
/** The hex code for the marking. Note that when the mod has a defined color axis, the color should be retrieved via the {@link DataViewRow.color} method. */
colorHexCode: string;
/** The name of the marking. */
name: string;
}
/**
* Specifies how a Marking shall be modified.
* <pre>
* - "Replace" - replaces the current marking.
* - "Add" - adds to the current marking.
* - "Subtract" - removes the current marking.
* - "Toggle" - toggles marking on each item in the set.
* - "Intersect" - marks the intersection of the current marking and the specified set.
* - "ToggleOrAdd" - will behave like toggle if all or no rows in the set are marked, otherwise it is an add operation. This is the default Spotfire behavior for control marking.
* </pre>
* @public
*/
export declare type MarkingOperation = "Replace" | "Add" | "Subtract" | "Toggle" | "Intersect" | "ToggleOrAdd";
/**
* Extract from T the keys of all properties with function values.
* @public
*/
export declare type MethodKeys<T> = {
[P in keyof T]: T[P] extends Function ? P : never;
}[keyof T];
/**
* Represents the entire Mod API and exposes methods for interacting with and reading data from
* the Mod Visualization and the Spotfire document.
*
* Reading content from the Mod is made by using either of the methods {@link Reader.subscribe} or {@link Reader.once} on an instance of a {@link Reader}.
* @public
*/
export declare interface Mod {
/**
* Gets an object that provides access to Spotfire document.
*/
document: SpotfireDocument;
/**
* Gets an object representing the content in the Mod Visualization and provides methods to read and/or modified it.
*/
visualization: ModVisualization;
/**
* Provides access to the {@link ModProperty} with the specified `name`.
*/
property<T extends ModPropertyDataType>(name: string): ReadableProxy<ModProperty<T>>;
/**
* Provides read-only access to the current size of the browser window in which the Mod
* is rendered. That is, the size of the iframe created for the Mod in the Spotfire UI.
*/
windowSize(): Readable<Size>;
/**
* Creates a {@link Reader} that can be used to access content specified by the {@link Readable} parameters.
* The reader is responsible for combining multiple {@link Readable}s and scheduling a callback to be invoked
* when one or more of the {@link Readable}s have changed.
* @param readables - The {@link Readable}s that will be available in the reader.
*/
createReader<T extends ReadonlyArray<Readable>>(...readables: T): Reader<ExtractValueType<T>>;
/**
* Gets an object that allows showing Spotfire controls and other UI component, like context menus, tooltips, etc.
*/
controls: Controls;
/**
* Performs a set of synchronous modifications in an explicit transaction to the Spotfire document.
*
* Use of this method is only needed to make sure that a set of modifications are done as one transaction, thereby resulting in one undo step.
* Modifications done outside of a transaction action callback will be grouped together in an implicit transaction.
*
* @param action - callback with a set of modifications
* @param onComplete - optional callback that is called when the transaction is committed or rolled back. When there is an error argument in the callback the transaction was rolled back.
* @example
* ```
* mod.transaction(() => {
* mod.property("X").set("new value for X");
* mod.property("Y").set("new value for Y");
* },
* (error) => {
* if (error) {
* // Show error message.
* }
* else {
* // Handle success, e.g. re-enable action button.
* }
* });
* ```
*/
transaction(action: () => void, onComplete?: (error?: string) => void): void;
/**
* Get the Mod's render context. This function should be invoked as soon as possible in the {@link initialize} callback.
*
* If this method is called in the {@link initialize} callback, Spotfire will wait for the Mod to finish rendering during
* an export. The export will be made once the {@link RenderContext.signalRenderComplete} method has been called.
*
* If this method is not called in the {@link initialize} callback, Spotfire will _not_ wait for the Mod to finish rendering during
* an export. Instead, the Mod will be automatically exported after one second.
*/
getRenderContext(): RenderContext;
/**
* Get mod metadata - name, id, version, etc.
*/
metadata: ModMetadata;
}
/**
* Represents that metadata of the Mod Visualization, as defined in the mod-manifest-json.
* @public
*/
export declare interface ModMetadata {
/**
* Gets the id of the Mod Visualization, as defined in the mod-manifest-json.
*/
id: string;
/**
* Gets the name of the Mod Visualization, as defined in the mod-manifest-json.
*/
name: string;
/**
* Gets the version of the Mod Visualization, as defined in the mod-manifest-json.
*/
version: string;
/**
* Gets the api version used by the Mod Visualization, as declared in the mod-manifest-json.
*/
apiVersion: string;
}
/**
* Represents a property owned by the Mod Visualization.
* The Mod manifest defines the properties owned by the Mod Visualization.
* @public
*/
export declare interface ModProperty<T extends ModPropertyDataType = ModPropertyDataType> extends ModPropertyValue<T> {
/**
* Set the value of this instance.
* @param value - The value to set.
*/
set(value: T): void;
}
/**
* Represents the data types possible to store in a mod {@link ModProperty}.
* @public
*/
export declare type ModPropertyDataType = string | number | boolean;
/**
* Represents the values held by a {@link ModProperty}.
* @public
*/
export declare interface ModPropertyValue<T extends ModPropertyDataType = ModPropertyDataType> {
/**
* Gets the name of this instance.
*/
name: string;
/**
* Gets the value held by this instance;
*/
value<T2 extends T>(): T2 | null;
}
/**
* Represents the content in the Mod Visualization that can be read and/or modified.
*
* The content is a combination of state stored by the Mod Visualization in the Spotfire document,
* its view of the data and relevant UI properties. All values are {@link Readable} objects and are
* typically accessed using the {@link Reader} object.
*
* @public
*/
export declare interface ModVisualization {
/**
* Provides access to the {@link DataView} that the Mod Visualization is to render.
*/
data(): DataViewProxy;
/**
* Provides access to the {@link DataTable} in the Spotfire document that the Mod Visualization
* uses as its main table.
*/
mainTable(): ReadableProxy<DataTable>;
/**
* Sets the main {@link DataTable} in the Mod visualization.
* @param tableName - The name or id of the {@link DataTable} to be used as main table.
*/
setMainTable(tableName: string): void;
/**
* Sets the main {@link DataTable} in the Mod visualization.
* @param table - The {@link DataTable} object to be used as main table.
*/