当前位置: 首页>>代码示例>>Java>>正文


Java Axis类代码示例

本文整理汇总了Java中javafx.scene.chart.Axis的典型用法代码示例。如果您正苦于以下问题:Java Axis类的具体用法?Java Axis怎么用?Java Axis使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Axis类属于javafx.scene.chart包,在下文中一共展示了Axis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPlotArea

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
	 * Returns the plot area in the reference's coordinate space.
	 */
	public Rectangle2D getPlotArea() {
		Axis<?> xAxis = chart.getXAxis();
		Axis<?> yAxis = chart.getYAxis();

		double xStart = getXShift( xAxis, referenceNode );
		double yStart = getYShift( yAxis, referenceNode );

		//If the direct method to get the width (which is based on its Node dimensions) is not found to
		//be appropriate, an alternative method is commented.
//		double width = xAxis.getDisplayPosition( xAxis.toRealValue( xAxis.getUpperBound() ) );
		double width = xAxis.getWidth();
//		double height = yAxis.getDisplayPosition( yAxis.toRealValue( yAxis.getLowerBound() ) );
		double height = yAxis.getHeight();

		return new Rectangle2D( xStart, yStart, width, height );
	}
 
开发者ID:gillius,项目名称:jfxutils,代码行数:20,代码来源:XYChartInfo.java

示例2: CandleStickChart

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
 * Construct a new CandleStickChart with the given axis.
 *
 * @param xAxis The x axis to use
 * @param yAxis The y axis to use
 */
