本文整理匯總了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);
}
}