您现在所在的是:

工控软件

回帖:0个,阅读:2783 [上一页] [1] [下一页]
113
Springal
文章数:53
年度积分:-223
历史总积分:113
注册时间:2009/2/15
发站内信
发表于:2009/8/12 2:34:03
#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

关于我们 | 联系我们 | 广告服务 | 本站动态 | 友情链接 | 法律声明 | 非法和不良信息举报

工控网客服热线:0755-86369299
版权所有 工控网 Copyright©2024 Gkong.com, All Rights Reserved

31.2002