Skip to content
Snippets Groups Projects
Commit e8bf83e2 authored by felmer's avatar felmer
Browse files

LMS-1397 change thumbnail width to 300, adapt title and label sizes, sort rows

SVN: 15076
parent 1a8bb2d1
No related branches found
No related tags found
No related merge requests found
......@@ -17,12 +17,14 @@
package ch.systemsx.cisd.yeastx.eicml;
import java.awt.Color;
import java.awt.Font;
import java.io.IOException;
import java.io.OutputStream;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.Axis;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
......@@ -229,9 +231,13 @@ public class EICMLChromatogramImageGenerator
*/
private XYPlot configureChart(JFreeChart chart)
{
Font font = JFreeChart.DEFAULT_TITLE_FONT;
chart.getTitle().setFont(cloneFontWithNewSize(font, Math.max(11, imageHeight / 30)));
chart.setBackgroundPaint(Color.WHITE);
XYPlot plot = (XYPlot) chart.getPlot();
setAxisLabelFontSize(plot.getDomainAxis());
setAxisLabelFontSize(plot.getRangeAxis());
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinesVisible(false);
plot.setRangeGridlinesVisible(true);
......@@ -244,4 +250,15 @@ public class EICMLChromatogramImageGenerator
return plot;
}
private void setAxisLabelFontSize(Axis axis)
{
Font labelFont = axis.getLabelFont();
axis.setLabelFont(cloneFontWithNewSize(labelFont, Math.max(10, imageHeight / 40)));
}
private Font cloneFontWithNewSize(Font font, int newSize)
{
return new Font(font.getName(), font.getStyle(), newSize);
}
}
......@@ -18,6 +18,8 @@ package ch.systemsx.cisd.yeastx.eicml;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Properties;
......@@ -36,6 +38,7 @@ import ch.systemsx.cisd.openbis.generic.shared.GenericSharedConstants;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.GeneratedImageTableCell;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ISerializableComparable;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModel;
import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRow;
import ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription;
import ch.systemsx.cisd.yeastx.db.DBUtils;
......@@ -48,8 +51,10 @@ public class EICMLChromatogramImagesReporter extends AbstractDatastorePlugin imp
IReportingPluginTask
{
private static final String CHROMATOGRAM_SERVLET = "chromatogram";
private static final int MZ_1_COLUMN_INDEX = 1;
private static final int THUMBNAIL_WIDTH = 150;
private static final int THUMBNAIL_WIDTH = 300;
private static final int THUMBNAIL_HEIGHT = 150;
......@@ -127,7 +132,18 @@ public class EICMLChromatogramImagesReporter extends AbstractDatastorePlugin imp
datasetRun.setChromatograms(chromatograms);
addRun(builder, datasetRun);
}
return builder.getTableModel();
TableModel tableModel = builder.getTableModel();
List<TableModelRow> rows = tableModel.getRows();
Collections.sort(rows, new Comparator<TableModelRow>()
{
public int compare(TableModelRow r1, TableModelRow r2)
{
ISerializableComparable v1 = r1.getValues().get(MZ_1_COLUMN_INDEX);
ISerializableComparable v2 = r2.getValues().get(MZ_1_COLUMN_INDEX);
return v1.compareTo(v2);
}
});
return tableModel;
}
private List<DatasetRun> fetchRuns(List<DatasetDescription> datasets)
......@@ -229,9 +245,9 @@ public class EICMLChromatogramImagesReporter extends AbstractDatastorePlugin imp
private static void addReportHeaders(SimpleTableModelBuilder builder)
{
builder.addHeader("Label");
builder.addHeader("m/z 1");
builder.addHeader("m/z 2");
builder.addHeader("Chromatogram");
builder.addHeader("Label", 100);
builder.addHeader("m/z 1", 50);
builder.addHeader("m/z 2", 50);
builder.addHeader("Chromatogram", THUMBNAIL_WIDTH);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment