JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java Tools  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 关于JfreeChart的问题
zhou851213





發文: 1
積分: 0
於 2009-12-24 17:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
因为在每个分类里面都默认有s1-s21根柱子,虽然有很多是不能显示出来的,可是能够显示的柱子却被压缩的非常扁,有没有解决方法!
生成图片:
我希望达到的效果:能显示出来的柱子能够平均分布每一category,柱子能够变粗!
代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
public class TestBar3D {
private static CategoryDataset createDataset() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(0.50D, "s1", "c1");
dataset.addValue(0.00D, "s2", "c1");
dataset.addValue(-1.00D, "s3", "c1");
 
                  dataset.addValue(1.20D, "s4", "c2");
dataset.addValue(1.40D, "s5", "c2");
dataset.addValue(-0.8D, "s6", "c2");
 
dataset.addValue(-1.20D, "s7", "c3");
dataset.addValue(0.40D, "s8", "c3");
dataset.addValue(-0.1D, "s9", "c3");
dataset.addValue(-0.20D, "s10", "c3");
dataset.addValue(0.80D, "s11", "c3");
dataset.addValue(1.1D, "s12", "c3");
 
dataset.addValue(-0.50D, "s13", "c4");
dataset.addValue(0.80D, "s14", "c4");
dataset.addValue(1.8D, "s15", "c4");
dataset.addValue(-1.5D, "s16", "c4");
dataset.addValue(-0.8D, "s17", "c4");
 
dataset.addValue(0.30D, "s18", "c5");
dataset.addValue(0.80D, "s19", "c5");
dataset.addValue(1.00D, "s20", "c5");
dataset.addValue(-0.8D, "s21", "c5");
return dataset;
}
 
public static JFreeChart createJFreeChart(CategoryDataset dataset) {
JFreeChart chart = ChartFactory.createBarChart3D(
"t", "ss", "vv", dataset,
PlotOrientation.VERTICAL, true, true, false);
return chart;
}
 
public static void main(String args[]) {
JFreeChart chart = createJFreeChart(createDataset());
FileOutputStream fos = null;
try {
fos = new FileOutputStream(new File("d:/1.jpg"));
ChartUtilities.writeChartAsJPEG(fos, chart, 1024, 768);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
 
}
}
 

希望增加两列以后,柱子宽度不变!


zhou851213 edited on 2009-12-24 17:18
reply to postreply to post
» JWorld@TW »  Java Tools

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8