本文整理匯總了Java中javafx.scene.chart.NumberAxis.setTickLength方法的典型用法代碼示例。如果您正苦於以下問題:Java NumberAxis.setTickLength方法的具體用法?Java NumberAxis.setTickLength怎麽用?Java NumberAxis.setTickLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.NumberAxis
的用法示例。
在下文中一共展示了NumberAxis.setTickLength方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
示例2: AreaChartSample
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
public AreaChartSample() {
NumberAxis xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d);
xAxis.setTickLength(12.0f);
NumberAxis yAxis = new NumberAxis("Y Values", 0.0d, 10.0d, 2.0d);
ObservableList<AreaChart.Series> areaChartData = FXCollections.observableArrayList(
new AreaChart.Series("Series 1",FXCollections.observableArrayList(
new AreaChart.Data(0,4),
new AreaChart.Data(2,5),
new AreaChart.Data(4,4),
new AreaChart.Data(6,2),
new AreaChart.Data(8,6),
new AreaChart.Data(10,8)
)),
new AreaChart.Series("Series 2", FXCollections.observableArrayList(
new AreaChart.Data(0,8),
new AreaChart.Data(2,2),
new AreaChart.Data(4,9),
new AreaChart.Data(6,7),
new AreaChart.Data(8,5),
new AreaChart.Data(10,7)
)),
new AreaChart.Series("Series 3", FXCollections.observableArrayList(
new AreaChart.Data(0,2),
new AreaChart.Data(2,5),
new AreaChart.Data(4,8),
new AreaChart.Data(6,6),
new AreaChart.Data(8,9),
new AreaChart.Data(10,7)
))
);
AreaChart chart = new AreaChart(xAxis, yAxis, areaChartData);
getChildren().add(chart);
}
示例3: handleOnlinePlayersChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
private void handleOnlinePlayersChart() throws IOException, InterruptedException, ExecutionException {
FutureRequest<LinkedHashMap<LocalDateTime, Integer>> requestResult;
requestResult = sock.submit(new PastOnlinePlayerCountRequest(
startDatePicker.getValue().atStartOfDay(),
endDatePicker.getValue().plusDays(1).atStartOfDay()
));
LinkedHashMap<LocalDateTime, Integer> counts = requestResult.get();
//mungeDataToSquareLines(counts);
XYChart.Series<Date, Number> series = new XYChart.Series<>();
for(Map.Entry<LocalDateTime, Integer> e : counts.entrySet()) {
series.getData().add(new XYChart.Data(Date.from(e.getKey().atZone(ZoneId.systemDefault()).toInstant()), e.getValue()));
}
final DateAxis xAxis = new DateAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel("Time");
yAxis.setLabel("Online Players");
yAxis.setTickLength(5);
yAxis.setMinorTickLength(1);
xAxis.setAutoRanging(true);
final LineChart<Date, Number> lineChart = new LineChart<>(xAxis, yAxis);
lineChart.setTitle("Online Players");
lineChart.getData().add(series);
chartPane.setCenter(lineChart);
chartPane.layout();
lineChart.setOnScroll(e -> handleScroll(xAxis, e));
}
示例4: handleUniqueLoginsChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的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();
}
示例5: initializeFrequencyChart
import javafx.scene.chart.NumberAxis; //導入方法依賴的package包/類
public final void initializeFrequencyChart(){
xAxis = new NumberAxis(0,1,1);
yAxis = new NumberAxis();
xAxis.setTickLength(5);
yAxis.setTickLabelsVisible(false);
yAxis.setTickMarkVisible(false);
xAxis.setLabel("Time (days)");
frequencyChart = new LineChart<>(xAxis,yAxis);
frequencyChart.setLegendVisible(true);
frequencyChart.setCreateSymbols(false);
frequencyChart.setTranslateX(-5);
UIUtils.setSize(frequencyChart, Main.columnWidthLEFT+5, 300);
}