Java Code Examples for javafx.scene.canvas.GraphicsContext#lineTo()

The following examples show how to use javafx.scene.canvas.GraphicsContext#lineTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToolGraphics.java    From JetUML with GNU General Public License v3.0 6 votes vote down vote up
private static void applyPath(GraphicsContext pGraphics, Path pPath)
{
	pGraphics.beginPath();
	for(PathElement element : pPath.getElements())
	{
		if(element instanceof MoveTo)
		{
			pGraphics.moveTo(((int)((MoveTo) element).getX()) + 0.5, ((int)((MoveTo) element).getY()) + 0.5);
		}
		else if(element instanceof LineTo)
		{
			pGraphics.lineTo(((int)((LineTo) element).getX()) + 0.5, ((int)((LineTo) element).getY()) + 0.5);
		}
		else if (element instanceof QuadCurveTo)
		{
			QuadCurveTo curve = (QuadCurveTo) element;
			pGraphics.quadraticCurveTo(((int)curve.getControlX())+0.5, ((int)curve.getControlY()) + 0.5, 
					((int) curve.getX()) + 0.5, ((int) curve.getY()) + 0.5);
		}
	}
}
 
Example 2
Source File: Helper.java    From OEE-Designer with MIT License 6 votes vote down vote up
public static final void drawRoundedRect(final GraphicsContext CTX, final CtxBounds BOUNDS,
		final CtxCornerRadii RADII) {
	double x = BOUNDS.getX();
	double y = BOUNDS.getY();
	double width = BOUNDS.getWidth();
	double height = BOUNDS.getHeight();
	double xPlusWidth = x + width;
	double yPlusHeight = y + height;

	CTX.beginPath();
	CTX.moveTo(x + RADII.getTopLeft(), y);
	CTX.lineTo(xPlusWidth - RADII.getTopRight(), y);
	CTX.quadraticCurveTo(xPlusWidth, y, xPlusWidth, y + RADII.getTopRight());
	CTX.lineTo(xPlusWidth, yPlusHeight - RADII.getBottomRight());
	CTX.quadraticCurveTo(xPlusWidth, yPlusHeight, xPlusWidth - RADII.getBottomRight(), yPlusHeight);
	CTX.lineTo(x + RADII.getBottomLeft(), yPlusHeight);
	CTX.quadraticCurveTo(x, yPlusHeight, x, yPlusHeight - RADII.getBottomLeft());
	CTX.lineTo(x, y + RADII.getTopLeft());
	CTX.quadraticCurveTo(x, y, x + RADII.getTopLeft(), y);
	CTX.closePath();
}
 
Example 3
Source File: Helper.java    From charts with Apache License 2.0 6 votes vote down vote up
public static final void drawRoundedRect(final GraphicsContext CTX, final CtxBounds BOUNDS, final CtxCornerRadii RADII) {
    double x           = BOUNDS.getX();
    double y           = BOUNDS.getY();
    double width       = BOUNDS.getWidth();
    double height      = BOUNDS.getHeight();
    double xPlusWidth  = x + width;
    double yPlusHeight = y + height;

    CTX.beginPath();
    CTX.moveTo(x + RADII.getTopLeft(), y);
    CTX.lineTo(xPlusWidth - RADII.getTopRight(), y);
    CTX.quadraticCurveTo(xPlusWidth, y, xPlusWidth, y + RADII.getTopRight());
    CTX.lineTo(xPlusWidth, yPlusHeight - RADII.getBottomRight());
    CTX.quadraticCurveTo(xPlusWidth, yPlusHeight, xPlusWidth - RADII.getBottomRight(), yPlusHeight);
    CTX.lineTo(x + RADII.getBottomLeft(), yPlusHeight);
    CTX.quadraticCurveTo(x, yPlusHeight, x, yPlusHeight - RADII.getBottomLeft());
    CTX.lineTo(x, y + RADII.getTopLeft());
    CTX.quadraticCurveTo(x, y, x + RADII.getTopLeft(), y);
    CTX.closePath();
}
 
