Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Microsoft Graph
Message
From
03/12/1998 18:28:15
 
 
To
06/11/1998 09:50:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00154251
Message ID:
00163897
Views:
28
>>>>I think Flores' answer is excellent; I use that method(?) too.
>>>>However I have more tip and question about implementing M.S graph.
>>>>
>>>>Tip1.
>>>> ** Using Autoformat property.
>>>>
>>>> If there is no predefined max value of data series, that is to say whenever a your makes
>>>> graph in applications the max value fluctuate emensely, user may get stupid graphs that
>>>> every data value for graph exceed the max limit of predefined graph in Gen field.
>>>>
>>>> Autoformat property can solve this problem.
>>>>
>>>> < code omitted >
>>>>
>>>> Use Utiltable
>>>> Append General gen_1 DATA m.Cgdata ** m.Cgdata ; data series
>>>>
>>>> Thisform.oleboundcontrol1.ControlSource = " gen_1"
>>>>
>>>> Thisform.oleboundcontrol1.autoformat(n,m)
>>>>
>>>> The combination of numbers n,m in autoformat(n,m) decide which types of graph it would be
>>>> and you don't have to worry about the value of X,Y axies. But the combination is also predefined
>>>> that if you issue the wrong combination it can cause an error.
>>>>
>>>>Tip2. Covering Oleobject with transparent shape object.
>>>> This can prevent users from making dubleclick event on the Oleobject; in case Activating
>>>> Ole server application is not desirable.
>>>>
>>>>My Question.
>>>>
>>>> A client PC has no M.S graph and M.S graph runtime is included in the setup procedure. But
>>>> the graph in application is not working. Does anyone know why ?
>>>>
>>>> Thanks in advance.
>>>You're right about that problem that can arise when predefined graph is given a larger set of values than the test data you use. I mentioned that approach as quick and dirty solution for John's problem. I also stated I had to go to OLE automation to get a better grip on the layout of a graph. You've made a good point on using the autoformat method of MS-Graph. But even this does not give you the solution to everything a user may ask for.
>>> In addition to your number 2 tip, you can also set the OLE bound control Enabled property to .F., to prevent users from double-clicking on it and activating another application.
>>
>>Could someone give me a simple example of the process of autoformat and the test data approach you are talking about. I am using vfp3.0 does that make a difference? What about a little boost on the ole automation approach? Thanks guys...
>>
>>jd
>Here's one example:
>
>#Define xlArea 1
>#Define xlShowLabel 4
>#Define xlHigh -4127
>#Define xlUpward -4171
>Use Chart      && Table contains one general field called mschart.
>Blank Fields mschart
>Append General mschart Class MSGraph
>oDummy = CreateObject("Form")
>With oDummy
>  .Height = 420
>  .Width = 620
>  .AddObject("oGraph","OleBoundControl")
>  .ControlBox = .F.
>  .AutoCenter = .T.
>  .Caption = "Year-To-Date Chart"
>  .Show
>EndWith
>Append General mschart Data lcData  && lcData has been given data
>oDummy.Refresh()                    && you can check help file in how to
>With oDummy.oGraph                  && format a string to pass to MSGraph
>  .Top = 1
>  .Left = 1
>  .Height = 400
>  .Width = 600
>  .AutoActivate = 0
>  .ControlSource="chart.mschart"
>  .Visible = .T.
>  .HasLegend = .f.
>  .AutoFormat(xlArea, 1)
>  .HasTitle = .f.
>  .Axes(2).ReversePlotOrder = .T.
>  .Axes(2).TickLabels.NumberFormat = "##0K"
>  .Axes(1).TickLabelPosition = xlHigh
>  .Axes(1).TickLabels.NumberFormat = "mmm-yy"
>  .Axes(1).TickLabels.Orientation = xlUpward
>  .Axes(1).TickLabels.Font.Size = 8
>EndWith
>oDummy.Refresh()
>
>Just a cross-section of a working program I have. You will have to add your code for formatting the data appended to the general field at the beginning, as well as cleanup code at the end. You can find more details on the MS-Graph object model in C:\Your_Windows_Dir\msapps\msgraph5\vba_grp.hlp.HTH

Hey guys:

Just a quick question. Everything is working well in regard to controlling the graph using the suggested approach. I am having a difficult time changing the grid lins color. When I use the "axes(1).MajorGridlines.ColorIndex=52" command, I get an ole error. I have tried every combination I can think of. Help.

Thanks again....

jd
Previous
Reply
Map
View

Click here to load this message in the networking platform