资源描述:
《javascript实现折线图、饼图、柱状图》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、JavaScript实现折线图、饼图、柱状图 JavaScript函数之折线图 ----------------------------------- 〈script language=javascript〉 function table2(total,table_x,table_y,all_width,all_height,line_no) { var line_color = "#69f";; var left_width = 70;; var total_no = total[1].length var temp1,temp2
2、,temp3 temp1 = 0;; for(var i=1;;i〈total_no;;i++) { for(var j=1;;j〈=line_no;;j++) { if(temp1〈total[j][i]) temp1 = total[j][i];; } } temp1 = parseInt(temp1);; if(temp1〉9) { temp2 = temp1.toString().substr(1,1);; if(temp2〉4) { temp3 = (parseInt(temp1/(Math.pow(10,(temp1.to
3、String().length-1))))+1)*Math.pow(10,(temp1.toString().length-1));; } else { temp3 = (praseInt(temp1/(Math.pow(10,(temp1.toString().length-1))))+0.5)*Math.pow(10,(temp1.toString().length-1)) } } else { if(temp1〉4) { emp3 = 10;; } else { temp3 = 5;; } } temp4 = temp3;; d
4、ocument.write("〈v:rect id=’_x0000_s1027’ alt=’’ style=’position:absolute;;left:" + (table_x + left_width) + "px;;top:" + table_y + "px;;width:" + all_width + "px;;height:" + all_height + "px;;z-index:-1’ fillcolor=’#9cf’ stroked=’f’〉〈v:fill rotate=’t’ angle=’-45’ focus=
5、’100%’ type=’gradient’/〉〈/v:rect〉");; for(var i=0;;i〈all_height;;i += all_height/5) { document.write("〈v:line id=’_x0000_s1027’ alt=’’ style=’position:absolute;;left:0;;text-align:left;;top:0;;flip:y;;z-index:-1’ from=’" + (table_x + left_width + length) + "px," + (tabl
6、e_y + all_height - length - i) + "px’ to=’" + (table_x + all_width + left_width) + "px," + (table_y + all_height - length - i) + "px’ strokecolor=’" + line_color + "’/〉");; document.write("〈v:line id=’_x0000_s1027’ alt=’’ style=’position:absolute;;left:0;;text-align:lef
7、t;;top:0;;flip:y;;z-index:-1’ from=’" + (table_x + (left_width - 15)) + "px," + (table_y + i) + "px’ to=’" + (table_x + left_width) + "px," + (table_y + i) + "px’/〉");; document.write("〈v:shape id=’_x0000_s1025’ type=’#_x0000_t202’ alt=’’ style=’position:absolute;;left:
8、" + table_x + "px;;top:" + (table_y + i) + "px;;width:" + left_width + "px;;height:18px;;z-index:1’〉");; docum