首頁 後端開發 php教程 php折線圖、餅狀圖、長條圖的生成實例

php折線圖、餅狀圖、長條圖的生成實例

Jul 25, 2016 am 08:55 AM

  1. var tb_color = new Array(tmdColor1,tmdColor2);

  2. var tb_height = tmdColor1,tmdColor2);
  3. var tb_height = tmdColor1,tmdColor2);
  4. var tb_height = tmdColor1,tmdColor2);
  5. var tb_height = tmdColor1,tmdColor2);
  6. var tb_height = tmdColor1,tmdColor2);
  7. var tb_height = 230;
  8. var total_no = total[0].length;
  9. var totalpie = 0;
  10. for(var i=0;i{total[1][i ]*=100;totalpie += total[1][i];}var PreAngle = 0;for(var i=0;i { document.write("");PreAngle += total[1][i] / totalpie; }
  11. if(table_type=="A")
  12. {
  13. document.write("");
  14. for(var i=0;i{
  15. document.write("");
  16. document.write("" + 總計[0][i] + " ;
    v:shape>");
  17. document.write(" ");
  18. / / 顯示比例數
  19. document.write("");
  20. document. write("" + Math.round(parseFloat(total[1][i ]*100/totalpie)*100)/100 + "%
  21. ");
  22. }
  23. }
  24. if(table_type == "B")
  25. {
  26. var pie = 3.14159265358979;
  27. var Tempfor(var i=0;i{
  28. var TempAngle = 餅* 2 * (total[1][i] / (totalpie * 2) + TempPie);
  29. var x1 = table_x + all_width/2 + Math.cos( TempAngle) * all_width * 3/8;
  30. var y1 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/8;
  31. var x2 = table_x + all_width/2 + Math.cos( TempAngle) * all_width * 3/4;
  32. var y2 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/4;
  33. if(x2>table_x + all_width/2)
  34. {
  35. x3 = x2 + 20;
  36. x4 = x3;
  37. }
  38. else
  39. {
  40. x3 = x2 - 200 ;
  41. x4 = x3 - 100;
  42. }
  43. document.write("");
  44. document.write(" ");
  45. document.write("");
  46. document.write("");
  47. document. write("
" + 總計[0][ i] + " " + Math.round(parseFloat(total[1][i] * 100/totalpie)*100)/100 + "% td>
v:textbox>")
  • TempPie += Total[1][i]/totalpie;
  • }
  • }
  • }
  • //-->
  • function getdata_and_name2(data,name){
  • var dataArray2 = new Array()
  • var dataArray =data.split(",");
  • var nameArray =name.split(",");
  • dataArray2[0]="# 0000FF,1,2,3,"+dataArray[0 ];
  • for(var i=1;i dataArray2[i]=dataArray[i]* 10;
  • }
  • var Total =new Array(nameArray,dataArray2);
  • table2(total,70,980,804,200,1);
  • }
  • 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,temp3
  • temp1 = 0;
  • for(var i=1 ;i{
  • for(var j=1;j{
  • if(temp1 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.toString().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;
  • else
  • {
  • temp3 = 5;
  • ^}
  • }
  • temp4 = temp3;
  • document.write("");
  • for(var i=0;i{
  • document.write("");
  • document.write("") ;
  • document.write("");
  • document.write("
    " + temp4 + "
  • ");
  • temp4 = temp4 - temp3/5;
  • }
  • document.write("");
  • document.write("") ;
  • var tmpStr = ""
  • for(i=1;i{var re = /,/g;tmpStr += ",[" " + total[i][0].replace(re,"","") + ""]"}
  • tmpStr = tmpStr.substr(1,tmpStr.length-1)
  • var line_code = eval("new Array(" + tmpStr + ")")
  • for(var j=1;j{
  • for(var i=1;i{
  • var x1 = table_x + left_width + all_width * (i - 1)/(total_no -1)
  • var y1 = table_y + (temp3 - Total[j][i]) * (all_height/temp3)
  • var x2 = table_x + left_width + all_width * i/(total_no-1)
  • var y2 = table_y + (temp3 - Total[j][i+1]) * (all_height/temp3)
  • document.write(" ");
  • switch (parseInt(line_code[j-1][2]))
  • {
  • 情況1:
  • 中斷;
  • 情況2:
  • document.write( " ");
  • break;
  • 情況3:
  • document.write("" );
  • 中斷;
  • 案例4:
  • document.write("");
  • 中斷;
  • 案例5:
  • document.write( "");
  • break;
  • 案例6:
  • document.write("");
  • 中斷;
  • 案例7:
  • document.write("");
  • 中斷;
  • }
  • document.write(" v:line>");
  • switch (parseInt(line_code[j-1][3]))
  • {
  • 情況1:
  • Break;
  • 情況2:
  • document .write("");
  • 中斷;
  • 案例3:
  • document.write("");
  • 中斷;
  • }
  • }
  • switch (parseInt(line_code[j-1][3]))
  • {
  • 情況1:
  • 中斷;
  • 情況2:
  • document.write("");
  • break;
  • 情況3:
  • document.write("");
  • break;
  • }
  • }
  • for(var i=0;i{
  • document.write("");
  • document.write("");
  • document.write("" + Total[0][i] + "");
  • }
  • var tb_height = 30
  • document.write("");
  • for(var i=0;i{
  • document.write("");
  • document.write("
  • " + line_code[i][4] + "
  • ");
  • document.write("均勻>");
  • }
  • }
  • script>
  • function getdata_and_name1(data,name){
  • var dataArray =data. split(",");
  • var nameArray =name.split(",");
  • var Total =new Array(dataArray,nameArray);
  • table1(total,70,350,20,30,800,100," A");
  • }
  • function table1(total,table_x,table_y,thickness,table_width,all_width,all_height,table_type){
  • //參數調節(傳遞的架構,橫向座標,縱向座標,柱子的,柱子的寬度,圖表的寬度,圖表的高度,圖表的形狀類型)
  • //純ASP程式碼產生圖表函數1——柱圖
  • //********** ** ** ********************************************** **** ****** **************************
  • var tmdColor1 = new Array();
  • tmdColor1[0] = "#d1ffd1" ;
  • tmdColor1[1] = "#ffbbbb";
  • tmdColor1[2] = "#ffe3bb";
  • tmdColor1[3] = "#cff4f3";
  • tmdColor1[3] = "#cff4f3";
  • tmdColor1[ 4] = "# d9d9e5";
  • tmdColor1[5] = "#ffc7ab";
  • tmdColor1[6] = "#ecffb7";
  • tmdor1[7] = "#97bbd" ;
  • tmdColor1[8] = "#009900";
  • tmdColor1[9] = "#cc3300";
  • tmdColor1[10] = "#ffcc00";
  • tmdColtmdColor1[10] = "#ffcc00";
  • tmdColtmor1[11] = " 3366cc";
  • tmdColor1[12] = "#33cc33";
  • tmdColor1[13] = "#ff9933";
  • tmdColor1[14] = "#cc99";tmdColor1 [16] = "#66ff99";
  • tmdColor1[17] = "#4f6600";
  • tmdColor1[18] = "#481000";
  • tmdColor1[18] = "#481000"; ] = "# 7d6400";
  • tmdColor1[20] = "#173064";
  • tmdColor1[21] = "#173064";
  • tmdColor1[22] = "#173064";
  • tmdColor1[22] = "#1a6a1a";
  • tmdColor1[22] = "#1a6a1a」; [23] = “#974b00”;
  • tmdColor1[24] = "#78793c";
  • tmdColor1[25] = "#557e27";
  • tmdColor1[26] = "#009337";
  • tmdColor1[26] = "#009337";
  • var tmdor2 = new Ar
  • tmdColor2[0] = "#00ff00";
  • tmdColor2[1] = "#ff0000";
  • tmdColor2[2] = "#ff9900";tmdorColcc2[3] = "#333cc ";
  • tmdColor2[4] = "#666699";
  • tmdColor2[5] = "#993300";
  • tmdColor2[6] = "#99cc00";
  • dtmdColor2[6] = "#99cc00";
  • dtmdor2[7] =f #97bd00";
  • tmdColor2[8] = "#009900";
  • tmdColor2[9] = "#cc3300";
  • tmdColor2[10] = "#ffcc00"; = "#3366cc";
  • tmdColor2[12] = "#33cc33";
  • tmdColor2[13] = "#ff9933";
  • tmdColor2[14] = "#cc99";tmdColor2[16] = "#66ff99";
  • tmdColor2[17] = "#4f6600";
  • tmdColor2[18] = "#4f6600";
  • tmdColor2[18] = "#481000"; tmdColor2[19] = "#7d6400";
  • tmdColor2[20] = "#173064";
  • tmdColor2[21] = "#173064";
  • tmdColor2[21] = "#173064";
  • tmdColor2[22] = "#17366a; 🎜>tmdColor2[23] = "#974b00";
  • tmdColor2[24] = "#78793c";
  • tmdColor2[25] = "#557e27";
  • tmdColor2[25] = "#557e27";
  • tmdColor2[25] = "#557e27";
  • tmdColor2[25] =Col#209333370 ;
  • var tb_color = new Array(tmdColor1,tmdColor2);
  • var line_color = "#69f";
  • var left_width = 70;
  • var length = 厚度/2;
  • var Total_no總共[0].length;
  • var temp1 = 0;
  • var temp2,temp4,temp4;
  • for(var i = 0;i{
  • if( temp1{
  • temp1 = Total[0][i];
  • }
  • }
  • temp1 = parseInt(temp1.toString());
  • if(temp1>9)
  • {
  • temp2 = temp1.toString().substr(1,1)
  • if(temp2>4){temp3 = (parseInt( (temp1/(Math.pow(10,(temp1.toString().length-1))))).toString())+1)*Math.pow(10,(temp1.toString().length-1) );}
  • else
  • {
  • temp3 = (parseInt((temp1/(Math.pow(10,(temp1.toString().length-1)))).toString())+0.5)*Math .pow(10,(temp1.toString().length-1));
  • }
  • }
  • else
  • {
  • if(temp1>4)
  • temp3 = 10;
  • else
  • temp3 = 5;
  • }
  • temp4=temp3
  • document.write("");
  • document.write("");
  • document.write ( "");
  • 開關(table_type)
  • {
  • case "A":
  • var table_space = (all_width-table_width*total_no)/total_no ;
  • document.write("");
  • for(var i=0 ; i{
  • document.write( "");
  • document.write( "");
  • document.write("");
  • document.write( "");
  • document.write("");
  • document.write (" " + temp4 + "
  • " );
  • temp4 = temp4-temp3/5;
  • }
  • for(var i=0;i{
  • var temp_space = table_x + left_width + table_space / 2 + table_space * i + table_width * i;
  • document.write("; " );
  • document.write("")
  • document .write( "" );
  • document.write("
  • ");
  • document.write("");
  • document.write("" + 總計[0][i] + "
  • ");
  • document.write("");
  • document.write("" + 總計[1][ i] + "
  • ");
  • }
  • break;
  • case " B":
  • var table_space = (all_height - table_width * Total_no) / Total_no;
  • document.write( "");
  • for(var i=0;i {
  • document.write("");
  • document.write("");
  • 文件。text-align :left;top:0 ;翻轉:y;z-index:-1' from='" + (table_x+left_width+i+all_width/5) + "px," + (table_y+all_height) + " px' to ='" + (table_x +left_width+i+all_width/5) + "px," + (table_y+all_height+15) + "px'/>");
  • document. write(" ");
  • temp4 = temp4 - temp3 / 5;
  • }
  • for(var i=0;i{
  • var temp_space = table_space/2 + table_space * i + table_width * i;
  • document.write("");
  • document.write("");
  • document.write("");
  • document.write(" v:rect>");
  • document.write("");
  • document.write("" + 總計[0][i] + " tr>
  • " );
  • document.write("");
  • document.write("" + 總計[1][i] + "
  • ");
  • }
  • }
  • }

  • 本網站聲明
    本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

    熱AI工具

    Undresser.AI Undress

    Undresser.AI Undress

    人工智慧驅動的應用程序,用於創建逼真的裸體照片

    AI Clothes Remover

    AI Clothes Remover

    用於從照片中去除衣服的線上人工智慧工具。

    Undress AI Tool

    Undress AI Tool

    免費脫衣圖片

    Clothoff.io

    Clothoff.io

    AI脫衣器

    AI Hentai Generator

    AI Hentai Generator

    免費產生 AI 無盡。

    熱門文章

    R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
    3 週前 By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O.最佳圖形設置
    3 週前 By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O.如果您聽不到任何人,如何修復音頻
    3 週前 By 尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25:如何解鎖Myrise中的所有內容
    4 週前 By 尊渡假赌尊渡假赌尊渡假赌

    熱工具

    記事本++7.3.1

    記事本++7.3.1

    好用且免費的程式碼編輯器

    SublimeText3漢化版

    SublimeText3漢化版

    中文版,非常好用

    禪工作室 13.0.1

    禪工作室 13.0.1

    強大的PHP整合開發環境

    Dreamweaver CS6

    Dreamweaver CS6

    視覺化網頁開發工具

    SublimeText3 Mac版

    SublimeText3 Mac版

    神級程式碼編輯軟體(SublimeText3)

    php中的捲曲:如何在REST API中使用PHP捲曲擴展 php中的捲曲:如何在REST API中使用PHP捲曲擴展 Mar 14, 2025 am 11:42 AM

    PHP客戶端URL(curl)擴展是開發人員的強大工具,可以與遠程服務器和REST API無縫交互。通過利用Libcurl(備受尊敬的多協議文件傳輸庫),PHP curl促進了有效的執行

    在Codecanyon上的12個最佳PHP聊天腳本 在Codecanyon上的12個最佳PHP聊天腳本 Mar 13, 2025 pm 12:08 PM

    您是否想為客戶最緊迫的問題提供實時的即時解決方案? 實時聊天使您可以與客戶進行實時對話,並立即解決他們的問題。它允許您為您的自定義提供更快的服務

    解釋PHP中晚期靜態結合的概念。 解釋PHP中晚期靜態結合的概念。 Mar 21, 2025 pm 01:33 PM

    文章討論了PHP 5.3中介紹的PHP中的晚期靜態結合(LSB),允許靜態方法的運行時間分辨率調用以更靈活的繼承。 LSB的實用應用和潛在的觸摸

    在PHP API中說明JSON Web令牌(JWT)及其用例。 在PHP API中說明JSON Web令牌(JWT)及其用例。 Apr 05, 2025 am 12:04 AM

    JWT是一種基於JSON的開放標準,用於在各方之間安全地傳輸信息,主要用於身份驗證和信息交換。 1.JWT由Header、Payload和Signature三部分組成。 2.JWT的工作原理包括生成JWT、驗證JWT和解析Payload三個步驟。 3.在PHP中使用JWT進行身份驗證時,可以生成和驗證JWT,並在高級用法中包含用戶角色和權限信息。 4.常見錯誤包括簽名驗證失敗、令牌過期和Payload過大,調試技巧包括使用調試工具和日誌記錄。 5.性能優化和最佳實踐包括使用合適的簽名算法、合理設置有效期、

    框架安全功能:防止漏洞。 框架安全功能:防止漏洞。 Mar 28, 2025 pm 05:11 PM

    文章討論了框架中的基本安全功能,以防止漏洞,包括輸入驗證,身份驗證和常規更新。

    自定義/擴展框架:如何添加自定義功能。 自定義/擴展框架:如何添加自定義功能。 Mar 28, 2025 pm 05:12 PM

    本文討論了將自定義功能添加到框架上,專注於理解體系結構,識別擴展點以及集成和調試的最佳實踐。

    如何用PHP的cURL庫發送包含JSON數據的POST請求? 如何用PHP的cURL庫發送包含JSON數據的POST請求? Apr 01, 2025 pm 03:12 PM

    使用PHP的cURL庫發送JSON數據在PHP開發中,經常需要與外部API進行交互,其中一種常見的方式是使用cURL庫發送POST�...

    See all articles