-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLine.java
More file actions
63 lines (56 loc) · 2.18 KB
/
Line.java
File metadata and controls
63 lines (56 loc) · 2.18 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package exponn;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.stage.Stage;
/**
*
* @author Suleman
*/
public class Line extends Application {
@Override public void start(Stage stage) {
stage.setTitle("Line Chart Sample");
//defining the axes
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Number of Month");
//creating the chart
final LineChart<Number,Number> lineChart =
new LineChart<Number,Number>(xAxis,yAxis);
lineChart.setTitle("Stock Monitoring, 2010");
//defining a series
XYChart.Series series = new XYChart.Series();
series.setName("My portfolio");
//populating the series with data
for(int i = 0 ; i< 2; i++)
{
series.getData().add(new XYChart.Data(1+i, 23));
}
// series.getData().add(new XYChart.Data(1, 23));
// series.getData().add(new XYChart.Data(2, 14));
// series.getData().add(new XYChart.Data(3, 15));
// series.getData().add(new XYChart.Data(4, 24));
// series.getData().add(new XYChart.Data(5, 34));
// series.getData().add(new XYChart.Data(6, 36));
// series.getData().add(new XYChart.Data(7, 22));
// series.getData().add(new XYChart.Data(8, 45));
// series.getData().add(new XYChart.Data(9, 43));
// series.getData().add(new XYChart.Data(10, 17));
// series.getData().add(new XYChart.Data(11, 29));
// series.getData().add(new XYChart.Data(12, 25));
Scene scene = new Scene(lineChart,800,600);
lineChart.getData().add(series);
stage.setScene(scene);
stage.show();
}
public void main(String[] args) {
launch(args);
}
}