Skip to content

Commit feb36f1

Browse files
committed
chore: fixed math demo and made it framed
1 parent dbf7f4d commit feb36f1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package examples;
22

3+
import org.codejive.twinkle.core.text.Line;
34
import org.codejive.twinkle.core.widget.Panel;
5+
import org.codejive.twinkle.core.widget.Size;
6+
import org.codejive.twinkle.widgets.Framed;
47
import org.codejive.twinkle.widgets.graphs.plot.MathPlot;
58

69
public class MathPlotDemo {
710
public static void main(String[] args) {
8-
Panel pnl = Panel.of(40, 20);
9-
MathPlot p = MathPlot.of(pnl).ranges(-2 * Math.PI, 2 * Math.PI, -1.0, 1.0);
11+
MathPlot p = MathPlot.of(Size.of(40, 20)).ranges(-2 * Math.PI, 2 * Math.PI, -1.0, 1.0);
1012
// plot a sine wave
1113
p.plot(Math::sin);
12-
System.out.println(pnl.toString());
14+
Framed f = Framed.of(p).title(Line.of(" Sine Wave "));
15+
Panel pnl = Panel.of(42, 22);
16+
f.render(pnl);
17+
System.out.println(pnl);
1318
}
1419
}

0 commit comments

Comments
 (0)