Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VFP Automation on MS-Graph

Posted on 2011-10-06
8
Medium Priority
?
1,188 Views
Last Modified: 2012-06-21
Hello,

I am automating the preview of MS-Graph in VFP forms and their exports into Excel and PowerPoint.

There are way too many options on the software now to customize the charts (color, font, style, shadow, gradient, ...) and each time I change a property in the graph it has to refresh. So previewing a handful of columns is taking like 5-10 seconds to refresh. If I use other plotters it is done instantaneously.

I read on MSDN and other places that there is a Repaint Property:
http://msdn.microsoft.com/en-us/library/67a838cc(v=vs.71).aspx

However, it seems only to be available in .Net.

I also tried to hide the chart  (oChart.Visible = False) and to lock the VFP form from refreshing (LockScreen = .T.) and it improved the performance a bit.

Does anyone know how to handle this? I need to stop MS-Graph from refreshing when I assign all the properties I need.

Thanks!
Cyril
0
Comment
Question by:CaptainCyril
  • 5
  • 3
8 Comments
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 36926139
As ActiveX are always seperate forms with their own hwnd, VFPs native Lockscreen property doesn't help much, even if you do that on the _screen level. Try Win API LockWindowUpdate with the hwnd of the control.

Bye, Olaf.
0
 
LVL 27

Author Comment

by:CaptainCyril
ID: 36945503
That did not work. Same effect as LockScreen = .T.
0
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 36947054
Makes me wonder, LockWindowUpdate even works on all running processes. It just has the downside only one hwnd at a time can be locked, but that window then is locked. How did you implement LockWindowUpdate?

Bye, Olaf.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 27

Author Comment

by:CaptainCyril
ID: 36947208
The LockWindowUpdate did prevent the MSGraph from refreshing visibly but it took the same amount of time as without it. The same with LockScreen, Visible = .F. and other methods I tried.

The software does the following:
1) Change Data
2) Change Chart Type
3) Change and Format Title, Subtitle, Axes, ...
4) Change Colors
5) Apply additional options: Averages, Min, Max, Quartiles, ...
6) Apply DataLabels and Colors them
7) Apply Effects: Gradient, Shadow, 3D Effects

With each property change (ex. Font.Size = 10) the graph refreshes which means it redraws itself. There is Refresh and Update in MS-Graph. I could not find the option to prevent it from auto-refresh. The only method is to use Visual Studio .Net and MyChart.Repaint = False.

I wrote my own plotters using VFP objects. It takes a few milliseconds for my charts to draw and in some charts it takes 10 seconds of MS-Graph to draw. The client wishes to have editable charts in PowerPoint. So to export a study in 200 slides takes a considerable amount of time.
0
 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 36967601
Okay, I see. Then this is nothing you can solve via Lockscreen or LockWindoUpdate. But how about making all layout changes, while not having the full dataset in ms graph? Eg "zap" data or leave it to a minimum of data, which is drawn fast and only in the last step, if the graph layout is as wanted, add the data. That's the best I can think of, if you want to avoid the .Net involvement.

I don't have ms graph here, or I'm too stupid to find it, so I can't help you finding out how or why .Net offers an option you don't have in the OLE object.

Bye, Olaf.
0
 
LVL 27

Author Comment

by:CaptainCyril
ID: 36967630
I think the .net has a special way to communicate with the hidden parameters of MS-Graph.

Lockscreen and LockWindowUpdate just prevent the flickering. They hardly improve the performance.

The problem is that I am updating individual points in the series and I need to have the data there beforehand. There are special items in the chart that need the user's attention so they are colored or formatted differently. Plus I use special options to show average, quartiles, mins, maxs that MS-Graph does not show.

I made the chart now twice as fast by removing the formatting of the data labels in preview mode but I have to enable it when exporting to PowerPoint.
0
 
LVL 27

Accepted Solution

by:
CaptainCyril earned 0 total points
ID: 37233997
I found a way to make it faster but not as fast as I wish. The code has become 3 times bigger and much faster.

IF oMSGraph.Property <> Value
    oMSGraph.Property = Value
ENDIF
0
 
LVL 27

Author Closing Comment

by:CaptainCyril
ID: 37260934
The solutions posted on the internet do not work in FoxPro. They work in Excel or .Net. This is the only solution I could find after trying for months.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Quickbooks hosting can do wonders to your enterprise but considering the points elaborated in the article which will help you to better analyze the outcomes. So scan your business, its needs and then move to the new world of limitless benefits.
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question