本文整理汇总了Java中org.jfree.chart.title.PaintScaleLegend.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java PaintScaleLegend.setMargin方法的具体用法?Java PaintScaleLegend.setMargin怎么用?Java PaintScaleLegend.setMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.title.PaintScaleLegend
的用法示例。
在下文中一共展示了PaintScaleLegend.setMargin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RTMZPlot
import org.jfree.chart.title.PaintScaleLegend; //导入方法依赖的package包/类
public RTMZPlot(RTMZAnalyzerWindow masterFrame, AbstractXYZDataset dataset,
InterpolatingLookupPaintScale paintScale) {
super(null);
this.paintScale = paintScale;
chart = ChartFactory.createXYAreaChart("", "Retention time", "m/z",
dataset, PlotOrientation.VERTICAL, false, false, false);
chart.setBackgroundPaint(Color.white);
setChart(chart);
// title
TextTitle chartTitle = chart.getTitle();
chartTitle.setMargin(5, 0, 0, 0);
chartTitle.setFont(titleFont);
chart.removeSubtitle(chartTitle);
// disable maximum size (we don't want scaling)
setMaximumDrawWidth(Integer.MAX_VALUE);
setMaximumDrawHeight(Integer.MAX_VALUE);
// set the plot properties
plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
// set grid properties
plot.setDomainGridlinePaint(gridColor);
plot.setRangeGridlinePaint(gridColor);
// set crosshair (selection) properties
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
plot.setDomainCrosshairPaint(crossHairColor);
plot.setRangeCrosshairPaint(crossHairColor);
plot.setDomainCrosshairStroke(crossHairStroke);
plot.setRangeCrosshairStroke(crossHairStroke);
NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat();
NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat();
// set the X axis (retention time) properties
NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
xAxis.setNumberFormatOverride(rtFormat);
xAxis.setUpperMargin(0.001);
xAxis.setLowerMargin(0.001);
// set the Y axis (intensity) properties
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setAutoRangeIncludesZero(false);
yAxis.setNumberFormatOverride(mzFormat);
plot.setDataset(dataset);
spotRenderer = new RTMZRenderer(dataset, paintScale);
plot.setRenderer(spotRenderer);
spotRenderer.setDefaultToolTipGenerator(new RTMZToolTipGenerator());
// Add a paintScaleLegend to chart
paintScaleAxis = new NumberAxis("Logratio");
paintScaleAxis.setRange(paintScale.getLowerBound(),
paintScale.getUpperBound());
paintScaleLegend = new PaintScaleLegend(paintScale, paintScaleAxis);
paintScaleLegend.setPosition(plot.getDomainAxisEdge());
paintScaleLegend.setMargin(5, 25, 5, 25);
chart.addSubtitle(paintScaleLegend);
}