Baanboard.com

Go Back   Baanboard.com

User login

Frontpage Sponsor

Main

Poll
What is your current Baan flavour?
Triton (3.x)
0%
BaanIV (4.x)
48%
BaanERP (5.x)
11%
ERP LN (6.x)
41%
Total votes: 61

Reference Content

 
Chart manager example
By patvdv at 26 Feb 2008 - 21:56

Chart manager example


 #define CHART.NAME                   "RESULT"
 #define CHART.APPLICATION            "ttchmtest"

 #include <bic_chartman>

 long     chart.data(2,4)

 function main()
 {
                 long chno
                 string chart_type(16)

                 | start Chart manager
                 chm.chartman(CHART.APPLICATION, "Title", "user1", "")
                 chno = chm.open(CHART.NAME, chart_type)

                 if chno > 0  then
                                 send.chart.data()          | define data
                                 chm.draw()                 | draw chart
                                 get.chart.data(chno)       | store data
                 endif
 }

 | define data, send it to Chart manager
 function void send.chart.data( )
 {
                 double     series, category
                 long       no_1, no_2, no_3, no_4

                 | Chart title
                 chm.title.in("Financial Results", "")
                 | Set definitions
                 no_1 = 1
                 no_2 = 2
                 no_3 = 3
                 no_4 = 4
                 chm.set.in("Series", no_1, "Company 1")
                 chm.set.in("Series", no_2, "Company 2")
                 chm.set.in("Categories", no_1, "Qrtr I")
                 chm.set.in("Categories", no_2, "Qrtr II")
                 chm.set.in("Categories", no_3, "Qrtr III")
                 chm.set.in("Categories", no_4, "Qrtr IV")


                 | Domain definitions
                 chm.domain.in(CHM_SERIES_DOMAIN, CHM_SET,
                       "Series", "Companies", "Unit", 1.0, 2.0, 1.0, "")
                 chm.domain.in(CHM_CATEGORY_DOMAIN, CHM_SET,
                       "Categories", "Quarters", "1993", 1.0, 4.0,
                       1.0, "")
                 chm.domain.in(CHM_DATA_DOMAIN, CHM_REAL, "", "Result", "x 1000",
                                                                         0.0, 100.0, 0.01, "ZZZZZ9V,99")

                 | Axis data
                 chm.axis.in(CHM_SERIES_AXIS, FALSE, 0, 2, 1.0, 0.0, "")
                 chm.axis.in(CHM_CATEGORY_AXIS, FALSE, 0, 4, 1.0, 0.0, "")
                 chm.axis.in(CHM_DATA_AXIS, FALSE, 0, 10, 10.0, 0.0, "")

                 get.data.from.table(chart.data())          | user defined

                 for series = 1 to 2
                                 for category = 1 to 4                 | Data values
                                                 chm.data.in(series, category, 1,
                                                                 chart.data(series, category), 0)
                                 endfor
                 endfor
 }

 | get data from Chart manager
 function void get.chart.data( long chart_no)
 {
                 long      datn, footnote_no, ret, request
                 double    catv, data, serv, category_from, category_to

                 repeat
                                 request = chm.get.request( chart_no,category_from,
                                 category_to)
                                 on case request
                                 case CHM_SOURCE_OUT:            | OUT-command Chart manager

                         ret = chm.first.data.out(CHM_ALL_DATA,
                            serv, catv, datn, data, footnote_no)

                                                 while (ret = CHM_OK)
                                                                 chart.data(serv, catv) = data
                                                                 ret = chm.next.data.out(CHM_ALL_DATA,
                               serv, catv, datn, data, footnote_no)
                                                 endwhile

                                                 put.data.in.table(chart.data()) | user defined
                                                 break
                                 endcase
                 until (request = CHM_ABORT)
 }

Related topics



0
No votes yet


All times are GMT +2. The time now is 16:31.


©2001-2008 - Baanboard.com - Baanforums.com