本文整理汇总了Java中javafx.scene.chart.NumberAxis.setSide方法的典型用法代码示例。如果您正苦于以下问题:Java NumberAxis.setSide方法的具体用法?Java NumberAxis.setSide怎么用?Java NumberAxis.setSide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.chart.NumberAxis
的用法示例。
在下文中一共展示了NumberAxis.setSide方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected ScatterChart<Number, Number> createChart() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setSide(Side.TOP);
final NumberAxis yAxis = new NumberAxis();
yAxis.setSide(Side.RIGHT);
final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
// setup chart
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
for (int s=0;s<5;s++) {
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
series.setName("Data Series "+s);
for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
sc.getData().add(series);
}
return sc;
}
示例2: createChart
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
protected ScatterChart<Number, Number> createChart() {
final NumberAxis xAxis = new NumberAxis();
xAxis.setSide(Side.TOP);
final NumberAxis yAxis = new NumberAxis();
yAxis.setSide(Side.RIGHT);
final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
// setup chart
xAxis.setLabel("X Axis");
yAxis.setLabel("Y Axis");
// add starting data
for (int s=0;s<5;s++) {
XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
series.setName("Data Series "+s);
for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
sc.getData().add(series);
}
return sc;
}
示例3: createIntegerTimingDiagram
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
/**
* Generates an integer timing diagram.
*
* @param concreteSpec the concrete specification which should be used to extract the needed
* information
* @param specIoVar the variable for which a diagram should be generated
* @param globalXAxis global x axis used for all diagrams
* @param selection selection that should be updated when hovering with mouse
* @param activated only update selection if true
* @return A {@link Pair} which holds a {@link TimingDiagramController} and a {@link NumberAxis}
*/
public static Pair<TimingDiagramController, Axis> createIntegerTimingDiagram(
ConcreteSpecification concreteSpec, ValidIoVariable specIoVar, NumberAxis globalXAxis,
Selection selection, BooleanProperty activated) {
NumberAxis yaxis = new NumberAxis(0, 10, 1);
yaxis.setPrefWidth(30);
yaxis.setSide(Side.LEFT);
yaxis.setTickLabelFormatter(new IntegerTickLabelConverter());
yaxis.setMinorTickVisible(false);
TimingDiagramController timingDiagramController = new TimingDiagramController(globalXAxis,
yaxis, concreteSpec, specIoVar, selection, activated);
return new ImmutablePair<>(timingDiagramController, yaxis);
}
示例4: createAxis
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
/**
* create a horizontal axis
*
* @param maxReadLength
* @return axis
*/
public static Pane createAxis(final ReadOnlyIntegerProperty maxReadLength, final ReadOnlyDoubleProperty widthProperty) {
final Pane pane = new Pane();
pane.prefWidthProperty().bind(widthProperty);
final NumberAxis axis = new NumberAxis();
axis.setSide(Side.TOP);
axis.setAutoRanging(false);
axis.setLowerBound(0);
axis.prefHeightProperty().set(20);
axis.prefWidthProperty().bind(widthProperty.subtract(60));
final ChangeListener<Number> changeListener = new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
int minX = Math.round(maxReadLength.get() / 2000.0f); // at most 2000 major ticks
for (int x = 10; x < 10000000; x *= 10) {
if (x >= minX && widthProperty.doubleValue() * x >= 50 * maxReadLength.doubleValue()) {
axis.setUpperBound(maxReadLength.get());
axis.setTickUnit(x);
return;
}
}
axis.setTickUnit(maxReadLength.get());
axis.setUpperBound(maxReadLength.get());
}
};
maxReadLength.addListener(changeListener);
widthProperty.addListener(changeListener);
pane.getChildren().add(axis);
return pane;
}
示例5: plotGraph
import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private static Pane plotGraph(Pane root, LineGraph graph) {
if (!graph.isRendered())
graph.render(LineGraph.Render.ALL);
handleMapping(graph);
//The holder
AnchorPane pane = new AnchorPane();
//pane.setMaxSize(graph.getWidth(), graph.getHeight());
//pane.setPrefWidth(graph.getWidth());
//Add the graph
pane.getChildren().add(graph);
//Creates axises
NumberAxis xAxis = new NumberAxis(xStart, xEnd, xIncrement);
NumberAxis yAxis = new NumberAxis(yStart, yEnd, yIncrement);
yAxis.setSide(Side.LEFT);
pane.getChildren().add(xAxis);
pane.getChildren().add(yAxis);
//Add x-axis
if(labels.containsKey(graph.getId()))
xAxis.setLabel(labels.get(graph.getId())[0]);
AnchorPane.setLeftAnchor(xAxis, 68.0);
AnchorPane.setRightAnchor(xAxis, 5.0);
AnchorPane.setBottomAnchor(xAxis, 0.0);
AnchorPane.setLeftAnchor(graph,68.0);
//Add y-axis
if(labels.containsKey(graph.getId()))
yAxis.setLabel(labels.get(graph.getId())[1]);
AnchorPane.setLeftAnchor(yAxis, 0.0);
AnchorPane.setTopAnchor(yAxis, graph.getHeight() - graph.getRealMaxHeight());
//Setting margin of y-axis and graph related to the x-axis height
xAxis.heightProperty().addListener((observable,oldV,newV) -> {
AnchorPane.setBottomAnchor(yAxis,newV.doubleValue());
AnchorPane.setBottomAnchor(graph, newV.doubleValue());
});
Pane out;
if (root == null)
out = new Pane();
else
out = root;
out.getChildren().add(pane);
clear();
return out;
}