本文整理汇总了Java中javafx.scene.chart.ScatterChart.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java ScatterChart.setTitle方法的具体用法?Java ScatterChart.setTitle怎么用?Java ScatterChart.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.ScatterChart
的用法示例。
在下文中一共展示了ScatterChart.setTitle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
protected ScatterChart<Number, Number> createChart() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setForceZeroInRange(false);
final NumberAxis yAxis = new NumberAxis(-100,100,10);
final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
// setup chart
sc.setId("liveScatterChart");
sc.setTitle("Animated Sine Wave ScatterChart");
xAxis.setLabel("X Axis");
xAxis.setAnimated(false);
yAxis.setLabel("Y Axis");
yAxis.setAutoRanging(false);
// add starting data
series = new ScatterChart.Series<Number,Number>();
series.setName("Sine Wave");
series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
sc.getData().add(series);
return sc;
}
示例2: createScene
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
private static Scene createScene() {
javafx.scene.chart.NumberAxis myaxis1 = new javafx.scene.chart.NumberAxis();
javafx.scene.chart.NumberAxis myaxis2 = new javafx.scene.chart.NumberAxis();
ScatterChart sc = new ScatterChart(myaxis1, myaxis2);
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
series.setName(plotName);
sc.setTitle(plotTitle);
int N = pointsX.length;
for (int k = 0; k < N; k++)
series.getData().add(new XYChart.Data<Number, Number>(pointsX[k], pointsY[k]));
sc.getData().add(series);
BorderPane pane = new BorderPane();
pane.setCenter(sc);
Scene myScene = new Scene(pane, Color.ALICEBLUE);
return myScene;
}
示例3: start
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("Scatter Chart Sample");
final NumberAxis yAxis = new NumberAxis(1400, 2100, 100);
final NumberAxis xAxis = new NumberAxis(500000, 90000000, 1000000);
final ScatterChart<Number, Number> scatterChart = new ScatterChart<>(xAxis, yAxis);
xAxis.setLabel("Population");
yAxis.setLabel("Decade");
scatterChart.setTitle("Population Scatter Graph");
XYChart.Series series = new XYChart.Series();
try (CSVReader dataReader = new CSVReader(new FileReader("EuropeanScatterData.csv"), ',')) {
String[] nextLine;
while ((nextLine = dataReader.readNext()) != null) {
int decade = Integer.parseInt(nextLine[0]);
int population = Integer.parseInt(nextLine[1]);
series.getData().add(new XYChart.Data(population, decade));
System.out.println("Decade: " + decade + " Population: " + population);
}
}
scatterChart.getData().addAll(series);
Scene scene = new Scene(scatterChart, 500, 400);
stage.setScene(scene);
stage.show();
}
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:28,代码来源:ScatterChart - MainApp.java
示例4: buildChart
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
private ScatterChart<Number, Number> buildChart(String chartName, List<XYChart.Series<Number, Number>> series) {
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
final ScatterChart<Number, Number> sc = new ScatterChart<Number, Number>(xAxis, yAxis);
sc.setTitle(chartName);
sc.setPrefHeight(450);
sc.setPrefWidth(600);
xAxis.getValueForDisplay(1);
yAxis.getValueForDisplay(2);
sc.getData().addAll(series);
return sc;
}
示例5: createObject
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
public static Object createObject(Axis x_axis, Axis y_axis, double width, double height) {
Series s1 = new Series( FXCollections.observableArrayList(
new XYChart.Data(3, 4),
new XYChart.Data(1, 5),
new XYChart.Data(4, 6)
));
s1.setName("Set 1");
Series s2 = new Series( FXCollections.observableArrayList(
new XYChart.Data(1, 4),
new XYChart.Data(2, 3),
new XYChart.Data(4, 2)
));
s2.setName("Set 2");
Series s3 = new Series( FXCollections.observableArrayList(
new XYChart.Data(5, 4),
new XYChart.Data(1, 6),
new XYChart.Data(3, 8)
));
s3.setName("Set 3");
ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
ScatterChart chart = new ScatterChart(x_axis, y_axis, data);
chart.setMaxSize(width, height);
chart.setPrefSize(width, height);
chart.setTitle("ScatterChart");
chart.setStyle("-fx-border-color: darkgray;");
return chart;
}
示例6: start
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
stage.setTitle("Scatter Chart Sample");
final NumberAxis xAxis = new NumberAxis(0, 100, 10);
final NumberAxis yAxis = new NumberAxis(0, 130000, 10000);
final ScatterChart<Number,Number> sc = new
ScatterChart<Number,Number>(xAxis,yAxis);
xAxis.setLabel("Age");
yAxis.setLabel("Income");
sc.setTitle("Camping Inclination");
/*
23,45600,1
26,32000,0
45,65700,1
29,25300,0
72,55600,1
24,28700,1
56,125300,1
22,34200,1
28,32800,1
32,24600,1
25,36500,1
67,76800,0
25,14500,1
86,58900,0
*/
XYChart.Series series1 = new XYChart.Series();
series1.setName("Camps");
series1.getData().add(new XYChart.Data(23,45600));
series1.getData().add(new XYChart.Data(45,65700));
series1.getData().add(new XYChart.Data(72,55600));
series1.getData().add(new XYChart.Data(24,28700));
series1.getData().add(new XYChart.Data(22,34200));
series1.getData().add(new XYChart.Data(28,32800));
series1.getData().add(new XYChart.Data(32,24600));
series1.getData().add(new XYChart.Data(25,36500));
series1.getData().add(new XYChart.Data(22,43600));
series1.getData().add(new XYChart.Data(78,125700));
series1.getData().add(new XYChart.Data(73,56500));
XYChart.Series series2 = new XYChart.Series();
series2.setName("Doesn't Camp");
series2.getData().add(new XYChart.Data(26,91000));
series2.getData().add(new XYChart.Data(29,85300));
series2.getData().add(new XYChart.Data(67,76800));
series2.getData().add(new XYChart.Data(86,58900));
series2.getData().add(new XYChart.Data(56,125300));
series2.getData().add(new XYChart.Data(25,125000));
series2.getData().add(new XYChart.Data(29,87600));
series2.getData().add(new XYChart.Data(65,79300));
sc.getData().addAll(series1, series2);
Scene scene = new Scene(sc, 500, 400);
stage.setScene(scene);
stage.show();
}
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:58,代码来源:MainApp-Camping.java
示例7: start
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void start(final Stage stage) {
stage.setTitle("Scatter Chart Sample");
final NumberAxis xAxis = new NumberAxis(0, 10, 1);
final NumberAxis yAxis = new NumberAxis(-100, 500, 100);
xAxis.setAutoRanging(true);
xAxis.setForceZeroInRange(false);
yAxis.setAutoRanging(true);
yAxis.setForceZeroInRange(false);
final ScatterChart<Number, Number> sc = new ScatterChart<Number, Number>(xAxis, yAxis);
xAxis.setLabel("Age (years)");
yAxis.setLabel("Returns to date");
sc.setTitle("Investment Overview");
final XYChart.Series<Number, Number> series1 = new XYChart.Series<>();
series1.setName("Equities");
series1.getData().add(new XYChart.Data(4.2, 193.2));
series1.getData().add(new XYChart.Data(2.8, 33.6));
series1.getData().add(new XYChart.Data(6.2, 24.8));
series1.getData().add(new XYChart.Data(1, 14));
series1.getData().add(new XYChart.Data(1.2, 26.4));
series1.getData().add(new XYChart.Data(4.4, 114.4));
series1.getData().add(new XYChart.Data(8.5, 323));
series1.getData().add(new XYChart.Data(6.9, 289.8));
series1.getData().add(new XYChart.Data(9.9, 287.1));
series1.getData().add(new XYChart.Data(0.9, -9));
series1.getData().add(new XYChart.Data(3.2, 150.8));
series1.getData().add(new XYChart.Data(4.8, 20.8));
series1.getData().add(new XYChart.Data(7.3, -42.3));
series1.getData().add(new XYChart.Data(1.8, 81.4));
series1.getData().add(new XYChart.Data(7.3, 110.3));
series1.getData().add(new XYChart.Data(2.7, 41.2));
final XYChart.Series<Number, Number> series2 = new XYChart.Series<>();
series2.setName("Mutual funds");
series2.getData().add(new XYChart.Data(5.2, 229.2));
series2.getData().add(new XYChart.Data(2.4, 37.6));
series2.getData().add(new XYChart.Data(3.2, 49.8));
series2.getData().add(new XYChart.Data(1.8, 134));
series2.getData().add(new XYChart.Data(3.2, 236.2));
series2.getData().add(new XYChart.Data(7.4, 114.1));
series2.getData().add(new XYChart.Data(3.5, 323));
series2.getData().add(new XYChart.Data(9.3, 29.9));
series2.getData().add(new XYChart.Data(8.1, 287.4));
// DO NOT ADD DATA TO CHART
// sc.getData().addAll(series1, series2);
final StackPane pane = new StackPane();
pane.getChildren().add(sc);
final Scene scene = new Scene(pane, 500, 400);
new ZoomManager(pane, sc, series1, series2);
stage.setScene(scene);
stage.show();
}
示例8: getNewChart
import javafx.scene.chart.ScatterChart; //导入方法依赖的package包/类
public ScatterChart getNewChart() {
ScatterChart chart = new ScatterChart(axis1, axis2);
chart.setTitle("ScatterChart");
chart.setStyle("-fx-border-color: darkgray;");
return chart;
}