/** * Set the line stroke style. */ public LinePlot setStroke(Stroke stroke) { line.setStroke(stroke); return this; }
/** * Constructor. */ public LinePlot(double[][] data, Line.Style style) { super(data, '.'); line = new Line(style, data); }
@Override public Color getColor() { return line.getColor(); }
@Override public void paint(Graphics g) { line.paint(g); if (drawDot) { super.paint(g); } }
/** * Returns the line stroke style. */ public Stroke getStroke() { return line.getStroke(); }
@Override public LinePlot setColor(Color color) { super.setColor(color); line.setColor(color); return this; }
private void moveUp() { Line line = new Line(cX, cY, cX, cY - 10); line.setStroke(Color.BLUE); pane.getChildren().add(line); cY -= 10; }
/** * Initialize grid lines. */ private void initGridLines() { gridLines = new Line[base.getDimension() - 1][linesSlicing.length]; int i2 = 0; for (int i = 0; i < base.getDimension() - 1; i++) { if (i2 == index) { i2++; } for (int j = 0; j < gridLines[i].length; j++) { double[] originBase = new double[base.getDimension()]; double[] endBase = new double[base.getDimension()]; System.arraycopy(origin, 0, originBase, 0, base.getDimension()); System.arraycopy(origin, 0, endBase, 0, base.getDimension()); endBase[i2] = base.getCoordinateSpace()[i2 + 1][i2]; originBase[index] = linesSlicing[j]; endBase[index] = linesSlicing[j]; if (j == 0 || j == gridLines[i].length - 1) { gridLines[i][j] = new Line(originBase, endBase); } else { gridLines[i][j] = new Line(Line.Style.DOT, Color.lightGray, originBase, endBase); } } i2++; } }
@Override public void paint(Graphics g) { Color c = g.getColor(); g.setColor(getColor()); Stroke s = g.getStroke(); if (stroke != null) { g.setStroke(stroke); } g.drawLine(points); if (stroke != null) { g.setStroke(s); } g.setColor(c); } }
private void moveUp() { Line sLine = new Line(cX, cY, cX, cY - 10); sLine.setStroke(Color.RED); pane.getChildren().add(sLine); cY -= 10;