Hello everyone,

I want to create a dynamic chart using Chart.js with data from the database 
but I am not really sure how to do that . I have manager to create 
predefined and filled arrays but I dont know how to make it dynamic I have 
here my controller code

def calc():
    
    teams =  db(db.projects).select(orderby=db.projects.id)
    rows1 = db(db.projects).select(orderby=db.projects.id)
    rows = db(db.projects).select(orderby=db.projects.id)
    
    # Calculation for total project by Teams in different developmentphases
    construct = db(db.projects.project_devlopment_phase).select()
    identification = db(db.projects.project_devlopment_phase=='0').select()
    
    pre_feasibility= db(db.projects.project_devlopment_phase=='1' ).select()
    feasibility= db(db.projects.project_devlopment_phase=='2' ).select()
    understudy = pre_feasibility + feasibility

    financing = db(db.projects.project_devlopment_phase=='3' ).select()
    implementation = db(db.projects.project_devlopment_phase=='4' 
).select() 
    under_construction = financing + implementation

    wp = db(db.projects.technology=='WP').select()
    sp=  db(db.projects.technology=='SP').select()
    hp = db(db.projects.technology=='HP').select()
    bi = db(db.projects.technology=='BI').select()

    re = wp + sp + hp + bi
      
    data2d = [[100, 12, 5, 2, 5], [5, 100, 10,4,1 ], [5, 8, 100, 5,6], 
[12,15,8,6,100]]
    data1d = [11,5, 12,6, 5,100, 2,100]

    mylist = list(dict.fromkeys(data1d))
   
    return dict(mylist=mylist, team=team, datatest=datatest,  data2d=data2d 
,data1d = data1d,construct=construct,rows1= rows1 ,teams=teams, rows=rows, 
identification=identification, understudy=understudy, 
under_construction=under_construction, 
re=re)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/84192b23-cc7c-4553-ae42-baea1b88b4ben%40googlegroups.com.

Reply via email to