When using multiple date columns (switched using property control) on a particular axis, we lose the ability to change the time dimension of the date selected. In order to overcome this issue, we can add a Time Hierarchy property control (a slider) and use it to alter the date column’s time hierarchy.
We start off by building a property control for changing date column. An important note here is to provide the Value as exact literals of the column name which you want to use against a Display Name.
Then we create a TimeHierarchy slider control to navigate across three dimensions – Year, Quarter and Month.
And apply the below custom expression on the date column.
This customization allows us to change the Time Hierarchy for Date columns. Below is a view of quarterly Sales (by Order Date)
And a monthly Sales view (using Dispatch Date)
To perform K-Means clustering in Spotfire, we need an appropriate line chart on which the clustering calculation could be performed.
Below we are using a simple line chart with Sales on Y-axis (a single column and not a custom expression with multiple columns) and Order Date on X-axis.
The Euclidean distance is used to perform the clustering with maximum number of clusters to be 9.
Here is a segmented view of similar product sub-categories which fall in clusters depending on their sales performance.
References (apart from those included as part of plot titles):
Reference snippet to pass a radio button value into Spotfire context, that is into a Document Property.
<FORM><B>Select date for filtering:</B>
value=”N” CHECKED type=radio name=pack1>
value=”Y” type=radio name=pack1>Date 2
Advanced data visualization tools such as Tableau and Spotfire bundle capabilities such as Table calculations and Custom expressions respectively and make new dimensions of viewing data possible. Further, interactivity and customization which could be brought into dashboards with the use of parameters (in Tableau) and property controls (in Spotfire) set apart these visual analytic products from conventional BI query and analysis tools.
However, apart from out-of-the-box functionality, more could be achieved using these tools with some minor tweaks. One such example is to use phpGrid in a webpage (as part of the Tableau dashboard) as a user interface to show dynamic views depending on the data entered on the grid.
Below is a simple gantt chart which has parameters to filter data. Interactivity is limited to filtering data depending on the filters which only work on the data from the source file.
However, there are a couple of ways we could update the data into a database with these parameters. First is to use a phpgrid to interact with the database using the refresh button action. And another method is to use the GET method (to pass parameters as part of the URL) using the dashboard webpage.
By Ryan Robitaille
By Russell Christopher
Reference snippet for fetching the values from a particular column after filtering is applied to the data table.
import Spotfire.Dxp.Data.DataTable from Spotfire.Dxp.Data import * from Spotfire.Dxp.Data import DataValueCursor dataTable = Document.ActiveDataTableReference rows = Document.ActiveFilteringSelectionReference.GetSelection(dataTable).AsIndexSet() for row in rows: for column in dataTable.Columns: if (column.Name == "colName"): print (column.RowValues.GetFormattedValue(row))