Jump to content

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.


Thibault BAUDARD

Recommended Posts

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

  • 8 months later...
  • 3 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...