Michael Zaragoza Posted January 4, 2019 Share Posted January 4, 2019 I'm totally new to Iron Python scripting. I want to write a script where the x-axis in a bar chart can be flipped from horizontal to vertical depending on it's current orientation. I tried the following code but it appears that the comparison operation I'm attempting isn't valid. Is it just a matter of bad syntax or something deeper from Spotfire.Dxp.Application.Visuals import * myVis = myVis.As[barChart]() if (myVis.XAxis.Scale.LabelOrientation == 0) : myVis.XAxis.Scale.LabelOrientation = 1 else: myVis.XAxis.Scale.LabelOrientation = 0 Thanks! Link to comment Share on other sites More sharing options...
Gaia Paolini Posted January 4, 2019 Share Posted January 4, 2019 Hi this worked for me (check indenting that may have been lost in copying and pasting). LabelOrientation is itself a class and you need to compare its members this way: from Spotfire.Dxp.Application.Visuals import * myVis = myVis.As[barChart]() if (myVis.XAxis.Scale.LabelOrientation == LabelOrientation.Horizontal) : myVis.XAxis.Scale.LabelOrientation = LabelOrientation.Vertical else: myVis.XAxis.Scale.LabelOrientation = LabelOrientation.Horizontal This flips just the label of the x axis, presumably what you wanted Gaia Link to comment Share on other sites More sharing options...
Michael Zaragoza Posted January 4, 2019 Author Share Posted January 4, 2019 Brilliant, Gaila! That makes sense. And yes, the objective was just to flip the x-axis label orientation. My question was poorly worded. 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