Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Graphs in reports?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00925468
Message ID:
00925597
Vues:
21
--
Thanks! Now you're teasing me! The "CLASS" verbage in the append general is new to me -
---


Terry, I am not teasing you, at least I don't mean to. And I am almost out of time to do this today.

--
The original post - if I remember correctly - asked about an Excel Chart. VFP-EXCEL automation can isolate and copy an Excel Chart area to the clipboard. The question then becomes: How to get that Excel Chart in the Clipboard to a report?
---

I believe I have already answered that question. Can you *please* get rid of the idea that you have to think about the clipboard here.

I don't have time to write a self-contained example for you today. So here is some old code, including the form definition, that should show you what you need to know. You won't be able to run it without the attendant table and FRX but it should be pretty obvious what procs go with what On... events in the report form.

In this particular case, the graph is in the summary, so you won't see the GO RECNO("x") I was talking about but other than that this is all the code you'd need for putting a graph that changes per line in a report.

The "first group" stuff is particular to this example, where the chart was in the summary. However everything else here is pretty generic.

>L<
#DEFINE CRLF CHR(13)+CHR(10)
#DEFINE TAB CHR(9)

* to properly talk to Graph,
* we have to use an oleboundcontrol because we 
* can't otherwise use a report form and print a graph
* oleboundcontrols are only available in forms...

REPORT FORM JGraph2 PREVIEW ALL
RETURN

PROC DESetup
 * private data session means the usual junk
 * with dates and so on -- I used DTOC() In here!!
 SET SYSFORMATS ON

ENDPROC

PROC BeforeGroup
  cData = cData+ALLTR(Name)
ENDPROC

PROC AfterGroup
  cData = cData+CRLF
  lFirstGroup = .F.
ENDPROC

PROC BeforeDetail
  IF lFirstGroup
     LOCAL liPos
     liPos = AT(CRLF,cData)
     cData = STUFF(cData, liPos,0,TAB+DTOC(Meeting))            
  ENDIF
  cData = cData+TAB+STR(Points,5,2)
ENDPROC

PROC BeforeSummary
     LOCAL oReportForm, oLineGroup
     CREATE CURSOR Temp (onefield g)
     APPEND BLANK
     APPEND GENERAL Temp.Onefield CLASS "msgraph.chart" DATA cData    
     oReportForm = CREATEOBJECT("JugglerGraph")     
     * I can go in here and try autoformats out... 
     oReportForm.MyGraph.AutoFormat(4,2)
     * to do stuff one series at a time:
     * loLineGroup = oReportForm.MyGraph.LineGroups(1)
     * loLineGroup.SeriesCollection(1).hasdatalabels = .T.
     oReportForm.MyGraph.ApplyDataLabels()
     oReportForm.MyGraph.OmitBackground()
ENDPROC

DEFINE CLASS JugglerGraph AS Form
   ADD OBJECT MyGraph AS OLEBoundControl WITH ;
       Class = "MsGraph.Chart", ;
       Height = THISFORM.Height, ;
       Width = THIS.Height * 2, ;
       ControlSource = "Temp.Onefield"
       * the dimensions are just meant to be relative to one another;
       * the report form will then size/scale it properly
ENDDEFINE   
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform