本文整理汇总了Java中org.jfree.chart.plot.XYPlot.addRangeMarker方法的典型用法代码示例。如果您正苦于以下问题:Java XYPlot.addRangeMarker方法的具体用法?Java XYPlot.addRangeMarker怎么用?Java XYPlot.addRangeMarker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.XYPlot
的用法示例。
在下文中一共展示了XYPlot.addRangeMarker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
* Creates a sample chart.
*
* @param dataset the dataset.
*
* @return A sample chart.
*/
private JFreeChart createChart(IntervalXYDataset dataset,String s) {
final JFreeChart chart = ChartFactory.createXYBarChart(
"Histogram Plot: "+s,
"Keyword index",
false,
"frequency",
dataset,
PlotOrientation.VERTICAL,
true,
true,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
final IntervalMarker target = new IntervalMarker(400.0, 700.0);
//target.setLabel("Target Range");
target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
target.setLabelAnchor(RectangleAnchor.LEFT);
target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
target.setPaint(new Color(222, 222, 255, 128));
plot.addRangeMarker(target, Layer.BACKGROUND);
return chart;
}
示例2: testListenersWithXYPlot
import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
* Checks that an XYPlot deregisters listeners when clearing markers.
*/
public void testListenersWithXYPlot() {
XYPlot plot = new XYPlot();
ValueMarker marker1 = new ValueMarker(1.0);
ValueMarker marker2 = new ValueMarker(2.0);
plot.addDomainMarker(marker1);
plot.addRangeMarker(marker2);
EventListener[] listeners1 = marker1.getListeners(
MarkerChangeListener.class);
assertTrue(Arrays.asList(listeners1).contains(plot));
EventListener[] listeners2 = marker1.getListeners(
MarkerChangeListener.class);
assertTrue(Arrays.asList(listeners2).contains(plot));
plot.clearDomainMarkers();
plot.clearRangeMarkers();
listeners1 = marker1.getListeners(MarkerChangeListener.class);
assertFalse(Arrays.asList(listeners1).contains(plot));
listeners2 = marker1.getListeners(MarkerChangeListener.class);
assertFalse(Arrays.asList(listeners2).contains(plot));
}
示例3: testAddRangeMarker
import org.jfree.chart.plot.XYPlot; //导入方法依赖的package包/类
/**
* Some tests for the addRangeMarker() method(s).
*/
public void testAddRangeMarker() {
XYPlot plot = new XYPlot();
Marker m = new ValueMarker(1.0);
plot.addRangeMarker(m);
List listeners = Arrays.asList(m.getListeners(
MarkerChangeListener.class));
assertTrue(listeners.contains(plot));
plot.clearRangeMarkers();
listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
assertFalse(listeners.contains(plot));
}