Example 4
Source File: Path.java    From charts with Apache License 2.0 6 votes vote down vote up
public void draw(final GraphicsContext CTX, final boolean FILL, final boolean STROKE) {
    PathIterator pi = getPathIterator(new Affine());

    CTX.setFillRule(WindingRule.WIND_EVEN_ODD == pi.getWindingRule() ? FillRule.EVEN_ODD : FillRule.NON_ZERO);
    CTX.beginPath();

    double[] seg = new double[6];
    int      segType;

    while(!pi.isDone()) {
        segType = pi.currentSegment(seg);
        switch (segType) {
            case PathIterator.MOVE_TO  : CTX.moveTo(seg[0], seg[1]); break;
            case PathIterator.LINE_TO  : CTX.lineTo(seg[0], seg[1]); break;
            case PathIterator.QUAD_TO  : CTX.quadraticCurveTo(seg[0], seg[1], seg[2], seg[3]);break;
            case PathIterator.BEZIER_TO: CTX.bezierCurveTo(seg[0], seg[1], seg[2], seg[3], seg[4], seg[5]);break;
            case PathIterator.CLOSE    : CTX.closePath();break;
            default                    : break;
        }
        pi.next();
    }

    if (FILL)   { CTX.setFill(fill); CTX.fill(); }
    if (STROKE) { CTX.setStroke(stroke); CTX.stroke(); }
}
 
Example 5
Source File: Helper.java    From tilesfx with Apache License 2.0 6 votes vote down vote up
public static final void drawRoundedRect(final GraphicsContext CTX, final CtxBounds BOUNDS, final CtxCornerRadii RADII) {
    double x           = BOUNDS.getX();
    double y           = BOUNDS.getY();
    double width       = BOUNDS.getWidth();
    double height      = BOUNDS.getHeight();
    double xPlusWidth  = x + width;
    double yPlusHeight = y + height;

    CTX.beginPath();
    CTX.moveTo(x + RADII.getTopLeft(), y);
    CTX.lineTo(xPlusWidth - RADII.getTopRight(), y);
    CTX.quadraticCurveTo(xPlusWidth, y, xPlusWidth, y + RADII.getTopRight());
    CTX.lineTo(xPlusWidth, yPlusHeight - RADII.getBottomRight());
    CTX.quadraticCurveTo(xPlusWidth, yPlusHeight, xPlusWidth - RADII.getBottomRight(), yPlusHeight);
    CTX.lineTo(x + RADII.getBottomLeft(), yPlusHeight);
    CTX.quadraticCurveTo(x, yPlusHeight, x, yPlusHeight - RADII.getBottomLeft());
    CTX.lineTo(x, y + RADII.getTopLeft());
    CTX.quadraticCurveTo(x, y, x + RADII.getTopLeft(), y);
    CTX.closePath();
}
 
Example 6
Source File: ControlledBufferPeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
	GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION));
	GuiUtils.rotateGraphics(this, graphics, getProperties().getValue(Properties.DIRECTION));
	
	graphics.beginPath();
	graphics.moveTo(getScreenX(), getScreenY());
	graphics.lineTo(getScreenX() + getScreenWidth(), getScreenY() + getScreenHeight() * 0.5);
	graphics.lineTo(getScreenX(), getScreenY() + getScreenHeight());
	graphics.closePath();
	
	graphics.setFill(Color.WHITE);
	graphics.fill();
	graphics.setStroke(Color.BLACK);
	graphics.stroke();
}
 
Example 7
Source File: GeneralPath.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
public int draw(final GraphicsContext gc) {
    int count = 0;
    for (final Segment segment : drawList) {
        switch (segment.type) {
        case GC_LINETO:
            gc.lineTo(segment.x, segment.y);
            count++;
            break;
        case GC_MOVETO:
            gc.moveTo(segment.x, segment.y);
            count++;
            break;
        case GC_BEGINPATH:
            gc.beginPath();
            break;
        case GC_CLOSEPATH:
            gc.closePath();
            gc.stroke();
            break;
        default:
            break;
        }
    }
    return count;
}
 
