Saturday, November 23, 2019

Run Javascript when Spotfire Tab clicked


  • Create TextArea
  • edit html
  • Write a div whith display : none


<DIV id=hiddenActionControl style="DISPLAY: none"><SpotfireControl id="f09f0891f34e4d659d52deae1a41d488" /></DIV>


  • Inside the div create a button (link) and create some ironpython script to execute upon



  • Write a JS as below. This is basically controlling document property written in iron python script for link click.


$('#hiddenActionControl a').click()


  • So basically when tab clicked the link anchor button clicked via javascript code.



  • If you don't want the ironpython script, it's not compulsory.I write below code to change textarea colour on tab click.


var randomColorChange = '#'+(Math.random()*0xFFFFFF<<0).toString(16);
$('#changeMyColor').css('background-color', randomColorChange);


Spotfire Automation Job


  • Go to Tools>> Automation Job Builder
  • Keep adding the steps you needed. These will be steps or tasks
  • Once done save it as xml

  • Try running/testing by executing locally and on server

  • The files Spotfire.Dxp.Automation.ClientJobSender.exe and Spotfire.Dxp.Automation.ClientJobSender.exe.config are located in the same directory.
  • Change username and pwd in Spotfire.Dxp.Automation.ClientJobSender.exe.config so that exe should be use correct spotfire username and pwd 

  • Go to Windows schedule task on spotfire server and Create new task to schedule a job to be executed with the Spotfire Automation Services Client Job Sender, use Windows Task Scheduler
  • In Windows Task Scheduler, create a new task that executes the Client Job Sender, provide arguments to it as described in Configuring the Client Job Sender, and set it to run periodically as needed.
  • programme/script   G:\Spotfire\Automation_Services\Spotfire.Dxp.Automation.ClientJobSender.exe
  • Argument : "http://localhost" "G:\Spotfire\Automation_Services\automation.xml"
  • The status of running jobs and the jobs history is available in Spotfire Server, on the Automation
  • Services tab of the Monitoring & Diagnostics area. For more information, see the Spotfire Server help.

Spotfire Automation Job Not executing on Server

In version 7.5 and later, the "automationservices@SPOTFIRESYSTEM" account is responsible for executing jobs on the service instance. 
To resolve permission issue issue, follow the steps below.

- Login to Spotfire Analyst as a Spotfire administrator.

- Click on the TOOLS menu.

- Click on "Library Administration".

- Highlight the folder which contains the report that is failing.

- Click EDIT in the "Permissions for Selected Folder".

- Search the user "automationservices@SPOTFIRESYSTEM".

- Grant Browse+ Access + Modify permissions.

Friday, November 22, 2019

Spotfire Data On Demand

When all data is not required and user can wait to fetch on the fly based on some trigger., data on demand can be utilized.

It's the way for data loading for a data table

We need to set trigger due to which data will be reloaded.

Following actors can be trigger for load data

  • Property
  • Unique column values in another table
  • Marking filtering

Spotfire Over Function

You can use Over function in spotfire
Over means grouping in spotfire
You can use in
1) Calculated columns

  • Sum(Amount) : It give total sum in datatable
  • Sum(Amount) over region: It gives sum for each region so basically group by region        

2) In graph custom expression
        In graph if sum(amount) in in Y axis and in x axis is region then chart automatically gives group by for each x axis values(here region)
So over function gives best results with when x axis is having date field with hierarchy for year>>month etc.

  • Avg(Amount) Over All([Axis.X]) : It gives Total average for all nodes of x axis. So basically it draws a single avg line

  • Avg(Amount) Over Parent([Axis.X]) : It gives avg line for parent node of x axis. Say x asis is year>> month then this will be avg line for Year.

  • Avg(Amount) over AllPrevious(Axix.X) :  It gives cumulative sum

  • Avg(Amount)  over Lastperiods(3,Axis.X) : Moving average for last 3 month
  • Sum(Amount) - Sum(Amount) over previous([Axis.X] : Seeing how the current amount is doing over last month.


Spotfire BIN Column



Integer Column
  • Specific limits separated  by  ;
  • Equal Intervals
  • Even distribution of unique values : Set Number of bin
  • Standard deviation
  • Sub
  • Even distribution of unique values : Set Number of bin
  • string
String Column
  • Substring
  • Values
  • Even distribution of unique values : Set Number of bin

Tuesday, December 27, 2016

How to enable geocoding map tables in spotfire (version 6.5)

Locate Folder for Import/Export library item in spotfire:

C:\tibco\tss\6.5.0\tomcat\application-data\library

create geoanalytics folder

Paste "geoanalytics.part0.zip" into this folder. (you can get this from spotfire server installation folder \\TIB_sfire_server_6.5.0_win)

Follow below steps:

To import the geocoding tables into the Library, do the following.

1). Start Spotfire and log in as a Spotfire Admin.

