Skip to content

howto dashed stroke

Erich Seifert edited this page Mar 14, 2016 · 1 revision

How can I use a dashed line to connect data points?

GRAL uses Java's ​java.awt.Stroke interface to draw lines. Use any class implementing this interface, like BasicStroke:

LineRenderer lineRenderer = new DefaultLineRenderer2D();
BasicStroke lineStyle = new BasicStroke(2.0f, BasicStroke.CAP_BUTT,
    BasicStroke.JOIN_MITER, 10.0f, new float[] {3f, 3f}, 0.0f);
lineRenderer.setStroke(lineStyle);