Java 类javafx.scene.chart.ValueAxis 实例源码

项目:binjr    文件:WorksheetController.java   
private void initChartPane() {
    //region *** XYChart ***
    ZonedDateTimeAxis xAxis = new ZonedDateTimeAxis(getWorksheet().getTimeZone());
    xAxis.zoneIdProperty().bind(getWorksheet().timeZoneProperty());
    xAxis.setAnimated(false);
    xAxis.setSide(Side.BOTTOM);
    StableTicksAxis yAxis;
    if (worksheet.getUnitPrefixes() == UnitPrefixes.BINARY) {
        yAxis = new BinaryStableTicksAxis();
    }
    else {
        yAxis = new MetricStableTicksAxis();
    }
    yAxis.setSide(Side.LEFT);
    yAxis.autoRangingProperty().bindBidirectional(autoScaleYAxisToggle.selectedProperty());
    yAxis.setAnimated(false);
    yAxis.setTickSpacing(30);
    yAxis.labelProperty().bind(worksheet.unitProperty());
    chart = buildChart(xAxis, (ValueAxis) yAxis, worksheet.showChartSymbolsProperty());
    chart.setCache(true);
    chart.setCacheHint(CacheHint.SPEED);
    chart.setCacheShape(true);
    chart.setFocusTraversable(true);
    chart.setLegendVisible(false);
    chart.animatedProperty().bindBidirectional(globalPrefs.chartAnimationEnabledProperty());
    chartParent.getChildren().add(chart);
    AnchorPane.setBottomAnchor(chart, 0.0);
    AnchorPane.setLeftAnchor(chart, 0.0);
    AnchorPane.setRightAnchor(chart, 0.0);
    AnchorPane.setTopAnchor(chart, 0.0);
    //endregion
}
项目:binjr    文件:WorksheetController.java   
/**
 * Sets the current state from a {@link XYChartSelection}
 *
 * @param selection the {@link XYChartSelection} to set as the current state
 * @param toHistory true if the change in state should be recorded in the history
 */
void setSelection(XYChartSelection<ZonedDateTime, Double> selection, boolean toHistory) {
    frozen = true;
    try {
        ZonedDateTime newStartX = roundDateTime(selection.getStartX());
        ZonedDateTime newEndX = roundDateTime(selection.getEndX());
        boolean dontPlotChart = newStartX.isEqual(startX.get()) && newEndX.isEqual(endX.get());
        this.startX.set(newStartX);
        this.endX.set(newEndX);
        // Disable auto range on Y axis if zoomed in
        if (toHistory) {
            double r = (((ValueAxis<Double>) chart.getYAxis()).getUpperBound() - ((ValueAxis<Double>) chart.getYAxis()).getLowerBound()) - Math.abs(selection.getEndY() - selection.getStartY());
            logger.debug(() -> "Y selection - Y axis range = " + r);
            if (r > 0.0001) {
                autoScaleYAxisToggle.setSelected(false);
            }
        }
        else {
            autoScaleYAxisToggle.setSelected(selection.isAutoRangeY());
        }

        this.startY.set(roundYValue(selection.getStartY()));
        this.endY.set(roundYValue(selection.getEndY()));
        invalidate(toHistory, dontPlotChart, false);
    } finally {
        frozen = false;
    }
}
项目:binjr    文件:AreaChartWorksheetController.java   
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
    AreaChart<ZonedDateTime, Double> newChart = new AreaChart<>(xAxis, yAxis);
    newChart.setCreateSymbols(false);
    newChart.createSymbolsProperty().bindBidirectional(showSymbolsProperty);
    return newChart;
}
项目:binjr    文件:LineChartWorksheetController.java   
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
    LineChart<ZonedDateTime, Double> newChart = new LineChart<>(xAxis, yAxis);
    newChart.setCreateSymbols(false);
    newChart.createSymbolsProperty().bindBidirectional(showSymbolsProperty);
    return newChart;
}
项目:binjr    文件:StackedAreaChartWorksheetController.java   
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
    StackedAreaChart<ZonedDateTime, Double> newChart = new StackedAreaChart<>(xAxis, yAxis);
    newChart.setCreateSymbols(false);
    newChart.createSymbolsProperty().bindBidirectional(showSymbolsProperty);
    return newChart;
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetValueAxisAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(ValueAxis.class);

    assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
