本文整理汇总了Java中org.jfree.chart.plot.ValueMarker.setLabelOffsetType方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMarker.setLabelOffsetType方法的具体用法?Java ValueMarker.setLabelOffsetType怎么用?Java ValueMarker.setLabelOffsetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.ValueMarker
的用法示例。
在下文中一共展示了ValueMarker.setLabelOffsetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetSetLabelOffsetType
import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
/**
* Some checks for the getLabelOffsetType() and setLabelOffsetType()
* methods.
*/
public void testGetSetLabelOffsetType() {
// 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(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
assertEquals(m, this.lastEvent.getMarker());
// check null argument...
try {
m.setLabelOffsetType(null);
fail("Expected an IllegalArgumentException for null.");
}
catch (IllegalArgumentException e) {
assertTrue(true);
}
}
示例2: testGetSetLabelOffsetType
import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
/**
* Some checks for the getLabelOffsetType() and setLabelOffsetType()
* methods.
*/
public void testGetSetLabelOffsetType() {
// 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(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
assertEquals(m, this.lastEvent.getMarker());
// check null argument...
try {
m.setLabelOffsetType(null);
fail("Expected an IllegalArgumentException for null.");
}
catch (IllegalArgumentException e) {
assertTrue(true);
}
}
示例3: 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);
}