JavaFX Chart
Posted liyanyan665
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaFX Chart相关的知识,希望对你有一定的参考价值。
import javafx.application.Application;
import javafx.geometry.NodeOrientation;
import javafx.geometry.Side;
import javafx.scene.Scene;
import javafx.scene.chart.*;
import javafx.scene.control.Label;
import javafx.stage.Stage;
public class LineChartSample extends Application
@Override
public void start(Stage stage)
stage.setTitle("people");
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Country");
final BarChart<String, Number> chart =
new BarChart<String, Number>(xAxis, yAxis);
chart.setTitle("people");
XYChart.Series series = new XYChart.Series(http://www.amjmh.com);
series.setName("flag");
series.getData().add(new XYChart.Data("China", 14.7));
series.getData().add(new XYChart.Data("America", 2.5));
series.getData().add(new XYChart.Data("India", 14));
XYChart.Data data = new XYChart.Data("Russa", 2);
data.setNode(new Label("2"));
series.getData().add(data);
Scene scene = new Scene(chart, 800, 600);
chart.getData().addAll(series);
stage.setScene(scene);
stage.show();
public static void main(String[] args)
launch(args);
---------------------
以上是关于JavaFX Chart的主要内容,如果未能解决你的问题,请参考以下文章