Search code examples
spotfire

SpotFire: Set plot's marking programmatically


I am trying to access the data>marking field of a spotfire plot programmatically.

I am trying to write a script that, when launched, sets the markings for this plot to the values shown in the image below.

I m fine with using scripts, IP and button; I just couldn't find any example of scripts on the internet that access these parameters so I am looking for a short nudge to get me started.

enter image description here


Solution

  • you could use the script below. It accepts a parameter named 'vis' which is the visual you're trying to set the marking for. In the example below "Marking2" is the name of the marking scheme.

    from Spotfire.Dxp.Data import DataManager
    from Spotfire.Dxp.Application.Visuals import VisualContent
    myVis= vis.As[VisualContent]()
    myVis.Data.MarkingReference=Application.Document.Data.Markings["Marking2"]