IE下的3D统计图之柱状图(VML实现)
这是07年初写的,直到现在还经常有人发信来要代码,在这里提供吧:) 以前的博客不能上传附件。
一个项目需要在IE(这个项目没有支持firefox等浏览器的需求)上呈现3D统计图。
最初的解决方案是:用jfreechart等生成3D图,在页面上显示。
缺陷:加入链接、事件等比较不方便
改进后的解决方案:用flash画3D图,然后调用object显示。
缺陷:调用的页面已经有很多flash object了(一些复杂的需要交互的统计图,不得不用flash做,如:地图等),导致页面载入很慢。
于是想到能不能用vml来做。当时还不像现在那么忙,空闲时间比较多。于是抽空写了一个vml的3D柱状图。缺陷也是非常明显:不支持IE以外的浏览器,甚至我在IE7下面还没有测试过。
由于项目工期紧,flash的方案已经通过严格的测试了,所以最后没有采用vml的方案,我写的这个东西到一半也就夭折了。所幸还能给出一个demo。给需要的人吧。
纵向效果图:
横向效果图:
可能有的朋友见过这个图,这个是从网上找的一个效果修改的,原作者是龚鸣。大家可以上网搜到他最初的代码。
除了显示效果,其它的东西我都重写了。主要改进如下:
- 支持位置控制。可以嵌入到页面的任何地方。对于嵌入的容器(div等),可以支持css控制。龚鸣的版本是没办法做到的,使用的是绝对位置。
- 重写数据定义方式:以前是数组,现在用json
- 重写调用方式:面向对象
- 支持数据重用
- 柱状图和文字过长,可自动用…代替,同时柱子和文字都支持链接、事件等。
调用方式如下:
// 初始化数据,json var d = '[{"value":"201","name":"阿里巴巴 报价 中华 版权 代理 ","id":"12661_61","url":"http://www.baidu.com","target":"_blank"},{"value":"43","name":"公积金贷款存款职工专家 ","id":"12661_49","behavior":"active(this)"},{"value":"42","name":"美国伊拉克华盛顿五角大楼越战 ","id":"12651_32"},{"value":"26","name":"单位广州房价 政府市长 ","id":"12671_29"},{"value":"26","name":"学生学校泰国 寄宿警方 ","id":"12651_40"}]'; var data = eval('('+d+')'); // 初始化柱状图 var h = new Histogram(data,340,280); // 一些属性 h.setTitle('当日前五热点统计图'); h.setNameLabel('主题名称'); h.setValueLabel('文档数量'); // 画图 h.draw('m','V'); |
本来打算加上svg,以支持非ie的浏览器。但是由于时间关系,仅仅这个vml版本的很多已知问题都没有纠正。我想我近期也没有精力来做这个了。放出来,需要的人拿去用吧~~
尽管代码我完全重写了,但是显示效果还是要注明来自网友龚鸣和绝对零度(awaysrain)。
以前没有用过vml,也就看了一会书,2007年也是刚开始做web,没有写过太多javascript,这里就算一个demo吧。




