I want to print a graph in the report writer and am able to do this with the default bar graph. I need some help with formatting the graph.
Specifically I want to put three lines on the graph representing actuals, forecast and last year for the last six months.
I am trying to find out how the data string is constructed and how the graph is formatted for this.
The current code I am using to construct the single series data string is:
#DEFINE CRLF CHR(13)+CHR(10)
#DEFINE TAB CHR(9)
CREATE dbf temp4 free (dist_mgr c(24),graph1 g,graph2 g)
SELECT temp4
INDEX on alltrim(dist_mgr) tag dum
SELECT a.dist_mgr,;
ltrim(str(a.storenum)) as storenum,;
tmprofit as tmp,;
tmbudget as tmb,;
TMPYProfit as tmpyp,;
ltrim(str(iif(a.TMPYProfit<=0 or a.tmprofit<=0,;
000.00,100*a.tmprofit/a.TMPYProfit),6,1)) as tmprofit, ;
ltrim(str(iif(a.tmbudget<=0 or a.tmprofit<=0,;
000.00,100*a.tmprofit/a.tmbudget),6,1)) as tmbudget ;
from temprep a, stores b ;
into dbf temp5 ;
where a.storenum=b.storenum ;
and not b.newstore=.t.
SELECT distinct dist_mgr from temp5 into dbf temp6
SELECT temp6
SCAN
lcTMPData=" "+TAB+"Net % profit change this month vs this month "+;
"last year."+CRLF
lcTMBData=" "+TAB+"% This month profit Vs Budget"+CRLF
INSERT into temp4 (dist_mgr) ;
value (temp6.dist_mgr)
SELECT temp5
CALCULATE sum(tmp),sum(tmpyp),sum(tmb);
to lntmp,lntmpyp,lntmb ;
for alltrim(dist_mgr)=alltrim(temp6.dist_mgr)
lntmb=iif(lntmb<=0,000.00,100*lntmp/lntmb)
lntmp=iif(lntmpyp<=0,000.00,100*lntmp/lntmpyp)
lntmb=max(0,lntmb)
lntmp=max(0,lntmp)
lcTMB=alltrim(str(lntmb,6,1))
lcTMP=alltrim(str(lntmp,6,1))
Release tm,lntmp,lntmpyp
SCAN for alltrim(dist_mgr)=alltrim(temp6.dist_mgr)
lcTMPData=lcTMPData+alltrim(temp5.storenum)+" - "+;
alltrim(temp5.tmprofit)+"%"+TAB+temp5.tmprofit+CRLF
lcTMBData=lcTMBData+alltrim(temp5.storenum)+" - "+;
alltrim(temp5.tmbudget)+"%"+TAB+temp5.tmbudget+CRLF
ENDSCAN
lcTMPData=lcTMPData+"Av. - "+lcTMP+"%"+TAB+lcTMP+CRLF
lcTMBData=lcTMBData+"Av. - "+lcTMB+"%"+TAB+lcTMB+CRLF
SELECT temp4
LOCATE for alltrim(dist_mgr)=alltrim(temp6.dist_mgr)
APPEND general graph1 data lcTMPData class "MSGraph.Chart.5"
APPEND general graph2 data lcTMBData class "MSGraph.Chart.5"
ENDSCAN
Thanks
John Campbell