Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java程序分享区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to topicflat modethreaded modego to previous topicgo to next topicgo to back
作者 在JSP页面中显示JFReeChart 3D图片的位置问题。。。
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-09-13 19:32 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我用jfreechart生成的3D PIE图片如下:



作者 在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-09-13 19:35 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
现在我想让图片显示在页面中间,如下图所示:
那么应该怎样修改源代码呢?或者有其他比较简单一点的方法也可以



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-09-13 19:37 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我只想到可以用三种方法:
1)是先生成PNG格式的图片,然后保存到一文件夹中。然后在JSP页面引用这张图片,就可以将其放到页面的任意位置了。但是由于此JSP页面需要生成许多不同的3D PIE图,而且有多用户来生成。如果生成的文件名是随机的,那么是能够实现的,只是此文件夹下的图片会越来越多,膨胀比较迅速。当然可以采取先生成后删除的方法,但是由于本人能力非常有限,感觉无从下手。好像JFREECHART本身就是这么做的。
2)和1)有些类似,先生成PNG格式的图片,然后保存到一文件夹中。然后在JSP页面引用这张图片。只是生成的文件名固定,这样当某一用户点击新链接生成某一图片时,会覆盖以前的图片。也就是说文件名不变,但是内容已经改变。这里又有一个问题:就是文件夹中的图片能迅速更新,但是显示在JSP页面上的图片却不是实时更新的。以为是刷新的问题,于是让程序每一次都强制刷新一次,问题依旧。但是如果让点击不同的链接之间的时间间隔长一些(比如5秒),是会看到图片更新的。不只问题在何处。
3)就是改源代码了。但本人能力非常有限,感觉很困难。

诚请各位大侠帮帮忙,能修改源代码最好,有其他比较简单可行的方法也可。谢谢!!!



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
lihongtao





发贴: 131
于 2004-09-14 09:11 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
使用cewolf很容易的,根本不需要生成文件:
1. 在web.xml中配置cewolf
<servlet>
<servlet-name>CewolfServlet</servlet-name>
<servlet-class>de.laures.cewolf.CewolfRenderer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CewolfServlet</servlet-name>
<url-pattern>/cewolf/*</url-pattern>
</servlet-mapping>
2. 在后台action(我用的是struts)中处理数据并放到request中:
CommonPie pie = new CommonPie();
...
...
...
request.setAttribute("pieDS", pie);
然后forward到目的jsp
3. 在jsp中使用cewolf tag:
<cewolf:chart id="pie" title="人员学历构成图" type="pie3d" xaxislabel="Page" yaxislabel="Views">
<cewolf:data>

<cewolf:producer id="pieDS">
<cewolf:param name="hql" value='<%= "select countStart, ac01.aac011 from PersonAC01 as ac01 group by ac01.aac011" %>'/>
<cewolf:param name="codeList" value='<%= "aac011" %>'/>
</cewolf:producer>
</cewolf:data>
</cewolf:chart>
<p>
<cewolf:img chartid="pie" height="500" width="600" renderer="/cewolf">
<cewolf:map tooltipgeneratorid="pieToolTipGenerator" linkgeneratorid="pieLinkGenerator"/>
</cewolf:img>
cewolf:img标签嵌在table中就可以任意定位



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-09-14 17:28 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
谢谢lihongtao!

下载cewolf试试看。



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-09-21 15:03 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这个cewolf用的也是JFreeChart画的图,只是加了JSP标签而已。而我学艺不精,看到JSP标签就头痛!

请教大家能否用上面我列的第二种方法给予解决啊?即:

和1)有些类似,先生成PNG格式的图片,然后保存到一文件夹中。然后在JSP页面引用这张图片。只是生成的文件名固定,这样当某一用户点击新链接生成某一图片时,会覆盖以前的图片。也就是说文件名不变,但是内容已经改变。这里又有一个问题:就是文件夹中的图片能迅速更新,但是显示在JSP页面上的图片却不是实时更新的。以为是刷新的问题,于是让程序每一次都强制刷新一次,问题依旧。但是如果让点击不同的链接之间的时间间隔长一些(比如5秒),是会看到图片更新的。不知问题在何处。

谢谢!!!



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-10-09 09:32 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
问题已经解决:保存文件时不保存为PNG格式,而是JPG格式就可以了。只是效果稍差一些。
谢谢各位!!!


struggle edited on 2004-10-09 09:34

作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
floater

Java Jedi

总版主


发贴: 3233
于 2004-10-10 06:35 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
what's the diff between jpg and png?

Which way did you go?

If you try to fix the filename, be careful the concurrency.



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code
作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-10-10 15:51 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
JPG和PNG我不知道究竟有什么区别,只知道用JPG在我这里是好用的,用PNG就不行。由于PNG格式比JPG格式清晰,所以一直没有用JPG格式,后来一个偶然的机会才用JPG的,哪知就好使了!

的确,文件名固定,并发性一定得考虑才行。如果能用上面我提到的第一种方法解决就好了!可是怎样在一个用户生成图片后,在他离开时删掉图片呢?这个时机不好把握,可能较复杂。唉~~~

大侠若有空给指点一下,谢~



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
jameszhang



CJSDN高级会员


发贴: 1594
于 2004-10-11 08:44 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
jfreechart这东西的接口是什么样的?只能生成文件吗?


"First they ignore u, then they laugh at u, then they fight u, then u will win

Mahatma Gandhi"

作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:jameszhang]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-10-12 08:58 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
jameszhang wrote:
jfreechart这东西的接口是什么样的?只能生成文件吗?


也可用OUTPUTSTREAM直接输出



作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:struggle]
jameszhang



CJSDN高级会员


发贴: 1594
于 2004-10-12 21:31 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
struggle wrote:
也可用OUTPUTSTREAM直接输出

那么直接输出到屏幕上,可否呢?



"First they ignore u, then they laugh at u, then they fight u, then u will win

Mahatma Gandhi"

作者 Re:在JSP页面中显示JFReeChart 3D图片的位置问题。。。 [Re:jameszhang]
struggle

不换头像了

CJSDN高级会员


发贴: 330
于 2004-11-10 17:30 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
jameszhang wrote:
那么直接输出到屏幕上,可否呢?


可以,我就是直接输出的!




reply to topicflat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923