當前位置: 首頁>>代碼示例>>Java>>正文


Java BarChart.setTitle方法代碼示例

本文整理匯總了Java中javafx.scene.chart.BarChart.setTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java BarChart.setTitle方法的具體用法?Java BarChart.setTitle怎麽用?Java BarChart.setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.chart.BarChart的用法示例。


在下文中一共展示了BarChart.setTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
protected BarChart<String, Number> createChart() {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis(0,50,10);
    final BarChart<String,Number> bc = new BarChart<String,Number>(xAxis,yAxis);
    bc.setId("barAudioDemo");
    bc.setLegendVisible(false);
    bc.setAnimated(false);
    bc.setBarGap(0);
    bc.setCategoryGap(1);
    bc.setVerticalGridLinesVisible(false);
    // setup chart
    bc.setTitle("Live Audio Spectrum Data");
    xAxis.setLabel("Frequency Bands");
    yAxis.setLabel("Magnitudes");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
    // add starting data
    XYChart.Series<String,Number> series1 = new XYChart.Series<String,Number>();
    series1.setName("Data Series 1");
    //noinspection unchecked
    series1Data = new XYChart.Data[128];
    String[] categories = new String[128];
    for (int i=0; i<series1Data.length; i++) {
        categories[i] = Integer.toString(i+1);
        series1Data[i] = new XYChart.Data<String,Number>(categories[i],50);
        series1.getData().add(series1Data[i]);
    }
    bc.getData().add(series1);
    return bc;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:30,代碼來源:AdvBarAudioChartSample.java

示例2: handleFirstLoginsChart

import javafx.scene.chart.BarChart; //導入方法依賴的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();
}
 
開發者ID:jmhertlein,項目名稱:mcanalytics,代碼行數:27,代碼來源:ChartPane.java

示例3: getBarChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public BarChart<String, Number> getBarChart() {
    BarChart<String, Number> barChart = new BarChart<String, Number>(xAxis, yAxis);
    barChart.setTitle(chartTitle());
    barChart.setLegendVisible(false);
    yAxis.setLabel(barChartYAxisLabel());
    xAxis.setLabel(barChartXAxisLabel());
    barChart.getData().add(barChartData());
    return barChart;
}
 
開發者ID:kwilliams3,項目名稱:Recordian,代碼行數:10,代碼來源:BarChartFactory.java

示例4: simpleBarChartByCountry

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public void simpleBarChartByCountry(Stage stage) {
    stage.setTitle("Bar Chart");
    final BarChart<String, Number> barChart
            = new BarChart<>(xAxis, yAxis);
    barChart.setTitle("Country Summary");
    xAxis.setLabel("Country");
    yAxis.setLabel("Population");

    series1.setName("1950");
    addDataItem(series1, belgium, 8639369);
    addDataItem(series1, france, 42518000);
    addDataItem(series1, germany, 68374572);
    addDataItem(series1, netherlands, 10113527);
    addDataItem(series1, sweden, 7014005);
    addDataItem(series1, unitedKingdom, 50127000);

    series2.setName("1960");
    addDataItem(series2, belgium, 9118700);
    addDataItem(series2, france, 46584000);
    addDataItem(series2, germany, 72480869);
    addDataItem(series2, netherlands, 11486000);
    addDataItem(series2, sweden, 7480395);
    addDataItem(series2, unitedKingdom, 52372000);

    series3.setName("1970");
    addDataItem(series3, belgium, 9637800);
    addDataItem(series3, france, 51918000);
    addDataItem(series3, germany, 77783164);
    addDataItem(series3, netherlands, 13032335);
    addDataItem(series3, sweden, 8042803);
    addDataItem(series3, unitedKingdom, 55632000);

    Scene scene = new Scene(barChart, 800, 600);
    barChart.getData().addAll(series1, series2, series3);
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:PacktPublishing,項目名稱:Machine-Learning-End-to-Endguide-for-Java-developers,代碼行數:38,代碼來源:BarCharts - MainApp.java

示例5: createChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
protected BarChart<String, Number> createChart() {
    final String[] years = {"2007", "2008", "2009"};
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null));
    final BarChart<String,Number> bc = new BarChart<String,Number>(xAxis,yAxis);
    // setup chart
    bc.setTitle("Advanced Bar Chart");
    xAxis.setLabel("Year");
    xAxis.setCategories(FXCollections.<String>observableArrayList(Arrays.asList(years)));
    yAxis.setLabel("Price");
    // add starting data
    XYChart.Series<String,Number> series1 = new XYChart.Series<String,Number>();
    series1.setName("Data Series 1");
    XYChart.Series<String,Number> series2 = new XYChart.Series<String,Number>();
    series2.setName("Data Series 2");
    XYChart.Series<String,Number> series3 = new XYChart.Series<String,Number>();
    series3.setName("Data Series 3");
    // create sample data
    series1.getData().add(new XYChart.Data<String,Number>(years[0], 567));
    series1.getData().add(new XYChart.Data<String,Number>(years[1], 1292));
    series1.getData().add(new XYChart.Data<String,Number>(years[2], 2180));
    series2.getData().add(new XYChart.Data<String,Number>(years[0], 956));
    series2.getData().add(new XYChart.Data<String,Number>(years[1], 1665));
    series2.getData().add(new XYChart.Data<String,Number>(years[2], 2450));
    series3.getData().add(new XYChart.Data<String,Number>(years[0], 800));
    series3.getData().add(new XYChart.Data<String,Number>(years[1], 1000));
    series3.getData().add(new XYChart.Data<String,Number>(years[2], 2800));
    bc.getData().add(series1);
    bc.getData().add(series2);
    bc.getData().add(series3);
    return bc;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:ChartAdvancedBar.java

