Java Code Examples for org.jfree.chart.plot.XYPlot#clearDomainMarkers()
The following examples show how to use
org.jfree.chart.plot.XYPlot#clearDomainMarkers() .
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 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)); }
Example 2
Source File: MarkerTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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)); }
Example 3
Source File: LineChartPanel.java From nmonvisualizer with Apache License 2.0 | 6 votes |
@Override public void addMarkers(List<Marker> markers) { if (getChart() != null) { XYPlot plot = getChart().getXYPlot(); plot.clearDomainMarkers(); plot.clearRangeMarkers(); for (Marker marker : markers) { if (marker instanceof RangeValueMarker) { plot.addRangeMarker(marker); } else if (marker instanceof DomainValueMarker) { plot.addDomainMarker(marker); } firePropertyChange("annotation", null, marker); } } }
Example 4
Source File: XYPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the addDomainMarker() method(s). */ public void testAddDomainMarker() { XYPlot plot = new XYPlot(); Marker m = new ValueMarker(1.0); 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: XYPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Some tests for the addDomainMarker() method(s). */ public void testAddDomainMarker() { XYPlot plot = new XYPlot(); Marker m = new ValueMarker(1.0); 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 6
Source File: JPanelProfil.java From Course_Generator with GNU General Public License v3.0 | 4 votes |
/** * Update the profil chart */ public void RefreshProfilChart() { if (track == null) return; if (track.data.isEmpty()) return; // -- Clear all series if (datasetProfil.getSeriesCount() > 0) datasetProfil.removeAllSeries(); XYPlot plot = chartProfil.getXYPlot(); plot.clearDomainMarkers(); // -- Populate the serie XYSeries serie1 = new XYSeries("Elevation/Distance"); int cmpt = 1; for (CgData r : track.data) { double x = r.getTotal(settings.Unit) / 1000; double y = r.getElevation(settings.Unit); serie1.add(x, y); if (((r.getTag() & CgConst.TAG_MARK) != 0) & showProfilMarker) { Marker m = new ValueMarker(x); m.setPaint(Color.GRAY); m.setLabelFont(new Font("SansSerif", Font.PLAIN, 10)); m.setLabel(String.valueOf(cmpt)); m.setLabelOffset(new RectangleInsets(5, 0, 0, 2)); m.setLabelAnchor(RectangleAnchor.TOP_RIGHT); m.setLabelTextAnchor(TextAnchor.TOP_LEFT); plot.addDomainMarker(m); cmpt++; } } datasetProfil.addSeries(serie1); if (track.getMaxElev(settings.Unit) > track.getMinElev(settings.Unit)) { // XYPlot plot = chart.getXYPlot(); ValueAxis axisY = plot.getRangeAxis(); axisY.setRange(Math.floor(track.getMinElev(settings.Unit) / 100.0) * 100.0, Math.ceil(track.getMaxElev(settings.Unit) / 100.0) * 100.0); } }
Example 7
Source File: HouseholdsPanel.java From computational-economy with GNU General Public License v3.0 | 4 votes |
@Override public synchronized void notifyListener() { if (isShowing()) { /* * income distribution chart */ final XYPlot plot = ((XYPlot) incomeDistributionChart.getPlot()); plot.setDataset(ApplicationContext.getInstance().getModelRegistry() .getNationalEconomyModel(currency).householdsModel.incomeDistributionModel .getHistogramDataset()); plot.clearDomainMarkers(); final SummaryStatisticalData summaryStatisticalData = ApplicationContext.getInstance() .getModelRegistry().getNationalEconomyModel(currency).householdsModel.incomeDistributionModel .getSummaryStatisticalData(); if (summaryStatisticalData.originalValues != null && summaryStatisticalData.originalValues.length > 0) { addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith10PercentY], "10 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith20PercentY], "20 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith30PercentY], "30 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith40PercentY], "40 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith50PercentY], "50 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith60PercentY], "60 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith70PercentY], "70 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith80PercentY], "80 %"); addValueMarker(incomeDistributionChart, summaryStatisticalData.originalValues[summaryStatisticalData.xWith90PercentY], "90 %"); } // prices panel if (priceTimeSeriesPanel != null) { this.remove(priceTimeSeriesPanel); } priceTimeSeriesPanel = createPriceTimeSeriesChartPanel(currency); this.add(priceTimeSeriesPanel); // market depth panel if (marketDepthPanel != null) { this.remove(marketDepthPanel); } marketDepthPanel = createMarketDepthPanel(currency); this.add(marketDepthPanel); validate(); repaint(); } }