Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Checkbox and Radio Buttons for TIBCO Spotfire






Checkbox Property Control
  1. Create Boolean document property "cb"
  2. Create a script that triggers when "cb" document property changes:

      #myVis is the target visualization script parameter
      from Spotfire.Dxp.Application.Visuals import Visualization
      myVis = myVis.As[Visualization]()
      myVis.XAxis.Scale.ShowGridlines = Document.Properties["cb"]
      myVis.YAxis.Scale.ShowGridlines = Document.Properties["cb"]


  3. Create a calculated value with custom expression and script:

    Custom expression:
    if(${cb},"[X]",[ ])

    Script:
    Document.Properties["cb"] = not Document.Properties["cb"]


Radio Button Property Control

  1. Create multiple Boolean document properties. For example:  "op1, op2, op3,..,opN"

  2. Create a script that triggers when each document property changes.
       if Document.Properties["op1"]: myVis.LabelVisibility = LabelVisibility.All
       if Document.Properties["op2"]: myVis.LabelVisibility = LabelVisibility.Marked 
       if Document.Properties["op3"]: myVis.LabelVisibility = LabelVisibility.None

  3. Create a calculated value with custom expression and assign the same script for each option (op1,op2,..,opN)

    Custom expression:
       if(${op1},"[X]",[ ])

    Script:
    #dp is the document property to set to true
      Document.Properties["op1"] = False
      Document.Properties["op2"] = False
      Document.Properties["op3"] = False
      Document.Properties[dp] = True

2 comments:

Akz said...

Jose are you using CSS and HTML to make the controls look better? I have used this in the past, but not with the Action of the Calculated Value control.

https:// www.w3schools.com/ howto/ howto_css_custom_checkbox.asp

This works great for me but mine does not look as nice as yours with the code snippets provided.

Nice work though!

Jose Leviaguirre said...

Thanks Akz

I am not using css or html checkboxes, but unicode characters, but it is a good idea to do so.

Checkout the complete reference here: https://community.tibco.com/s/article/IronPython-Checkbox-Property-Control-for-TIBCO-Spotfire