Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MS Graph
Message
De
25/04/2001 04:16:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
24/04/2001 21:44:28
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Divers
Thread ID:
00499398
Message ID:
00499452
Vues:
33
>Hi,
> I am using MS Graph to generate my graph report. I have problem with generate graph as my client requested. I have no idea with the style..pls help!
>
>
> #
> ^
> |
> |         --
> |        |  |
> |-- --   |A |__
> |A |  |  |--|A |
> |--|A |  |B |--|
> |B |--|  |  |B |
> |  |B |  |  |  |
> -------|--------|-------------------->  tv programme
>  Sport    Entertainment
>
>
>Legend
>A - Male
>B - Female
>
>
>Is it possible to have show the graph as above, which one bar will consist of stacked bar to represent # of resident in particular area and the other bar beside in in same tv programmer will show the overall persentage of # of resident who watch the same tv programme in whole country?
>
>pls donnot hestitate to ask me if you don understand my question
>thank you in advance

John,
There is no native way in MSGraph of Excel I know. You seem o be forced to cheat :
*** 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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform