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


Java ValueMarker.setLabelAnchor方法代码示例

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


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

示例1: testGetSetLabelAnchor

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
/**
 * Some checks for the getLabelAnchor() and setLabelAnchor() methods.
 */
public void testGetSetLabelAnchor() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(RectangleAnchor.TOP_LEFT, m.getLabelAnchor());
    m.setLabelAnchor(RectangleAnchor.TOP);
    assertEquals(RectangleAnchor.TOP, m.getLabelAnchor());
    assertEquals(m, this.lastEvent.getMarker());
    
    // check null argument...
    try {
        m.setLabelAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:MarkerTests.java

示例2: testGetSetLabelAnchor

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
/**
 * Some checks for the getLabelAnchor() and setLabelAnchor() methods.
 */
public void testGetSetLabelAnchor() {
    // we use ValueMarker for the tests, because we need a concrete
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(RectangleAnchor.TOP_LEFT, m.getLabelAnchor());
    m.setLabelAnchor(RectangleAnchor.TOP);
    assertEquals(RectangleAnchor.TOP, m.getLabelAnchor());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:MarkerTests.java

示例3: getAverageMarker

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
public static Marker getAverageMarker(double paramDouble) {
	ValueMarker localValueMarker = new ValueMarker(paramDouble, Color.red, new BasicStroke(0.3F));
	localValueMarker.setLabel(I18N.getMsg("msg.common.average"));
	localValueMarker.setLabelFont(new Font("SansSerif", 2, 11));
	localValueMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
	localValueMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
	return localValueMarker;
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:9,代码来源:ChartUtil.java

示例4: getDateMarker

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
public static Marker getDateMarker(Date paramDate, String paramString, boolean paramBoolean) {
	double d = paramDate.getTime();
	ValueMarker localValueMarker = new ValueMarker(d, Color.red, new BasicStroke(0.3F));
	localValueMarker.setLabel(paramString);
	localValueMarker.setLabelFont(new Font("SansSerif", 2, 11));
	localValueMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
	if (paramBoolean) {
		localValueMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
	} else {
		localValueMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
	}
	return localValueMarker;
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:14,代码来源:ChartUtil.java

示例5: makeMarker

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
protected ValueMarker makeMarker( final double value )
{
	final ValueMarker valueMarker = new ValueMarker( value );
	valueMarker.setStroke( new BasicStroke ( 2f ) );
	valueMarker.setPaint( new Color( 0f/255f, 0f/255f, 255f/255f ) );
	valueMarker.setLabel( " Distance=" + value );
	valueMarker.setLabelPaint( Color.BLUE );
	valueMarker.setLabelAnchor( RectangleAnchor.TOP );
	valueMarker.setLabelTextAnchor( TextAnchor.TOP_LEFT );

	return valueMarker;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:13,代码来源:MouseListenerValue.java

示例6: makeMarker

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
protected ValueMarker makeMarker( final int timePoint )
{
	final ValueMarker valueMarker = new ValueMarker( timePoint );
	valueMarker.setStroke( new BasicStroke ( 1.5f ) );
	valueMarker.setPaint( new Color( 0.0f, 93f/255f, 9f/255f ) );
	valueMarker.setLabel( " Reference\n Timepoint " + timePoint );
	valueMarker.setLabelAnchor(RectangleAnchor.BOTTOM );
	valueMarker.setLabelTextAnchor( TextAnchor.BOTTOM_LEFT );
	
	return valueMarker;
}
 
开发者ID:fiji,项目名称:SPIM_Registration,代码行数:12,代码来源:MouseListenerTimelapse.java

示例7: addData

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
public void addData(int datasetIndex, double x, double y){
	XYSeries series = dataCollection.get(datasetIndex).getSeries(0);
	series.add(x, y);

	if(showCurrentAverage){
		if(markers[datasetIndex] != null){
			plot.removeRangeMarker(markers[datasetIndex]);
		}
		
		pastData[datasetIndex].add(y);

		double average = pastData[datasetIndex].getAverage();
		
		ValueMarker marker = new ValueMarker(average);
		marker.setPaint(Color.black);
		String label = String.format(labelFormat, average);

		marker.setLabel(label);
		marker.setLabelOffset(new RectangleInsets(10, 0, 0, 10));
		marker.setLabelAnchor(RectangleAnchor.RIGHT);

		markers[datasetIndex] = marker;
		plot.addRangeMarker(marker);
	}


}
 
开发者ID:yeokm1,项目名称:odroid-power-measure,代码行数:28,代码来源:Chart.java

示例8: addDomainMarker

import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
public void addDomainMarker(XYPlot plot, cfCHARTDOMAINMARKERData dmData) throws cfmRunTimeException {
	double dbl;
	try {
		dbl = Double.parseDouble(dmData.getValue());
	} catch (NumberFormatException nfe) {
		throw newRunTimeException("the CFCHARTDOMAINMARKER value attribute must be numeric for scale charts");
	}
	ValueMarker domainMarker = new ValueMarker(dbl);
	boolean drawAsLine = true; // XY charts currently only support drawing
															// domain markers as lines
	domainMarker.setPaint(convertStringToColor(dmData.getColor()));
	if (dmData.getLabel() != null) {
		domainMarker.setLabel(dmData.getLabel());
		domainMarker.setLabelPaint(convertStringToColor(dmData.getLabelColor()));
		String labelPos = dmData.getLabelPosition();
		if (labelPos.equals("top_left")) {
			domainMarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
		} else if (labelPos.equals("top")) {
			domainMarker.setLabelAnchor(RectangleAnchor.TOP);
			domainMarker.setLabelTextAnchor(TextAnchor.TOP_CENTER);
		} else if (labelPos.equals("top_right")) {
			domainMarker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
		} else if (labelPos.equals("left")) {
			domainMarker.setLabelAnchor(RectangleAnchor.LEFT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_RIGHT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
		} else if (labelPos.equals("center")) {
			domainMarker.setLabelAnchor(RectangleAnchor.CENTER);
			domainMarker.setLabelTextAnchor(TextAnchor.CENTER);
		} else if (labelPos.equals("right")) {
			domainMarker.setLabelAnchor(RectangleAnchor.RIGHT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.CENTER_RIGHT);
		} else if (labelPos.equals("bottom_left")) {
			domainMarker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
		} else if (labelPos.equals("bottom")) {
			domainMarker.setLabelAnchor(RectangleAnchor.BOTTOM);
			domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_CENTER);
		} else if (labelPos.equals("bottom_right")) {
			domainMarker.setLabelAnchor(RectangleAnchor.BOTTOM_RIGHT);
			if (drawAsLine)
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_LEFT);
			else
				domainMarker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
		}
		domainMarker.setLabelOffsetType(LengthAdjustmentType.NO_CHANGE);
		domainMarker.setLabelFont(getFont(dmData.getFont(), dmData.getFontBold(), dmData.getFontItalic(), dmData.getFontSize()));
	}
	plot.addDomainMarker(domainMarker, Layer.BACKGROUND);
}
 
开发者ID:OpenBD,项目名称:openbd-core,代码行数:67,代码来源:cfCHART.java


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