Constructor
new SpotfireDocumentEditor(serverUrl, documentPath, [onDocumentOpenedHandler], [sfConnector], [defaultSerializer])
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
serverUrl
|
String | The TIBCO Spotfire® server URL to be connected to. |
|
documentPath
|
String | The document to be opened. Mandatory to use in a mashup using the TIBCO Spotfire® Web Player. Optional for the TIBCO Spotfire® Analyst. |
|
onDocumentOpenedHandler
|
onDocumentOpenedCb |
<optional> |
Handler to be executed on the openedDocument event. |
sfConnector
|
SpotfireConnectorBase |
<optional> |
The TIBCO Spotfire® connector instance you can inject at the creation. |
defaultSerializer
|
SpotfireDocumentEditorDefaultSerializer |
<optional> |
The serializer instance you can inject at the creation. |
Methods
addBarChart(barChartDescription)
Add a SpotfireBarChart
to the current state to be applied on the current Spotfire document
Parameters:
Name | Type | Description |
---|---|---|
barChartDescription
|
Object | the barChart properties (see |
addColumnMatchings(columnRelations)
Adds a match between two columns from two different data tables.
Parameters:
Name | Type | Description |
---|---|---|
columnRelations
|
Array.<SpotfireColumnRelation> | Array of column relation descriptions. |
Example
spotfireDocument.editor
.addColumnMatchings([
{
leftColumn: {
tableName: 'firstDataTable',
name: 'a column of firstDataTable',
transformation: SpotfireColumnTransformation.integer
},
rightColumn: {
tableName: 'secondDataTable',
name: 'a column of secondDataTable',
transformation: SpotfireColumnTransformation.integer
}
}
])
.applyState();
addColumnRelations(columnRelationsDescription, getMethod, destinationArray)
Adds/replaces a relation between two columns of two data tables. Used to add data table relations and column matchings for adding linked data.
Parameters:
Name | Type | Description |
---|---|---|
columnRelationsDescription
|
ColumnRelationDescription ▼ | Array of description of the relation between data columns |
[].leftColumn
|
ColumnDescription ▼ | The column to match with in the destination data table. |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
[].rightColumn
|
ColumnDescription ▼ | The column to match with in the source data table. |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
getMethod
|
function | The method to use when getting the corresponding relations |
destinationArray
|
Array.<SpotfireColumnRelation> | the array of SpotfireColumnRelation where to push/modify the column relation |
Example
spotfireDocument.editor.loadDataTableFromUrl('oneTable',urlToImport)
.loadDataTableFromUrl('secondTable',urlToImport)
.addColumnRelations([
{
leftColumn : {
tableName: 'oneDataTable',
name: 'Activity',
transformation: SpotfireColumnTransformation.string
},
rightColumn : {
tableName: 'secondDataTable',
name: 'Activity',
transformation: SpotfireColumnTransformation.string
}
}
]).applyState()
addColumnsFromUrl(importedDataAsColumnDescription)
Adds data to be imported as columns in a data table.
Parameters:
Name | Type | Description |
---|---|---|
importedDataAsColumnDescription
|
ImportedDataAsColumnDefinition ▼ | |
urlSource
|
String | The URL of the source containing the columns to be imported. |
dataTableTarget
|
String | The name of the data table in which new columns will be imported. |
targetIdColumn
|
String | The name of the column in the target data table to use for the matching. |
sourceIdColumn
|
String | The name of the column in the source data table to use for the matching. |
otherColumnsMatching
|
Array.<ColumnMatching> ▼ | Array of the description of other column matches. |
[].targetColumn
|
String | The name of the column in the target data table to use for the matching. |
[].sourceColumn
|
String | The name of the column in the source data table to use for the matching. |
replaceCommonColumns
|
Boolean | Specifies whether the columns in the target data table should be replaced by the imported columns if they are common. Otherwise, the name of imported columns will be indexed. |
columnsToReplace
|
Array.<String> | Columns to be replaced by the imported data. |
addCombinationChart(tableDescription)
Add a SpotfireCombinationChart
to the current state to be applied on the current Spotfire document
Parameters:
Name | Type | Description |
---|---|---|
tableDescription
|
Object | the tablePlot properties (see |
addDataTable(dataTableDescription)
Adds a data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableDescription
|
DataTableDescription ▼ | The description of the data table. |
name
|
String | The name of the data table. |
fromUrl
|
String | The URL of the source. |
addedColumnsDefinitions
|
AddedColumnsDefinition ▼ | Array of columns to add (calculated column, etc ...). |
[].name
|
String | The name of the column to add. |
[].type
|
SpotfireDataColumnsTypes {Enum} ▼ | The type of the column to add from |
Enum options: calculatedDataColumn | ||
importedDataAsColumns
|
ImportedDataAsColumnDefinition ▼ | Array of columns to import. |
[].urlSource
|
String | The URL of the source containing the columns to be imported. |
[].dataTableTarget
|
String | The name of the data table in which new columns will be imported. |
[].targetIdColumn
|
String | The name of the column in the target data table to use for the matching. |
[].sourceIdColumn
|
String | The name of the column in the source data table to use for the matching. |
[].otherColumnsMatching
|
Array.<ColumnMatching> ▼ | Array of the description of other column matches. |
[].targetColumn
|
String | The name of the column in the target data table to use for the matching. |
[].sourceColumn
|
String | The name of the column in the source data table to use for the matching. |
[].replaceCommonColumns
|
Boolean | Specifies whether the columns in the target data table should be replaced by the imported columns if they are common. Otherwise, the name of imported columns will be indexed. |
[].columnsToReplace
|
Array.<String> | Columns to be replaced by the imported data. |
importedDataAsRows
|
ImportedDataAsRowDefinition ▼ | Array of rows to import. |
[].urlSource
|
String | The URL of the source containing the columns to be imported. |
[].dataTableTarget
|
String | The name of the data table in which new rows will be imported. |
[].ignoredColumn
|
Array.<String> | The list of columns to be ignored during importation. |
[].rowSourceColumn
|
String | The column that identifies the origin of the row. |
[].rowSourceValue
|
String | The value that identifies the source of the row from the imported source. |
[].originalRowSourceValue
|
String | The value that identifies the source of the row from the target data table. |
[].mappings
|
Array.<ColumnMatching> ▼ | The list of columns to map between imported rows to existing rows. If not set, all common columns are merged. If set, common columns will be created with an indexed name. |
[].targetColumn
|
String | The name of the column in the target data table to use for the matching. |
[].sourceColumn
|
String | The name of the column in the source data table to use for the matching. |
properties
|
DataTablePropertyDefinition ▼ | Array of data table properties. |
[].name
|
String | |
[].value
|
string | boolean | number |
addDataTableColumns(dataTableName, addedColumnsDefinitions)
Adds columns to a data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
addedColumnsDefinitions
|
AddedColumnsDefinition ▼ | The definition of columns to be added. |
[].name
|
String | The name of the column to add. |
[].type
|
SpotfireDataColumnsTypes {Enum} ▼ | The type of the column to add from |
Enum options: calculatedDataColumn |
addDataTableProperty(dataTableName, dataTablePropertyName, dataTablePropertyValue)
Adds/updates a property in the specified data table.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table to be updated. |
dataTablePropertyName
|
String | The name of the data table property to be added/updated. |
dataTablePropertyValue
|
String | Boolean | Number | The value of the data table property to be added/updated. |
addDataTableRelations(dataTableRelations)
Adds a relation between two columns from two different data tables.
Parameters:
Name | Type | Description |
---|---|---|
dataTableRelations
|
Array.<SpotfireColumnRelation> | Array of column relation descriptions. |
Example
spotfireDocument.editor
.addDataTableRelations([
{
leftColumn: {
tableName: 'firstDataTable',
name: 'a column of firstDataTable',
transformation: 'Integer(Value)'
},
rightColumn: {
tableName: 'secondDataTable',
name: 'a column of secondDataTable',
transformation: 'Integer(Value)'
}
}
])
.applyState();
addFiltering(filteringName)
Add a filtering scheme in the current state to be applied
Parameters:
Name | Type | Description |
---|---|---|
filteringName
|
string | the name of the current filtering scheme to be added |
addFilterings(arrayOfFilteringNames)
Add one or many filtering scheme in the current state to be applied in the current SpotfireDocument
Parameters:
Name | Type | Description |
---|---|---|
arrayOfFilteringNames
|
Array.<string> | the array of filtering schemes to be added |
addMarking(markingDescription)
Add a MarkingDefinition
in the current state to be applied to the current Spotfire document
Parameters:
Name | Type | Description |
---|---|---|
markingDescription
|
MarkingDescription ▼ | description of the marking to be created/modified |
name
|
String | name of the marking |
color
|
MarkingColor ▼ | the color of the marking |
a
|
number | the alpha component of the color. Must be between 0 and 255 |
r
|
number | the red component of the color. Must be between 0 and 255 |
g
|
number | the green component of the color. Must be between 0 and 255 |
b
|
number | the blue component of the color. Must be between 0 and 255 |
addMarkings(arrayOfMarkingDescription)
Add one or many markings to the current state to be applied
Parameters:
Name | Type | Description |
---|---|---|
arrayOfMarkingDescription
|
MarkingDescription ▼ | array of marking description |
[].name
|
String | name of the marking |
[].color
|
MarkingColor ▼ | the color of the marking |
a
|
number | the alpha component of the color. Must be between 0 and 255 |
r
|
number | the red component of the color. Must be between 0 and 255 |
g
|
number | the green component of the color. Must be between 0 and 255 |
b
|
number | the blue component of the color. Must be between 0 and 255 |
addPage(pageDescription)
Add a page to the current state to be applied to the current Spotfire document
Parameters:
Name | Type | Description |
---|---|---|
pageDescription
|
PageDescription ▼ | the title or the complete description of the page to be added |
title
|
String | the title of the page |
tileMode
|
String | the tile Mode that defines the layout of the page (Vertically|Horizontally) |
showWebPanel
|
Boolean |
addRowsFromUrl(importedDataAsRowsDescription)
Add data from url as rows in a data table.
Parameters:
Name | Type | Description |
---|---|---|
importedDataAsRowsDescription
|
ImportedDataAsRowDefinition ▼ | |
urlSource
|
String | The URL of the source containing the columns to be imported. |
dataTableTarget
|
String | The name of the data table in which new rows will be imported. |
ignoredColumn
|
Array.<String> | The list of columns to be ignored during importation. |
rowSourceColumn
|
String | The column that identifies the origin of the row. |
rowSourceValue
|
String | The value that identifies the source of the row from the imported source. |
originalRowSourceValue
|
String | The value that identifies the source of the row from the target data table. |
mappings
|
Array.<ColumnMatching> ▼ | The list of columns to map between imported rows to existing rows. If not set, all common columns are merged. If set, common columns will be created with an indexed name. |
[].targetColumn
|
String | The name of the column in the target data table to use for the matching. |
[].sourceColumn
|
String | The name of the column in the source data table to use for the matching. |
addTable(tableDescription)
Add a SpotfireTable
to the current state to be applied on the current Spotfire document
Parameters:
Name | Type | Description |
---|---|---|
tableDescription
|
Object | the tablePlot properties (see |
defaultDataTableDescription() → {DataTableDescription}
Returns a data table description with default values.
The default description of a data table.
getColumnMatchingRelation(leftColumn, rightColumn)
Get the SpotfireColumnRelation
from the columnMatchings collection having
the same name for left and right column than the arg specified
Parameters:
Name | Type | Description |
---|---|---|
leftColumn
|
ColumnDescription ▼ | the left column description for the column relation searched |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
rightColumn
|
ColumnDescription ▼ | the right column description for the column relation searched |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
getColumnRelation(leftColumn, rightColumn, columnRelationCollection) → {Object|null}
Get the corresponding column relation from the specified SpotfireColumnRelation
collections having
the same name for left and right column than the arg specified
Parameters:
Name | Type | Description |
---|---|---|
leftColumn
|
ColumnDescription ▼ | the left column description for the column relation searched |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
rightColumn
|
ColumnDescription ▼ | the right column description for the column relation searched |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
columnRelationCollection
|
Array.<Object> | the SpotfireColumnRelation collection you are searching in |
getDataTable(dataTableName) → {Object|null}
Returns the data table with the given name if it exists.
Parameters:
Name | Type | Description |
---|---|---|
dataTableName
|
String | The name of the data table. |
getDataTableRelation(leftColumn, rightColumn)
Get the SpotfireColumnRelation
from the dataTableRelations collection having
the same name for left and right column than the arg specified
Parameters:
Name | Type | Description |
---|---|---|
leftColumn
|
ColumnDescription ▼ | the left column description for the column relation searched |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
rightColumn
|
ColumnDescription ▼ | the right column description for the column relation searched |
name
|
String | The name of the column. |
tableName
|
String | The name of the data table that owns the column. |
transformation
|
String | The transformation to apply on the column from |
getMarking(markingDescription) → {MarkingDescription|null}
Get the marking in the current state to be applied having the same name than the MarkingDescription
passed as arg
Parameters:
Name | Type | Description |
---|---|---|
markingDescription
|
MarkingDescription ▼ | the marking description we are looking for |
name
|
String | name of the marking |
color
|
MarkingColor ▼ | the color of the marking |
a
|
number | the alpha component of the color. Must be between 0 and 255 |
r
|
number | the red component of the color. Must be between 0 and 255 |
g
|
number | the green component of the color. Must be between 0 and 255 |
b
|
number | the blue component of the color. Must be between 0 and 255 |
getPage(pageDescription) → {SpotfirePage|undefined}
Get the SpotfirePage
having the same title than the pageDescription arg from the current state to be applied to the current SpotfireDocument
Parameters:
Name | Type | Description |
---|---|---|
pageDescription
|
PageDescription ▼ | the title or page description searched |
title
|
String | the title of the page |
tileMode
|
String | the tile Mode that defines the layout of the page (Vertically|Horizontally) |
showWebPanel
|
Boolean |
getPageByVisualDescription(visualDescription)
Get the SpotfirePage
for the corresponding visualDescription (see SpotfireVisualization
arg}
Parameters:
Name | Type | Description |
---|---|---|
visualDescription
|
Object | the visual description with a pageTitle property |
loadDataTableFromUrl(dataTableName, url, [addedColumnsDefinitions])
Loads a data table from a URL.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
dataTableName
|
String | The name of the data table. |
|
url
|
String | The URL of the source containing the data table. |
|
addedColumnsDefinitions
|
AddedColumnsDefinition ▼ |
<optional> |
Array of the column definitions. |
[].name
|
String | The name of the column to add. |
|
[].type
|
SpotfireDataColumnsTypes {Enum} ▼ | The type of the column to add from |
|
Enum options: calculatedDataColumn |
Example
spotfireDocument.editor.loadDataTableFromUrl('dummyTable', 'http://dummySource/url', [
{
type: SpotfireDataColumnsTypes.calculatedDataColumn,
name: 'MyCalculatedColumn1',
expression: 'SUM([Col1])'
},
{
type: SpotfireDataColumnsTypes.calculatedDataColumn,
name: 'MyCalculatedColumn2',
expression: 'AVG([Col2])'
}
]).applyStateAsync(true)