use of net.sf.mzmine.chartbasics.chartutils.XYBlockPixelSizeRenderer in project mzmine2 by mzmine.
the class KendrickMassPlotTask method create2DKendrickMassPlot.
/**
* create 2D Kendrick mass plot
*/
private JFreeChart create2DKendrickMassPlot() {
if (zAxisLabel.equals("none")) {
logger.info("Creating new 2D chart instance");
appliedSteps++;
// load dataset
dataset2D = new KendrickMassPlotXYDataset(parameterSet);
// create chart
chart = ChartFactory.createScatterPlot(title, xAxisLabel, yAxisLabel, dataset2D, PlotOrientation.VERTICAL, true, true, true);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainCrosshairPaint(Color.GRAY);
plot.setRangeCrosshairPaint(Color.GRAY);
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
appliedSteps++;
// set axis
NumberAxis domain = (NumberAxis) plot.getDomainAxis();
NumberAxis range = (NumberAxis) plot.getRangeAxis();
range.setRange(0, 1);
if (xAxisLabel.contains("KMD")) {
domain.setRange(0, 1);
}
// set renderer
XYBlockPixelSizeRenderer renderer = new XYBlockPixelSizeRenderer();
// set tooltip generator
ScatterPlotToolTipGenerator tooltipGenerator = new ScatterPlotToolTipGenerator(xAxisLabel, yAxisLabel, zAxisLabel, rows);
renderer.setSeriesToolTipGenerator(0, tooltipGenerator);
plot.setRenderer(renderer);
// set item label generator
NameItemLabelGenerator generator = new NameItemLabelGenerator(rows);
renderer.setDefaultItemLabelGenerator(generator);
renderer.setDefaultItemLabelsVisible(false);
renderer.setDefaultItemLabelFont(legendFont);
renderer.setDefaultPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -45), true);
}
return chart;
}
Aggregations