本文整理汇总了Java中org.jfree.chart.plot.Crosshair类的典型用法代码示例。如果您正苦于以下问题:Java Crosshair类的具体用法?Java Crosshair怎么用?Java Crosshair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Crosshair类属于org.jfree.chart.plot包,在下文中一共展示了Crosshair类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCloning
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Basic checks for cloning.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
CrosshairOverlay o1 = new CrosshairOverlay();
o1.addDomainCrosshair(new Crosshair(99.9));
o1.addRangeCrosshair(new Crosshair(1.23, new GradientPaint(1.0f, 2.0f,
Color.red, 3.0f, 4.0f, Color.blue), new BasicStroke(1.1f)));
CrosshairOverlay o2 = (CrosshairOverlay) o1.clone();
assertTrue(o1 != o2);
assertTrue(o1.getClass() == o2.getClass());
assertTrue(o1.equals(o2));
o1.addDomainCrosshair(new Crosshair(3.21));
o1.addRangeCrosshair(new Crosshair(4.32));
assertFalse(o1.equals(o2));
}
示例2: testCloning
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Basic checks for cloning.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
CrosshairOverlay o1 = new CrosshairOverlay();
o1.addDomainCrosshair(new Crosshair(99.9));
o1.addRangeCrosshair(new Crosshair(1.23, new GradientPaint(1.0f, 2.0f,
Color.RED, 3.0f, 4.0f, Color.BLUE), new BasicStroke(1.1f)));
CrosshairOverlay o2 = (CrosshairOverlay) o1.clone();
assertTrue(o1 != o2);
assertTrue(o1.getClass() == o2.getClass());
assertTrue(o1.equals(o2));
o1.addDomainCrosshair(new Crosshair(3.21));
o1.addRangeCrosshair(new Crosshair(4.32));
assertFalse(o1.equals(o2));
}
示例3: addRangeCrosshair
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
public void addRangeCrosshair(int axisIdx, Crosshair crosshair) {
while (rangeCrosshairs.size() < axisIdx + 1) {
rangeCrosshairs.add(new ArrayList<Crosshair>());
}
rangeCrosshairs.get(axisIdx).add(crosshair);
crosshair.addPropertyChangeListener(this);
}
示例4: removeRangeCrosshair
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
public void removeRangeCrosshair(int axisIdx, Crosshair crosshair) {
if (rangeCrosshairs.size() > axisIdx) {
ArrayList<Crosshair> crosshairsForRange = rangeCrosshairs.get(axisIdx);
crosshairsForRange.remove(crosshair);
crosshair.removePropertyChangeListener(this);
}
}
示例5: clearRangeCrosshairs
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Clears all range crosshairs on all axes.
*/
@Override
public void clearRangeCrosshairs() {
for (List<Crosshair> crosshairsForRange : rangeCrosshairs) {
for (Crosshair crosshair : crosshairsForRange) {
crosshair.removePropertyChangeListener(this);
}
}
rangeCrosshairs.clear();
}
示例6: MyDemoPane
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
public MyDemoPane() {
XYDataset dataset = createDataset();
JFreeChart chart = createChart(dataset);
this.chartViewer = new ChartViewer(chart);
this.chartViewer.addChartMouseListener(this);
getChildren().add(this.chartViewer);
CrosshairOverlayFX crosshairOverlay = new CrosshairOverlayFX();
this.xCrosshair = new Crosshair(Double.NaN, Color.GRAY,
new BasicStroke(0f));
this.xCrosshair.setStroke(new BasicStroke(1.5f,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1,
new float[]{2.0f, 2.0f}, 0));
this.xCrosshair.setLabelVisible(true);
this.yCrosshair = new Crosshair(Double.NaN, Color.GRAY,
new BasicStroke(0f));
this.yCrosshair.setStroke(new BasicStroke(1.5f,
BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1,
new float[] {2.0f, 2.0f}, 0));
this.yCrosshair.setLabelVisible(true);
crosshairOverlay.addDomainCrosshair(xCrosshair);
crosshairOverlay.addRangeCrosshair(yCrosshair);
Platform.runLater(() -> {
this.chartViewer.getCanvas().addOverlay(crosshairOverlay);
});
}
示例7: testSerialization
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Serialize an instance, restore it, and check for equality.
*/
@Test
public void testSerialization() {
CrosshairOverlay o1 = new CrosshairOverlay();
o1.addDomainCrosshair(new Crosshair(99.9));
o1.addRangeCrosshair(new Crosshair(1.23, new GradientPaint(1.0f, 2.0f,
Color.red, 3.0f, 4.0f, Color.blue), new BasicStroke(1.1f)));
CrosshairOverlay o2 = (CrosshairOverlay) TestUtilities.serialised(o1);
assertEquals(o1, o2);
}
示例8: clearDomainCrosshairs
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Clears all the domain crosshairs from the overlay and sends an
* {@link OverlayChangeEvent} to all registered listeners.
*/
public void clearDomainCrosshairs() {
if (this.xCrosshairs.isEmpty()) {
return; // nothing to do
}
List crosshairs = getDomainCrosshairs();
for (int i = 0; i < crosshairs.size(); i++) {
Crosshair c = (Crosshair) crosshairs.get(i);
this.xCrosshairs.remove(c);
c.removePropertyChangeListener(this);
}
fireOverlayChanged();
}
示例9: addRangeCrosshair
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Adds a crosshair against the range axis and sends an
* {@link OverlayChangeEvent} to all registered listeners.
*
* @param crosshair the crosshair (<code>null</code> not permitted).
*/
public void addRangeCrosshair(Crosshair crosshair) {
ParamChecks.nullNotPermitted(crosshair, "crosshair");
this.yCrosshairs.add(crosshair);
crosshair.addPropertyChangeListener(this);
fireOverlayChanged();
}
示例10: clearRangeCrosshairs
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Clears all the range crosshairs from the overlay and sends an
* {@link OverlayChangeEvent} to all registered listeners.
*/
public void clearRangeCrosshairs() {
if (this.yCrosshairs.isEmpty()) {
return; // nothing to do
}
List crosshairs = getRangeCrosshairs();
for (int i = 0; i < crosshairs.size(); i++) {
Crosshair c = (Crosshair) crosshairs.get(i);
this.yCrosshairs.remove(c);
c.removePropertyChangeListener(this);
}
fireOverlayChanged();
}
示例11: generateLabel
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Returns a string that can be used as the label for a crosshair.
*
* @param crosshair the crosshair (<code>null</code> not permitted).
*
* @return The label (possibly <code>null</code>).
*/
@Override
public String generateLabel(Crosshair crosshair) {
Object[] v = new Object[] {this.numberFormat.format(
crosshair.getValue())};
String result = MessageFormat.format(this.labelTemplate, v);
return result;
}
示例12: clearDomainCrosshairs
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Clears all the domain crosshairs from the overlay and sends an
* {@link OverlayChangeEvent} to all registered listeners.
*/
public void clearDomainCrosshairs() {
if (this.xCrosshairs.isEmpty()) {
return; // nothing to do
}
List<Crosshair> crosshairs = getDomainCrosshairs();
for (Crosshair c : crosshairs) {
this.xCrosshairs.remove(c);
c.removePropertyChangeListener(this);
}
fireOverlayChanged();
}
示例13: addRangeCrosshair
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Adds a crosshair against the range axis and sends an
* {@link OverlayChangeEvent} to all registered listeners.
*
* @param crosshair the crosshair ({@code null} not permitted).
*/
public void addRangeCrosshair(Crosshair crosshair) {
Args.nullNotPermitted(crosshair, "crosshair");
this.yCrosshairs.add(crosshair);
crosshair.addPropertyChangeListener(this);
fireOverlayChanged();
}
示例14: clearRangeCrosshairs
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Clears all the range crosshairs from the overlay and sends an
* {@link OverlayChangeEvent} to all registered listeners.
*/
public void clearRangeCrosshairs() {
if (this.yCrosshairs.isEmpty()) {
return; // nothing to do
}
List<Crosshair> crosshairs = getRangeCrosshairs();
for (Crosshair c : crosshairs) {
this.yCrosshairs.remove(c);
c.removePropertyChangeListener(this);
}
fireOverlayChanged();
}
示例15: generateLabel
import org.jfree.chart.plot.Crosshair; //导入依赖的package包/类
/**
* Returns a string that can be used as the label for a crosshair.
*
* @param crosshair the crosshair ({@code null} not permitted).
*
* @return The label (possibly {@code null}).
*/
@Override
public String generateLabel(Crosshair crosshair) {
Object[] v = new Object[] {this.numberFormat.format(
crosshair.getValue())};
String result = MessageFormat.format(this.labelTemplate, v);
return result;
}