Example 8
Source File: AndGatePeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void paintGate(GraphicsContext graphics, CircuitState circuitState) {
	int x = getScreenX();
	int y = getScreenY();
	int width = 4 * GuiUtils.BLOCK_SIZE;
	int height = 4 * GuiUtils.BLOCK_SIZE;
	
	graphics.beginPath();
	graphics.moveTo(x, y);
	graphics.lineTo(x, y + height);
	graphics.arc(x + width * 0.5, y + height * 0.5, width * 0.5, height * 0.5, 270, 180);
	graphics.closePath();
	
	graphics.setFill(Color.WHITE);
	graphics.setStroke(Color.BLACK);
	graphics.fill();
	graphics.stroke();
}
 
Example 9
Source File: NotGatePeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void paintGate(GraphicsContext graphics, CircuitState circuitState) {
	int x = getScreenX();
	int y = getScreenY();
	int width = 3 * GuiUtils.BLOCK_SIZE;
	int height = 2 * GuiUtils.BLOCK_SIZE;
	
	graphics.beginPath();
	graphics.moveTo(x, y);
	graphics.lineTo(x, y + height);
	graphics.lineTo(x + width * 0.7, y + height * 0.5);
	graphics.closePath();
	
	graphics.setFill(Color.WHITE);
	graphics.setStroke(Color.BLACK);
	graphics.fill();
	graphics.stroke();
	
	graphics.fillOval(x + width * 0.7, y + height * 0.5 - width * 0.125, width * 0.25, width * 0.25);
	graphics.strokeOval(x + width * 0.7, y + height * 0.5 - width * 0.125, width * 0.25, width * 0.25);
}
 
Example 10
Source File: NandGatePeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void paintGate(GraphicsContext graphics, CircuitState circuitState) {
	int x = getScreenX();
	int y = getScreenY();
	int width = 4 * GuiUtils.BLOCK_SIZE;
	int height = 4 * GuiUtils.BLOCK_SIZE;
	
	graphics.beginPath();
	graphics.moveTo(x, y);
	graphics.lineTo(x, y + height);
	graphics.arc(x + width * 0.3, y + height * 0.5, width * 0.5, height * 0.5, 270, 180);
	graphics.closePath();
	
	graphics.setFill(Color.WHITE);
	graphics.setStroke(Color.BLACK);
	graphics.fill();
	graphics.stroke();
	
	graphics.fillOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2);
	graphics.strokeOval(x + width * 0.8, y + height * 0.5 - width * 0.1, width * 0.2, width * 0.2);
}
 
Example 11
Source File: Helper.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public static final void drawTriangle(final GraphicsContext CTX,
                                      final double PIX, final double PIY, final double PO1X, final double PO1Y, final double PO2X, final double PO2Y) {
    CTX.beginPath();
    CTX.moveTo(PIX, PIY);
    CTX.lineTo(PO1X, PO1Y);
    CTX.lineTo(PO2X, PO2Y);
    CTX.closePath();
    CTX.fill();
}
 
Example 12
Source File: Helper.java    From Medusa with Apache License 2.0 5 votes vote down vote up
public static final void drawTrapezoid(final GraphicsContext CTX,
                                       final double PI1X, final double PI1Y, final double PI2X, final double PI2Y,
                                       final double PO1X, final double PO1Y, final double PO2X, final double PO2Y) {
    CTX.beginPath();
    CTX.moveTo(PI2X, PI2Y);
    CTX.lineTo(PI1X, PI1Y);
    CTX.lineTo(PO1X, PO1Y);
    CTX.lineTo(PO2X, PO2Y);
    CTX.closePath();
    CTX.fill();
}
 
