当前位置: 首页>>代码示例>>Java>>正文


Java TextTitle.setMargin方法代码示例

本文整理汇总了Java中org.jfree.chart.title.TextTitle.setMargin方法的典型用法代码示例。如果您正苦于以下问题:Java TextTitle.setMargin方法的具体用法?Java TextTitle.setMargin怎么用?Java TextTitle.setMargin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.title.TextTitle的用法示例。


在下文中一共展示了TextTitle.setMargin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: RTMZPlot

import org.jfree.chart.title.TextTitle; //导入方法依赖的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);

   }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:72,代码来源:RTMZPlot.java

示例2: HistogramChart

import org.jfree.chart.title.TextTitle; //导入方法依赖的package包/类
public HistogramChart() {

	super(null, true);

	// initialize the chart by default time series chart from factory
	chart = ChartFactory.createHistogram("", // title
		"", // x-axis label
		"", // y-axis label
		null, // data set
		PlotOrientation.VERTICAL, // orientation
		true, // create legend
		false, // generate tooltips
		false // generate URLs
		);

	// title
	chartTitle = chart.getTitle();
	chartTitle.setFont(titleFont);
	chartTitle.setMargin(5, 0, 0, 0);

	chartSubTitle = new TextTitle();
	chartSubTitle.setFont(subTitleFont);
	chartSubTitle.setMargin(5, 0, 0, 0);
	chart.addSubtitle(chartSubTitle);

	// legend constructed by ChartFactory
	LegendTitle legend = chart.getLegend();
	legend.setItemFont(legendFont);
	legend.setFrame(BlockBorder.NONE);

	chart.setBackgroundPaint(Color.white);
	setChart(chart);

	// 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));
	plot.setDatasetRenderingOrder(DatasetRenderingOrder.REVERSE);
	plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

	// set grid properties
	plot.setDomainGridlinePaint(gridColor);
	plot.setRangeGridlinePaint(gridColor);

	// set crosshair (selection) properties
	plot.setDomainCrosshairVisible(false);
	plot.setRangeCrosshairVisible(true);

	// set the logarithmic axis
	NumberAxis axisDomain = new HistogramDomainAxis();
	axisDomain.setMinorTickCount(1);
	axisDomain.setAutoRange(true);

	NumberAxis axisRange = new NumberAxis();
	axisRange.setMinorTickCount(1);
	axisRange.setAutoRange(true);

	plot.setDomainAxis(axisDomain);
	plot.setRangeAxis(axisRange);

	ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer();
	renderer.setMargin(marginSize);
	renderer.setShadowVisible(false);
	plot.setRenderer(renderer);

	this.setMinimumSize(new Dimension(400, 400));
	this.setDismissDelay(Integer.MAX_VALUE);
	this.setInitialDelay(0);

    }
 
开发者ID:mzmine,项目名称:mzmine2,代码行数:75,代码来源:HistogramChart.java


注:本文中的org.jfree.chart.title.TextTitle.setMargin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。