Jump to content

How to add vertical line progrimmatically


Nourah Almulla

Recommended Posts

I'm trying to add a vertical line to a line chart progrimmatically, the line chart's x-aixs is continous and I'm able to add the line manually.

My x-axis has the expression BinByDateTime([Date],"Year.Month.DayOfMonth.Hour.Minute",4). Values on my x-axis appear to be in the format "Date hour" for example "8/16/2020 10". I'm using the following ironpython code to populate vertical lines through a button:

visual = myViz.As[LineChart]()

visual.FittingModels.Clear()

 

d = '8/16/2020 10'

verticalLine1 = visual.FittingModels.AddVerticalLine(d)

verticalLine1.Line.Color = Color.Red

verticalLine1.Line.LineStyle = LineStyle.DashHowever, the above is giving an error

Traceback (most recent call last):

File "", line 16, in

Exception: The expression is not valid after '8' on line 1 character 11.

Could you please help me in figuring out the issue here

Link to comment
Share on other sites

Hi Nora,

 

Did you enter the script parameters You need at least a script parameter for the myViz part, telling Spotfire which visualization it should use to apply the vertical line.

It may well be that you need other script parameters as well, but that is a bit hard to see without a visual of your dashboard.

Kind regards,

David

Link to comment
Share on other sites

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...