Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MS Graph
Message
De
25/04/2001 06:58:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00499398
Message ID:
00499473
Vues:
51
I think half of this message is aimed at the other Jones (the thread originator)
But thanks anyway :)

Will

>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
Will Jones
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform