-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSimpleLineGraph.java
39 lines (31 loc) · 1.19 KB
/
SimpleLineGraph.java
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
import graph.LineGraph;
import graph.theme.Theme;
import javafx.application.Application;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import plotter.Plotter;
import java.util.Random;
import static java.lang.StrictMath.abs;
import static java.lang.StrictMath.sin;
public class SimpleLineGraph extends Application {
public static void main(String[] args) {
Application.launch(args);
}
@Override
public void start(Stage primaryStage) {
double[] values = new double[50];
//---->Default graph using plotter<----
LineGraph graph = new LineGraph(600,300, Theme.SIMPLELINEGRAPH);
LineGraph graph1 = new LineGraph(600, 300, Theme.SIMPLELINEGRAPH.withColor(Color.valueOf("#03A9F4")));
//Populating the graph
for (int i=0; i<30; i++) {
graph.addValue(0.15*i + abs(sin(new Random().nextInt(180))));
graph1.addValue(0.17*i + abs(sin(new Random().nextInt(180))));
}
Plotter.enableGrid(true);
Plotter.setTitle("Transfer rate",graph1);
Plotter.setAxisLabel("day (January)","GB/s",graph);
Plotter.mapXAxis(1, 31, graph);
Plotter.plot(true, graph, graph1);
}
}