七月 23rd, 2009 at 19:49
比我用java画的柱状图强多了…
[回复]
Codigg 回复:
七月 23rd, 2009 at 20:19
过奖..不过这个是用vml做的,只能在ie下用。
[回复]
三月 10th, 2011 at 13:13
Awesome post – keep up the good work.
[回复]
六月 3rd, 2011 at 14:48
Polish Dating Updates…
[...]we like to help out other sites, even if they aren’t related to us, by linking to them. Below are some sites worth checking out[...]…
六月 3rd, 2011 at 16:18
Mortgage Rates…
[...]here are some links to sites that we link to because we think they are worth visiting[...]…
六月 6th, 2011 at 15:16
The an important effectively writen in addition to thorough present everyone manufactured. Almost certainly you’re going to get a great deal targeted traffic who product someone with your talks. Following overlooking this post I purchased this breadmaker quite a few quite several information which is often actually an important incentive proper. It’s a putting up resulting in a small amount of significant hints
[回复]
七月 21st, 2011 at 09:38
Occasionally its better to take a stride back again and also realize that not everyone explains to you your values
[回复]
一月 13th, 2012 at 20:54
Your ugg boot’s delicate sheepskin fleece coat molds in the way of their wearer’s base uggs for kids apparel
[回复]
一月 14th, 2012 at 03:16
youtube muzica latino
[回复]
一月 14th, 2012 at 13:06
Attractive section of content. I just stumbled upon your weblog and in accession capital to assert that I get in fact enjoyed account your blog posts. Anyway I’ll be subscribing to your feeds and even I achievement you access consistently quickly.
[回复]
一月 18th, 2012 at 06:02
for instance shoes cheap uggs canada One of them is UGG Boots Classic Cardy
[回复]
一月 19th, 2012 at 23:38
because its traditional style and wispy artistic conception louis vuitton handbagsLV handbag make their life become more colorful
[回复]
一月 23rd, 2012 at 15:07
Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is great, as well as the content!. Thanks For Your article about IE下的3D统计图之柱状图(VML实现) – CODIGG .
[回复]
一月 23rd, 2012 at 15:07
Wow, wonderful blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is wonderful, let alone the content!. Thanks For Your article about IE下的3D统计图之柱状图(VML实现) – CODIGG .
[回复]
一月 23rd, 2012 at 15:07
Wow, marvelous blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your web site is wonderful, let alone the content!. Thanks For Your article about IE下的3D统计图之柱状图(VML实现) – CODIGG .
[回复]
一月 23rd, 2012 at 16:23
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this web site by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my trouble. You’re amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGG Best Regards Veronica Lawrence
[回复]
一月 26th, 2012 at 16:50
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Cassetta
[回复]
一月 26th, 2012 at 18:50
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my problem. You are amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGG Best Regards Shane Andy
[回复]
一月 26th, 2012 at 19:17
IE下的3D统计图之柱状图(VML实现) – CODIGG I was recommended this web site by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my problem. You’re incredible! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Lisa
[回复]
一月 26th, 2012 at 19:36
Hello There. I found your blog using msn. This is an extremely well written article. I will make sure to bookmark it and come back to read more of IE下的3D统计图之柱状图(VML实现) – CODIGG . Thanks for the post. I will definitely comeback.
[回复]
一月 26th, 2012 at 19:52
I got what you mean, thanks for swing up. Woh I am willing to gain this website finished google. Thanks For Share IE下的3D统计图之柱状图(VML实现) – CODIGG.
[回复]
一月 27th, 2012 at 02:08
You’re strongly suggested to check the interior before the purchase cheap chanel boots.
[回复]
一月 27th, 2012 at 15:17
1st decide on the web shop that may be certified by simply chanel shoes to trade his or her distinctive solutions.
[回复]
一月 27th, 2012 at 17:20
Fantastic goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I’ve understand your stuff previous to and you are just too wonderful. I really like what you have acquired here, certainly like what you’re stating and the way in which you say it. You make it entertaining and you still care for to keep it sensible. I can’t wait to read much more from you. This is actually a terrific IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
一月 27th, 2012 at 18:36
Great goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I have understand your stuff previous to and you are just too fantastic. I actually like what you have acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still take care of to keep it sensible. I can’t wait to read much more from you. This is actually a tremendous IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
一月 27th, 2012 at 19:13
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my problem. You are amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Lawrence
[回复]
一月 28th, 2012 at 13:49
Not knowing your clients’ way of learning (auditive coach shoes a life decision
[回复]
一月 28th, 2012 at 15:13
Wonderful goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I’ve understand your stuff previous to and you are just extremely magnificent. I actually like what you have acquired here, certainly like what you’re saying and the way in which you say it. You make it enjoyable and you still take care of to keep it smart. I can not wait to read far more from you. This is actually a tremendous IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
一月 28th, 2012 at 16:30
Great goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I have understand your stuff previous to and you’re just extremely fantastic. I actually like what you’ve acquired here, really like what you are stating and the way in which you say it. You make it entertaining and you still take care of to keep it wise. I cant wait to read much more from you. This is really a tremendous IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
一月 28th, 2012 at 17:06
I got what you signify, thanks for swing up. Woh I am cheerful to regain this website finished google. Thanks For Share IE下的3D统计图之柱状图(VML实现) – CODIGG.
[回复]
一月 28th, 2012 at 18:49
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this website by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are wonderful! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGG Best Regards Veronica Shane
[回复]
一月 29th, 2012 at 03:23
This way they can mix and match them to different lv pursescolors in their wardrobe.
[回复]
一月 29th, 2012 at 03:23
coach outlet store provides totes aren’t the only real issue is actually which energy. THE pipe from the coach is the greatest spot to appear.
[回复]
一月 29th, 2012 at 13:11
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my trouble. You are wonderful! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Cassetta
[回复]
一月 29th, 2012 at 15:06
IE下的3D统计图之柱状图(VML实现) – CODIGG I was recommended this web site by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my trouble. You’re amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Yoder
[回复]
一月 29th, 2012 at 15:07
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this website by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my problem. You are amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Shane
[回复]
一月 29th, 2012 at 17:14
I got what you convey, thanks for putting up. Woh I am pleased to experience this website finished google. Thanks For Share IE下的3D统计图之柱状图(VML实现) – CODIGG.
[回复]
一月 29th, 2012 at 19:55
IE下的3D统计图之柱状图(VML实现) – CODIGG I was recommended this blog by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my trouble. You are amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGG Best Regards Craig Lawrence
[回复]
一月 30th, 2012 at 15:45
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You’re incredible! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Nick
[回复]
一月 30th, 2012 at 19:47
IE下的3D统计图之柱状图(VML实现) – CODIGG I was recommended this website by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my difficulty. You are wonderful! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Cassetta
[回复]
一月 30th, 2012 at 20:56
Hey There. I found your blog using msn. This is a really well written article. I will make sure to bookmark it and come back to read more of IE下的3D统计图之柱状图(VML实现) – CODIGG . Thanks for the post. I’ll definitely comeback.
[回复]
一月 30th, 2012 at 20:59
Hello There. I found your blog using msn. This is a very well written article. I will make sure to bookmark it and return to read more of IE下的3D统计图之柱状图(VML实现) – CODIGG . Thanks for the post. I’ll definitely return.
[回复]
一月 30th, 2012 at 23:57
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this website by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are wonderful! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGG Best Regards Rolf Rolf
[回复]
一月 31st, 2012 at 05:59
I was more than happy to see this internet page! ! ! ! I wanted to give thanks to you for your energy and time intended for this amazing content. . . . My partner and I unquestionably taking advantage of every little piece of this and also, I have this post saved to fav to check out out brand new issues you write.
[回复]
一月 31st, 2012 at 07:06
Very neat article posting.Thanks a lot Again.
[回复]
一月 31st, 2012 at 13:31
I got what you intend, thanks for putting up. Woh I am cheerful to make this website finished google. Thanks For Share IE下的3D统计图之柱状图(VML实现) – CODIGG.
[回复]
一月 31st, 2012 at 18:10
Fantastic goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I’ve understand your stuff previous to and you are just extremely magnificent. I really like what you have acquired here, really like what you’re saying and the way in which you say it. You make it entertaining and you still care for to keep it sensible. I cant wait to read far more from you. This is really a great IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
一月 31st, 2012 at 18:52
Magnificent goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I have understand your stuff previous to and you are just too great. I actually like what you’ve acquired here, really like what you’re stating and the way in which you say it. You make it enjoyable and you still care for to keep it smart. I can’t wait to read much more from you. This is really a terrific IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
一月 31st, 2012 at 20:36
Hey There. I found your blog using msn. This is a really well written article. I will make sure to bookmark it and come back to read more of IE下的3D统计图之柱状图(VML实现) – CODIGG . Thanks for the post. I will certainly return.
[回复]
一月 31st, 2012 at 20:45
IE下的3D统计图之柱状图(VML实现) – CODIGG I was suggested this website by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You’re wonderful! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Veronica
[回复]
二月 1st, 2012 at 13:20
IE下的3D统计图之柱状图(VML实现) – CODIGG I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are amazing! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGGBest Regards Lisa
[回复]
二月 1st, 2012 at 15:54
Hello There. I found your blog using msn. This is a very well written article. I will make sure to bookmark it and return to read more of IE下的3D统计图之柱状图(VML实现) – CODIGG . Thanks for the post. I will certainly return.
[回复]
二月 1st, 2012 at 21:01
outstanding weblog, As I unquestionably like this website, thanks
[回复]
二月 2nd, 2012 at 00:41
I will be optimistic coach handbagsyou’ll want observed plenty of people communicate great end result tour bus, yet you think actually know very well what the common lower price instructors coming from?
[回复]
二月 2nd, 2012 at 13:33
This is the rectify IE下的3D统计图之柱状图(VML实现) – CODIGG blog for anyone who wants to attempt out out virtually this content. You observe so some its near exhausting to reason with you (not that I rattling would want…HaHa). You definitely put a new rotate on a matter thats been transcribed most for years. Precise squeeze, simply high!
[回复]
二月 2nd, 2012 at 13:35
This is the punish IE下的3D统计图之柱状图(VML实现) – CODIGG blog for anyone who wants to act out out around this content. You react so overmuch its most effortful to present with you (not that I truly would want…HaHa). You definitely put a new gyrate on a issue thats been inscribed virtually for period. Prissy force, but large!
[回复]
二月 2nd, 2012 at 20:31
Great goods from you, man. IE下的3D统计图之柱状图(VML实现) – CODIGG I have understand your stuff previous to and you are just extremely magnificent. I actually like what you’ve acquired here, really like what you’re stating and the way in which you say it. You make it entertaining and you still care for to keep it wise. I cant wait to read much more from you. This is really a terrific IE下的3D统计图之柱状图(VML实现) – CODIGG informations.
[回复]
二月 2nd, 2012 at 20:47
I got what you will, thanks for putting up. Woh I am glad to label this website finished google. Thanks For Share IE下的3D统计图之柱状图(VML实现) – CODIGG.
[回复]
二月 2nd, 2012 at 20:47
I got what you intend, thanks for putting up. Woh I am willing to deed this website finished google. Thanks For Share IE下的3D统计图之柱状图(VML实现) – CODIGG.
[回复]
二月 2nd, 2012 at 21:04
IE下的3D统计图之柱状图(VML实现) – CODIGG I was recommended this blog by my cousin. I’m not sure whether this post is written by him as no one else know such detailed about my trouble. You are incredible! Thanks! your article about IE下的3D统计图之柱状图(VML实现) – CODIGG Best Regards Lawrence Veronica
[回复]
二月 3rd, 2012 at 07:44
You are a very smart individual!
[回复]
二月 3rd, 2012 at 14:06
This is the rectify IE下的3D统计图之柱状图(VML实现) – CODIGG blog for anyone who wants to act out out around this substance. You attention so more its almost debilitating to discourse with you (not that I rattling would want…HaHa). You definitely put a new whirl on a message thats been printed nearly for eld. Squeamish sundries, only majuscule!
[回复]
二月 3rd, 2012 at 23:13
This is the penalize IE下的3D统计图之柱状图(VML实现) – CODIGG blog for anyone who wants to essay out out almost this issue. You attending so often its most effortful to contend with you (not that I real would want…HaHa). You definitely put a new aerobatics on a matter thats been graphic near for age. Respectable congest, but uppercase!
[回复]
二月 4th, 2012 at 00:02
Hey There. I found your blog using msn. This is a really well written article. I’ll be sure to bookmark it and return to read more of IE下的3D统计图之柱状图(VML实现) – CODIGG . Thanks for the post. I will certainly return.
[回复]
二月 4th, 2012 at 10:51
Terrific paintings! This is the kind of info that are meant to be shared around the net. Disgrace on the seek engines for now not positioning this publish upper! Come on over and discuss with my site . Thanks =) Maxim London Escorts, 16, Hindon Court, 104 Wilton Road, London, SW1V 1DU, 020 3011 2980
[回复]
二月 4th, 2012 at 19:47
chanel purse created Cabas by using leather, silk or fur.
[回复]
二月 5th, 2012 at 13:19
This is the right IE下的3D统计图之柱状图(VML实现) – CODIGG journal for anyone who wants to act out out most this issue. You note so such its nigh tiring to argue with you (not that I truly would want…HaHa). You definitely put a new stunting on a theme thats been codified around for geezerhood. Good lug, just major!
[回复]