项目:openjfx-8u-dev-tests    文件:XYChartBaseApp.java   
public AxisNode(ValueAxis xAxis, ValueAxis yAxis) {
    this.xAxis = xAxis;
    this.yAxis = yAxis;
}
项目:openjfx-8u-dev-tests    文件:ValueAxisDescriptionProvider.java   
public ValueAxisDescriptionProvider(Wrap<? extends ValueAxis> valueAxis) {
    super(valueAxis);
    this.valueAxis = valueAxis;
}
项目:binjr    文件:WorksheetController.java   
private void initNavigationPane() {
    //region *** Buttons ***
    backButton.setOnAction(this::handleHistoryBack);
    forwardButton.setOnAction(this::handleHistoryForward);
    refreshButton.setOnAction(this::handleRefresh);
    snapshotButton.setOnAction(this::handleTakeSnapshot);
    forwardButton.setOnAction(this::handleHistoryForward);
    backButton.disableProperty().bind(backwardHistory.emptyStackProperty);
    forwardButton.disableProperty().bind(forwardHistory.emptyStackProperty);
    //endregion

    //region *** Time pickers ***
    this.currentState = new XYChartViewState(getWorksheet().getFromDateTime(), getWorksheet().getToDateTime(), 0, 100);
    getWorksheet().fromDateTimeProperty().bind(currentState.startX);
    getWorksheet().toDateTimeProperty().bind(currentState.endX);
    plotChart(currentState.asSelection(), true);
    endDate.zoneIdProperty().bind(getWorksheet().timeZoneProperty());
    startDate.zoneIdProperty().bind(getWorksheet().timeZoneProperty());
    startDate.dateTimeValueProperty().bindBidirectional(currentState.startX);
    endDate.dateTimeValueProperty().bindBidirectional(currentState.endX);
    //endregion

    //region *** Crosshair ***
    DateTimeFormatter dateTimeFormatter = DateTimeFormatter.RFC_1123_DATE_TIME;//  DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.MEDIUM);
    NumberStringConverter numberFormatter = new NumberStringConverter(Locale.getDefault(Locale.Category.FORMAT));
    crossHair = new XYChartCrosshair<>(chart, chartParent, dateTimeFormatter::format, n -> String.format("%,.2f", n.doubleValue()));

    crossHair.onSelectionDone(s -> {
        logger.debug(() -> "Applying zoom selection: " + s.toString());
        currentState.setSelection(s, true);
    });
    hCrosshair.selectedProperty().bindBidirectional(globalPrefs.horizontalMarkerOnProperty());
    vCrosshair.selectedProperty().bindBidirectional(globalPrefs.verticalMarkerOnProperty());
    crossHair.horizontalMarkerVisibleProperty().bind(Bindings.createBooleanBinding(() -> globalPrefs.isShiftPressed() || hCrosshair.isSelected(), hCrosshair.selectedProperty(), globalPrefs.shiftPressedProperty()));
    crossHair.verticalMarkerVisibleProperty().bind(Bindings.createBooleanBinding(() -> globalPrefs.isCtrlPressed() || vCrosshair.isSelected(), vCrosshair.selectedProperty(), globalPrefs.ctrlPressedProperty()));
    currentColumn.setVisible(crossHair.isVerticalMarkerVisible());
    crossHair.verticalMarkerVisibleProperty().addListener((observable, oldValue, newValue) -> currentColumn.setVisible(newValue));
    setAndBindTextFormatter(yMinRange, numberFormatter, currentState.startY, ((ValueAxis<Double>) chart.getYAxis()).lowerBoundProperty());
    setAndBindTextFormatter(yMaxRange, numberFormatter, currentState.endY, ((ValueAxis<Double>) chart.getYAxis()).upperBoundProperty());
    //endregion
}
项目:binjr    文件:ScatterChartWorksheetController.java   
@Override
protected XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty) {
    ScatterChart<ZonedDateTime, Double> newChart = new ScatterChart<ZonedDateTime, Double>(xAxis, yAxis);
    return newChart;
}
项目:efiscen    文件:ChartController.java   
/**
 * Constructor for ChartController
 * @param panel chart where graphs are printed 
 * @param efiscenModel Model containing data that is shown in the graph
 * @param selections selections for regions, owners, sites and species  
 * @param rb ResourceBundle containing localization.
 */
public ChartController(LineChart<Float,Float> panel, EfiscenModel efiscenModel,
        Selections selections, ResourceBundle rb) {
    this.selections = selections;
    this.panel = panel;
    this.efiscenModel = efiscenModel;
    this.rb = rb;
    dataParsers = new DataParsers(efiscenModel);
    ((ValueAxis)panel.getXAxis()).setTickLabelFormatter(new StringConverter() {

        @Override
        public String toString(Object t) {
            Number n = (Number) t;
            if(n.intValue()!=n.doubleValue()) return "..";
            return ""+n.intValue();
        }

        @Override
        public Object fromString(String string) {
            return Double.parseDouble(string);
        }
    });
    regions = new HashSet<>();
    owners = new HashSet<>();
    sites = new HashSet<>();
    species = new HashSet<>();
    regions.add(0l);
    owners.add(0l);
    sites.add(0l);
    species.add(0l);

    //get all parsable values from DataParsers
    //set all graphs disabled
    for(String key : dataParsers.getIds()) {
        graphsEnabled.put(key, Boolean.FALSE);
    }

    GMEfiscen efiscen = efiscenModel.getEfiscen();
    if(efiscen==null) efiscen = new GMEfiscen();

}
项目:binjr    文件:WorksheetController.java   
protected abstract XYChart<ZonedDateTime, Double> buildChart(ZonedDateTimeAxis xAxis, ValueAxis<Double> yAxis, BooleanProperty showSymbolsProperty);