#viz is a Cross Table visualization script parameter
from Spotfire.Dxp.Application.Visuals import CrossTablePlot, CategoryKey
from Spotfire.Dxp.Data import SortOrder
crossTable = viz.As[CrossTablePlot]()
#Change the second RowHeader
crossTable.RowHeaderWidths[1]=150
#Resize cells
crossTable.CellWidth=100
#sort
#Change sorting
categoryKey = CategoryKey("cellValueColumnToSort")
crossTable.SortRowsCategory = categoryKey
crossTable.SortColumnsOrder = SortOrder.Descending
crossTable.SortRowsOrder = SortOrder.Descending
#Reset sorting
crossTable.SortRowsCategory = None
See CrossTablePlot Members
#sort
#Change sorting
categoryKey = CategoryKey("cellValueColumnToSort")
crossTable.SortRowsCategory = categoryKey
crossTable.SortColumnsOrder = SortOrder.Descending
crossTable.SortRowsOrder = SortOrder.Descending
#Reset sorting
crossTable.SortRowsCategory = None
1 comment:
Hi,
I have applied the same script below where i need to sort column "RefrenceDate_Month" but it is not getting sorted
#Script to change row header, cell widths and row sorting
#viz is a Cross Table visualization script parameter
from Spotfire.Dxp.Application.Visuals import CrossTablePlot, CategoryKey
from Spotfire.Dxp.Data import SortOrder
#Get a reference of the cross table from viz param
crossTable = viz.As[CrossTablePlot]()
#Change the second RowHeader
crossTable.RowHeaderWidths[1]=150
#Resize cells
crossTable.CellWidth=100
#Change sorting
categoryKey = CategoryKey("RefrenceDate_Month")
crossTable.SortRowsCategory = categoryKey
crossTable.SortColumnsOrder = SortOrder.Descending
Post a Comment