changed return Value of getValue Method in PlotProvider (and inherited) from Float to Double
implemented time based x_axismaster
parent
f45db5f242
commit
ac96878a66
|
@ -27,6 +27,7 @@ import javax.swing.JPanel;
|
|||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import org.hwo.ui.diagram.CirclePlotPainter;
|
||||
import org.hwo.ui.diagram.DiagramListener;
|
||||
import org.hwo.ui.diagram.DiagramViewEvent;
|
||||
import org.hwo.ui.diagram.LinePlotPainter;
|
||||
|
@ -111,6 +112,10 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
private Point mousePos;
|
||||
|
||||
private double mouseWheelZoom = 1.03;
|
||||
|
||||
private double abzissSpacing;
|
||||
private boolean pointsEnabled;
|
||||
|
||||
|
||||
public JDiagram(){
|
||||
setMinimumSize(new Dimension(80, 80));
|
||||
|
@ -119,7 +124,8 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
defaultLabeler = new SimplePlotLabeler();
|
||||
abszissLabeler = defaultLabeler;
|
||||
|
||||
bTop = bBottom = bLeft = 10;
|
||||
bTop = 40;
|
||||
bBottom = bLeft = 10;
|
||||
bRight = 30;
|
||||
axMarkerLength = 3;
|
||||
|
||||
|
@ -258,6 +264,8 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
this.abzissSpacing = 1.2;
|
||||
}
|
||||
|
||||
private void fireViewWindowChanged(){
|
||||
|
@ -324,7 +332,7 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
for (int n=0; n < plotProvider.getMaxOrdinate() + 1; n++)
|
||||
ordinateViews[n] = new OrdinateView(n);
|
||||
|
||||
PlotPainter pp = new LinePlotPainter();
|
||||
PlotPainter pp = new CirclePlotPainter();
|
||||
plotPainters = new PlotPainter[plotProvider.getNumGraphs()];
|
||||
for (int n=0;n<plotProvider.getNumGraphs();n++)
|
||||
plotPainters[n] = pp;
|
||||
|
@ -402,6 +410,12 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
this.abszissLabeler = abszissLabeler;
|
||||
}
|
||||
|
||||
public double getAbzissSpacing() {
|
||||
return this.abzissSpacing;
|
||||
}
|
||||
public void setAbszissSpacing(double spacing) {
|
||||
this.abzissSpacing = spacing;
|
||||
}
|
||||
|
||||
public void autoscale(){
|
||||
int ordinate;
|
||||
|
@ -591,7 +605,7 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
|
||||
if (nMarker == 0){
|
||||
int w = g.getFontMetrics().stringWidth( labeler.getAbzisseLabel(this, (double)this.plotProvider.getPositionMaximum()));
|
||||
nMarker = plotWidth / (w*8/7);
|
||||
nMarker = plotWidth / (int)(w*this.abzissSpacing);
|
||||
}
|
||||
|
||||
// TODO change for zoom
|
||||
|
@ -623,7 +637,7 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
getWidth() - bRight - plotWidth + xpos,
|
||||
bTop + plotHeight + axMarkerLength
|
||||
);
|
||||
|
||||
|
||||
if (drawVerticalGrid){
|
||||
g.setColor(verticalGridColor);
|
||||
g.drawLine(
|
||||
|
@ -663,7 +677,7 @@ public class JDiagram extends JComponent implements PlotProviderListener, Bounde
|
|||
for (int n=0;n<this.plotProvider.getLength(); n++){
|
||||
int x,y;
|
||||
Float value = this.plotProvider.getValue(n, graph);
|
||||
Float position = this.plotProvider.getPosition(n, graph);
|
||||
Double position = this.plotProvider.getPosition(n, graph);
|
||||
|
||||
if ((value != null) && (position != null) && (position >= this.abszissMinimum) && (position <= amax))
|
||||
{
|
||||
|
|
|
@ -291,18 +291,18 @@ public class AnnotatedPlotProvider implements PlotProvider2{
|
|||
}
|
||||
|
||||
@Override
|
||||
public Float getPosition(int x, int graph) {
|
||||
return (float)x;
|
||||
public Double getPosition(int x, int graph) {
|
||||
return (double)x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float getPositionMinimum() {
|
||||
return 0.0f;
|
||||
public Double getPositionMinimum() {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float getPositionMaximum() {
|
||||
return this.values.size()-1.0f;
|
||||
public Double getPositionMaximum() {
|
||||
return this.values.size()-1.0;
|
||||
}
|
||||
|
||||
private LinkedList<PlotProviderListener> plotProviderListeners = new LinkedList<PlotProviderListener>();
|
||||
|
|
|
@ -9,11 +9,11 @@ public interface PlotProvider2 {
|
|||
public int getNumGraphs();
|
||||
public String getLabel(int graph);
|
||||
public Float getValue(int x,int graph);
|
||||
public Float getPosition(int x,int graph);
|
||||
public Double getPosition(int x,int graph);
|
||||
public int getOrdinate(int graph);
|
||||
|
||||
public Float getPositionMinimum();
|
||||
public Float getPositionMaximum();
|
||||
public Double getPositionMinimum();
|
||||
public Double getPositionMaximum();
|
||||
|
||||
|
||||
public Color[] getColors();
|
||||
|
|
|
@ -83,8 +83,8 @@ public class SimplePlotProvider implements PlotProvider2 {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Float getPosition(int x, int graph) {
|
||||
return (float)x;
|
||||
public Double getPosition(int x, int graph) {
|
||||
return x * 1.0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,12 +97,12 @@ public class SimplePlotProvider implements PlotProvider2 {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Float getPositionMaximum() {
|
||||
return (float)(this.points-1);
|
||||
public Double getPositionMaximum() {
|
||||
return (double)(this.points-1);
|
||||
}
|
||||
@Override
|
||||
public Float getPositionMinimum() {
|
||||
return (float)0;
|
||||
public Double getPositionMinimum() {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue