Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating graphs
Message
From
28/08/2000 08:45:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/08/2000 06:58:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00380132
Message ID:
00409745
Views:
21
Shaishav,
Try this code to see if that works for you :
*** set the LOCALEID to English
nlLocaleId=sys(3004)		&& Save local id
=sys(3006,1033)				&& We will be sending instructions in English

* Part of xlChartType constants
#DEFINE xl3DArea 					-4098
#DEFINE xl3DColumn					-4100
#DEFINE xl3DLine					-4101
#DEFINE xl3DPie						-4102
#DEFINE xlArea						1
#DEFINE xlBubble3DEffect			87
#DEFINE xlLine						4
#DEFINE xlPie						5
#DEFINE xlRadar						-4151
#DEFINE xlSurface					83

#DEFINE TAB CHR(9)
#DEFINE CRLF CHR(13)+CHR(10)

CREATE cursor test (degree i, sine n(8,4) NULL, cosine n(8,4))
FOR ix = 1 to 90
  INSERT into test ;
    values ;
    (ix,cos(ix)*ix,sin(ix)*ix)
ENDFOR
45
SCAN next 30     && Nullify 30 degrees
  REPLACE sine with .null.       && Nullify some values to see effect
ENDSCAN

WAIT window nowait "Filling cell values..."
MCGDATA = ""
nCols = fcount()
FOR ix = 1 to nCols
  MCGDATA = MCGDATA + iif(empty(MCGDATA),"",TAB)+field(ix)
ENDFOR
MCGDATA = MCGDATA + CRLF
SCAN
  FOR ix = 1 to nCols
    MCGDATA = MCGDATA + iif(ix=1,"",TAB)+nvl(str(evaluate(field(ix))),"")
  ENDFOR
  MCGDATA = MCGDATA + CRLF
ENDSCAN
* Data prepare *

CREATE cursor testgen (graphtest g)
APPEND blank
APPEND general graphtest class "MSGraph.Chart" data MCGDATA

oForm = createobject("Form")
WITH oForm
  .height = 400
  .width = 600
  .show
  .closable = .f.
  .addobject("myGraph","OleBoundControl")
  .addobject("myQuit1","myQuit")
  .addobject("myChanger1","myPlotChanger")
  WITH .myGraph
    .height = oForm.height - 20
    .width = oForm.width
    .left = 0
    .top = 0
    .ControlSource = "testgen.graphtest"
    WAIT window nowait "Plotting..."
    .haslegend = .t.
    .ChartType=xlLine
    .object.application.plotby = 2
    WAIT clear
    .visible=.T.
  ENDWITH
  .myQuit1.visible = .t.
  .myChanger1.visible = .t.
ENDWITH
**** Set the LocaleId to the previous value
=sys(3006,val(nlLocaleId))

READ events

DEFINE class myquit as commandbutton
  Left=1
  Top=0
  AutoSize = .T.
  Caption="Close"
  PROCEDURE click
  Release all
  Clear events
ENDPROC
ENDDEFINE

DEFINE class myPlotChanger as commandbutton
  Left=150
  Top=0
  AutoSize = .T.
  Caption="Change plotby"
  PROCEDURE click
  WITH thisform.myGraph.object.application
    .plotby = iif(.plotby=1,2,1)
  ENDWITH
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
Previous
Reply
Map
View

Click here to load this message in the networking platform