Example 13
Source File: DemultiplexerPeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
	GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION));
	Direction direction = getProperties().getValue(Properties.DIRECTION);
	
	int x = getScreenX();
	int y = getScreenY();
	int width = 3 * GuiUtils.BLOCK_SIZE;
	int height = (getComponent().getNumOutputs() + 2) * GuiUtils.BLOCK_SIZE;
	
	int zeroXOffset = 0;
	
	switch(direction) {
		case SOUTH:
			graphics.translate(x, y);
			graphics.rotate(270);
			graphics.translate(-x - width, -y);
		case WEST:
			zeroXOffset = 2;
			graphics.beginPath();
			graphics.moveTo(x, y);
			graphics.lineTo(x + width, y + Math.min(20, height * 0.2));
			graphics.lineTo(x + width, y + height - Math.min(20, height * 0.2));
			graphics.lineTo(x, y + height);
			graphics.closePath();
			break;
		case NORTH:
			graphics.translate(x, y);
			graphics.rotate(270);
			graphics.translate(-x - width, -y);
		case EAST:
			zeroXOffset = width - 10;
			graphics.beginPath();
			graphics.moveTo(x + width, y);
			graphics.lineTo(x, y + Math.min(20, height * 0.2));
			graphics.lineTo(x, y + height - Math.min(20, height * 0.2));
			graphics.lineTo(x + width, y + height);
			graphics.closePath();
			break;
	}
	
	graphics.setFill(Color.WHITE);
	graphics.fill();
	graphics.setStroke(Color.BLACK);
	graphics.stroke();
	
	graphics.setFill(Color.DARKGRAY);
	graphics.fillText("0", x + zeroXOffset, y + 13);
}
 
Example 14
Source File: DecoderPeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
	GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION));
	Direction direction = getProperties().getValue(Properties.DIRECTION);
	
	int x = getScreenX();
	int y = getScreenY();
	int width = 3 * GuiUtils.BLOCK_SIZE;
	int height = (getComponent().getNumOutputs() + 2) * GuiUtils.BLOCK_SIZE;
	
	int zeroXOffset = 0;
	
	switch(direction) {
		case SOUTH:
			graphics.translate(x, y);
			graphics.rotate(270);
			graphics.translate(-x - width, -y);
		case WEST:
			zeroXOffset = 2;
			graphics.beginPath();
			graphics.moveTo(x, y);
			graphics.lineTo(x + width, y + Math.min(20, height * 0.2));
			graphics.lineTo(x + width, y + height - Math.min(20, height * 0.2));
			graphics.lineTo(x, y + height);
			graphics.closePath();
			break;
		case NORTH:
			graphics.translate(x, y);
			graphics.rotate(270);
			graphics.translate(-x - width, -y);
		case EAST:
			zeroXOffset = width - 10;
			graphics.beginPath();
			graphics.moveTo(x + width, y);
			graphics.lineTo(x, y + Math.min(20, height * 0.2));
			graphics.lineTo(x, y + height - Math.min(20, height * 0.2));
			graphics.lineTo(x + width, y + height);
			graphics.closePath();
			break;
	}
	
	graphics.setFill(Color.WHITE);
	graphics.fill();
	graphics.setStroke(Color.BLACK);
	graphics.stroke();
	
	graphics.setFill(Color.DARKGRAY);
	graphics.fillText("0", x + zeroXOffset, y + 13);
}
 
Example 15
Source File: MultiplexerPeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
	GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION));
	
	Direction direction = getProperties().getValue(Properties.DIRECTION);
	
	int x = getScreenX();
	int y = getScreenY();
	int width = 3 * GuiUtils.BLOCK_SIZE;
	int height = (getComponent().getNumInputs() + 2) * GuiUtils.BLOCK_SIZE;
	
	int zeroXOffset = 0;
	
	switch(direction) {
		case NORTH:
			graphics.translate(x, y);
			graphics.rotate(270);
			graphics.translate(-x - width, -y);
		case EAST:
			zeroXOffset = 2;
			graphics.beginPath();
			graphics.moveTo(x, y);
			graphics.lineTo(x + width, y + Math.min(20, height * 0.2));
			graphics.lineTo(x + width, y + height - Math.min(20, height * 0.2));
			graphics.lineTo(x, y + height);
			graphics.closePath();
			break;
		case SOUTH:
			graphics.translate(x, y);
			graphics.rotate(270);
			graphics.translate(-x - width, -y);
		case WEST:
			zeroXOffset = width - 10;
			graphics.beginPath();
			graphics.moveTo(x + width, y);
			graphics.lineTo(x, y + Math.min(20, height * 0.2));
			graphics.lineTo(x, y + height - Math.min(20, height * 0.2));
			graphics.lineTo(x + width, y + height);
			graphics.closePath();
			break;
	}
	
	graphics.setFill(Color.WHITE);
	graphics.fill();
	graphics.setStroke(Color.BLACK);
	graphics.stroke();
	
	graphics.setFill(Color.DARKGRAY);
	graphics.fillText("0", x + zeroXOffset, y + 13);
}
 
