Spotfire IronPython脚本可滚动浏览筛选器并更新每个步骤的可视化效果(日期范围内的播放按钮)

MLH*_*H13 4 ironpython spotfire

大家早上好,

我已经在这个问题上工作了几天,但找不到解决方法。我已经研究过,但没有用谷歌搜索。任何帮助/见解将不胜感激。我正在尝试创建一个按钮,当单击该按钮时,它将自动通过日期过滤器(例如从1/1/15开始),并通过1/2 -1/5,随着新过滤的标记层逐步通过,从而更新地图功能。我已使过滤器逐步通过1 / 1-1 / 5;但是,它不会随着进度的进行而更新地图可视化效果,因此用户看到的只是从1/1到1/5的跳转,中间有一个暂停(每个步骤都有一个睡眠计时器)。我已经包含了下面的代码,我只是在学习IronPython,并且不确定刷新可视化需要调用什么。Visualization.Refresh()不起作用。非常感谢!

import Spotfire.Dxp.Application.Filters as filters
import Spotfire.Dxp.Application.Filters.ItemFilter
import time
from Spotfire.Dxp.Application.Filters import FilterTypeIdentifiers
from Spotfire.Dxp.Data import DataProperty, DataType, DataPropertyAttributes, DataPropertyClass
from Spotfire.Dxp.Application.Visuals import MarkerLayer

myPanel = Document.ActivePageReference.FilterPanel
myFilter= myPanel.TableGroups[2].GetFilter("Date (Daily)")

myFilter.FilterReference.TypeId = FilterTypeIdentifiers.ItemFilter
itemFilter = myFilter.FilterReference.As[filters.ItemFilter]()

whichCol = itemFilter.DataColumnReference
count = 0
while count < 5:

    count = count +1
    if (whichCol.Properties.PropertyExists("CurrentStep") == False):
        myProp = DataProperty.CreateCustomPrototype("CurrentStep",0,DataType.Integer,DataPropertyAttributes.IsVisible|DataPropertyAttributes.IsEditable)
        Document.Data.Properties.AddProperty(DataPropertyClass.Column, myProp)
        whichCol.Properties.SetProperty("CurrentStep",0)
        Document.Properties["DateTest"] = "1/1/15" 
        time.sleep(1)

    else:
        time.sleep(1)
        whichVal = whichCol.Properties.GetProperty("CurrentStep")
        #print whichVal
        #print itemFilter.Values.Count
        if (whichVal == itemFilter.Values.Count):
            whichCol.Properties.SetProperty("CurrentStep",0)
            Document.Properties["DateTest"] = "1/1/15"
        else:
            itemFilter.Value = itemFilter.Values.Item[whichVal]
            whichCol.Properties.SetProperty("CurrentStep",whichVal+1)
            Document.Properties["DateTest"] =  itemFilter.Value
Run Code Online (Sandbox Code Playgroud)

小智 5

据我了解,这不能使用IronPython来完成。尼科回答了我对类似问题的回答: 在Tibco Spotfire中动画化数据更改 “ IronPython引擎会锁定Spotfire,直到执行完成为止。” 因此,我以与尝试制作散点图动画相同的方式来处理您的问题...使用JS而不是IP。由于我无权访问正在使用的数据集,因此我使用了一个随机数据集,其id列的范围是1-100(而不是日期)。我设置了一个数据限制自定义表达式[id] = $ {FilterValue},其中{FilterValue}是一个文档属性,其整数类型设置为默认值1。然后,我使用以下HTML和JS从1迭代该属性。 100 注意:我在SF 7.0中使用“深色”视觉主题进行了此操作。在“浅色”主题或SF 6.X中,您将需要在HTML和JS中为按钮定义不同的颜色。根据要求,我可以将.dxp上传到保管箱并在此处共享。 我希望这有帮助。HTML:

<div id="button1" style="padding: 2px; border: 3px outset grey; border-image: none; text-decoration: none; cursor:pointer;    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;position:relative;
    user-select: none;width:13em;display:block;;"><font color="white" size="2" style="margin:0px 0px 0px 1px">Cycle Filters</font>
</div>


<div id='FilterValue' style='display:none'>
<SpotfireControl id="b986fa43508a484da22f6b42d510061f" />
</div>
Run Code Online (Sandbox Code Playgroud)

JS:

var button=document.getElementById(button1);
var doc=document.getElementById(doc);

t=0;
var CycleFilters = function(){
    if (t<=100)
    {       
        $("#FilterValue input").val(t).blur();
        t+=1;
    }

}




var mouseDown=function()
{
   button.style.background="#202020";
   button.style.border="3px inset grey";
   button.style.padding="4px 0px 0px 4px";
   button.onmouseup=mouseUp;
   button.onmouseout=mouseOut;
   button.onmouseover=mouseOver;

}

function mouseUp() {
    button.style.background="none";
    button.style.border="3px outset grey";
    button.style.padding="2px 2px 2px 2px";
    button.onmouseover=mouseOver2;
    t=0.00;
    setInterval(CycleFilters,1000)
    //document.getElementById('mySpotfireControlx').firstChild.value = 20;
    //$("#mySpotfireControlx input").val(20).blur();
    //document.getElementById('mySpotfireControly').firstChild.value = 10;
    //$("#mySpotfireControly input").val(10).blur();



}
function mouseOut()
{
    button.style.background="none";
    button.style.border="3px outset grey";
    button.style.padding="2px 2px 2px 2px";
}
function mouseOver()
{   
    button.style.background="#202020";
    button.style.border="3px inset grey";
    button.style.padding="4px 0px 0px 4px";
}
function mouseOver2()
{
    button.onmousedown=mouseDown;
}


button.onmouseover=mouseOver2;
button.onmouseout=mouseOut;

document.documentElement.addEventListener('mouseup', function(e)
{
button.onmouseover=mouseOver2;
})
Run Code Online (Sandbox Code Playgroud)