fixed block width
@@ -4,7 +4,6 @@ import com.google.common.collect.Range;
import io.github.mzmine.datamodel.RawDataFile;
import io.github.mzmine.datamodel.Scan;
import io.github.mzmine.gui.chartbasics.chartutils.XYBlockPixelSizePaintScales;
-import io.github.mzmine.gui.chartbasics.chartutils.XYBlockPixelSizeRenderer;
import io.github.mzmine.gui.chartbasics.gui.javafx.EChartViewer;
import io.github.mzmine.parameters.ParameterSet;
import io.github.mzmine.taskcontrol.AbstractTask;
@@ -23,7 +22,6 @@ import org.jfree.chart.block.BlockBorder;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.LookupPaintScale;
-import org.jfree.chart.renderer.xy.XYBarRenderer;
import org.jfree.chart.renderer.xy.XYBlockRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.title.PaintScaleLegend;
@@ -109,7 +107,8 @@ public class ImsVisualizerTask extends AbstractTask {
// create heatmap plot
chartHeatMap = createPlot3D();
- EChartViewer eChartViewerHeatMap = new EChartViewer(chartHeatMap, true, true, true, true, false);
+ EChartViewer eChartViewerHeatMap =
+ new EChartViewer(chartHeatMap, true, true, true, true, false);
// Create ims plot Window
Platform.runLater(
@@ -302,11 +301,26 @@ public class ImsVisualizerTask extends AbstractTask {
// todo : take suggetions not sure about the exact blockwidth.
- double retentionWidth = copyXValues[copyXValues.length-1 ] - copyXValues[0];
- double mobilityWidth = copyYValues[copyYValues.length - 1] - copyYValues[0];
+ double retentionWidth = 0.0;
+ double mobilityWidth = 0.0;
- if ( retentionWidth <= 0.0 )retentionWidth = 1;
- if ( mobilityWidth <= 0.0 ) mobilityWidth = 1;
+ for (int i = 0; i + 1 < copyXValues.length; i++) {
+ if (copyXValues[i] != copyXValues[i + 1]) {
+ retentionWidth = copyXValues[i + 1] - copyXValues[i];
+ break;
+ }
+ }
+ for (int i = 0; i + 1 < copyYValues.length; i++) {
+ if (copyYValues[i] != copyYValues[i + 1]) {
+ mobilityWidth = copyYValues[i + 1] - copyYValues[i];
+ break;
+ }
+ }
+
+ if (mobilityWidth <= 0.0 || retentionWidth <= 0.0) {
+ throw new IllegalArgumentException(
+ "there must be atleast two unique value of retentio time and mobility");
+ }
renderer.setBlockHeight(mobilityWidth);
renderer.setBlockWidth(retentionWidth);
