惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
S
Securelist
博客园 - Franky
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
The Cloudflare Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
AI
AI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Schneier on Security
Schneier on Security
Attack and Defense Labs
Attack and Defense Labs
Vercel News
Vercel News
腾讯CDC
Google DeepMind News
Google DeepMind News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
N
Netflix TechBlog - Medium
量子位
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
Cyberwarzone
Cyberwarzone
S
Security Affairs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
N
News and Events Feed by Topic
T
Tenable Blog
PCI Perspectives
PCI Perspectives
MyScale Blog
MyScale Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
W
WeLiveSecurity
N
News | PayPal Newsroom
P
Proofpoint News Feed
O
OpenAI News
C
CERT Recently Published Vulnerability Notes
B
Blog
Cisco Talos Blog
Cisco Talos Blog
Microsoft Security Blog
Microsoft Security Blog
V
Visual Studio Blog
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
Arctic Wolf
Y
Y Combinator Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Spread Privacy
Spread Privacy

博客园 - 溺水妖精

连载暂时停止,因为要打官司^^在这里谢谢各位的支持啦! 徒给别人做嫁衣——与人共同创业(1) 好久没来了^^来看看,顺便整理一下我这几年的经历 那年的那一场雪 写给未来的孩子-----孩子不要怨恨,不要气馁,每个人都有自己的无奈,每个人都有受伤的时候,学会宽容,学会忍耐,学会善待自己和他人..... 好久没来写什么东西了:(鄙视下自己~~ 打开一个应用程序~~ - 溺水妖精 - 博客园 学习笔记1 5555~~~晕了晕了~~~object类型的相等问题~~~ - 溺水妖精 - 博客园 刚才在博客堂看到的:( 今天从HELLO,WORLD开始! 55555555~~今天夸下海口,不学C#都不行了~~ 最近好倒霉哦!!!!!!!555555555555555555555555 今天是妇女节,一定要去采购,女人用的东西都打折:) 蓝冰 MYSQL和MSSQL修改密码总结----在此感谢一直帮助我的J9988大叔 一个男人的话 随想----真的是断翼天使~~ 周末了,好幸福哦!!!HOHO~~~~~~~~~~~~~~~~~~~~~
下午没有什么事情,就做了个数值统计直方图,好玩,哈
溺水妖精 · 2004-03-08 · via 博客园 - 溺水妖精

    如果经理看到我工作时间做其他的非要气死不可
    最近不知怎的,和GD2较上劲了,喜欢上用他画图玩了,哈~~

    其实做直方图,就是计算坐标,除此之外没有什么难的。
    而我笨笨的认为象X、Y一样,下面的数值小,上面的大结果发现自己脑袋坏掉了,图片也好、屏幕也好,都是左上角为原点的。
   
    这个就是我做出来的图,有点垃圾,嘿嘿,偶是没有美感啦,不然就去做美工了。。。


以下是代码:

   //在图中表示的统计分析数字,目前最多只能分析5组数居(在实际应用中,可以用百分比算)
$values=array(100,300,120,77,230);
Header("Content-type: image/gif");
$im = imagecreate(400,400);
//颜色
$WHITE=ImageColorAllocate($im, 250,250,250);
$black=ImageColorAllocate($im, 0,0,0);
$grey=ImageColorAllocate($im, 150,150,150);
$Blue=imagecolorallocate($im, 184, 212, 250);
$Red=imagecolorallocate($im, 255, 0, 0);
//原点坐标
$min=array(50,350);
//最大点坐标
$max=array(350,50);
//柱体的间隔距离
$space=20;
//柱体的宽度
$weith=30;

ImageRectangle($im,$min[0],$min[1],$max[0],$max[1],$grey);
//画格线并在左侧写出相应的数值
for($i=1;$i<10;$i+=1){
   $y=$i*30;
   imagestring($im,5,$min[0]-35,$min[1]-$y,$y,$black);
   ImageLine($im,$min[0]+$y,$min[1],$min[0]+$y,$max[1],$grey);
   ImageLine($im,$min[0],$max[1]+$y,$max[0],$max[1]+$y,$grey);
}
imagestring($im,5,$min[0]-35,$min[1]-$y-30,$y+30,$black);

//根据数字绘制直方图
for($i=0;$i<5;$i++){
   $y=10+$i*60;
   imagefilledrectangle($im,($min[0]+$space),($min[1]-$values[$i]),($min[0]+$weith+$space+7),$min[1]-1,$grey);
   imagefilledrectangle($im,($min[0]+$space),($min[1]-$values[$i]+1),($min[0]+$weith+$space),$min[1]-1,$Blue);
   imagestring($im,5,$min[0]+$y,$min[1]+10,"200".$i."Y",$Red);
   $space=$space+$weith+30;
}

ImagePNG($im);
ImageDestroy($im);