示例6: createChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
protected BarChart<Number, String> createChart() {
    final String[] years = {"2007", "2008", "2009"};
    final CategoryAxis yAxis = new CategoryAxis();
    final NumberAxis xAxis = new NumberAxis();
    final BarChart<Number,String> bc = new BarChart<Number,String>(xAxis,yAxis);
    // setup chart
    bc.setTitle("Horizontal Bar Chart Example");
    yAxis.setLabel("Year");
    yAxis.setCategories(FXCollections.<String>observableArrayList(Arrays.asList(years)));
    xAxis.setLabel("Price");
    // add starting data
    XYChart.Series<Number,String> series1 = new XYChart.Series<Number,String>();
    series1.setName("Data Series 1");
    XYChart.Series<Number,String> series2 = new XYChart.Series<Number,String>();
    series2.setName("Data Series 2");
    XYChart.Series<Number,String> series3 = new XYChart.Series<Number,String>();
    series3.setName("Data Series 3");
    series1.getData().add(new XYChart.Data<Number,String>(567, years[0]));
    series1.getData().add(new XYChart.Data<Number,String>(1292, years[1]));
    series1.getData().add(new XYChart.Data<Number,String>(2180, years[2]));
    series2.getData().add(new XYChart.Data<Number,String>(956, years[0]));
    series2.getData().add(new XYChart.Data<Number,String>(1665, years[1]));
    series2.getData().add(new XYChart.Data<Number,String>(2450, years[2]));
    series3.getData().add(new XYChart.Data<Number,String>(800, years[0]));
    series3.getData().add(new XYChart.Data<Number,String>(1000, years[1]));
    series3.getData().add(new XYChart.Data<Number,String>(2800, years[2]));
    bc.getData().add(series1);
    bc.getData().add(series2);
    bc.getData().add(series3);
    return bc;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:32,代碼來源:AdvHorizontalBarChartSample.java

示例7: simpleBarChartByYear

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public void simpleBarChartByYear(Stage stage) {
    stage.setTitle("Bar Chart");
    final BarChart<String, Number> barChart
            = new BarChart<>(xAxis, yAxis);
    barChart.setTitle("Year Summary");
    xAxis.setLabel("Year");
    yAxis.setLabel("Population");

    String year1950 = "1950";
    String year1960 = "1960";
    String year1970 = "1970";

    series1.setName(belgium);
    addDataItem(series1, year1950, 8639369);
    addDataItem(series1, year1960, 9118700);
    addDataItem(series1, year1970, 9637800);

    series2.setName(france);
    addDataItem(series2, year1950, 42518000);
    addDataItem(series2, year1960, 46584000);
    addDataItem(series2, year1970, 51918000);

    series3.setName(germany);
    addDataItem(series3, year1950, 68374572);
    addDataItem(series3, year1960, 72480869);
    addDataItem(series3, year1970, 77783164);

    series4.setName(netherlands);
    addDataItem(series4, year1950, 10113527);
    addDataItem(series4, year1960, 11486000);
    addDataItem(series4, year1970, 13032335);

    series5.setName(sweden);
    addDataItem(series5, year1950, 7014005);
    addDataItem(series5, year1960, 7480395);
    addDataItem(series5, year1970, 8042803);

    series6.setName(unitedKingdom);
    addDataItem(series6, year1950, 50127000);
    addDataItem(series6, year1960, 52372000);
    addDataItem(series6, year1970, 55632000);

    Scene scene = new Scene(barChart, 800, 600);
    barChart.getData().addAll(series1, series2, series3, series4, series5, series6);
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:PacktPublishing,項目名稱:Java-Data-Science-Made-Easy,代碼行數:48,代碼來源:BarCharts - MainApp.java

示例8: showTrackingData

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public void showTrackingData(){

		Alert alert = new Alert(AlertType.INFORMATION);
		alert.setTitle("TDD Trainer by Team ImmortalsGG");
		alert.setHeaderText("Klick 'show details' fuer einen Graph deiner Aktivitaet");
		CategoryAxis tasks = new CategoryAxis();
		NumberAxis time = new NumberAxis();
		BarChart<String,Number> barChart = new BarChart<>(tasks,time);

		if (log.size()==1){
			barChart.setTitle("Tracking Information: Ein Schritt bis jetzt");
		}else {
			barChart.setTitle("Tracking Information: " + log.size() + " Schritte bis jetzt");
		}

		tasks.setLabel("Schritte");
		time.setLabel("verbrachte Zeit");

		XYChart.Series series1 = new XYChart.Series();
		for(TDDTuple date : log){
			series1.getData().add(new XYChart.Data(date.getTask(), date.getSeconds()));
		}

		barChart.getData().addAll(series1);
		barChart.setPrefWidth(1000);
		GridPane expContent = new GridPane();
		expContent.setMaxWidth(Double.MAX_VALUE);
		expContent.add(barChart,0,0);
		alert.getDialogPane().setExpandableContent(expContent);

		alert.showAndWait();
	}
 
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-team-immortalsgg,代碼行數:33,代碼來源:TDDAlert.java

示例9: createObject

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public static Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data("First", 4),
                    new XYChart.Data("Second", 5),
                    new XYChart.Data("Fourth", 6)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data("First", 4),
                    new XYChart.Data("Second", 3),
                    new XYChart.Data("Fourth", 2)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data("First", 4),
                    new XYChart.Data("Second", 6),
                    new XYChart.Data("Fourth", 8)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        BarChart chart = new BarChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("BarChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:29,代碼來源:BarChartApp.java

示例10: getBarChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
static BarChart<String, Number> getBarChart(String title, CategoryAxis categoryAxis, NumberAxis numberAxis) {

        BarChart<String, Number> bar = new BarChart<>(categoryAxis, numberAxis);
        bar.setTitle(title);
        bar.setLegendVisible(false);
        bar.setCategoryGap(0.0);
        bar.setBarGap(0.1);
        bar.setBackground(Background.EMPTY);
        bar.setVerticalGridLinesVisible(false);
        return bar;
    }
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:12,代碼來源:FxBuilder.java

示例11: getNumberStringBarChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
private static BarChart<Number, String> getNumberStringBarChart(String title, NumberAxis xAxis, CategoryAxis
        yAxis) {
    final BarChart<Number, String> bar = new BarChart<>(xAxis, yAxis);
    bar.setTitle(title);
    bar.setLegendVisible(false);
    bar.setCategoryGap(0.0);
    bar.setBarGap(0.25);
    bar.setBackground(Background.EMPTY);
    bar.setHorizontalGridLinesVisible(false);
    return bar;
}
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:12,代碼來源:FxHorizontalBar.java

示例12: chart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public static BarChart<String, Number> chart(
        String title,
        CategoryColumn x,
        NumericColumn y) {

    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel(x.name());
    yAxis.setLabel(y.name());

    Table t = Table.create("", x, y);
    t = t.sortDescendingOn(y.name());

    final BarChart<String, Number> bar = new BarChart<>(xAxis, yAxis);

    bar.setTitle(title);

    List<XYChart.Data<String, Number>> d2 = new ArrayList<>(x.size());

    for (int i = 0; i < x.size(); i++) {
        d2.add(new XYChart.Data<>(t.categoryColumn(0).get(i), t.nCol(1).getFloat(i)));
    }
    XYChart.Series<String, Number> series1
            = new XYChart.Series<>(FXCollections.observableList(d2));

    series1.setName(y.name());

    bar.setLegendVisible(false);
    bar.setCategoryGap(0.0);
    bar.setBarGap(0.1);
    bar.setBackground(Background.EMPTY);
    bar.setVerticalGridLinesVisible(false);

    bar.getData().add(series1);
    return bar;
}
 
開發者ID:jtablesaw,項目名稱:tablesaw,代碼行數:37,代碼來源:FxPareto.java

示例13: handleUniqueLoginsChart

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
private void handleUniqueLoginsChart() throws IOException, InterruptedException, ExecutionException {
    final LocalDate start = startDatePicker.getValue();
    final LocalDate end = endDatePicker.getValue().plusDays(1);
    FutureRequest<Map<LocalDate, Integer>> requestResult = sock.submit(new UniqueLoginsPerDayRequest(
            start, end));

    Map<LocalDate, Integer> uniqueLogins = requestResult.get();

    LocalDate c = start;
    XYChart.Series<String, Number> series = new XYChart.Series<>();
    while(c.isBefore(end)) {
        if(uniqueLogins.containsKey(c)) {
            series.getData().add(new XYChart.Data(c.toString(), uniqueLogins.get(c)));
        } else {
            series.getData().add(new XYChart.Data(c.toString(), 0));
        }
        c = c.plusDays(1);
    }
    
    series.setName("Unique Logins per Day");
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("Day");
    yAxis.setLabel("Unique Logins");
    yAxis.setTickLength(5);
    yAxis.setMinorTickLength(1);
    xAxis.setAutoRanging(true);
    final BarChart<String, Number> barChart = new BarChart<>(xAxis, yAxis);
    barChart.setTitle("Unique Logins");
    barChart.getData().add(series);

    chartPane.setCenter(barChart);
    chartPane.layout();
}
 
開發者ID:jmhertlein,項目名稱:mcanalytics,代碼行數:35,代碼來源:ChartPane.java

示例14: getResultsContent

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public Parent getResultsContent() {
    NumberAxis xAxis = new NumberAxis();
    CategoryAxis yAxis = new CategoryAxis();
    BarChart<Number, String> chart = new BarChart<>(xAxis, yAxis);

    chart.setTitle("Data structure packet size based on number of packets");

    yAxis.setLabel("Number of Packets");
    yAxis.setCategories(FXCollections.<String>observableArrayList(Arrays.asList(new String[] {String.valueOf(numPackets)})));

    xAxis.setLabel("Size (in bytes). Lower is better");

    for (int i = 0; i < results.size(); i++) {
        XYChart.Series<Number, String> series = new XYChart.Series<Number, String>();
        series.setName(results.get(i).name);
        series.getData().addAll(
                new XYChart.Data<Number, String>(results.get(i).size, String.valueOf(numPackets))
                //                    new XYChart.Data<Number, String>(results1000.get(i).size, "1000"),
                //                    new XYChart.Data<Number, String>(results10000.get(i).size, "10000")
                );

        series.getData().forEach(data -> {
            Label l = new Label(data.getXValue().toString());
            l.setAlignment(Pos.CENTER_RIGHT);
            data.setNode(l);
        });

        chart.getData().add(series);
    }

    return chart;
}
 
開發者ID:AlmasB,項目名稱:mmorpg,代碼行數:35,代碼來源:ProtocolSizeTest.java

示例15: getResultsContent

import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
@Override
public Parent getResultsContent() {
    NumberAxis xAxis = new NumberAxis();
    CategoryAxis yAxis = new CategoryAxis();
    BarChart<Number, String> chart = new BarChart<>(xAxis, yAxis);

    chart.setTitle(String.valueOf(numPackets) + " packets");

    yAxis.setLabel("Compression");
    yAxis.setCategories(FXCollections.<String>observableArrayList("NONE", "ZIP", "LZMA"));

    xAxis.setLabel("Time (in seconds). Lower is better");

    for (int i = 0; i < results.size(); i++) {
        XYChart.Series<Number, String> series = new XYChart.Series<Number, String>();
        series.setName(results.get(i).name);
        series.getData().addAll(
                new XYChart.Data<Number, String>(results.get(i).timeTook, "NONE"),
                new XYChart.Data<Number, String>(results.get(i).timeTookZIP + results.get(i).timeTook, "ZIP"),
                new XYChart.Data<Number, String>(results.get(i).timeTookLZMA + results.get(i).timeTook, "LZMA")
                );

        series.getData().forEach(data -> {
            Label l = new Label(String.format("%.3f", data.getXValue().doubleValue()));
            l.setAlignment(Pos.CENTER_RIGHT);
            data.setNode(l);
        });

        chart.getData().add(series);
    }

    return chart;
}
 
開發者ID:AlmasB,項目名稱:mmorpg,代碼行數:34,代碼來源:ProtocolCompressionSpeedTest.java


注:本文中的javafx.scene.chart.BarChart.setTitle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。