Example 16
Source File: Tunnel.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paint(GraphicsContext graphics, CircuitState circuitState) {
	Direction direction = getProperties().getValue(Properties.DIRECTION);
	
	boolean isIncompatible = isIncompatible();
	
	graphics.setStroke(Color.BLACK);
	graphics.setFill(isIncompatible ? Color.ORANGE : Color.WHITE);
	
	int block = GuiUtils.BLOCK_SIZE;
	int x = getScreenX();
	int y = getScreenY();
	int width = getScreenWidth();
	int height = getScreenHeight();
	
	int xOff = 0;
	int yOff = 0;
	
	switch(direction) {
		case EAST:
			xOff = -block;
			graphics.beginPath();
			graphics.moveTo(x + width, y + height * 0.5);
			graphics.lineTo(x + width - block, y + height);
			graphics.lineTo(x, y + height);
			graphics.lineTo(x, y);
			graphics.lineTo(x + width - block, y);
			graphics.closePath();
			break;
		case WEST:
			xOff = block;
			graphics.beginPath();
			graphics.moveTo(x, y + height * 0.5);
			graphics.lineTo(x + block, y);
			graphics.lineTo(x + width, y);
			graphics.lineTo(x + width, y + height);
			graphics.lineTo(x + block, y + height);
			graphics.closePath();
			break;
		case NORTH:
			yOff = block;
			graphics.beginPath();
			graphics.moveTo(x + width * 0.5, y);
			graphics.lineTo(x + width, y + block);
			graphics.lineTo(x + width, y + height);
			graphics.lineTo(x, y + height);
			graphics.lineTo(x, y + block);
			graphics.closePath();
			break;
		case SOUTH:
			yOff = -block;
			graphics.beginPath();
			graphics.moveTo(x + width * 0.5, y + height);
			graphics.lineTo(x, y + height - block);
			graphics.lineTo(x, y);
			graphics.lineTo(x + width, y);
			graphics.lineTo(x + width, y + height - block);
			graphics.closePath();
			break;
	}
	
	graphics.fill();
	graphics.stroke();
	
	if(!label.isEmpty()) {
		Bounds bounds = GuiUtils.getBounds(graphics.getFont(), label);
		graphics.setFill(Color.BLACK);
		graphics.fillText(label,
		                  x + xOff + ((width - xOff) - bounds.getWidth()) * 0.5,
		                  y + yOff + ((height - yOff) + bounds.getHeight()) * 0.4);
	}
	
	if(isIncompatible) {
		PortConnection port = getConnections().get(0);
		
		graphics.setFill(Color.BLACK);
		graphics.fillText(String.valueOf(bitSize),
		                  port.getScreenX() + 11,
		                  port.getScreenY() + 21);
		
		graphics.setStroke(Color.ORANGE);
		graphics.setFill(Color.ORANGE);
		graphics.strokeOval(port.getScreenX() - 2, port.getScreenY() - 2, 10, 10);
		graphics.fillText(String.valueOf(bitSize),
		                  port.getScreenX() + 10,
		                  port.getScreenY() + 20);
	}
}
 
Example 17
Source File: TransistorPeer.java    From CircuitSim with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void paint(GraphicsContext graphics, CircuitState state) {
	GuiUtils.drawName(graphics, this, getProperties().getValue(Properties.LABEL_LOCATION));
	GuiUtils.rotateGraphics(this, graphics, getProperties().getValue(Properties.DIRECTION));
	
	int x = getScreenX();
	int y = getScreenY();
	int width = getScreenWidth() > getScreenHeight() ? getScreenWidth() : getScreenHeight();
	int height = getScreenWidth() > getScreenHeight() ? getScreenHeight() : getScreenWidth();
	
	boolean gateLoc = getProperties().getValue(GATE_LOCATION_PROPERTY);
	switch(getProperties().getValue(Properties.DIRECTION)) {
		case WEST:
		case SOUTH:
			gateLoc = !gateLoc;
			break;
	}
	
	int yOff = gateLoc ? 0 : height;
	int m = gateLoc ? 1 : -1;
	
	graphics.setStroke(Color.BLACK);
	graphics.setLineWidth(2);
	
	graphics.beginPath();
	graphics.moveTo(x, y + height - yOff);
	graphics.lineTo(x + width / 3.0, y + height - yOff);
	graphics.lineTo(x + width / 3.0, y + yOff + m * height * 0.7);
	graphics.lineTo(x + 2.0 * width / 3.0, y + yOff + m * height * 0.7);
	graphics.lineTo(x + 2.0 * width / 3.0, y + height - yOff);
	graphics.lineTo(x + width, y + height - yOff);
	
	graphics.moveTo(x + width / 3.0, y + yOff + m * height * 0.5);
	graphics.lineTo(x + 2.0 * width / 3.0, y + yOff + m * height * 0.5);
	graphics.stroke();
	
	graphics.setLineWidth(1);
	
	graphics.beginPath();
	graphics.moveTo(x + width * 0.5 - 1.5, y + yOff + m * (height * 0.7 + 3));
	graphics.lineTo(x + width * 0.5 + 3.0, y + yOff + m * (height * 0.7 + 5));
	graphics.lineTo(x + width * 0.5 - 1.5, y + yOff + m * (height * 0.7 + 7));
	graphics.stroke();
	
	if(getProperties().getValue(TRANSISTOR_TYPE_PROPERTY)) {
		graphics.strokeOval(x + width * 0.5 - 3, y + (gateLoc ? 3 : height - 9), 6, 6);
	} else {
		graphics.strokeLine(x + width * 0.5, y + yOff, x + width * 0.5, y + height * 0.5);
	}
}
 
Example 18
Source File: ErrorDataSetRenderer.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
protected static void drawPolyLineLine(final GraphicsContext gc, final CachedDataPoints localCachedPoints) {
    gc.save();
    DefaultRenderColorScheme.setLineScheme(gc, localCachedPoints.defaultStyle, localCachedPoints.dataSetIndex + localCachedPoints.dataSetStyleIndex);
    DefaultRenderColorScheme.setGraphicsContextAttributes(gc, localCachedPoints.defaultStyle);

    if (localCachedPoints.allowForNaNs) {
        gc.beginPath();
        gc.moveTo(localCachedPoints.xValues[0], localCachedPoints.yValues[0]);
        boolean lastIsFinite = true;
        double xLastValid = 0.0;
        double yLastValid = 0.0;
        for (int i = 0; i < localCachedPoints.actualDataCount; i++) {
            final double x0 = localCachedPoints.xValues[i];
            final double y0 = localCachedPoints.yValues[i];
            if (Double.isFinite(x0) && Double.isFinite(y0)) {
                if (!lastIsFinite) {
                    gc.moveTo(x0, y0);
                    lastIsFinite = true;
                    continue;
                }
                gc.lineTo(x0, y0);
                xLastValid = x0;
                yLastValid = y0;
                lastIsFinite = true;
            } else {
                lastIsFinite = false;
            }
        }
        gc.moveTo(xLastValid, yLastValid);
        gc.closePath();
        gc.stroke();
    } else {
        if (gc.getLineDashes() != null) {
            gc.strokePolyline(localCachedPoints.xValues, localCachedPoints.yValues, localCachedPoints.actualDataCount);
        } else {
            for (int i = 0; i < localCachedPoints.actualDataCount - 1; i++) {
                final double x1 = localCachedPoints.xValues[i];
                final double x2 = localCachedPoints.xValues[i + 1];
                final double y1 = localCachedPoints.yValues[i];
                final double y2 = localCachedPoints.yValues[i + 1];

                gc.strokeLine(x1, y1, x2, y2);
            }
        }
    }

    gc.restore();
}