[問題] JFREECHART的設置URL問題

看板java作者 (異教徒)時間15年前 (2010/07/26 21:23), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/2 (看更多)
各位先進大家好,我最近在撰寫JFREECHART遇到了一些困擾。 希望能請大家指點迷津。 目前在練習PIE_CHART跟BAR_CHART都寫出來了,但是在製作 GANTT_CHART時想使用滑鼠點選進度條能夠換頁,在這個部分遇到 了困難。 使用JSP、TOMCAT5 GANTT_CHART程式碼如下: <HTML> <HEAD> <META http-equiv=Content-Type content="text/html; charset=utf-8"> <META NAME="Author" CONTENT="Alpha"> <TITLE>Gantt練習</TITLE> </HEAD> <BODY> <%! //時間處理 public Date getDate(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month-1, day); Date date = calendar.getTime(); return date; } %> <% //開始設置DATA TaskSeries s1 = new TaskSeries("預期進度"); TaskSeries s2 = new TaskSeries("實際進度"); s1.add(new Task("第一項項目",new SimpleTimePeriod(getDate(2011,6,5),getDate(2011,7,8)))); s2.add(new Task("第一項項目",new SimpleTimePeriod(getDate(2011,6,5),getDate(2011,7,8)))); s1.add(new Task("第二項項目",new SimpleTimePeriod(getDate(2011,6,6), getDate(2011,7,8)))); s2.add(new Task("第二項項目",new SimpleTimePeriod(getDate(2011,6,6), getDate(2011,7,8)))); TaskSeriesCollection collection = new TaskSeriesCollection(); collection.add(s1); collection.add(s2); String chartTitle = "甘特圖標題"; JFreeChart chart = ChartFactory.createGanttChart ( chartTitle, // 圖表標題 "工作項目", // Y 座標標題 "時間", // X 座標標題 collection, // 定義繪製數據 true, // 定義圖表是否包含圖例 true, // 定義圖表是否包含提示 true // 定義圖表是否包含URL ); //設置DATA完畢 int width=500, height=300; chart.setAntiAlias(false);GradientPaint bgGP = new GradientPaint(0, 0, Color.WHITE,width, height, Color.CYAN, false); chart.setBackgroundPaint(bgGP); CategoryPlot plot = chart.getCategoryPlot(); //plot.setURLGenerator(new StandardCategoryURLGenerator("123.jsp")); DateAxis rangeAxis = (DateAxis)plot.getRangeAxis(); //取得橫軸標題 DateFormat df = new SimpleDateFormat("yyyy-MM"); DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 60, df); rangeAxis.setTickUnit(unit) ; ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection()); PrintWriter w = new PrintWriter(out);//輸出MAP信息 String filename = ServletUtilities.saveChartAsJPEG(chart,width,height,info,session); ChartUtilities.writeImageMap(w,"map0",info,false); String graphURL = request.getContextPath() + "/servlet/DisplayChart?filename=" + filename; %> <P ALIGN="CENTER"> <img src="<%= graphURL %>" width=500 height=300 border=0 usemap="#map0"> </P> </BODY> </HTML> 目前遇到的問題是無法將滑鼠點選進度條後轉向網址到123.jsp 目前都會跑到預設的index.html,不知道有沒有人能指點迷津 非常感謝(鞠躬) -- ╭—╮ │就│ ▃▄ ▄▃▂ ▼▼▼ │這│ 你看JACKEY的鼻子很大對吧? □ ̄ ▼▼│樣│ ∠ ︶ _╱ η ┬— ∠ 。│ ▅▅▃▆▆ ╟╯ ╰—╯ ψkana0102 目▄▄目 ◤ ◥ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.64.178.177

07/26 23:03, , 1F
已自己解決,我再發一篇解決的上來,感謝大家。
07/26 23:03, 1F
※ 編輯: inquisition 來自: 203.64.178.177 (07/26 23:04)
文章代碼(AID): #1CJOnZTt (java)
文章代碼(AID): #1CJOnZTt (java)