Link to home
Start Free TrialLog in
Avatar of Cyril Joudieh
Cyril JoudiehFlag for Lebanon

asked on

VFP Automation on MS-Graph

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
Avatar of Olaf Doschke
Olaf Doschke
Flag of Germany image

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.
Avatar of Cyril Joudieh

ASKER

That did not work. Same effect as LockScreen = .T.
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.
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.
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.
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.
ASKER CERTIFIED SOLUTION
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.