Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS Graph
Message
From
25/04/2001 06:31:13
 
 
To
25/04/2001 05:29:03
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00499398
Message ID:
00499470
Views:
39
Hi!

I used "MSGraph.Chart" as a class in it runs. However, it does not do what you want exactly. I looked to the chart objects model and tried to use combined charts. However, I did not found a way to combine 4 series to 2 bars with 2 different stack types. It seems you can have only one stacked bar, changing chart type for any series just adds these series to the stacked bar and change the stack type (value/percent) for all series. Is this different in Excel chart?

I remember, you can do this in the TeeChart control, but it seems this control canot be put into general field.

You can also use drawings in the chart and draw them manually using OleBoundControl.Object reference. Than, before use of the graph after data populating, resize drwings to show secondary bars properly. I doubt this is good way to go.

>Helps if I say where the error occurs
>
>Append general graphtest class MSGraph.Chart.5 data lcData
>
>
>>Cetin,
>>
>>I am interested in what this does (mainly setting LocaleId to english bit)
>>
>>I have tried cutting and pasting this code but I get an error
>>"Only insertable objects are allowed in general fields"
>>
>>Help is about as much use as a wet kipper
>>Any ideas?
>>
>>Will
>>
>>>
*** set the LOCALEID to English
>>>nlLocaleId=sys(3004)		&& Save local id
>>>=sys(3006,1033)				&& We will be sending instructions in English
>>>
>>>#Define xl3DColumnStacked  55
>>>#Define xlColumnStacked  52
>>>
>>>#Define TABULATE CHR(9)
>>>#Define CRLF CHR(13)+CHR(10)
>>>
>>>Dimension Groups[5]
>>>Groups[1] = 'Sports'
>>>Groups[2] = 'News'
>>>Groups[3] = 'Magazine'
>>>Groups[4] = 'Music'
>>>Groups[5] = 'Discovery'
>>>Rand(-1)
>>>Create cursor test (GroupName c(10), Gender c(6), Counted i)
>>>For ix = 1 to 300
>>>  Insert into test ;
>>>    values ;
>>>    (Groups[int(rand()*100)%5+1], iif(int(rand()*100)%2=1,'Male','Female'),int(rand()*100))
>>>Endfor
>>>Select GroupName, Gender, sum(Counted) as Total ;
>>>  from test ;
>>>  group by 1,2 ;
>>>  into cursor crsGraph nofilter
>>>
>>>Select GroupName, sum(Total) as SumTot ;
>>>  from crsGraph ;
>>>  group by 1 ;
>>>  into cursor crsGrpSum nofilter
>>>Select max(SumTot) from crsGrpSum into array arrP100 && 100%
>>>
>>>Create cursor crsXTab (GroupName c(10),Female b(2), Male b(2))
>>>Select distinct GroupName from crsGraph into array arrGroups
>>>For ix=1 to alen(arrGroups,1)
>>>  Select * from crsGraph where GroupName = arrGroups[ix,1] into cursor crsTemp
>>>  m.GroupName = arrGroups[ix,1]
>>>  Scan
>>>    Store Total to ('m.'+Gender)
>>>  Endscan
>>>  Insert into crsXTab from memvar
>>>  * Insert % representation
>>>  m.Multiplier = arrP100/(m.Female+m.Male)
>>>  m.Female = m.Multiplier*m.Female
>>>  m.Male = m.Multiplier*m.Male
>>>  Insert into crsXTab from memvar
>>>Endfor
>>>Select crsXTab
>>>lcTempFile = sys(2015)+'.tmp'
>>>Copy to (lcTempFile) type CSV
>>>lcData = chrtran(FileToStr(lcTempFile),',',TABULATE)
>>>Erase (lcTempFile)
>>>
>>>Create cursor testgen (graphtest g)
>>>Append blank
>>>Append general graphtest class MSGraph.Chart.5 data lcData
>>>
>>>oForm = createobject("myForm")
>>>With oForm
>>>  .height = 400
>>>  .width = 600
>>>  .addobject("myGraph","OleBoundControl")
>>>  With .myGraph
>>>    .height = oForm.height - 50
>>>    .width = oForm.width
>>>    .left = 0
>>>    .top = 0
>>>    .ControlSource = "testgen.graphtest"
>>>    Wait window nowait "Plotting..."
>>>    .haslegend = .t.
>>>    .ChartType=xlColumnStacked
>>>    .object.application.plotby = 2
>>>    Wait clear
>>>    .visible=.T.
>>>  Endwith
>>>  .Show
>>>Endwith
>>>**** Set the LocaleId to the previous value
>>>=sys(3006,val(nlLocaleId))
>>>Read events
>>>
>>>Define class myForm as Form
>>>  Procedure Destroy
>>>    Clear events
>>>  Endproc
>>>Enddefine
>>>
Cetin
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform