I'd like to replace Int[] mydata and to use the array argv and to call my class Graph with javafx from another class with javax, from there I declare my array of strings and call my java program. - Now I need to call my class from another Program with string like mydata. and - To use the array argv and to build my new array.
Is that possible? and how? Thank you for your Help.
public class Graph extends Application {
public void start(Stage stage) {
int[] mydata = {
12, 9, 0, 1, 38, 19, 21, 72, 33, 83, 14, 10, 65, 46, 10, 17, 27, 38, 65, 98, 8, 58, 38, 79, 37, 69, 26, 15};
Pane root = new Pane();
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
ScatterChart scatterChart=new ScatterChart(xAxis,yAxis);
scatterChart.setTitle("Chart");
XYChart.Series data=new XYChart.Series();
data.setName("Data");
for (int i=0; i< mydata.length; i++) {
data.getData().add(new XYChart.Data(i,mydata[i]));
}
scatterChart.getData().addAll(data);
root.getChildren().add(scatterChart);
Scene scene = new Scene(root, 1000, 600);
//scene.getStylesheets().add("style.css");
//scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
scatterChart.setPrefSize(1000, 600);
stage.setTitle("Graph");
stage.setScene(scene);
stage.show();
File file = new File("c:\\Images\\Image.png");
WritableImage snapshot = scene.snapshot(null);
BufferedImage bimg = SwingFXUtils.fromFXImage(snapshot, null);
try {
ImageIO.write(bimg, "png", file);
} catch (Exception s) {
s.printStackTrace();
}
}
public static void main(String[] argv) {
launch(argv);
}
}
startseems to be not working. Can you share your code of methodlaunch