forked from LupusNobilis/java-org.hwo.ui
JDiagram Update
parent
817d0c867b
commit
9f2215eaf4
|
@ -10,7 +10,6 @@ import java.awt.Toolkit;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
import org.hwo.ui.diagram.Diagram;
|
|
||||||
import org.hwo.ui.diagram.LinePlotPainter;
|
import org.hwo.ui.diagram.LinePlotPainter;
|
||||||
import org.hwo.ui.diagram.LinearScaler;
|
import org.hwo.ui.diagram.LinearScaler;
|
||||||
import org.hwo.ui.diagram.PlotLabeler;
|
import org.hwo.ui.diagram.PlotLabeler;
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package org.hwo.ui.diagram;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class Plot {
|
|
||||||
|
|
||||||
private Diagram diagram;
|
|
||||||
|
|
||||||
private String label;
|
|
||||||
|
|
||||||
private Float[] values;
|
|
||||||
|
|
||||||
protected Plot(Diagram diagram){
|
|
||||||
this.diagram = diagram;
|
|
||||||
this.values = new Float[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Diagram getDiagram() {
|
|
||||||
return diagram;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float[] getValues() {
|
|
||||||
return this.values;
|
|
||||||
};
|
|
||||||
public void setValues(Float[] values) {
|
|
||||||
this.values = values;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float getValue(int index){
|
|
||||||
return this.values[index];
|
|
||||||
}
|
|
||||||
public void setValue(int index,Float value){
|
|
||||||
this.values[index] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Float getMin(){
|
|
||||||
Float min = Float.MAX_VALUE;
|
|
||||||
|
|
||||||
for (Float f: values)
|
|
||||||
if (f < min)
|
|
||||||
min = f;
|
|
||||||
|
|
||||||
return min;
|
|
||||||
};
|
|
||||||
public Float getMax(){
|
|
||||||
Float max = Float.MIN_VALUE;
|
|
||||||
|
|
||||||
for (Float f: values)
|
|
||||||
if (f > max)
|
|
||||||
max = f;
|
|
||||||
|
|
||||||
return max;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void resize(int points){
|
|
||||||
int l = Math.min(this.values.length,points);
|
|
||||||
Float[] nv = new Float[points];
|
|
||||||
System.arraycopy(this.values, 0, nv, 0, l);
|
|
||||||
this.values = nv;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue