本文整理汇总了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);
}