Monday School, back to make-up of logistics, sad reminders of life.
Nonsense not to say, directly on the code, well, 4 line, but the discerning can see it is a line.
var mytable=new Table ({
title: ' University four years ',
data:data,
thead:thead
});
Data format with EXT
var data=[
[' sad ', ' eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the World Cold ',
[' sad ', ' eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the world Cold '],
[' sad ', ' Eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the World Cold ',
[' sad ', ' eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the World Cold ']
]
var thead=[' title 1 ', ' Title 2 ', ' Heading 3 ', ' Heading 4 ', ' Heading 5 ', ' Heading 6 '
Of course, every time you want to create such a table, you need to carry out a certain package, code as follows, write very random, not careful, no comments, there is no fault-tolerant processing, make it.
Obviously imitate the Ext table.
myext={};
myext.util={};
myext.util.css={};
Myext.util.css.applycss=function (src) {var link=document.createelement (' link ') link.rel= "stylesheet";
Link.type= ' Text/css ';
LINK.HREF=SRC;
document.getElementsByTagName (' head ') [0].appendchild (link);
};
function Table (config) {this.title=config.title;
This.data=config.data;
This.thead=config.thead;
This.show ();
} table.prototype.show=function () {var table=document.createelement (' Table ');
var tbody=document.createelement (' tbody ');
var cap=document.createelement (' caption ');
Cap.appendchild (document.createTextNode (this.title));
Table.appendchild (CAP);
Table.appendchild (TBODY);
var thead=document.createelement (' tr ');
Tbody.appendchild (THEAD);
for (Var m=0;this.thead[m];m++) {var th=document.createelement (' th ');
Th.appendchild (document.createTextNode (this.thead[m));
Thead.appendchild (TH);
} var Rows=this.data.length;
var cols=this.data[0].length;
for (Var i=0;i<rows;i++) { var tr=document.createelement (' tr ');
Tbody.appendchild (TR);
for (Var j=0;j<cols;j++) {if (j) {var td=document.createelement (' TD ');
Td.appendchild (document.createTextNode (this.data[i][j));
Tr.appendchild (TD);
}else{var td=document.createelement (' th ');
Td.appendchild (document.createTextNode (this.data[i][j));
Tr.appendchild (TD);
}} myExt.util.css.applyCss (' Table.css ');
Document.body.appendChild (table); var data=[[' sad ', ' eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the World cold ', [' sad ', ' eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the world Cold '], [' sad ', ' eat ', ' Sleep ', ' play games ', ' Learn Java ', ' See the World cold ', [' sad ', ' eat ', ' sleep ', ' play games ', ' Learn Java ', ' See the world Cold ']] var thead=[' title 1 ', ' Heading 2 ', ' Heading 3 ', ' Heading 4 ', ' Heading 5 ', ' Title 6 '] var mytable=new Table ({title: ' University four years ', Data:data, thead:thead});
Finally send everyone a pure JS canvas pie chart, forget Flash.