2). Select Tools > Library Administration.

3). Navigate to the Library folder where you want to import the demo files. For instance, you can create a folder called GeoAnalytics.

4). Select Import.

5). Click Browse and select the file geoanalytics.part0.zip.

6). Click OK.

7). Click OK.

Click Close when the dialog states Import Done.

Friday, November 4, 2016

How to create custom color scheme in spotfire

How to create custom color scheme in spotfire


How to change a chart color scheme to not revert back to spotfire's standard categorical color scheme

The solution is to define a custom color scheme and set that as the default categorical/continuous color scheme for the particular columns you will be setting via property control.

The only catch is that this will only work if the columns are all continuous or all categorical. Mixing them will not work.

  1. For each column you will be coloring by (all in the drop-down), save your colors as a 'Document Color Scheme
      a. Select column from the property control drop-down (for example 'MyFirstColumn').
      b. Change the "Color By" colors as desired (either via Legend or via visualization > Properties > Colors).
      c. Right click on your visualization > Properties > Colors > Click the 'Color Schemes' button (To the right of the 'One scale per' drop-down) > Save as > Document Color Scheme...
      d. Use a name like 'MyFirstColumn_Color'.
  2. Define this color scheme as the default for this column
      a. Go to Edit > Column Properties > Select the Data Column in question (for example 'MyFirstColumn').
      b. Go to the Properties tab > Edit the 'DefaultCategoricalColorScheme' or 'DefaultContinuousColorScheme' Property for that column (depending on whether your column is categorical or continuous).
      c. Add in the value that matches the Document Color Scheme you saved earlier (for example, 'MyFirstColumn_Color').
      d. Click OK (twice) to save all changes.

Thursday, November 3, 2016

Single select list filter without none and All in spotfire

1) Create TextArea
2) Right click and "Edit TextArea"
3) Create single select list property as below as named "singleselctList"
4) Go to chart. Right click. click on properties. Go to "Data" Section. Go to Limit Data using expressions and add below.

[category] = DocumentProperty("singleselectList")

where category is a column to be filtered and singleselectList is name of list as in step 3


How to make multi-select list and use as filter in spotfire

1) Create textarea
2) Create Multiple select list as below with name vList 
3) Right click in properties for chart. Go to data properties. Go in Limit data Using expression.

([category]=$map("'${vList}'", " OR [category]=")

where category is column to be filtered. vList is name of Multiple-Select List property in step 2




Gauges in Spotfire

1) Add TextArea
2) Edit HTML
3) Add property (calculated column)

For example.
<SpotfireControl id="0e9f0a8148354db49fe6b71ad3545ccd" />

3) Add below code snippet

<style> 
.regionSettings{
float:left;
width:200px;
margin:10px;
padding: 5px;
border:2px solid gray;
background:whitesmoke;
}
</style>
<div  id="gauge" style="width: 200px; height: 120px;"></div>
<span id="calcValue">
<SpotfireControl id="0e9f0a8148354db49fe6b71ad3545ccd" />
</span>


4) Add js as below


//define your javascript libraries
resource=[
 "//cdn.jsdelivr.net/raphael/2.1.0/raphael-min.js",
 "//cdn.jsdelivr.net/justgage/1.0.1/justgage.min.js"
]

//add scripts to head
$.getScript(resource[0],function(){
 $.getScript(resource[1],init)
})

//start your widget
init=function(){
  var g = new JustGage({
    id: "gauge", 
    value:  parseInt($("#0e9f0a8148354db49fe6b71ad3545ccd").text()), 
    min: 0,
    max: 5646,
    title: "Visitors"
  });
  
  //refresh gauge when calcvalue changes
  $(calcValue).on('DOMSubtreeModified',function(){
    g.refresh($(this).text())
  })
}


