简体   繁体   中英

Spotfire Java Script to split a field into unique values and Update MapChart Visualization every 30seconds reflecting change in value

I am having the same problem as per the thread ( Spotfire IronPython Script to Scroll through a Filter and Update a Visualization Each Step (Play Button through Date Ranges) ) but in the form of a listbox filtering in spotfire using IP. I have a action control button named as "Magic". What I wanted to do was when this button is hit, the code will first figure out the number of unique values in a data field and populate these values into a listbox. From there, I then extract out the fields to display in a map chart visualization. The visualization is supposed to change in appearance after a certain specified time interval but as mentioned before, this does not work in IP. I have attached my code below. Is there a chance someone can guide me through how to implement this in HTML and JS? I have very little experience in them. Thank you very much in advanced!

#!/usr/bin/python
import time

import Spotfire.Dxp.Application.Filters as filters
import Spotfire.Dxp.Application.Filters.ListBoxFilter
from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers
from Spotfire.Dxp.Data import *
from Spotfire.Dxp.Application.Filters import *

finalStr = ""

found, nodes = myTable.Columns["FSY_CODE"].Hierarchy.Levels.LeafLevel.TryGetNodes(int.MaxValue)
for node in nodes:
    finalStr = finalStr + ',' + node.Value.ValidValue + ''
finalStr = finalStr.strip(',')

print(finalStr)

myPanel=Application.Document.ActivePageReference.FilterPanel
myFilter=myPanel.TableGroups[1].GetFilter("FSY_CODE")
myFilter.FilterReference.As[ListBoxFilter]().Reset()
myFilter.FilterReference.As[ListBoxFilter]().IncludeAllValues = False

def p1():
    myFilter.FilterReference.As[ListBoxFilter]().SetSelection("E")
    print("Proc 1")

def p2():
    myFilter.FilterReference.As[ListBoxFilter]().SetSelection("H")
    print("Proc 2")

def p3():
    myFilter.FilterReference.As[ListBoxFilter]().SetSelection("P")
    print("Proc 3")

p1()
time.slp(5)
p2()
time.slp(5)
p3()


#if myTable.IsRefreshable and myTable.NeedsRefresh:
#   myTable.Refresh()

#myFilter.FilterReference.As[ListBoxFilter]().SetSelection(finalStr.split(','))

if you haven't already, please read my original answer which @kaorie mentions. definitely look into the example DXP I provided, as I tried to be very detailed in my explanation. if you still have questions about it, bump this thread.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM