-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStockGrapher.java
More file actions
32 lines (23 loc) · 829 Bytes
/
Copy pathStockGrapher.java
File metadata and controls
32 lines (23 loc) · 829 Bytes
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
32
package patternfinder;
import graph.Graph;
import java.awt.Frame;
import javax.swing.JFrame;
@SuppressWarnings("serial")
public class StockGrapher extends JFrame {
public StockGrapher(String[] dates, double[] closePrices) {
super("Stock Grapher");
setSize(1000, 600);
this.setExtendedState(this.getExtendedState() | Frame.MAXIMIZED_BOTH);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Graph graph = new Graph(1000, 600);
double[][] points = new double[closePrices.length][2];
for(int i = 0;i < closePrices.length;i++) {
points[i] = new double[]{i, closePrices[i]};
}
graph.setPoints(points);
graph.setCompression(10);
graph.setEquations(StockPatternFinder.findBestFitEquations(closePrices));
getContentPane().add(graph);
setVisible(true);
}
}