本文整理汇总了Java中org.jfree.chart.plot.ValueMarker.setLabelOffset方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMarker.setLabelOffset方法的具体用法?Java ValueMarker.setLabelOffset怎么用?Java ValueMarker.setLabelOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.ValueMarker
的用法示例。
在下文中一共展示了ValueMarker.setLabelOffset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetSetLabelOffset
import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
/**
* Some checks for the getLabelOffset() and setLabelOffset() methods.
*/
public void testGetSetLabelOffset() {
// 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(new RectangleInsets(3, 3, 3, 3), m.getLabelOffset());
m.setLabelOffset(new RectangleInsets(1, 2, 3, 4));
assertEquals(new RectangleInsets(1, 2, 3, 4), m.getLabelOffset());
assertEquals(m, this.lastEvent.getMarker());
// check null argument...
try {
m.setLabelOffset(null);
fail("Expected an IllegalArgumentException for null.");
}
catch (IllegalArgumentException e) {
assertTrue(true);
}
}
示例2: testGetSetLabelOffset
import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
/**
* Some checks for the getLabelOffset() and setLabelOffset() methods.
*/
public void testGetSetLabelOffset() {
// 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(new RectangleInsets(3, 3, 3, 3), m.getLabelOffset());
m.setLabelOffset(new RectangleInsets(1, 2, 3, 4));
assertEquals(new RectangleInsets(1, 2, 3, 4), m.getLabelOffset());
assertEquals(m, this.lastEvent.getMarker());
// check null argument...
try {
m.setLabelOffset(null);
fail("Expected an IllegalArgumentException for null.");
}
catch (IllegalArgumentException e) {
assertTrue(true);
}
}
示例3: addKillEvent
import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
private static void addKillEvent(XYPlot xyplot, long pos) {
ValueMarker vm = new ValueMarker(pos);
vm.setPaint(ChartColor.VERY_DARK_GREEN);
vm.setLabelOffset(new RectangleInsets(10.0D, 1.0D, 1.0D, 1.0D));
vm.setLabel("Container Kill Event");
vm.setStroke(new BasicStroke(2));
xyplot.addDomainMarker(vm);
}
示例4: addIllegalEvent
import org.jfree.chart.plot.ValueMarker; //导入方法依赖的package包/类
private static void addIllegalEvent(XYPlot xyplot, long pos) {
ValueMarker vm = new ValueMarker(pos);
vm.setPaint(ChartColor.LIGHT_YELLOW);
vm.setLabelOffset(new RectangleInsets(10.0D, 1.0D, 1.0D, 1.0D));
vm.setLabel("Illegal State");
vm.setStroke(new BasicStroke(2));
xyplot.addDomainMarker(vm);
}
示例5: 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);
}
}