每个人早上,
我已经在这个问题上工作了几天,我无法找到解决办法。我研究过并用谷歌搜索无济于事。任何帮助/见解将不胜感激。我正在尝试创建一个按钮,单击该按钮将自动通过日期过滤器(从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
答案 0 :(得分:4)
根据我的理解,使用IronPython无法做到这一点。引用niko从他对我所遇到的类似问题的回答中引用:Animating Data Changes in Tibco Spotfire &#34; IronPython引擎锁定Spotfire直到执行完成。&#34; 所以我以同样的方式处理你的问题,我接近我试图使用JS而不是IP来动画散点图。由于我无法访问您正在使用的数据集,因此我使用了一个随机数据集,其id列从1-100而不是日期。我设置了一个数据限制自定义表达式[id] = $ {FilterValue},其中{FilterValue}是一个文档属性,其类型为整数设置为默认值1.然后我使用以下HTML和JS从1-迭代属性100。注意:我在SF 7.0中使用&#34; dark&#34;视觉主题。在&#34;灯&#34;主题,或者在SF 6.X中,您需要在HTML和JS中为按钮定义不同的颜色。根据要求,我可以将.dxp上传到Dropbox并在此处分享。我希望这有帮助。 的 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>
<强> 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;
})
答案 1 :(得分:1)
您可以查看有关如何为Spotfire可视化设置动画的详细信息here
HTML
<div id='spotfireButton' style='display:none'>
<SpotfireControl id="y0ursp07f1r3c0n7r01IdH3r3" />
</div>
<SPAN id=startButton>Start</SPAN>
<SPAN id=stopButton style='display:none'>Stop</SPAN>
蟒
#changes RangeFilter low and high bounds in small increments
from Spotfire.Dxp.Application.Filters import RangeFilter, ValueRange
from Spotfire.Dxp.Data import IndexSet
#get a reference to the range filter in question
filt=Document.FilteringSchemes[0].Item[myDataTable].Item[myDataTable.Columns.Item["b"]].As[RangeFilter]()
delta = .1
if(filt.ValueRange.High.ToString() == "High"): #reset filters
idx = IndexSet(myDataTable.RowCount,True)
min = myDataTable.Columns["b"].RowValues.GetMinValue(idx).Value
filt.ValueRange = ValueRange(min,min+delta)
print filt.ValueRange
else:
filt.StepBodyUp()
的javascript
var pid
var speed = .5 //change filter 2/second
start = function(){
pid = setInterval(function(){
$("#spotfireButton input").click()
},speed*1000)
$('#stopButton').show()
$('#startButton').hide()
}
stop = function(){
clearInterval(pid)
$('#dd').text("stopped " + pid)
$('#stopButton').hide()
$('#startButton').show()
}
s
$("#stopButton").button().on('click',stop)
$("#startButton").button().on('click',start)