登录
首页 工控软件 工控软件
回帖 发帖
正文

主题:iFIX趋势曲线中实时数据和历史数据一起显示

点击:2960 回复:0

 ifix趋势曲线中实时数据和历史数据一起显示
来源:极易ifix论坛
http://www.geifix.com/dispbbs.asp?boardid=5&id=52

这种方法用两只图表画笔表示一个相同的值—— 一个实时画笔与一个历史画笔——并利用可见性属性在两者之间切换。 尽管可以简单的通过改变某只画笔的属性达到同样的目的,但是通过脚本的方法更为有利,因为当历史画笔不可见时历史数据仍在采集。 因此,操作员不得不花很长时间等待历史数据显示。 一旦向后按钮被单击画笔则被切换,当卷翻回到目前时间时向前按钮切换回实时状态。
下面显示了这些按钮的代码:
例: 前翻页和后翻页按钮
private sub commandbutton2_click() scroll back button.
    if the real-time pen is scrolled back in time, switch
    to historical data.
    if chart1.pens.item(1).showline = 1 then
         make the real-time pen invisible and historical
         pen visible.
         chart1.pens.item(1).showline = false
         chart1.pens.item(2).showline = true

         set the historical pen to active.
         chart1.currentpen = 2

         使实时笔图例不可见,历史笔
         图例可见。
         chart1.pens.item(1).legend.visible = false
         chart1.pens.item(2).legend.visible = true

         更改数据类型指示器。
         text26.caption = 历史数据
    end if

    if its a historical pen, scroll the chart backward.
    chart1.scrollback
end sub

private sub commandbutton1_click() scroll forward button
    if its a real-time pen, scrolling forward is
    not available.
    if chart1.pens.item(1).showline = 1 then
         msgbox cant move into the future!, _
         vbexclamation, this isnt a time machine.
         exit sub
    end if

    if historical pen, scroll the chart forward.
    chart1.scrollforward

    if historical pen is scrolled beyond current
    time, switch back to real-time.
    if chart1.endtime >= now then
         使历史笔不可见,而
         实时笔可见。
         chart1.pens.item(2).showline = false
         chart1.pens.item(1).showline = true

         设置激活实时笔。
         chart1.currentpen = 1

         隐藏历史笔图例
         和实时笔。
         chart1.pens.item(1).legend.visible = true
         chart1.pens.item(2).legend.visible = false

         更改数据类型指示器。
         text26.caption = real-time data
    end if
end sub
----------------------------------------------
此篇文章从博客转发
原文地址: Http://blog.gkong.com/more.asp?id=96966&Name=springal
09-08-12 02:34

工控新闻

更多新闻资讯