Skip to content

Commit e5ddb35

Browse files
committed
second commit
1 parent 3884d73 commit e5ddb35

File tree

15 files changed

+174
-38
lines changed

15 files changed

+174
-38
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[[{"location":"E:\\Programming\\School\\JAVA_Application_Project\\Java_Course_Project\\Statistical_Analysis","type":"PROJECT","hints":{"PROJECT_NAME":"Statistical_Analysis"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_144","type":"JRE","hints":{"EXECUTION_ENVIRONMENT":"JavaSE-1.8"}},"jre:jre:1.8.0"]]
1+
[[{"location":"C:\\Users\\DongGoo\\Downloads\\jfreechart-1.0.19\\jfreechart-1.0.19\\lib\\jfreechart-1.0.19.jar","type":"JAR","hints":{}},"ABSENT"],[{"location":"C:\\Java_Course_Project\\Statistical_Analysis","type":"PROJECT","hints":{"PROJECT_NAME":"Statistical_Analysis"}},"ABSENT"],[{"location":"C:\\Program Files\\Java\\jre1.8.0_144","type":"JRE","hints":{"EXECUTION_ENVIRONMENT":"JavaSE-1.8"}},"jre:jre:1.8.0"]]

Statistical_Analysis/.classpath

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
<classpathentry kind="src" path="src"/>
55
<classpathentry kind="src" path="GUISource"/>
66
<classpathentry kind="src" path="Global_Region"/>
7-
<classpathentry kind="lib" path="E:/Programming/School/JAVA_Application_Project/Java_Course_Project/ExternalLib/Apache/commons-math3-3.6.1.jar"/>
8-
<classpathentry kind="lib" path="E:/Programming/School/JAVA_Application_Project/Java_Course_Project/ExternalLib/Apache/commons-math3-3.6.1-javadoc.jar"/>
9-
<classpathentry kind="lib" path="E:/Programming/School/JAVA_Application_Project/Java_Course_Project/ExternalLib/Apache/commons-math3-3.6.1-sources.jar"/>
7+
<classpathentry kind="lib" path="C:/Users/DongGoo/Downloads/jfreechart-1.0.19/jfreechart-1.0.19/lib/jfreechart-1.0.19.jar"/>
8+
<classpathentry kind="lib" path="C:/Users/DongGoo/Downloads/jfreechart-1.0.19/jfreechart-1.0.19/lib/jcommon-1.0.23.jar"/>
109
<classpathentry kind="output" path="bin"/>
1110
</classpath>

Statistical_Analysis/Data/Historical/AAPL.csv

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
timestamp,open,high,low,close,adjusted_close,volume,dividend_amount,,
2-
2017-11-27,175.0500,175.0800,173.3400,174.0900,174.0900,20590163,0.0000,,
3-
2017-11-24,175.1000,175.5000,174.6500,174.9700,174.9700,14026519,0.0000,,
2+
2017-11-29,172.6300,172.9200,167.1600,169.4800,169.4800,41456722,0.0000,,
3+
2017-11-28,174.3000,174.8700,171.8600,173.0700,173.0700,25468442,0.0000,,
4+
2017-11-27,175.0500,175.0800,173.3400,174.0900,174.0900,20536313,0.0000,,
5+
2017-11-24,175.1000,175.5000,174.6459,174.9700,174.9700,14026519,0.0000,,
46
2017-11-22,173.3600,175.0000,173.0500,174.9600,174.9600,24997274,0.0000,,
57
2017-11-21,170.7800,173.7000,170.7800,173.1400,173.1400,24875471,0.0000,,
68
2017-11-20,170.2900,170.5600,169.5600,169.9800,169.9800,15974387,0.0000,,

Statistical_Analysis/DataMeta/Availability.csv

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
AAPL,2017-11-28,2000-01-03,
1+
AAPL,2017-11-30,2000-01-03,
22
SFNC,2017-11-26,2000-01-03,
33
CPRT,2017-11-26,2000-01-03,
4-
GOOG,2017-11-27,2014-03-27,
4+
GOOG,2017-11-28,2014-03-27,
55
EDIG,2017-11-26,2000-01-03,
66
IRCP,2017-11-26,2003-11-05,
77
WAYN,2017-11-26,2000-01-03,
@@ -17,8 +17,8 @@ STX,2017-11-27,2002-12-11,
1717
XOM,2017-11-27,2000-01-03,
1818
MARA,2017-11-26,2012-05-04,
1919
AVGO,2017-11-27,2009-08-06,
20-
AAPL,2017-11-28,2000-01-03,
21-
GOOG,2017-11-27,2014-03-27,
20+
AAPL,2017-11-30,2000-01-03,
21+
GOOG,2017-11-28,2014-03-27,
2222
TSLA,2017-11-28,2010-06-29,
2323
AMZN,2017-11-27,2000-01-03,
2424
XRT,2017-11-27,2006-06-22,
@@ -29,6 +29,8 @@ XOM,2017-11-27,2000-01-03,
2929
AVGO,2017-11-27,2009-08-06,
3030
AAP,2017-11-27,2001-11-29,
3131
ABC,2017-11-27,2000-01-03,
32-
AAPL,2017-11-28,2000-01-03,
32+
AAPL,2017-11-30,2000-01-03,
3333
TSLA,2017-11-28,2010-06-29,
3434
GOOG,2017-11-28,2014-03-27,
35+
AAPL,2017-11-30,2000-01-03,
36+
AAPL,2017-11-30,2000-01-03,

Statistical_Analysis/GUISource/generalInfoFrame/GeneralInfoFramePanel_LatestData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
import javax.swing.*;
33

44
public class GeneralInfoFramePanel_LatestData extends JPanel{
5-
5+
66
}
Lines changed: 105 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,120 @@
11
package graphFrame;
22

3+
import java.awt.BorderLayout;
4+
import java.awt.Color;
5+
import java.awt.Component;
6+
import java.awt.Dimension;
7+
import java.util.ArrayList;
8+
import java.util.Date;
9+
import java.util.Collection;
10+
import java.util.Collections;
11+
312
import javax.swing.*;
413

14+
import org.jfree.chart.*;
15+
import org.jfree.chart.axis.DateAxis;
16+
import org.jfree.chart.axis.NumberAxis;
17+
import org.jfree.chart.axis.Timeline;
18+
import org.jfree.chart.plot.PlotOrientation;
19+
import org.jfree.chart.plot.XYPlot;
20+
import org.jfree.chart.renderer.xy.CandlestickRenderer;
21+
import org.jfree.data.*;
22+
import org.jfree.data.category.DefaultCategoryDataset;
23+
import org.jfree.data.general.DatasetGroup;
24+
import org.jfree.data.time.TimeSeries;
25+
import org.jfree.data.xy.DefaultHighLowDataset;
26+
import org.jfree.data.xy.XYDataset;
27+
28+
import black.Utils;
529
import gray.Global;
630
import red.Stock;
731

832
public class GraphFramePanel_Chart extends JPanel{
9-
Stock stock;
33+
Stock stock;
34+
35+
String symbol;
36+
ArrayList<String> date;
37+
ArrayList<Double> high;
38+
ArrayList<Double> low;
39+
ArrayList<Double> open;
40+
ArrayList<Double> adj_close;
41+
ArrayList<Double> volume;
42+
43+
BorderLayout layout = new BorderLayout();
44+
45+
DefaultHighLowDataset data;
46+
47+
JFreeChart chart;
48+
ChartPanel insidepanel;
1049

11-
String[] column;
12-
String[][] data;
50+
Double y_axis_min;
51+
Double y_axis_max;
52+
1353

1454
GraphFramePanel_Chart(){
15-
stock_price_graph();
55+
renderPanel();
1656
}
1757

58+
public void renderPanel() {
59+
removeAll();
60+
setLayout(layout);
61+
62+
data = createDataset();
63+
chart = createChart(data);
64+
insidepanel = new ChartPanel(chart);
65+
add(insidepanel);
66+
67+
68+
validate();
69+
repaint();
70+
}
1871

72+
public DefaultHighLowDataset createDataset() {
73+
stock = new Stock(Global.SYMBOL);
74+
75+
symbol = stock.SYMBOL;
76+
date = stock.request("DATE", "2017-09-01", "2017-11-01");
77+
high = stock.request("HIGH", "2017-09-01", "2017-11-01");
78+
low = stock.request("LOW", "2017-09-01", "2017-11-01");
79+
open = stock.request("OPEN", "2017-09-01", "2017-11-01");
80+
adj_close = stock.request("ADJ_CLOSE", "2017-09-01", "2017-11-01");
81+
volume = stock.request("VOLUME", "2017-09-01", "2017-11-01");
82+
83+
Date[] date_list = new Date[date.size()];
84+
date_list = Utils.StringToDate(date);
85+
double[] high_list = new double[high.size()];
86+
double[] low_list = new double[low.size()];
87+
double[] open_list = new double[open.size()];
88+
double[] adj_close_list = new double[adj_close.size()];
89+
double[] volume_list = new double[volume.size()];
90+
for (int i=0; i<high_list.length; i++) {
91+
high_list[i] = high.get(i);
92+
low_list[i] = low.get(i);
93+
open_list[i] = open.get(i);
94+
adj_close_list[i] = adj_close.get(i);
95+
volume_list[i] = volume.get(i);
96+
}
97+
98+
y_axis_min = Collections.min(low);
99+
y_axis_max = Collections.max(high);
100+
101+
DefaultHighLowDataset data = null;
102+
data = new DefaultHighLowDataset(symbol, date_list, high_list, low_list, open_list, adj_close_list, volume_list);
103+
104+
return data;
105+
}
106+
107+
private JFreeChart createChart(final DefaultHighLowDataset dataset) {
108+
109+
chart = ChartFactory.createCandlestickChart("History of " + stock.SYMBOL, "Time", "Price", dataset, true);
110+
111+
XYPlot plot = chart.getXYPlot();
112+
CandlestickRenderer renderer = (CandlestickRenderer) plot.getRenderer();
113+
renderer.setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);
114+
115+
NumberAxis domain = (NumberAxis) plot.getRangeAxis();
116+
domain.setRange(y_axis_min - 1, y_axis_max + 1);
117+
118+
return chart;
119+
}
19120
}

Statistical_Analysis/GUISource/graphFrame/GraphFramePanel_Mother.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@
44

55
public class GraphFramePanel_Mother extends JPanel{
66
GraphFramePanel_Chart chart;
7+
GraphFramePanel_Search search;
78

89
GraphFramePanel_Mother() {
10+
renderpanel();
11+
}
12+
13+
public void renderpanel() {
914
setLayout(null);
1015

1116
chart = new GraphFramePanel_Chart();
12-
chart.setBounds(0,0,200,100);
17+
chart.setBounds(0, 0, 800, 500);
18+
19+
search = new GraphFramePanel_Search();
20+
search.setBounds(820, 20, 200, 50);
1321

1422
add(chart);
23+
add(search);
1524
}
1625

1726
}

Statistical_Analysis/GUISource/graphFrame/GraphFrame_Mother.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package graphFrame;
2+
import java.awt.BorderLayout;
3+
24
import javax.swing.*;
35

46
public class GraphFrame_Mother extends JInternalFrame{
57
GraphFramePanel_Mother motherpanel;
68

9+
BorderLayout layout = new BorderLayout();
710
public GraphFrame_Mother() {
811
super("Stock Data Graph", true, true, true, true);
9-
setSize(1100,600);
12+
setLayout(layout);
13+
setSize(1050,600);
1014
setLocation(500,0);
1115

1216
motherpanel = new GraphFramePanel_Mother();

Statistical_Analysis/GUISource/white/GUIMain.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package white;
22

3-
import java.awt.Font;
4-
import java.awt.GraphicsEnvironment;
53

64
import gray.Global;
75

0 commit comments

Comments
 (0)