-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_mine0.groovy
31 lines (29 loc) · 1.05 KB
/
test_mine0.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.awt.Color
import javax.swing.JFrame
import de.erichseifert.gral.data.DataTable
import de.erichseifert.gral.plots.XYPlot
import de.erichseifert.gral.ui.InteractivePanel
import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D
import de.erichseifert.gral.plots.lines.LineRenderer
public class LinePlotTest extends JFrame {
public LinePlotTest() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(800, 600);
DataTable data = new DataTable(Double.class, Double.class);
for (double x = -5.0; x <= 5.0; x+=0.25) {
double y = 5.0*Math.sin(x);
data.add(x, y);
}
XYPlot plot = new XYPlot(data);
getContentPane().add(new InteractivePanel(plot));
LineRenderer lines = new DefaultLineRenderer2D();
plot.setLineRenderers(data, [lines]);
Color color = new Color(0.0f, 0.3f, 1.0f);
plot.getPointRenderers(data)[0].setColor(color);
plot.getLineRenderers(data)[0].setColor(color);
}
public static void main(String[] args) {
LinePlotTest frame = new LinePlotTest();
frame.setVisible(true);
}
}