public CandleStickChart(Axis<Number> xAxis, Axis<Number> yAxis) {
    super(xAxis, yAxis);
    setAnimated(false);
    xAxis.setAnimated(false);
    yAxis.setAnimated(false);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:13,代码来源:AdvCandleStickChartSample.java

示例3: updateAxisRange

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
 * This is called when the range has been invalidated and we need to update it. If the axis are auto
 * ranging then we compile a list of all data that the given axis has to plot and call invalidateRange() on the
 * axis passing it that data.
 */
@Override
protected void updateAxisRange() {
    // For candle stick chart we need to override this method as we need to let the axis know that they need to be able
    // to cover the whole area occupied by the high to low range not just its center data value
    final Axis<Number> xa = getXAxis();
    final Axis<Number> ya = getYAxis();
    List<Number> xData = null;
    List<Number> yData = null;
    if (xa.isAutoRanging()) {
        xData = new ArrayList<Number>();
    }
    if (ya.isAutoRanging()) {
        yData = new ArrayList<Number>();
    }
    if (xData != null || yData != null) {
        for (Series<Number, Number> series : getData()) {
            for (Data<Number, Number> data : series.getData()) {
                if (xData != null) {
                    xData.add(data.getXValue());
                }
                if (yData != null) {
                    CandleStickExtraValues extras = (CandleStickExtraValues) data.getExtraValue();
                    if (extras != null) {
                        yData.add(extras.getHigh());
                        yData.add(extras.getLow());
                    } else {
                        yData.add(data.getYValue());
                    }
                }
            }
        }
        if (xData != null) {
            xa.invalidateRange(xData);
        }
        if (yData != null) {
            ya.invalidateRange(yData);
        }
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:45,代码来源:AdvCandleStickChartSample.java

示例4: TimingDiagramView

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
 * Instantiates a new Timing diagram view.
 *
 * @param xaxis the x axis
 * @param yaxis the y axis
 */
public TimingDiagramView(NumberAxis xaxis, Axis<A> yaxis) {
  super(xaxis, yaxis);
  this.xaxis = xaxis;
  this.yaxis = yaxis;

  setPrefHeight(80);

  getPlotChildren().addAll(cycleSelectionPane, durationLinesPane, dataPane);
  ViewUtils.setupView(this);

  ObservableList<Series<Number, A>> seriesObservableList = FXCollections.observableArrayList();
  setData(seriesObservableList);
  seriesObservableList.addListener((InvalidationListener) change -> {
    Platform.runLater(TimingDiagramView.this::requestRelayout);
  });
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:23,代码来源:TimingDiagramView.java

示例5: createIntegerTimingDiagram

import javafx.scene.chart.Axis; //导入依赖的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);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:24,代码来源:TimingDiagramController.java

示例6: createBoolTimingDiagram

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
 * Generates a boolean 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 CategoryAxis}
 */
public static Pair<TimingDiagramController, Axis> createBoolTimingDiagram(
    ConcreteSpecification concreteSpec, ValidIoVariable specIoVar, NumberAxis globalXAxis,
    Selection selection, BooleanProperty activated) {
  ObservableList<String> categories = FXCollections.observableArrayList();
  categories.addAll("FALSE", "TRUE");
  CategoryAxis boolCategoryAxis = new CategoryAxis(categories);
  boolCategoryAxis.setPrefWidth(30);
  boolCategoryAxis.setSide(Side.LEFT);
  boolCategoryAxis.setAutoRanging(true);
  TimingDiagramController timingDiagramController = new TimingDiagramController(globalXAxis,
      boolCategoryAxis, concreteSpec, specIoVar, selection, activated);
  return new ImmutablePair<>(timingDiagramController, boolCategoryAxis);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:25,代码来源:TimingDiagramController.java

示例7: createEnumTimingDiagram

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
 * Generates an enum 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 typeEnum type of the enum this diagram is generated for
 * @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 CategoryAxis}
 */
public static Pair<TimingDiagramController, Axis> createEnumTimingDiagram(
    ConcreteSpecification concreteSpec, ValidIoVariable specIoVar, TypeEnum typeEnum,
    NumberAxis globalXAxis, Selection selection, BooleanProperty activated) {
  ObservableList<String> categories = FXCollections.observableArrayList();
  typeEnum.getValues().stream().map(ValueEnum::getEnumValue).forEach(categories::add);
  CategoryAxis categoryAxis = new CategoryAxis(categories);
  categoryAxis.setSide(Side.LEFT);
  categoryAxis.setPrefWidth(30);
  categoryAxis.setAutoRanging(true);
  TimingDiagramController timingDiagramController = new TimingDiagramController(globalXAxis,
      categoryAxis, concreteSpec, specIoVar, selection, activated);
  return new ImmutablePair<>(timingDiagramController, categoryAxis);
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:26,代码来源:TimingDiagramController.java

示例8: createTimingDiagram

import javafx.scene.chart.Axis; //导入依赖的package包/类
/**
 * Generates a {@link TimingDiagramController} for a given {@link ValidIoVariable}. The method
 * adds multiple views to the {@link TimingDiagramCollectionView view} of this controller:
 * <ul>
 * <li>A {@link TimingDiagramView} wrapped in a
 * {@link edu.kit.iti.formal.stvs.view.spec.timingdiagram.renderer.VerticalResizeContainerView}
 * will be added to {@link TimingDiagramCollectionView#diagramContainer}</li>
 * <li>A {@link Label} (title of the {@link ValidIoVariable}) will be added to
 * {@link TimingDiagramCollectionView#labelContainer}</li>
 * <li>A {@link Axis} will be added to the {@link TimingDiagramCollectionView#yaxisContainer}</li>
 * </ul>
 *
 * @param concreteSpec the concrete specification which should be used to extract the needed
 *        information
 * @param validIoVariable the variable for which a diagram should be generated
 */
private void createTimingDiagram(ConcreteSpecification concreteSpec,
    ValidIoVariable validIoVariable) {
  Pair<TimingDiagramController, Axis> diagramAxisPair = validIoVariable.getValidType().match(
      () -> TimingDiagramController.createIntegerTimingDiagram(concreteSpec, validIoVariable,
          view.getXaxis(), selection, activated),
      () -> TimingDiagramController.createBoolTimingDiagram(concreteSpec, validIoVariable,
          view.getXaxis(), selection, activated),
      (e) -> TimingDiagramController.createEnumTimingDiagram(concreteSpec, validIoVariable, e,
          view.getXaxis(), selection, activated));
  TimingDiagramView timingDiagramView = diagramAxisPair.getLeft().getView();

  if (concreteSpec.isCounterExample()) {
    timingDiagramView.getStyleClass().add("counterexample");
  }
  Axis externalYAxis = diagramAxisPair.getRight();
  VerticalResizeContainerController verticalResizeContainerController =
      new VerticalResizeContainerController(timingDiagramView);

  this.view.getDiagramContainer().getChildren().add(verticalResizeContainerController.getView());
  this.view.getyAxisContainer().getChildren().add(externalYAxis);
  timingDiagramView.getyAxis().layoutBoundsProperty()
      .addListener(change -> updateAxisExternalPosition(timingDiagramView, externalYAxis));
  verticalResizeContainerController.getView().layoutYProperty()
      .addListener(change -> updateAxisExternalPosition(timingDiagramView, externalYAxis));
  AnchorPane.setRightAnchor(externalYAxis, 0.0);

  Label label = new Label(validIoVariable.getName());
  label.getStyleClass().add(validIoVariable.getCategory().name().toLowerCase());
  this.view.getLabelContainer().getChildren().add(label);
  // Ensures that labels are always centered vertically relative to their diagram
  label.layoutYProperty().bind(externalYAxis.layoutYProperty()
      .add(externalYAxis.heightProperty().divide(2)).subtract(label.heightProperty().divide(2)));
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:50,代码来源:TimingDiagramCollectionController.java

示例9: setXAxis

import javafx.scene.chart.Axis; //导入依赖的package包/类
public void setXAxis(final Axis AXIS) {
    if (null == xAxis) {
        _xAxis = AXIS;
        fireTileEvent(RESIZE_EVENT);
    } else {
        xAxis.set(AXIS);
    }
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:9,代码来源:Tile.java

示例10: xAxisProperty

import javafx.scene.chart.Axis; //导入依赖的package包/类
public ObjectProperty<Axis> xAxisProperty() {
    if (null == xAxis) {
        xAxis = new ObjectPropertyBase<Axis>(_xAxis) {
            @Override protected void invalidated() { fireTileEvent(RESIZE_EVENT); }
            @Override public Object getBean() { return Tile.this; }
            @Override public String getName() {
                return "xAxis";
            }
        };
        _xAxis = null;
    }
    return xAxis;
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:14,代码来源:Tile.java

示例11: setYAxis

import javafx.scene.chart.Axis; //导入依赖的package包/类
public void setYAxis(final Axis AXIS) {
    if (null == yAxis) {
        _yAxis = AXIS;
        fireTileEvent(RESIZE_EVENT);
    } else {
        yAxis.set(AXIS);
    }
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:9,代码来源:Tile.java

示例12: yAxisProperty

import javafx.scene.chart.Axis; //导入依赖的package包/类
public ObjectProperty<Axis> yAxisProperty() {
    if (null == yAxis) {
        yAxis = new ObjectPropertyBase<Axis>(_yAxis) {
            @Override protected void invalidated() { fireTileEvent(RESIZE_EVENT); }
            @Override public Object getBean() { return Tile.this; }
            @Override public String getName() { return "yAxis"; }
        };
        _yAxis = null;
    }
    return yAxis;
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:12,代码来源:Tile.java

示例13: createObject

import javafx.scene.chart.Axis; //导入依赖的package包/类
protected Chart createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1,4),
                    new XYChart.Data(2,5),
                    new XYChart.Data(3,6)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(4,4),
                    new XYChart.Data(5,3),
                    new XYChart.Data(6,2)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(7,4),
                    new XYChart.Data(8,6),
                    new XYChart.Data(9,8)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        AreaChart chart = new AreaChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("AreaChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:29,代码来源:AreaChartApp.java

示例14: createObject

import javafx.scene.chart.Axis; //导入依赖的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);
        StackedBarChart chart = new StackedBarChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("StackedBarChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:29,代码来源:StackedBarChartApp.java

示例15: createObject

import javafx.scene.chart.Axis; //导入依赖的package包/类
protected Object createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1, 4),
                    new XYChart.Data(4, 5),
                    new XYChart.Data(9, 6)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(0, 4),
                    new XYChart.Data(3, 3),
                    new XYChart.Data(8, 2)
                ));
        s2.setName("Set 2");
        Series s3 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(2, 4),
                    new XYChart.Data(5, 6),
                    new XYChart.Data(9, 8)
                ));
        s3.setName("Set 3");
        ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
        LineChart chart = new LineChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("LineChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:29,代码来源:LineChartApp.java


注:本文中的javafx.scene.chart.Axis类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。