Changeset 5149
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/clients/web/net/sf/basedb/clients/web/servlet/ExperimentExplorerPlotServlet.java
r5141 r5149 29 29 import java.awt.font.FontRenderContext; 30 30 import java.awt.geom.Rectangle2D; 31 import java.awt.geom.RectangularShape; 31 32 import java.awt.image.BufferedImage; 32 33 import java.io.IOException; … … 58 59 import org.jfree.chart.plot.CategoryPlot; 59 60 import org.jfree.chart.plot.Plot; 61 import org.jfree.chart.renderer.category.BarPainter; 62 import org.jfree.chart.renderer.category.BarRenderer; 63 import org.jfree.chart.renderer.category.BarRenderer3D; 60 64 import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; 65 import org.jfree.chart.renderer.category.CategoryItemRenderer; 61 66 import org.jfree.chart.renderer.category.LineAndShapeRenderer; 67 import org.jfree.chart.renderer.category.StandardBarPainter; 62 68 import org.jfree.chart.title.TextTitle; 63 69 import org.jfree.data.category.DefaultCategoryDataset; 64 70 import org.jfree.data.statistics.BoxAndWhiskerItem; 65 71 import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset; 72 import org.jfree.ui.RectangleEdge; 66 73 67 74 import net.sf.basedb.clients.web.ExperimentExplorer; … … 134 141 final int reporterIndex = Values.getInt(request.getParameter("reporterIndex")); 135 142 final int positionIndex = Values.getInt(request.getParameter("positionIndex")); 136 final String plotType = Values.getString(request.getParameter("type"), "line"); 143 final String plotType = Values.getString(request.getParameter("type"), "assay"); 144 final String subType = Values.getString(request.getParameter("subtype"), "line"); 137 145 138 146 // Where to deliver the image … … 207 215 208 216 JFreeChart chart = null; 209 if (" box".equals(plotType))217 if ("annotation".equals(plotType)) 210 218 { 211 219 // Collect all spot data values in one list per annotation group … … 255 263 chart = new JFreeChart(plot); 256 264 } 257 else if (" line".equals(plotType))265 else if ("assay".equals(plotType)) 258 266 { 259 267 // Load annotation summaries … … 307 315 // Create the plot and chart objects 308 316 categoryAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); 309 Plot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, new LineAndShapeRenderer()); 317 CategoryItemRenderer renderer = null; 318 if ("line".equals(subType)) 319 { 320 renderer = new LineAndShapeRenderer(); 321 } 322 else 323 { 324 BarRenderer br = new BarRenderer(); 325 renderer = br; 326 br.setShadowVisible(false); 327 br.setBarPainter(new StandardBarPainter()); 328 br.setDrawBarOutline(true); 329 } 330 Plot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer); 310 331 chart = new JFreeChart(plot); 311 332 } -
trunk/www/views/experiments/explorer/view/plotter.jsp
r5142 r5149 75 75 final int reporterIndex = Values.getInt(request.getParameter("reporterIndex")); 76 76 final int positionIndex = Values.getInt(request.getParameter("positionIndex")); 77 final String plotType = Values.getString(request.getParameter("type"), " line");77 final String plotType = Values.getString(request.getParameter("type"), "assay"); 78 78 final int annotationTypeId = Values.getInt(request.getParameter("annotationTypeId")); 79 79 final boolean needAverageMethod = positionIndex == ExperimentExplorer.SPOT_AVG; … … 137 137 { 138 138 var plotType = getPlotType(); 139 if (plotType == ' line')140 { 141 return validate LinePlot();142 } 143 else if (plotType == ' box')144 { 145 return validate BoxPlot();139 if (plotType == 'assay') 140 { 141 return validateAssayPlot(); 142 } 143 else if (plotType == 'annotation') 144 { 145 return validateAnnotationPlot(); 146 146 } 147 147 return false; 148 148 } 149 149 150 function validate LinePlot()151 { 152 var frm = document.forms[' line'];150 function validateAssayPlot() 151 { 152 var frm = document.forms['assay']; 153 153 if (Main.trimString(frm.yFormula.value) == '') 154 154 { … … 160 160 } 161 161 162 function validate BoxPlot()163 { 164 var frm = document.forms[' box'];162 function validateAnnotationPlot() 163 { 164 var frm = document.forms['annotation']; 165 165 if (Main.trimString(frm.yFormula.value) == '') 166 166 { … … 180 180 function switchTab(tabControlId, tabId) 181 181 { 182 if (tabId == ' line' || tabId == 'box')182 if (tabId == 'assay' || tabId == 'annotation') 183 183 { 184 184 plotType = tabId; … … 217 217 } 218 218 var plotType = getPlotType(); 219 if (plotType == 'line') 220 { 221 var frm = document.forms['line']; 222 url += '&type=line'; 219 if (plotType == 'assay') 220 { 221 var frm = document.forms['assay']; 222 url += '&type=assay'; 223 url += '&subtype=' + frm.subtype[frm.subtype.selectedIndex].value; 223 224 url += '&y='+Main.encodeURI(frm.yFormula.value); 224 225 url += '&yLog='+(frm.yLog.checked ? 1 : 0); … … 230 231 } 231 232 } 232 else if (plotType == ' box')233 { 234 var frm = document.forms[' box'];235 url += '&type= box';233 else if (plotType == 'annotation') 234 { 235 var frm = document.forms['annotation']; 236 url += '&type=annotation'; 236 237 url += '&y='+Main.encodeURI(frm.yFormula.value); 237 238 url += '&yLog='+(frm.yLog.checked ? 1 : 0); … … 359 360 active="<%=plotType%>" remember="false" 360 361 switch="switchTab"> 361 <t:tab id=" line" title="Line plot" helpid="explorer.lineplot"362 tooltip="Create a line plot with bioassays along the x axis">363 <form name=" line">362 <t:tab id="assay" title="By bioassay" helpid="explorer.assayplot" 363 tooltip="Create a line/bar plot with bioassays along the x axis"> 364 <form name="assay"> 364 365 <table border="0" cellspacing="0" cellpadding="2" class="form"> 366 <tr> 367 <td class="prompt">Plot type</td> 368 <td colspan="2"> 369 <select name="subtype"> 370 <option value="line">Line plot</option> 371 <option value="bar">Bar plot</option> 372 </select> 373 </tr> 365 374 <tr> 366 375 <td class="prompt" colspan="3">Y-axis</td> … … 385 394 image="expression_builder.gif" 386 395 tooltip="Use the Expression builder" 387 onclick="openExpressionBuilder('Y-axis expression', ' line', 'yFormula', 'COLUMN_EXPRESSION')"396 onclick="openExpressionBuilder('Y-axis expression', 'assay', 'yFormula', 'COLUMN_EXPRESSION')" 388 397 /> 389 398 </td> … … 431 440 </form> 432 441 </t:tab> 433 <t:tab id=" box" title="Box plot" helpid="explorer.boxplot"442 <t:tab id="annotation" title="By annotation" helpid="explorer.annotationplot" 434 443 tooltip="Create a box plot with annotation values along the x axis"> 435 <form name=" box">444 <form name="annotation"> 436 445 <table border="0" cellspacing="0" cellpadding="2" class="form"> 437 446 <tr> … … 457 466 image="expression_builder.gif" 458 467 tooltip="Use the Expression builder" 459 onclick="openExpressionBuilder('Y-axis expression', ' box', 'yFormula', 'COLUMN_EXPRESSION')"468 onclick="openExpressionBuilder('Y-axis expression', 'annotation', 'yFormula', 'COLUMN_EXPRESSION')" 460 469 /> 461 470 </td> -
trunk/www/views/experiments/explorer/view/view.jsp
r5140 r5149 254 254 } 255 255 } 256 function plotSpotData()257 { 258 var url = 'plotter.jsp?ID=<%=ID%>&type= line';256 function assayPlot() 257 { 258 var url = 'plotter.jsp?ID=<%=ID%>&type=assay'; 259 259 url += '&bioAssaySetId=<%=bioAssaySetId%>'; 260 260 url += '&reporterIndex=<%=reporterIndex%>'; 261 261 url += '&positionIndex=<%=positionIndex%>'; 262 Main.openPopup(url, ' SpotPlot', 1100, 700);263 } 264 function boxPlot(annotationType)265 { 266 var url = 'plotter.jsp?ID=<%=ID%>&type= box';262 Main.openPopup(url, 'AssayPlot', 1100, 700); 263 } 264 function annotationPlot(annotationType) 265 { 266 var url = 'plotter.jsp?ID=<%=ID%>&type=annotation'; 267 267 url += '&bioAssaySetId=<%=bioAssaySetId%>'; 268 268 url += '&reporterIndex=<%=reporterIndex%>'; 269 269 url += '&positionIndex=<%=positionIndex%>'; 270 270 url += '&annotationTypeId=' + annotationType; 271 Main.openPopup(url, ' BoxPlot', 1100, 700);271 Main.openPopup(url, 'AnnotationPlot', 1100, 700); 272 272 } 273 273 </script> … … 469 469 <td class="summaryheader"><base:icon 470 470 image="plotter.gif" 471 onclick="<%=" boxPlot(" + at.getId() + ")"%>"471 onclick="<%="annotationPlot(" + at.getId() + ")"%>" 472 472 tooltip="Box plot for selected spot data per annotation group" 473 473 /></td> … … 736 736 <tbl:button 737 737 image="plotter.gif" 738 onclick=" plotSpotData()"738 onclick="assayPlot()" 739 739 title="Plot…" 740 740 tooltip="Plot selected data from this table"
Note: See TracChangeset
for help on using the changeset viewer.