-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgressChart.pde
More file actions
64 lines (56 loc) · 1.97 KB
/
ProgressChart.pde
File metadata and controls
64 lines (56 loc) · 1.97 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//This class is used to create a scatter chart using the giUtilities libraries
//it IS no longer used JFreeProgressChart has replaced it
class ProgressChart {
//declare variables
RedPanda c;
XYChart scatterplot;
float [] dates, scores;
String labelOne, labelTwo;
//contructor takes reference to the RedPanda class, two float arrays containing the data to be plotted and the names of the axis
public ProgressChart(RedPanda _c, float[] _dates, float[] _scores, String _labelOne, String _labelTwo) {
//initialise variable
this.c = _c;
this.scatterplot = new XYChart(c); //create chart object
this.dates = _dates;
this.scores = _scores;
this.labelOne = _labelOne;
this.labelTwo = _labelTwo;
// Both x and y data set here.
if (dates != null && scores != null) { //i fthe data isnt null
scatterplot.setData(dates, scores); //set the chart data
}
else { //set default values
scatterplot.setData(new float[] {
1900, 1910, 1920, 1930, 1940, 1950,
1960, 1970, 1980, 1990, 2000
}
,
new float[] {
6322, 6489, 6401, 7657, 9649, 9767,
12167, 15154, 18200, 23124, 28645
}
);
}
// Axis formatting and labels.
scatterplot.showXAxis(true);
scatterplot.showYAxis(true);
//scatterplot.setXFormat("$###,###");
//SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
//scatterplot.setXFormat("0000");
scatterplot.setXAxisLabel(labelOne);
scatterplot.setYAxisLabel(labelTwo);
scatterplot.setMinY(6);
// Symbol styles
scatterplot.setLineWidth(1);
scatterplot.setLineColour(color(82, 139, 184));
scatterplot.setPointColour(color(51, 196, 241));
scatterplot.setPointSize(10);
}
public void drawUI() {
//draw translucent white square over background
fill(51, 196, 241);
rect(764, 105, 319, 380);
//draw the scatter plot chart object
scatterplot.draw(116, 105, 800, 380);
}
}