Thursday, October 27, 2016

Spotfire Shortcut keys

Ctrl+A               
 Mark filtered rows
 Ctrl+C               
 Copy the marked records to the clipboard as text
 Ctrl+D                
 Create Duplicate Active page
 Ctrl+E                
 Unmark the set of marked records
 Ctrl+F                
 Find the entered text in the entire file
 Ctrl+I                 
 Inverts the set of marked records
 Ctrl+N               
 New Page
 Ctrl+O               
 Open an existing file or a file to import
 Ctrl+P                
 Launch the Print Layout Options tool
 Ctrl+R              
 Reset all filters
 Ctrl+S              
 Save the current analysis file
 Ctrl+T               
 Create a new text area
 Ctrl+U              
 Duplicate visualization
 Ctrl+V              
 Paste the clipboard contents into Spotfire
 Ctrl+W             
 Close the current analysis file
 Ctrl+Y              
 Redo
 Ctrl+Z               
 Undo
 Ctrl+1              
  New table 
 Ctrl+2              
  New cross table
 Ctrl+3              
  New bar chart
 Ctrl+4              
  New line chart
 Ctrl+5              
  New combination chart 
 Ctrl+6              
  New pie chart
 Ctrl+7              
  New scatter plot
 Ctrl+8              
  New 3D scatter plot
 Ctrl+9              
  New map chart
 Ctrl+0              
  New graphical table
 Ctrl+Shift+1    
  New tree map
 Ctrl+Shift+2    
  New heat map
 Ctrl+Shift+3    
  New parallel Coordinate plot
 Ctrl+Shift+4    
  New summary table
 Ctrl+Shift+5    
  New box plot
 Ctrl+F4            
 Close the active visualization
 Delete             
 Delete Marked rows
 Alt+F4              
 Exit Tool
 F1                     
 Open online help

Wednesday, October 26, 2016

Spotfire HTML formatting (Horizontal) for filters in textarea

<table>
<tbody>
<tr>
    <td valign="top"><p align="left">(Write heading 1 here)</p></td>
    <td valign="top"><p align="left">(Write heading 2 here)</p></td>
</tr>
<tr>
    <td> (Add filter control 1 here)</td>
   <td> (Add filter control 2 here)</td>
</tr> 
</tbody>
</table>

Few suggestions:
Repeat section in  <td></td> (orange marked) for more filters
Change valign = middle / bottom as required.
Write <table bgcolor=”red”> to give red color to canvas


More advance is there and you can build very nice webpage  with css and jquey.

Spotfire HTML formatting (Vertical) for filters in textarea



<table>
<tbody>
<tr>
<td valign="top"><p align="left">(Write heading 1 here)</p></td>
<td> (Add filter control 1 here)</td>
</tr>
</tbody>

</table>

Few suggestions:
Repeat Yellow marked part for more filters
Change valign = middle / bottom as required.
Write <table bgcolor=”red”> to give red color to canvas

Toggle the filter panel show\hide

if (Document.ActivePageReference.FilterPanel.Visible == False):
   Document.ActivePageReference.FilterPanel.Visible = True
else:
   Document.ActivePageReference.FilterPanel.Visible = False

Toggle the details-on-demand panel on\off

if (Document.ActivePageReference.DetailsOnDemandPanel.Visible == False):
   Document.ActivePageReference.DetailsOnDemandPanel.Visible = True
else:
   Document.ActivePageReference.DetailsOnDemandPanel.Visible = False

Reset Filters in spotfire using IronPython

# Reset Filters in spotfire using IronPython
for scheme in Document.FilteringSchemes:
     scheme.ResetAllFilters()

Reset All Marking in spotfire using ironpython

# Import required libraries
from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Application.Filters import *

# Loop through each data table
for dataTable in Document.Data.Tables:
 for marking in Document.Data.Markings:
  rows = RowSelection(IndexSet(dataTable.RowCount, False))
  marking.SetSelection(rows, dataTable)

Change default value for Listbox in spotifre

Document.Properties['test'] = 'papa'