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

» JWorld@TW » Java Tools  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 jfreechart XYURLGenerator y值問題
briansqq





發文: 3
積分: 0
於 2011-06-23 16:06 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
各位先進大家好,小弟有小小問題想請教各位

座標點( -242.321322 , 1109 )

tooltip使用後 滑鼠在點上顯示
"index: 1109 log value: -242.321322 in condition 3"
是正確的

但是在URL部份則是會抓到該點是該dataset第幾個item
http://web/showAndFind.jsp?nop=3&index=107

不知道有無方法可以將URL部份的idex值變為座標值而非第幾個item值
先謝謝各位了

程式碼如下
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
                //build XYDataset
                String xName = "log(2)[(Average Mutant Concentration) / (Average Wild Type Concentration)]";
                String yName = "index";
                String tName = "build at " + new Date().toString() + "\n threshold: "
                        + threshold + " Condition:" + i + " pointCount: "
                        + yCount;
 
                final javacode.masslynx.XYDatasetOneSample xydata = new javacode.masslynx.XYDatasetOneSample(1, yCount, xyTxtFilePath);
                JFreeChart jfreechart = ChartFactory.createScatterPlot(tName, xName,
                        yName, xydata, PlotOrientation.VERTICAL, true, true, true);
                XYPlot xyplot = (XYPlot) jfreechart.getPlot();
 
                new StandardXYToolTipGenerator();
 
                //y line font
                ValueAxis y = xyplot.getRangeAxis();
                y.setTickLabelFont(new Font("Times New Roman", Font.PLAIN, 12));
 
                //x line font
                ValueAxis x = xyplot.getDomainAxis();
                x.setTickLabelFont(new Font("Times New Roman", Font.PLAIN, 12));
 
                // xy label
                x.setLabelFont(new Font("Times New Roman", Font.PLAIN, 12));
                y.setLabelFont(new Font("Times New Roman", Font.PLAIN, 12));
 
                XYItemRenderer render = xyplot.getRenderer();
 
                //build url link
                XYURLGenerator urls = new StandardXYURLGenerator("showAndFind.jsp", "nop", "index");
                render.setURLGenerator(urls);
                //tooltip
                render.setBaseToolTipGenerator(new StandardXYToolTipGenerator("index:{2} log value: {1} in {0} ", new DecimalFormat("0.000000"), new DecimalFormat("0")));
 
                //Marker
                final Marker cutOffMarker = new ValueMarker(cutoff);
                cutOffMarker.setPaint(Color.orange);
                cutOffMarker.setStroke(new BasicStroke(5.0F));
                cutOffMarker.setLabel("cutoff");
                xyplot.addDomainMarker(cutOffMarker);
 
                jfreechart.setTitle(new TextTitle(tName, new Font("Times New Roman", Font.CENTER_BASELINE, 16)));
 
                ChartRenderingInfo crInfo = new ChartRenderingInfo(new StandardEntityCollection());
                String fname = ServletUtilities.saveChartAsJPEG(jfreechart, 500, 500, crInfo, session);
                PrintWriter pw = new PrintWriter(out);
                ChartUtilities.writeImageMap(pw, fname, crInfo, true);
                pw.flush();
 


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