Foxcharts (latest) Refresh

Topics: General
Mar 19, 2013 at 12:46 PM
I want to refresh my graph every X minutes, or as soon as the entries in my table change.

What's the simplest method to do so? I have the API in a simple form.
Developer
Mar 19, 2013 at 1:34 PM
Just update your table, and call the "DrawChart" method!
Mar 19, 2013 at 5:48 PM
Edited Mar 19, 2013 at 6:03 PM
The thing is, another program updates my table at a regular interval, but I cannot fire DrawChart from there. So let's say that I have no control over what writes into my table. I can only check if it has been changed (and repeat that procedure indefinitely, which I am not sure how to do).

I made a copy of my table and I compare them. I need to loop that somehow, but I always end up freezing foxpro...

!
! Draw the chart, then check for differences between tables
!

IF STATS.TOT_EXP != OLDSTATS.TOT_EXP
    REPLACE OLDSTATS.TOT_EXP WITH STATS.TOT_EXP
    REPLACE OLDSTATS.TOT_SCIAGE WITH STATS.TOT_SCIAGE
    REPLACE OLDSTATS.TOT_SLABS WITH STATS.TOT_SLABS
    REPLACE OLDSTATS.TOT_MCX WITH STATS.TOT_MCX
    REPLACE OLDSTATS.OBJ_EXP WITH STATS.OBJ_EXP
    REPLACE OLDSTATS.OBJ_SCIAGE WITH STATS.OBJ_SCIAGE
    REPLACE OLDSTATS.OBJ_MCX WITH STATS.OBJ_MCX
    REPLACE OLDSTATS.OBJ_SLABS WITH STATS.OBJ_SLABS
THISFORM.foxcharts1.DrawChart()
    ELSE        
!
! WAIT A BIT?
!
ENDIF
Coordinator
Mar 19, 2013 at 6:02 PM
Can you put a timer on your form to call DrawChart.?

Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)


On Tue, Mar 19, 2013 at 11:48 AM, poroporo <notifications@codeplex.com> wrote:

From: poroporo

The thing is, another program updates my table at a regular interval, but I cannot fire DrawChart from there. So let's say that I have no control over what writes into my table.

Read the full discussion online.

To add a post to this discussion, reply to this email (VFPX@discussions.codeplex.com)

To start a new discussion for this project, email VFPX@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 19, 2013 at 6:09 PM
Edited Mar 19, 2013 at 6:10 PM
I tried Sleep, inkey, WAIT WINDOW TIMEOUT n.... nothing seems to work. It really has to loop (without crashing it)
Coordinator
Mar 19, 2013 at 6:32 PM
You need to add a Timer object to your form.



Jim Nelson

(805) 498-9195 (preferred)
(720) 837-3536 (cell)


On Tue, Mar 19, 2013 at 12:09 PM, poroporo <notifications@codeplex.com> wrote:

From: poroporo

I tried Sleep, inkey, WAIT WINDOW TIMEOUT n.... nothing seems to work.

Read the full discussion online.

To add a post to this discussion, reply to this email (VFPX@discussions.codeplex.com)

To start a new discussion for this project, email VFPX@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Mar 19, 2013 at 6:43 PM
Edited Mar 19, 2013 at 6:43 PM
I had no idea Timer was a class. I will be trying this right away. A million thanks.
Mar 19, 2013 at 11:14 PM
Edited Mar 19, 2013 at 11:17 PM
It works but my data does not refresh because my table-specific code is with Foxchart's init code.

SET REFRESH TO 5
SET DEFAULT TO "C:\TRASH"
USE STATS
totsciage = (stats.tot_sciage / stats.obj_sciage) * 100
totexp = (stats.tot_exp / stats.obj_exp) * 100
totsciage_color1 = 0
totsciage_color2 = 0
totsciage_color3 = 0
totexp_color1 = 0
totexp_color2 = 0
totexp_color3 = 0

IF totsciage >= 49
totsciage_color1 = 255
totsciage_color2 = 255
totsciage_color3 = 0
IF totsciage > 99 
    totsciage_color1 = 0
    totsciage_color2 = 255
    totsciage_color3 = 0
ENDIF
ELSE
totsciage_color1 = 255
totsciage_color2 = 0
totsciage_color3 = 0
ENDIF


IF totexp >= 49
totexp_color1 = 255
totexp_color2 = 255
totexp_color3 = 0
IF totexp > 99 
    totexp_color1 = 0
    totexp_color2 = 255
    totexp_color3 = 0
ENDIF
ELSE
totexp_color1 = 255
totexp_color2 = 0
totexp_color3 = 0
ENDIF



CREATE CURSOR Production (Chart1 n(8,2), Legend c(30), color i)

INSERT INTO Production VALUES ( stats.tot_sciage, "Sciage (pi2)", RGB(totsciage_color1, totsciage_color2, totsciage_color3))
INSERT INTO Production VALUES ( stats.tot_exp, "Expedition (pi2)", RGB(totexp_color1, totexp_color2, totexp_color3))


*---------------------------------------------------------------------------------------------------------


.DrawChart() will just redraw the same thing over and over because this code only fires once (on init).

Where should I move it? Or can I destroy the API's instance and recreate it?