本文整理汇总了Java中javafx.scene.chart.NumberAxis.setLabel方法的典型用法代码示例。如果您正苦于以下问题:Java NumberAxis.setLabel方法的具体用法?Java NumberAxis.setLabel怎么用?Java NumberAxis.setLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.NumberAxis
的用法示例。
在下文中一共展示了NumberAxis.setLabel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected LineChart<String, Number> createChart() {
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
final LineChart<String,Number> lc = new LineChart<String,Number>(xAxis,yAxis);
// setup chart
lc.setTitle("LineChart with Category Axis");
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
XYChart.Series<String,Number> series = new XYChart.Series<String,Number>();
series.setName("Data Series 1");
series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[0], 50d));
series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[1], 80d));
series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[2], 90d));
series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[3], 30d));
series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[4], 122d));
series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[5], 10d));
lc.getData().add(series);
return lc;
}
示例2: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的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;
}
示例3: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected AreaChart<Number,Number> createChart() {
final NumberAxis xAxis = new NumberAxis(0,128,8);
final NumberAxis yAxis = new NumberAxis(0,50,10);
final AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
// setup chart
ac.setId("audioAreaDemo");
ac.setLegendVisible(false);
ac.setTitle("Live Audio Spectrum Data");
ac.setAnimated(false);
xAxis.setLabel("Frequency Bands");
yAxis.setLabel("Magnitudes");
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
// add starting data
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("Audio Spectrum");
//noinspection unchecked
series1Data = new XYChart.Data[(int)xAxis.getUpperBound()];
for (int i=0; i<series1Data.length; i++) {
series1Data[i] = new XYChart.Data<Number,Number>(i,50);
series.getData().add(series1Data[i]);
}
ac.getData().add(series);
return ac;
}
示例4: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected ScatterChart<Number, Number> createChart() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setSide(Side.TOP);
final NumberAxis yAxis = new NumberAxis();
yAxis.setSide(Side.RIGHT);
final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
// setup chart
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
for (int s=0;s<5;s++) {
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
series.setName("Data Series "+s);
for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
sc.getData().add(series);
}
return sc;
}
示例5: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected AreaChart<Number, Number> createChart() {
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
// setup chart
ac.setTitle("Area Chart Example");
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
for (int s=0;s<3;s++) {
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("Data Series "+s);
double x = 0;
while (x<95) {
series.getData().add(new XYChart.Data<Number,Number>(x, Math.random()*99));
x += 5 + (15*Math.random());
}
series.getData().add(new XYChart.Data<Number,Number>(99d, Math.random()*99));
ac.getData().add(series);
}
return ac;
}
示例6: start
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
@Override public void start(Stage stage) {
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel(xName);
yAxis.setLabel(yName);
final LineChart<Number,Number> lineChart = new LineChart<Number,Number>(xAxis,yAxis);
lineChart.setTitle(title);
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
for (int i=1; i<n+1; i++){
series.getData().add(new XYChart.Data<Number, Number>(x[i], y[i]));
}
Scene scene = new Scene(lineChart,800,600);
lineChart.getData().add(series);
stage.setScene(scene);
stage.show();
}
示例7: displayIndex
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private void displayIndex(Map<String, Double> resultIndex, String title, String header) {
BaseDialog dialog = new BaseDialog(title, header);
dialog.getDialogPane().setPrefSize(800, 600);
dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE));
// draw
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
final LineChart<String,Number> lineChart = new LineChart<>(xAxis, yAxis);
lineChart.setTitle(title);
lineChart.setLegendVisible(false);
xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis"));
yAxis.setLabel(Configuration.getBundle().getString("ui.actions.readable.yaxis"));
XYChart.Series<String, Number> series = new XYChart.Series();
for(Map.Entry<String, Double> st:resultIndex.entrySet()) {
series.getData().add(new XYChart.Data(st.getKey(), st.getValue()));
}
lineChart.getData().addAll(series);
dialog.getDialogPane().setContent(lineChart);
dialog.setResizable(true);
dialog.showAndWait();
}
示例8: createGraph
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private Node createGraph() { // create a graph node to be acted on by the controls.
// setup graph
NumberAxis xAxis = new NumberAxis(); xAxis.setLabel("X Axis");
NumberAxis yAxis = new NumberAxis(); yAxis.setLabel("Y Axis");
LineChart<Number,Number> graph = new LineChart<Number,Number>(xAxis,yAxis);
graph.setTitle("Test Graph");
graph.setCreateSymbols(false);
// add starting data
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("Squares");
for (int x = 0; x <= 10; x++) series.getData().add(new XYChart.Data<Number,Number>(x, x * x));
graph.getData().add(series);
graph.setMinSize(300, 260);
graph.setMaxSize(300, 260);
//return graph;
return new Circos(new long[]{34,56,90, 65, 10}, null, null);
}
示例9: handleFirstLoginsChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private void handleFirstLoginsChart() throws IOException, InterruptedException, ExecutionException {
FutureRequest<LinkedHashMap<LocalDateTime, Integer>> requestResult = sock.submit(new NewPlayerLoginsRequest(
startDatePicker.getValue(),
endDatePicker.getValue().plusDays(1)
));
LinkedHashMap<LocalDateTime, Integer> counts = requestResult.get();
XYChart.Series<String, Number> series = new XYChart.Series<>();
for(Map.Entry<LocalDateTime, Integer> e : counts.entrySet()) {
series.getData().add(new XYChart.Data(e.getKey().toString(), e.getValue()));
}
series.setName("New Players");
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Time Joined");
yAxis.setLabel("Players Joined");
yAxis.setTickLength(5);
yAxis.setMinorTickLength(1);
xAxis.setAutoRanging(true);
final BarChart<String, Number> barChart = new BarChart<>(xAxis, yAxis);
barChart.setTitle("New Players");
barChart.getData().add(series);
chartPane.setCenter(barChart);
chartPane.layout();
}
示例10: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected ScatterChart<Number, Number> createChart() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setSide(Side.TOP);
final NumberAxis yAxis = new NumberAxis();
yAxis.setSide(Side.RIGHT);
final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
// setup chart
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
for (int s=0;s<5;s++) {
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
series.setName("Data Series "+s);
for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
sc.getData().add(series);
}
return sc;
}
示例11: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected LineChart<Number, Number> createChart() {
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
// setup chart
lc.setTitle("Basic LineChart");
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
series.setName("Data Series 1");
series.getData().add(new XYChart.Data<Number,Number>(20d, 50d));
series.getData().add(new XYChart.Data<Number,Number>(40d, 80d));
series.getData().add(new XYChart.Data<Number,Number>(50d, 90d));
series.getData().add(new XYChart.Data<Number,Number>(70d, 30d));
series.getData().add(new XYChart.Data<Number,Number>(170d, 122d));
lc.getData().add(series);
return lc;
}
示例12: initYAxis
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("Meters⁻²");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(true);
return yAxis;
}
示例13: SinChartComponent
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
public SinChartComponent() {
NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("x");
NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("y");
XYChart.Series<Number, Number> series = new XYChart.Series<>();
series.setName("Sine");
ObservableList<XYChart.Data<Number, Number>> data = series.getData();
for (double x = -Math.PI; x < Math.PI; x += 0.5) {
data.add(new XYChart.Data<Number, Number>(x, 10 * Math.sin(x)));
}
LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);
lineChart.setTitle("Sine function");
lineChart.getData().add(series);
getChildren().add(lineChart);
}
示例14: initYAxis
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("Meters");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(true);
return yAxis;
}
示例15: initYAxis
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private NumberAxis initYAxis() {
final NumberAxis yAxis = new NumberAxis();
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis) {
@Override
public String toString(final Number object) {
return String.format("%6.2f", object);
}
});
yAxis.setTickLabelFont(Font.font("Arial", FontWeight.MEDIUM, 18));
yAxis.setPrefWidth(120);
yAxis.setAutoRanging(true);
yAxis.setLabel("factor");
yAxis.setForceZeroInRange(false);
yAxis.setAnimated(false);
return yAxis;
}