2015-04-01 85 views
1

我正在嘗試使用腳本「格式化」彙總表。 TrellisVisualization不適用於SummaryTable類。使用GUI,我可以通過將特定列分配給Columns Properties下的Categorization屬性來格式化彙總表。但是,在使用IronPython腳本時,我沒有看到SummaryTable對象的任何名爲Categorization的屬性。所以,我想分配列則CategoryAxis如下:在Spotfire中,如何使用IronPython腳本格式化SummaryTable

mySummaryTable.CategoryAxis = "<[myColumn]>" 

但是,這將引發一個錯誤:

AttributeError: 'SummaryTable' object has no attribute 'CategoryAxis' 

我使用Axis或CategoricalAxisBase等,性能也嘗試過,但這些選項都沒有鍛鍊。如果有人對此有更多想法,請告訴我。謝謝。 RD

回答

1

這裏的關鍵問題是Summary Table類下面的CategoryAxis屬性是GroupByAxis類的此視覺對象的GET。您可以使用打印命令和獲取信息的有關對象的看到這一點:

print mySummaryTable.CategoryAxis 

結果在我的Spotfire例如:
<Spotfire.Dxp.Application.Visuals.GroupByAxis object at 0x000000000000002C [Spotfire.Dxp.Application.Visuals.GroupByAxis]>

你實際上是相當接近,但。爲了設置爲CategoryAxis需要設置爲CategoryAxis的Expression屬性,像這樣:

from Spotfire.Dxp.Application.Visuals import SummaryTable 

mySummaryTable = myVisual.As[SummaryTable]() 
mySummaryTable.CategoryAxis.Expression = "<[COLUMN]>" 

如果你需要一個實際的列名進入該,而不是硬編碼的,我將串聯表達式語法和設置等於該變量的表達式:

myColumnExp = "<[" + myColumnName + "]>" 
mySummaryTable.CategoryAxis.Expression = myColumnExp 

請讓我知道你是否需要任何清晰的說明。我的Spotfire版本爲這個答案是v6.5.2.26和我的API信息從https://docs.tibco.com/pub/doc_remote/spotfire/6.5.0/api/Index.aspx

相關問題