|
@@ -77,27 +77,28 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
|
|
g2 = (Graphics2D) g;
|
|
g2 = (Graphics2D) g;
|
|
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
g2.setRenderingHints(rh);
|
|
g2.setRenderingHints(rh);
|
|
- g2.setStroke(new BasicStroke(1));
|
|
|
|
|
|
+ g2.setStroke(new BasicStroke(0));
|
|
|
|
|
|
graphCurve.reset();
|
|
graphCurve.reset();
|
|
|
|
|
|
// Draw the Vertical Lines
|
|
// Draw the Vertical Lines
|
|
- g2.setColor(new Color(240, 240, 240));
|
|
|
|
- for (int i = 0; i < model.getIterations(); i++) {
|
|
|
|
|
|
+ g2.setColor(Color.BLACK);
|
|
|
|
+ for (int i = 0; i <= model.getIterations(); i++) {
|
|
g2.drawLine((i) * this.getWidth() / (model.getIterations() - 1), 0,
|
|
g2.drawLine((i) * this.getWidth() / (model.getIterations() - 1), 0,
|
|
(i) * this.getWidth() / (model.getIterations() - 1), this.getHeight());
|
|
(i) * this.getWidth() / (model.getIterations() - 1), this.getHeight());
|
|
}
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < model.getIterations(); i++) {
|
|
|
|
|
|
+ for (int i = 0; i <= model.getIterations(); i++) {
|
|
g2.drawLine(0, (i) * this.getHeight() / (model.getIterations() - 1), this.getWidth(),
|
|
g2.drawLine(0, (i) * this.getHeight() / (model.getIterations() - 1), this.getWidth(),
|
|
(i) * this.getHeight() / (model.getIterations() - 1));
|
|
(i) * this.getHeight() / (model.getIterations() - 1));
|
|
}
|
|
}
|
|
|
|
|
|
if (arrayOfValue != null) {
|
|
if (arrayOfValue != null) {
|
|
- //array fillen
|
|
|
|
|
|
+ // array fillen
|
|
fillArrayofValue();
|
|
fillArrayofValue();
|
|
|
|
|
|
// Draw the Lines
|
|
// Draw the Lines
|
|
|
|
+ g2.setStroke(new BasicStroke(2));
|
|
g2.setColor(Color.BLACK);
|
|
g2.setColor(Color.BLACK);
|
|
for (int i = 0; i < pointList.size() - 1; i++) {
|
|
for (int i = 0; i < pointList.size() - 1; i++) {
|
|
c = buildCurve(pointList.get(i), pointList.get(i + 1));
|
|
c = buildCurve(pointList.get(i), pointList.get(i + 1));
|
|
@@ -115,30 +116,24 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
|
|
}
|
|
}
|
|
// Iteration Line
|
|
// Iteration Line
|
|
g2.setColor(Color.BLUE);
|
|
g2.setColor(Color.BLUE);
|
|
|
|
+ g2.setStroke(new BasicStroke(1));
|
|
g2.drawLine((model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1), 0,
|
|
g2.drawLine((model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1), 0,
|
|
(model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1), this.getHeight());
|
|
(model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1), this.getHeight());
|
|
// Iteration Value
|
|
// Iteration Value
|
|
if (arrayOfValue != null) {
|
|
if (arrayOfValue != null) {
|
|
- if (model.getCurIteration() > model.getIterations() / 2) {
|
|
|
|
g2.drawString("" + arrayOfValue[model.getCurIteration()],
|
|
g2.drawString("" + arrayOfValue[model.getCurIteration()],
|
|
- (model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1) - 30,
|
|
|
|
- this.getHeight() / 2);
|
|
|
|
- } else {
|
|
|
|
- g2.drawString("" + arrayOfValue[model.getCurIteration()],
|
|
|
|
- (model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1) + 2,
|
|
|
|
- this.getHeight() / 2);
|
|
|
|
- }
|
|
|
|
|
|
+ (model.getCurIteration()) * this.getWidth() / (model.getIterations() - 1) +2,
|
|
|
|
+ this.getHeight()-10);
|
|
}
|
|
}
|
|
- // Actual Iteration Point Visualization
|
|
|
|
|
|
|
|
- g2.setColor(Color.RED);
|
|
|
|
- if (arrayOfValue != null) {
|
|
|
|
- for (int i = 0; i < arrayOfValue.length; i++) {
|
|
|
|
- g2.fillOval((int) (i * width / (model.getIterations() - 1) * scaleX - recSize.getX() / 2),
|
|
|
|
- (int) (convertToCanvasY((int) arrayOfValue[i]) * scaleY - recSize.getY() / 2),
|
|
|
|
- (int) recSize.getX(), (int) recSize.getY());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ /*
|
|
|
|
+ * // Actual Iteration Point Visualization g2.setColor(Color.RED); if
|
|
|
|
+ * (arrayOfValue != null) { for (int i = 0; i < arrayOfValue.length;
|
|
|
|
+ * i++) { g2.fillOval((int) (i * width / (model.getIterations() - 1) *
|
|
|
|
+ * scaleX - recSize.getX() / 2), (int) (convertToCanvasY((int)
|
|
|
|
+ * arrayOfValue[i]) * scaleY - recSize.getY() / 2), (int)
|
|
|
|
+ * recSize.getX(), (int) recSize.getY()); } }
|
|
|
|
+ */
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -163,7 +158,6 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
|
|
repaint();
|
|
repaint();
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|