Cleanups
This commit is contained in:
@@ -1,10 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
||||
3
ch.psi.plot/.settings/org.eclipse.core.resources.prefs
Normal file
3
ch.psi.plot/.settings/org.eclipse.core.resources.prefs
Normal file
@@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
@@ -1,3 +1,5 @@
|
||||
#Tue Oct 18 15:36:07 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
||||
12
ch.psi.plot/Readme.md
Normal file
12
ch.psi.plot/Readme.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Overview
|
||||
|
||||
# Notes
|
||||
JFree is not thread safe!
|
||||
|
||||
While data is modified while JFree is rendering the plot there will be an runtime exception.
|
||||
|
||||
E.g. if you define an array of hundred points to be plotted by JFree and for some reason
|
||||
you decide to remove (or alter) these points, then the rendering thread tries to finish rendering the 100
|
||||
points it started with but allows the concurrent modification of the data. This causes a runtime
|
||||
ArrayIndexOutOfBounds or similar Runtime Exception in the worst case or at least give a 'noisy' impression of the plotting.
|
||||
However, the problem occurs only for large datasets and/or high update frequencies.
|
||||
@@ -1 +0,0 @@
|
||||
JFree is not thread safe. If a manipulate the plotting data used by JFree, the rendering process is not synchronized in the sense that it does not lock the data and hence does not finish plotting the data it started with. If you e.g. define a array of hundred points to be plotted by JFree and for some reason you decide to remove (or alter) these points, then the rendering thread tries to finish rendering the 100 points it started with but allows the concurrent modification of the data. This can cause a runtime Array Index Out of Bounds Exception in the worst case or at least give a 'noisy' impression of the plotting. However, the problem occurs only for large datasets and/or high update frequencies.
|
||||
@@ -2,13 +2,13 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>ch.psi</groupId>
|
||||
<artifactId>plot</artifactId>
|
||||
<version>1.1.30</version>
|
||||
<version>1.1.31</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jfree</groupId>
|
||||
<artifactId>chart</artifactId>
|
||||
<version>1.0.13</version>
|
||||
<artifactId>jfreechart</artifactId>
|
||||
<version>1.0.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@@ -20,6 +20,14 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Generate Javadoc Jar -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -22,10 +22,6 @@ package ch.psi.plot;
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public interface Plot {
|
||||
/**
|
||||
* Get the chart panel
|
||||
|
||||
@@ -50,8 +50,6 @@ import ch.psi.plot.xy.tools.Minimum;
|
||||
|
||||
public class LinePlot implements Plot {
|
||||
|
||||
|
||||
// Get Logger
|
||||
private static final Logger logger = Logger.getLogger(LinePlot.class.getName());
|
||||
|
||||
private ChartPanel chartPanel;
|
||||
@@ -77,7 +75,6 @@ public class LinePlot implements Plot {
|
||||
private boolean tooltips = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param title Title of plot
|
||||
*/
|
||||
public LinePlot(String title){
|
||||
@@ -86,7 +83,6 @@ public class LinePlot implements Plot {
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param title Title of plot
|
||||
* @param data Data of plot
|
||||
*/
|
||||
@@ -222,7 +218,7 @@ public class LinePlot implements Plot {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add additional items to the context menu of the frame
|
||||
* Add additional items to the context menu of the plot
|
||||
*/
|
||||
public void amendContextMenu(){
|
||||
|
||||
@@ -231,7 +227,7 @@ public class LinePlot implements Plot {
|
||||
JMenu toolsMenu = new JMenu("Tools");
|
||||
chartPanel.getPopupMenu().add(toolsMenu);
|
||||
|
||||
// Manipulation function
|
||||
// Mark average
|
||||
JMenuItem averageMenuItem = new JMenuItem("Average");
|
||||
averageMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -239,8 +235,6 @@ public class LinePlot implements Plot {
|
||||
Average average = new Average();
|
||||
for (XYSeriesP series : data.getSeries()) {
|
||||
double a = average.average(series);
|
||||
// System.out.println("Average: "+a);
|
||||
|
||||
// Remove all range markers
|
||||
Collection<?> c = chartPanel.getChart().getXYPlot().getRangeMarkers(Layer.FOREGROUND);
|
||||
if(c!=null){
|
||||
@@ -269,9 +263,10 @@ public class LinePlot implements Plot {
|
||||
}
|
||||
}
|
||||
});
|
||||
// chartPanel.getPopupMenu().add(averageMenuItem);
|
||||
toolsMenu.add(averageMenuItem);
|
||||
|
||||
|
||||
// Mark minimum value
|
||||
JMenuItem minimumMenuItem = new JMenuItem("Minimum");
|
||||
minimumMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -290,10 +285,10 @@ public class LinePlot implements Plot {
|
||||
}
|
||||
}
|
||||
});
|
||||
// chartPanel.getPopupMenu().add(minimumMenuItem);
|
||||
toolsMenu.add(minimumMenuItem);
|
||||
|
||||
|
||||
// Mark maximum value
|
||||
JMenuItem maximumMenuItem = new JMenuItem("Maximum");
|
||||
maximumMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -301,7 +296,6 @@ public class LinePlot implements Plot {
|
||||
Maximum maximum = new Maximum();
|
||||
for (XYSeriesP series : data.getSeries()) {
|
||||
XYDataItem m = maximum.maximum(series);
|
||||
// System.out.println("Maximum: "+m.getXValue());
|
||||
// Remove all annotation for the series
|
||||
for(Object o: chartPanel.getChart().getXYPlot().getAnnotations()){
|
||||
chartPanel.getChart().getXYPlot().removeAnnotation((XYAnnotation) o);
|
||||
@@ -312,26 +306,15 @@ public class LinePlot implements Plot {
|
||||
}
|
||||
}
|
||||
});
|
||||
// chartPanel.getPopupMenu().add(maximumMenuItem);
|
||||
toolsMenu.add(maximumMenuItem);
|
||||
|
||||
|
||||
// Show derivative
|
||||
JMenuItem derivativeMenuItem = new JMenuItem("Derivative");
|
||||
derivativeMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Derivative derivative = new Derivative();
|
||||
// for (XYSeriesP series : data.getSeries()) {
|
||||
// // Show derivative in same plot
|
||||
// final XYSeriesP s = derivative.derivative(series);
|
||||
// SwingUtilities.invokeLater(new Runnable() { // Avoid concurrent modification exception
|
||||
// @Override
|
||||
// public void run() {
|
||||
// data.addSeries(s); // Add Derivative
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
// Show new frame
|
||||
LinePlot p = new LinePlot("Derivative - " + title, derivative.derivative(data));
|
||||
|
||||
JFrame frame = new JFrame();
|
||||
@@ -341,9 +324,9 @@ public class LinePlot implements Plot {
|
||||
frame.setVisible(true);
|
||||
}
|
||||
});
|
||||
// chartPanel.getPopupMenu().add(derivativeMenuItem);
|
||||
toolsMenu.add(derivativeMenuItem);
|
||||
|
||||
// Show integral
|
||||
JMenuItem integralMenuItem = new JMenuItem("Integral");
|
||||
integralMenuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
@@ -360,37 +343,10 @@ public class LinePlot implements Plot {
|
||||
frame.setVisible(true);
|
||||
}
|
||||
});
|
||||
// chartPanel.getPopupMenu().add(integralMenuItem);
|
||||
toolsMenu.add(integralMenuItem);
|
||||
|
||||
chartPanel.getPopupMenu().addSeparator();
|
||||
|
||||
// // Plot all series of the plot in a own plot
|
||||
// JMenuItem splitPlotMenuItem = new JMenuItem("Split");
|
||||
// splitPlotMenuItem.addActionListener(new ActionListener() {
|
||||
// @Override
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// for (XYSeriesP serie : data.getSeries()) {
|
||||
// XYSeriesCollectionP collection = new XYSeriesCollectionP();
|
||||
// collection.addSeries(serie);
|
||||
//
|
||||
// int index = data.indexOf(serie);
|
||||
// //The right colors are not automatically assigned
|
||||
// Paint paint = chart.getXYPlot().getRenderer().getSeriesPaint(index);
|
||||
// LinePlot p = new LinePlot((String) serie.getKey(), collection);
|
||||
// // there is only one series in this plot, so we choose index 0 to assign paint
|
||||
// p.getChartPanel().getChart().getXYPlot().getRenderer().setSeriesPaint(0, paint);
|
||||
//
|
||||
// JFrame frame = new JFrame();
|
||||
// frame.setContentPane(p.getChartPanel());
|
||||
// frame.pack();
|
||||
// RefineryUtilities.centerFrameOnScreen(frame);
|
||||
// frame.setVisible(true);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// chartPanel.getPopupMenu().add(splitPlotMenuItem);
|
||||
|
||||
// Detach plot into a separate frame
|
||||
JMenuItem detachPlotMenuItem = new JMenuItem("Detach");
|
||||
detachPlotMenuItem.addActionListener(new ActionListener() {
|
||||
@@ -454,9 +410,6 @@ public class LinePlot implements Plot {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show tooltips
|
||||
*/
|
||||
private void showTooltips(){
|
||||
tooltips = true;
|
||||
DecimalFormat dm = new DecimalFormat("0.##########");
|
||||
@@ -466,9 +419,6 @@ public class LinePlot implements Plot {
|
||||
chartPanel.getChartRenderingInfo().setEntityCollection(new StandardEntityCollection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide tooltips
|
||||
*/
|
||||
private void hideTooltips(){
|
||||
tooltips = false;
|
||||
// http://www.jfree.org/phpBB2/viewtopic.php?t=12788&highlight=redraw+speed+performance+problem
|
||||
@@ -477,13 +427,8 @@ public class LinePlot implements Plot {
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.plot.Plot#update()
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
// Fire chart change event
|
||||
// chart.fireChartChanged();
|
||||
if(data != null){
|
||||
SwingUtilities.invokeLater(new Runnable() { // Try to avoid concurrent modification exception
|
||||
@Override
|
||||
@@ -502,48 +447,26 @@ public class LinePlot implements Plot {
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see ch.psi.plot.Plot#getChart()
|
||||
*/
|
||||
@Override
|
||||
public JFreeChart getChart() {
|
||||
return chart;
|
||||
}
|
||||
|
||||
//getter and setter
|
||||
// Getter and setter
|
||||
public XYSeriesCollectionP getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the xAxisLabel
|
||||
*/
|
||||
public String getxAxisLabel() {
|
||||
return xAxisLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param xAxisLabel the xAxisLabel to set
|
||||
*/
|
||||
public void setxAxisLabel(String xAxisLabel) {
|
||||
this.xAxisLabel = xAxisLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the yAxisLabel
|
||||
*/
|
||||
public String getyAxisLabel() {
|
||||
return yAxisLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param yAxisLabel the yAxisLabel to set
|
||||
*/
|
||||
public void setyAxisLabel(String yAxisLabel) {
|
||||
this.yAxisLabel = yAxisLabel;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ import ch.psi.plot.xy.XYSeriesP;
|
||||
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
* Calculate average of series
|
||||
*/
|
||||
public class Average {
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import ch.psi.plot.xy.XYSeriesCollectionP;
|
||||
import ch.psi.plot.xy.XYSeriesP;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
* Calculate derivative of series
|
||||
*/
|
||||
public class Derivative {
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import ch.psi.plot.xy.XYSeriesCollectionP;
|
||||
import ch.psi.plot.xy.XYSeriesP;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
* Calculate integral of series
|
||||
*/
|
||||
public class Integral {
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.jfree.data.xy.XYDataItem;
|
||||
import ch.psi.plot.xy.XYSeriesP;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
* Find maximum of series
|
||||
*/
|
||||
public class Maximum {
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ import org.jfree.data.xy.XYDataItem;
|
||||
import ch.psi.plot.xy.XYSeriesP;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
* Find minimum of series
|
||||
*/
|
||||
public class Minimum {
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ package ch.psi.plot.xyz;
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
* Utility class for applying a color map
|
||||
*/
|
||||
public class ColorManager {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.renderer.xy.XYBlockRenderer;
|
||||
import org.jfree.data.DomainOrder;
|
||||
import org.jfree.data.general.DatasetChangeEvent;
|
||||
import org.jfree.data.general.DatasetChangeListener;
|
||||
import org.jfree.data.general.DatasetGroup;
|
||||
import org.jfree.data.xy.XYZDataset;
|
||||
@@ -32,15 +31,11 @@ import org.jfree.ui.RectangleAnchor;
|
||||
|
||||
/**
|
||||
* Dynamic dataset
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public class DynamicXYZDataset implements XYZDataset{
|
||||
|
||||
private final double xResolution;
|
||||
private final double yResolution;
|
||||
private final double incX;
|
||||
private final double incY;
|
||||
|
||||
private final NumberAxis xAxis = new NumberAxis();
|
||||
private double xLowerBound = Double.NaN;
|
||||
@@ -56,7 +51,6 @@ public class DynamicXYZDataset implements XYZDataset{
|
||||
private final XYBlockRenderer renderer = new XYBlockRenderer();
|
||||
|
||||
|
||||
private final List<DatasetChangeListener> listeners = new ArrayList<DatasetChangeListener>();
|
||||
private List<DynamicXYZDataset.Vector> items = new ArrayList<DynamicXYZDataset.Vector>();
|
||||
|
||||
/**
|
||||
@@ -65,8 +59,6 @@ public class DynamicXYZDataset implements XYZDataset{
|
||||
public DynamicXYZDataset(){
|
||||
xResolution = 1.0;
|
||||
yResolution = 1.0;
|
||||
incX = xResolution/2;
|
||||
incY = yResolution/2;
|
||||
|
||||
xAxis.setRange(xLowerBound, xUpperBound);
|
||||
yAxis.setRange(yLowerBound, yUpperBound);
|
||||
@@ -77,150 +69,56 @@ public class DynamicXYZDataset implements XYZDataset{
|
||||
renderer.setBaseCreateEntities(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add datapoint
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
*/
|
||||
public void addData(double x, double y, double z){
|
||||
items.add(new DynamicXYZDataset.Vector(x,y,z));
|
||||
|
||||
// Update axis
|
||||
|
||||
|
||||
// if(Double.isNaN(xLowerBound) && Double.isNaN(xUpperBound)){
|
||||
// xLowerBound = x-incX;
|
||||
// xUpperBound = x+incX;
|
||||
// xAxis.setRange(xLowerBound, xUpperBound);
|
||||
// }
|
||||
// else{
|
||||
// if(x>(xUpperBound+incX)){
|
||||
// xUpperBound = x+incX;
|
||||
// xAxis.setUpperBound(xUpperBound);
|
||||
// }
|
||||
// else if(x<xLowerBound-incX){
|
||||
// xLowerBound = x-incX;
|
||||
// xAxis.setLowerBound(xLowerBound);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(Double.isNaN(yLowerBound) && Double.isNaN(yUpperBound)){
|
||||
// yLowerBound = y-incY;
|
||||
// yUpperBound = y+incY;
|
||||
// yAxis.setRange(yLowerBound, yUpperBound);
|
||||
// }
|
||||
// else{
|
||||
// if(y>(yUpperBound+incY)){
|
||||
// yUpperBound = y+incY;
|
||||
// yAxis.setUpperBound(yUpperBound);
|
||||
// }
|
||||
// else if(y<yLowerBound-incY){
|
||||
// yLowerBound = y-incY;
|
||||
// yAxis.setLowerBound(yLowerBound);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(Double.isNaN(zLowerBound) && Double.isNaN(zUpperBound)){
|
||||
// zLowerBound = z;
|
||||
// zUpperBound = z;
|
||||
// }
|
||||
// else{
|
||||
// if(z>zUpperBound){
|
||||
// zUpperBound = z;
|
||||
// }
|
||||
// else if(z<zLowerBound){
|
||||
// zLowerBound = z;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Inform change listeners
|
||||
// DatasetChangeEvent event = new DatasetChangeEvent(this, this);
|
||||
// for(DatasetChangeListener l: listeners){
|
||||
// l.datasetChanged(event );
|
||||
// }
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYDataset#getItemCount(int)
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int getItemCount(int series) {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYDataset#getX(int, int)
|
||||
*/
|
||||
@Override
|
||||
public Number getX(int series, int item) {
|
||||
return items.get(item).getX();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYDataset#getXValue(int, int)
|
||||
*/
|
||||
@Override
|
||||
public double getXValue(int series, int item) {
|
||||
return items.get(item).getX();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYDataset#getY(int, int)
|
||||
*/
|
||||
@Override
|
||||
public Number getY(int series, int item) {
|
||||
return items.get(item).getY();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYDataset#getYValue(int, int)
|
||||
*/
|
||||
@Override
|
||||
public double getYValue(int series, int item) {
|
||||
return items.get(item).getY();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYZDataset#getZ(int, int)
|
||||
*/
|
||||
@Override
|
||||
public Number getZ(int series, int item) {
|
||||
return items.get(item).getZ();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYZDataset#getZValue(int, int)
|
||||
*/
|
||||
@Override
|
||||
public double getZValue(int series, int item) {
|
||||
return items.get(item).getZ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.xy.XYDataset#getDomainOrder()
|
||||
*/
|
||||
@Override
|
||||
public DomainOrder getDomainOrder() {
|
||||
return DomainOrder.NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.SeriesDataset#getSeriesCount()
|
||||
*/
|
||||
@Override
|
||||
public int getSeriesCount() {
|
||||
// Series not implemented/used - dataset only holds one series
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.SeriesDataset#getSeriesKey(int)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Comparable getSeriesKey(int series) {
|
||||
@@ -228,9 +126,6 @@ public class DynamicXYZDataset implements XYZDataset{
|
||||
return "";
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.SeriesDataset#indexOf(java.lang.Comparable)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public int indexOf(Comparable seriesKey) {
|
||||
@@ -238,115 +133,56 @@ public class DynamicXYZDataset implements XYZDataset{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.Dataset#getGroup()
|
||||
*/
|
||||
@Override
|
||||
public DatasetGroup getGroup() {
|
||||
// Not implemented/used
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.Dataset#setGroup(org.jfree.data.general.DatasetGroup)
|
||||
*/
|
||||
@Override
|
||||
public void setGroup(DatasetGroup group) {
|
||||
// Not implemented/used
|
||||
}
|
||||
|
||||
// Listener concept implementation
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.Dataset#addChangeListener(org.jfree.data.general.DatasetChangeListener)
|
||||
*/
|
||||
@Override
|
||||
public void addChangeListener(DatasetChangeListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.jfree.data.general.Dataset#removeChangeListener(org.jfree.data.general.DatasetChangeListener)
|
||||
*/
|
||||
@Override
|
||||
public void removeChangeListener(DatasetChangeListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
|
||||
// Convenient methods
|
||||
|
||||
/**
|
||||
* @return the zLowerBound
|
||||
*/
|
||||
public double getzLowerBound() {
|
||||
return zLowerBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the zUpperBound
|
||||
*/
|
||||
public double getzUpperBound() {
|
||||
return zUpperBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the xAxis
|
||||
*/
|
||||
public NumberAxis getxAxis() {
|
||||
return xAxis;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the yAxis
|
||||
*/
|
||||
public NumberAxis getyAxis() {
|
||||
return yAxis;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the renderer
|
||||
*/
|
||||
public XYBlockRenderer getRenderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the xLowerBound
|
||||
*/
|
||||
public double getxLowerBound() {
|
||||
return xLowerBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the xUpperBound
|
||||
*/
|
||||
public double getxUpperBound() {
|
||||
return xUpperBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the yLowerBound
|
||||
*/
|
||||
public double getyLowerBound() {
|
||||
return yLowerBound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the yUpperBound
|
||||
*/
|
||||
public double getyUpperBound() {
|
||||
return yUpperBound;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Vector{
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.renderer.xy.XYBlockRenderer;
|
||||
import org.jfree.data.DomainOrder;
|
||||
import org.jfree.data.general.DatasetChangeEvent;
|
||||
import org.jfree.data.general.DatasetChangeListener;
|
||||
import org.jfree.data.general.DatasetGroup;
|
||||
import org.jfree.data.xy.XYZDataset;
|
||||
@@ -39,18 +38,10 @@ public class DynamicXYZDatasetList implements XYZDataset{
|
||||
|
||||
private final double xResolution;
|
||||
private final double yResolution;
|
||||
private final double incX;
|
||||
private final double incY;
|
||||
|
||||
private final NumberAxis xAxis = new NumberAxis();
|
||||
private double xLowerBound = Double.NaN;
|
||||
private double xUpperBound = Double.NaN;
|
||||
private final NumberAxis yAxis = new NumberAxis();
|
||||
private double yLowerBound = Double.NaN;
|
||||
private double yUpperBound = Double.NaN;
|
||||
private double zLowerBound = Double.NaN;
|
||||
|
||||
|
||||
private double zUpperBound = Double.NaN;
|
||||
|
||||
private final XYBlockRenderer renderer = new XYBlockRenderer();
|
||||
@@ -67,17 +58,12 @@ public class DynamicXYZDatasetList implements XYZDataset{
|
||||
public DynamicXYZDatasetList(){
|
||||
xResolution = 1.0;
|
||||
yResolution = 1.0;
|
||||
incX = xResolution/2;
|
||||
incY = yResolution/2;
|
||||
|
||||
xAxis.setRange(0, 100);
|
||||
yAxis.setRange(0, 100);
|
||||
|
||||
renderer.setBlockWidth(xResolution); // If this is not set the default block size is 1
|
||||
renderer.setBlockHeight(yResolution); // If this is not set the default block size is 1
|
||||
renderer.setBlockAnchor(RectangleAnchor.CENTER);
|
||||
// renderer.setBaseCreateEntities(true, false);
|
||||
// renderer.setBaseCreateEntities(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.List;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.renderer.xy.XYBlockRenderer;
|
||||
import org.jfree.data.DomainOrder;
|
||||
import org.jfree.data.general.DatasetChangeEvent;
|
||||
import org.jfree.data.general.DatasetChangeListener;
|
||||
import org.jfree.data.general.DatasetGroup;
|
||||
import org.jfree.data.xy.XYZDataset;
|
||||
@@ -32,8 +31,6 @@ import org.jfree.ui.RectangleAnchor;
|
||||
|
||||
/**
|
||||
* Dynamic dataset
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public class DynamicXYZDatasetNumber implements XYZDataset{
|
||||
|
||||
|
||||
@@ -8,15 +8,11 @@ import java.text.DecimalFormat;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JMenu;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.axis.NumberAxis;
|
||||
import org.jfree.chart.axis.ValueAxis;
|
||||
import org.jfree.chart.event.AxisChangeEvent;
|
||||
import org.jfree.chart.event.AxisChangeListener;
|
||||
import org.jfree.chart.labels.StandardXYZToolTipGenerator;
|
||||
import org.jfree.chart.labels.XYZToolTipGenerator;
|
||||
import org.jfree.chart.plot.XYPlot;
|
||||
@@ -24,8 +20,6 @@ import org.jfree.chart.renderer.LookupPaintScale;
|
||||
import org.jfree.chart.renderer.PaintScale;
|
||||
import org.jfree.chart.renderer.xy.XYBlockRenderer;
|
||||
import org.jfree.chart.title.PaintScaleLegend;
|
||||
import org.jfree.data.Range;
|
||||
import org.jfree.ui.RectangleAnchor;
|
||||
import org.jfree.ui.RectangleEdge;
|
||||
import org.jfree.ui.RectangleInsets;
|
||||
|
||||
@@ -41,8 +35,6 @@ public class MatrixPlot2 implements Plot {
|
||||
private static final int chartPanelHeight = 270;
|
||||
|
||||
private String title;
|
||||
private String xAxisLabel = "X";
|
||||
private String yAxisLabel = "Y";
|
||||
|
||||
private boolean grayScale = false;
|
||||
|
||||
@@ -51,7 +43,6 @@ public class MatrixPlot2 implements Plot {
|
||||
private ChartPanel chartPanel;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param title
|
||||
* @param data
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package ch.psi.plot.xyz;
|
||||
|
||||
//import java.util.Arrays;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -15,7 +13,6 @@ import org.jfree.data.xy.XYZDataset;
|
||||
*/
|
||||
public class MatrixPlotData {
|
||||
|
||||
// Get Logger
|
||||
private static final Logger logger = Logger.getLogger(MatrixPlotData.class.getName());
|
||||
|
||||
private final double minX;
|
||||
|
||||
@@ -22,8 +22,6 @@ package ch.psi.plot.xyz;
|
||||
import org.jfree.data.xy.XYZDataset;
|
||||
|
||||
/**
|
||||
* @author ebner
|
||||
*
|
||||
*/
|
||||
public class XYZDatasetUtil {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user