srinivas
3rd February 2004, 06:51
I am trying an example in charts.
I have several queries.
Will the same program generate a pie, bar or line graphs? Or we need to write different programs for each chart type?
This is my code. I want to take customers on X axis and Sales data on Y axis. But this code is not working. The same code if I run for a pie chart type then I am getting a cirecle and nothing else.
Pls. suggest.
************************************************
|****************************** declaration section ***************************
declaration:
table ttccom010
table ttdsls045
extern domain tccuno cuno.f,cuno.t,customer
extern domain tcamnt amount
long chno, aa
string chart_type(16)
long bb, cc, dd, ee, ff,request
double category_from, category_to
#include <bic_chartman>
#define CHART.NAME "tccom9999"
#define CHART.APPLICATION "tccom8888"
|****************************** form section **********************************
form.1:
init.form:
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** field section *********************************
field.year.f:
when.field.changes:
cuno.t=cuno.f
|****************************** function section ******************************
functions:
function read.main.table()
{
set.chart.attributes()
send.chart.data()
chm.draw()
repeat
request=chm.get.request(chno,category_from,category_to)
until (request=CHM_ABORT)
}
function send.chart.data()
{
long foot.no
double cat.value
Select tdsls045.cuno:customer,sum(tdsls045.amnt):amount
From tdsls045
|Where tdsls045._index1 inrange {1,:cuno.f} and {20,:cuno.t}
|Where tdsls045.cuno between :cuno.f and :cuno.t
Group by tdsls045.cuno
|Order by amount DESC
As set with 5 rows
Selectdo
amount=amount/1000
foot.no=foot.no+1
chm.footnote.in( foot.no, customer)
chm.set.in("customers", foot.no, customer)
cat.value=foot.no
chm.data.in(1.0,cat.value,1, amount,1)
endselect
}
function set.chart.attributes()
{
chm.domain.in(CHM_CATEGORY_DOMAIN,CHM_SET,"customers","Customers","", 1.0,20.0,2.0,"")
chm.domain.in(CHM_DATA_DOMAIN, CHM_REAL, "data", "Sales Data", "X10000", 1.0, 20.0, 1.0, "ZZZ99")
chm.chartman(CHART.APPLICATION, "TOP FIVE CUSTOMERS", "baan", "")
chno=chm.open(CHART.NAME)
chm.axis.in(CHM_CATEGORY_AXIS, FALSE, 0, 20, 2.0, 0.0, "customers")
chm.axis.in(CHM_DATA_AXIS, FALSE, 0, 20, 1.0, 0.0, "data")
chm.title.in("Top 5 Customers", "")
}
I have several queries.
Will the same program generate a pie, bar or line graphs? Or we need to write different programs for each chart type?
This is my code. I want to take customers on X axis and Sales data on Y axis. But this code is not working. The same code if I run for a pie chart type then I am getting a cirecle and nothing else.
Pls. suggest.
************************************************
|****************************** declaration section ***************************
declaration:
table ttccom010
table ttdsls045
extern domain tccuno cuno.f,cuno.t,customer
extern domain tcamnt amount
long chno, aa
string chart_type(16)
long bb, cc, dd, ee, ff,request
double category_from, category_to
#include <bic_chartman>
#define CHART.NAME "tccom9999"
#define CHART.APPLICATION "tccom8888"
|****************************** form section **********************************
form.1:
init.form:
get.screen.defaults()
|****************************** choice section ********************************
choice.cont.process:
on.choice:
read.main.table()
|****************************** field section *********************************
field.year.f:
when.field.changes:
cuno.t=cuno.f
|****************************** function section ******************************
functions:
function read.main.table()
{
set.chart.attributes()
send.chart.data()
chm.draw()
repeat
request=chm.get.request(chno,category_from,category_to)
until (request=CHM_ABORT)
}
function send.chart.data()
{
long foot.no
double cat.value
Select tdsls045.cuno:customer,sum(tdsls045.amnt):amount
From tdsls045
|Where tdsls045._index1 inrange {1,:cuno.f} and {20,:cuno.t}
|Where tdsls045.cuno between :cuno.f and :cuno.t
Group by tdsls045.cuno
|Order by amount DESC
As set with 5 rows
Selectdo
amount=amount/1000
foot.no=foot.no+1
chm.footnote.in( foot.no, customer)
chm.set.in("customers", foot.no, customer)
cat.value=foot.no
chm.data.in(1.0,cat.value,1, amount,1)
endselect
}
function set.chart.attributes()
{
chm.domain.in(CHM_CATEGORY_DOMAIN,CHM_SET,"customers","Customers","", 1.0,20.0,2.0,"")
chm.domain.in(CHM_DATA_DOMAIN, CHM_REAL, "data", "Sales Data", "X10000", 1.0, 20.0, 1.0, "ZZZ99")
chm.chartman(CHART.APPLICATION, "TOP FIVE CUSTOMERS", "baan", "")
chno=chm.open(CHART.NAME)
chm.axis.in(CHM_CATEGORY_AXIS, FALSE, 0, 20, 2.0, 0.0, "customers")
chm.axis.in(CHM_DATA_AXIS, FALSE, 0, 20, 1.0, 0.0, "data")
chm.title.in("Top 5 Customers", "")
}