0

0

php折线图、饼状图、柱状图的生成实例

php中文网

php中文网

发布时间:2016-07-25 08:55:28

|

1302人浏览过

|

来源于php中文网

原创

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

  2. var tb_height = 30;
  3. var total_no = total[0].length;
  4. var totalpie = 0;
  5. for(var i=0;i{
  6. total[1][i]*=100;
  7. totalpie += total[1][i];
  8. }
  9. var PreAngle = 0;
  10. for(var i=0;i{
  11. document.write("");
  12. PreAngle += total[1][i] / totalpie;
  13. }
  14. if(table_type=="A")
  15. {
  16. document.write("");
  17. for(var i=0;i{
  18. document.write("");
  19. document.write("
    " + total[0][i] + "
  20. ");
  21. document.write("");
  22. //显示比例数
  23. document.write("");
  24. document.write("
    " + Math.round(parseFloat(total[1][i]*100/totalpie)*100)/100 + "%
  25. ");
  26. }
  27. }
  28. if(table_type == "B")
  29. {
  30. var pie = 3.14159265358979;
  31. var TempPie = 0;
  32. for(var i=0;i{
  33. var TempAngle = pie * 2 * (total[1][i] / (totalpie * 2) + TempPie);
  34. var x1 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/8;
  35. var y1 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/8;
  36. var x2 = table_x + all_width/2 + Math.cos(TempAngle) * all_width * 3/4;
  37. var y2 = table_y + all_height/2 - Math.sin(TempAngle) * all_height * 3/4;
  38. if(x2>table_x + all_width/2)
  39. {
  40. x3 = x2 + 20;
  41. x4 = x3;
  42. }
  43. else
  44. {
  45. x3 = x2 - 20;
  46. x4 = x3 - 100;
  47. }
  48. document.write("");
  49. document.write("");
  50. document.write("");
  51. document.write("");
  52. document.write("
    " + total[0][i] + " " + Math.round(parseFloat(total[1][i] * 100/ totalpie)*100)/100 + "%
  53. ")
  54. TempPie += total[1][i]/totalpie;
  55. }
  56. }
  57. }
  58. //-->
");
  • 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]))
  • {
  • case 1:
  • break;
  • case 2:
  • document.write("");
  • break;
  • case 3:
  • document.write("");
  • break;
  • case 4:
  • document.write("");
  • break;
  • case 5:
  • document.write("");
  • break;
  • case 6:
  • document.write("");
  • break;
  • case 7:
  • document.write("");
  • break;
  • }
  • document.write("
  • ");
  • switch (parseInt(line_code[j-1][3]))
  • {
  • case 1:
  • break;
  • case 2:
  • document.write("");
  • break;
  • case 3:
  • document.write("");
  • break;
  • }
  • }
  • switch (parseInt(line_code[j-1][3]))
  • {
  • case 1:
  • break;
  • case 2:
  • document.write("");
  • break;
  • case 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("");
  • }
  • }

  • 相关文章

    PHP速学教程(入门到精通)
    PHP速学教程(入门到精通)

    PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

    下载

    本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

    相关专题

    更多
    Java 项目构建与依赖管理(Maven / Gradle)
    Java 项目构建与依赖管理(Maven / Gradle)

    本专题系统讲解 Java 项目构建与依赖管理的完整体系,重点覆盖 Maven 与 Gradle 的核心概念、项目生命周期、依赖冲突解决、多模块项目管理、构建加速与版本发布规范。通过真实项目结构示例,帮助学习者掌握 从零搭建、维护到发布 Java 工程的标准化流程,提升在实际团队开发中的工程能力与协作效率。

    11

    2026.01.12

    c++主流开发框架汇总
    c++主流开发框架汇总

    本专题整合了c++开发框架推荐,阅读专题下面的文章了解更多详细内容。

    106

    2026.01.09

    c++框架学习教程汇总
    c++框架学习教程汇总

    本专题整合了c++框架学习教程汇总,阅读专题下面的文章了解更多详细内容。

    64

    2026.01.09

    学python好用的网站推荐
    学python好用的网站推荐

    本专题整合了python学习教程汇总,阅读专题下面的文章了解更多详细内容。

    139

    2026.01.09

    学python网站汇总
    学python网站汇总

    本专题整合了学python网站汇总,阅读专题下面的文章了解更多详细内容。

    13

    2026.01.09

    python学习网站
    python学习网站

    本专题整合了python学习相关推荐汇总,阅读专题下面的文章了解更多详细内容。

    19

    2026.01.09

    俄罗斯手机浏览器地址汇总
    俄罗斯手机浏览器地址汇总

    汇总俄罗斯Yandex手机浏览器官方网址入口,涵盖国际版与俄语版,适配移动端访问,一键直达搜索、地图、新闻等核心服务。

    93

    2026.01.09

    漫蛙稳定版地址大全
    漫蛙稳定版地址大全

    漫蛙稳定版地址大全汇总最新可用入口,包含漫蛙manwa漫画防走失官网链接,确保用户随时畅读海量正版漫画资源,建议收藏备用,避免因域名变动无法访问。

    480

    2026.01.09

    php学习网站大全
    php学习网站大全

    精选多个优质PHP入门学习网站,涵盖教程、实战与文档,适合零基础到进阶开发者,助你高效掌握PHP编程。

    52

    2026.01.09

    热门下载

    更多
    网站特效
    /
    网站源码
    /
    网站素材
    /
    前端模板

    精品课程

    更多
    相关推荐
    /
    热门推荐
    /
    最新课程
    关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
    php中文网:公益在线php培训,帮助PHP学习者快速成长!
    关注服务号 技术交流群
    PHP中文网订阅号
    每天精选资源文章推送

    Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号