Java Code Examples for org.jfree.chart.plot.CategoryPlot#addDomainMarker()
The following examples show how to use
org.jfree.chart.plot.CategoryPlot#addDomainMarker() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MarkerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Checks that a CategoryPlot deregisters listeners when clearing markers. */ public void testListenersWithCategoryPlot() { CategoryPlot plot = new CategoryPlot(); CategoryMarker marker1 = new CategoryMarker("X"); ValueMarker marker2 = new ValueMarker(1.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)); }
Example 2
Source File: MarkerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Checks that a CategoryPlot deregisters listeners when clearing markers. */ public void testListenersWithCategoryPlot() { CategoryPlot plot = new CategoryPlot(); CategoryMarker marker1 = new CategoryMarker("X"); ValueMarker marker2 = new ValueMarker(1.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)); }
Example 3
Source File: CategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the addDomainMarker() method(s). */ public void testAddDomainMarker() { CategoryPlot plot = new CategoryPlot(); CategoryMarker m = new CategoryMarker("C1"); plot.addDomainMarker(m); List listeners = Arrays.asList(m.getListeners( MarkerChangeListener.class)); assertTrue(listeners.contains(plot)); plot.clearDomainMarkers(); listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class)); assertFalse(listeners.contains(plot)); }
Example 4
Source File: CategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the addDomainMarker() method(s). */ public void testAddDomainMarker() { CategoryPlot plot = new CategoryPlot(); CategoryMarker m = new CategoryMarker("C1"); plot.addDomainMarker(m); List listeners = Arrays.asList(m.getListeners( MarkerChangeListener.class)); assertTrue(listeners.contains(plot)); plot.clearDomainMarkers(); listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class)); assertFalse(listeners.contains(plot)); }
Example 5
Source File: cfCHART.java From openbd-core with GNU General Public License v3.0 | 4 votes |
public void addDomainMarker(CategoryPlot plot, cfCHARTDOMAINMARKERData dmData) throws cfmRunTimeException { CategoryMarker domainMarker = new CategoryMarker(dmData.getValue()); boolean drawAsLine = false; if (dmData.getShape().equals("line")) drawAsLine = true; domainMarker.setDrawAsLine(drawAsLine); 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); }