本文整理汇总了Java中javafx.scene.chart.LineChart.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java LineChart.setTitle方法的具体用法?Java LineChart.setTitle怎么用?Java LineChart.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.LineChart
的用法示例。
在下文中一共展示了LineChart.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: simpleIndexChart
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
public void simpleIndexChart(Stage stage) {
stage.setTitle("Index Chart");
final LineChart<String, Number> lineChart
= new LineChart<>(xAxis, yAxis);
lineChart.setTitle("Belgium Population");
yAxis.setLabel("Population");
series.setName("Population");
addDataItem(series, "1950", 8639369);
addDataItem(series, "1960", 9118700);
addDataItem(series, "1970", 9637800);
addDataItem(series, "1980", 9846800);
addDataItem(series, "1990", 9969310);
addDataItem(series, "2000", 10263618);
Scene scene = new Scene(lineChart, 800, 600);
lineChart.getData().add(series);
stage.setScene(scene);
stage.show();
}
开发者ID:PacktPublishing,项目名称:Machine-Learning-End-to-Endguide-for-Java-developers,代码行数:21,代码来源:IndexChart - MainApp.java
示例2: createChart
import javafx.scene.chart.LineChart; //导入方法依赖的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;
}
示例3: createChart
import javafx.scene.chart.LineChart; //导入方法依赖的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;
}
示例4: start
import javafx.scene.chart.LineChart; //导入方法依赖的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();
}
示例5: displayIndex
import javafx.scene.chart.LineChart; //导入方法依赖的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();
}
示例6: createGraph
import javafx.scene.chart.LineChart; //导入方法依赖的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);
}
示例7: createScene
import javafx.scene.chart.LineChart; //导入方法依赖的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();
LineChart lc = new LineChart(myaxis1, myaxis2);
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
series.setName(plotName);
lc.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]));
lc.getData().add(series);
BorderPane pane = new BorderPane();
pane.setCenter(lc);
Scene myScene = new Scene(pane, Color.ALICEBLUE);
return myScene;
}
示例8: start
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
stage.setTitle("Beacon RSSI");
//defining the axes
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Minute");
xAxis.setAutoRanging(true);
xAxis.setForceZeroInRange(false);
//creating the chart
final LineChart<Number, Number> lineChart = new LineChart<>(xAxis, yAxis);
lineChart.setTitle("Beacon RSSI");
//defining a series
XYChart.Series series = new XYChart.Series();
series.setName("RSSI");
//populating the series with data
series.getData().addAll(data);
Scene scene = new Scene(lineChart, 800, 600);
lineChart.getData().add(series);
stage.setScene(scene);
stage.show();
}
示例9: SinChartComponent
import javafx.scene.chart.LineChart; //导入方法依赖的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);
}
示例10: build
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public LineChart<Number, Number> build()
{
final NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("MAPQ");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<Number,Number> serie = new XYChart.Series<Number,Number>();
serie.setName(xAxis.getLabel());
for(int g=0;g<=100;++g)
{
serie.getData().add(new XYChart.Data<Number,Number>(
g,this.mapq2count.count(g))
);
}
final LineChart<Number, Number> sbc =
new LineChart<Number, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCreateSymbols(false);
sbc.setLegendVisible(false);
return sbc;
}
示例11: build
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public Chart build() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setLabel("QUAL");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<Number,Number> serie = new XYChart.Series<Number,Number>();
serie.setName(xAxis.getLabel());
for(final Integer i: new TreeSet<>(this.qual2count.keySet()))
{
serie.getData().add(new XYChart.Data<Number,Number>(
i,this.qual2count.count(i))
);
}
final LineChart<Number, Number> sbc =
new LineChart<Number, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCreateSymbols(false);
sbc.setLegendVisible(false);
return sbc;
}
示例12: createChart
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
protected LineChart<Number, Number> createChart() {
xAxis = new NumberAxis(0,24,3);
final NumberAxis yAxis = new NumberAxis(0,100,10);
final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
// setup chart
lc.setId("lineStockDemo");
lc.setCreateSymbols(false);
lc.setAnimated(false);
lc.setLegendVisible(false);
lc.setTitle("ACME Company Stock");
xAxis.setLabel("Time");
xAxis.setForceZeroInRange(false);
yAxis.setLabel("Share Price");
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
// add starting data
hourDataSeries = new XYChart.Series<Number,Number>();
hourDataSeries.setName("Hourly Data");
minuteDataSeries = new XYChart.Series<Number,Number>();
minuteDataSeries.setName("Minute Data");
// create some starting data
hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY));
for (double m=0; m<(60); m++) {
nextTime();
plotTime();
}
lc.getData().add(minuteDataSeries);
lc.getData().add(hourDataSeries);
return lc;
}
示例13: start
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public void start(Stage stage) {
//Belgium 1950 8639369
//Belgium 1960 9118700
//Belgium 1970 9637800
//Belgium 1980 9846800
//Belgium 1990 9969310
//Belgium 2000 10263618
double[][] input = {
{1950, 8639369},
{1960, 9118700},
{1970, 9637800},
{1980, 9846800},
{1990, 9969310},
{2000, 10263618}};
double[] predictionYears = {1950, 1960, 1970, 1980, 1990, 2000, 2010, 2020, 2030, 2040};
NumberFormat yearFormat = NumberFormat.getNumberInstance();
yearFormat.setMaximumFractionDigits(0);
yearFormat.setGroupingUsed(false);
NumberFormat populationFormat = NumberFormat.getNumberInstance();
populationFormat.setMaximumFractionDigits(0);
SimpleRegression regression = new SimpleRegression();
regression.addData(input);
projectedSeries.setName("Projected");
for (int i = 0; i < predictionYears.length; i++) {
out.println(yearFormat.format(predictionYears[i]) + "-"
+ populationFormat.format(regression.predict(predictionYears[i])));
addDataItem(projectedSeries, predictionYears[i],
regression.predict(predictionYears[i]));
}
displayAttribute("Slope",regression.getSlope());
displayAttribute("Intercept", regression.getIntercept());
displayAttribute("InterceptStdEr", regression.getInterceptStdErr());
displayAttribute("MeanSquareError", regression.getMeanSquareError());
displayAttribute("N", + regression.getN());
displayAttribute("R", + regression.getR());
displayAttribute("RSquare", regression.getRSquare());
//Create index chart
stage.setTitle("Simple Linear Regression");
xAxis.setTickLabelFormatter(new StringConverter<Number>() {
@Override
public String toString(Number object) {
return (object.intValue()) + "";
}
@Override
public Number fromString(String string) {
return 0;
}
});
final LineChart<Number, Number> lineChart
= new LineChart<>(xAxis, yAxis);
lineChart.setTitle("Belgium Population");
yAxis.setLabel("Population");
originalSeries.setName("Actual");
addDataItem(originalSeries, 1950, 8639369);
addDataItem(originalSeries, 1960, 9118700);
addDataItem(originalSeries, 1970, 9637800);
addDataItem(originalSeries, 1980, 9846800);
addDataItem(originalSeries, 1990, 9969310);
addDataItem(originalSeries, 2000, 10263618);
Scene scene = new Scene(lineChart, 800, 600);
lineChart.getData().addAll(originalSeries, projectedSeries);
stage.setScene(scene);
stage.show();
}
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Made-Easy,代码行数:75,代码来源:MainApp - Simple Regression.java
示例14: start
import javafx.scene.chart.LineChart; //导入方法依赖的package包/类
@Override
public void start(final Stage stage) {
stage.setTitle("Line Chart Sample");
// defining the axes
final NumberAxis xAxis = new NumberAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setAutoRanging(true);
xAxis.setForceZeroInRange(false);
yAxis.setAutoRanging(true);
yAxis.setForceZeroInRange(false);
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
final XYChart.Series series = new XYChart.Series();
series.setName("My portfolio");
// populating the series with data
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));
// DO NOT ADD DATA TO CHART
// bc.getData().addAll(series1, series2, series3);
final StackPane pane = new StackPane();
pane.getChildren().add(lineChart);
final Scene scene = new Scene(pane, 500, 400);
new ZoomManager(pane, lineChart, series);
stage.setScene(scene);
stage.show();
}
示例15: start
import javafx.scene.chart.LineChart; //导入方法依赖的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>();
XYChart.Series<Number, Number> series1 = new XYChart.Series<Number, Number>();
series.setName("Lions");
series1.setName("Gazelles");
for (int i=1; i<n+1; i++){
series.getData().add(new XYChart.Data<Number, Number>(t[i], x[i]));
series1.getData().add(new XYChart.Data<Number, Number>(t[i], y[i]));
}
Scene scene = new Scene(lineChart,800,600);
lineChart.getData().add(series);
lineChart.getData().add(series1);
stage.setScene(scene);
stage.show();
}