Thibault BAUDARD Posted February 10, 2015 Share Posted February 10, 2015 Hi, I'm currently creating a chart via some python scripting, and I'd like to add a Show/Hide Item rule to it, still in the script. I've been trying to play around with FilterRule, FilterRuleCollection, TryToGetFilterRule, but I can't figure out how to have it working... Here is a part of my code to create a chart (a crosstable in this case): #Gets the visualization for visual in Document.ActivePageReference.Visuals : if visual.TypeId not in (VisualTypeIdentifiers.HtmlTextArea,VisualTypeIdentifiers.TextArea) : vis = visual [...] if visTypeStandard == "Cross Table" : #set to Cross Table vis.TypeId = VisualTypeIdentifiers.CrossTable #Cast to cross table plot vis = vis.As[CrossTablePlot]() #Set rows by critere1 vis.ColumnAxis.Expression = xpression #Set the MeasureAxis expression if Headcount == " " : vis.MeasureAxis.Expression = ypressionconsolideeSimple elif Headcount == "Pondr" : vis.MeasureAxis.Expression = ypressionpondereeSimple #Hide Legend vis.Legend.Visible = False #Totals and Subtotals vis.ColumnSubtotalsLayout = 0 vis.ColumnSubtotals.ShowAll() vis.ShowColumnGrandTotal = True #Change the RowHeader size for index in range(vis.RowHeaderWidths.Count) : vis.RowHeaderWidths.Item[index]=150 #resize cells vis.CellWidth=85 #Change the value of the VisTypeStandard property Document.Properties["VisTypeStandard"] = "Cross Table" There is no problem doing what I need via the UI, but can't get it to work. Do somebody know how to do that with the API Link to comment Share on other sites More sharing options...
Sayali Patil Posted October 23, 2015 Share Posted October 23, 2015 Here is one example for vis in Document.ActivePageReference.Visuals: if vis.Title == 'Examples': tablePlot = vis.As[TablePlot]() for item in tablePlot.TryGetFilterRules(): if item != True: item.AddTopNRule("[c1]", 5, False) Link to comment Share on other sites More sharing options...
gurusai sankar Posted May 8, 2019 Share Posted May 8, 2019 HI Sayali,Could you please help on below spotfire queryhttps://community.spotfire.com/questions/how-get-grand-total-value-all-rows-or-else-how-fix-empty-values-all-rows-except-grand Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now