2

我找到了如何从表格可视化中添加/删除列的信息。 http://www.bearonspotfire.com/dynamic-tables-using-scripts-in-spotfire

from Spotfire.Dxp.Application.Visuals import VisualContent
## we need to import this as it is an enum and we want to refer to it
from Spotfire.Dxp.Application.Visuals import TablePlotColumnSortMode

## get the table visualisation
table = tableVisualisation.As[VisualContent]()

## check what option user selected and remove column (if present) of other column(s)
if selectedOrder == usagesName and table.TableColumns.Contains(dataTable.Columns[lastAccessedName]):
    table.TableColumns.Remove(dataTable.Columns[lastAccessedName])
elif selectedOrder == lastAccessedName and table.TableColumns.Contains(dataTable.Columns[usagesName]):
    table.TableColumns.Remove(dataTable.Columns[usagesName])

## add in new column assuming it isn't there already
if not table.TableColumns.Contains(dataTable.Columns[selectedOrder]):
    table.TableColumns.Add(dataTable.Columns[selectedOrder])

## set the sorting for the table
table.SortInfos.Clear();
table.SortInfos.Add(dataTable.Columns[selectedOrder], TablePlotColumnSortMode.Descending)

## changing the table resets the column size so lets fix it
addedColumn = table.TableColumns.TryGetTableColumn(dataTable.Columns[selectedOrder])[1]
addedColumn.Width = 120

我需要为交叉表可视化做同样的事情。

4

1 回答 1

1

我注意到可以修改 ColumnAxis 的表达式属性,这会导致列集的修改,因此它允许添加/删除列,但它不像表格可视化那样整洁。– Jacek Sierajewski 2014 年 9 月 25 日 20:52

crossTable.ColumnAxis.Expression = "" 这段代码正在修改 Column Axis 的内容以仅包含 Clothing 列。– Jacek Sierajewski 2014 年 9 月 26 日在 7:24

另一个表达式示例是 <[服装] NEST [杂货] NEST [玩具] NEST [购买的物品数量]>。我现在可以通过将属性值发送到输入文本值来获取工具创建的表达式。– Jacek Sierajewski 2014 年 9 月 26 日在 11:21

于 2017-02-15T10:47:35.967 回答