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


Java NumberAxis.setTickUnit方法代码示例

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


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

示例1: createBarChart

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private BarChart createBarChart() {
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(tableModel.getColumnNames()));
    xAxis.setLabel("Year");

    double tickUnit = tableModel.getTickUnit();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickUnit(tickUnit);
    yAxis.setLabel("Units Sold");

    final BarChart chart = new BarChart(xAxis, yAxis, tableModel.getBarChartData());
    tableModel.addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                final int row = e.getFirstRow();
                final int column = e.getColumn();
                final Object value = ((SampleTableModel) e.getSource()).getValueAt(row, column);

                Platform.runLater(new Runnable() {
                    public void run() {
                        XYChart.Series<String, Number> s = (XYChart.Series<String, Number>) chart.getData().get(row);
                        BarChart.Data data = s.getData().get(column);
                        data.setYValue(value);
                    }
                });
            }
        }
    });
    return chart;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:33,代码来源:SwingInterop.java

示例2: updateAxisTickUnit

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private void updateAxisTickUnit(NumberAxis axis) {
    double size = Math.abs(axis.getUpperBound() - axis.getLowerBound());
    double tick = Math.ceil(size / 10);
    if (tick > 100) {
        tick = tick - (tick % 100);
    } else if (tick > 10) {
        tick = tick - (tick % 10);
    } else if (tick > 5) {
        tick = tick - (tick % 5);
    } else if (tick > 2) {
        tick = tick - (tick % 2);
    }
    axis.setTickUnit(tick);
}
 
开发者ID:yuriy-budiyev,项目名称:population,代码行数:15,代码来源:PrimaryController.java

示例3: setUpChart

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
@Override
public void setUpChart(XYChart<Number, Number> chart, ResourceBundle resources) {
    NumberAxis xAxis = (NumberAxis) chart.getXAxis();
    NumberAxis yAxis = (NumberAxis) chart.getYAxis();
    xAxis.setLabel(resources.getString("photometricdata.period"));
    xAxis.setAutoRanging(false);
    xAxis.setTickUnit(0.25);
    xAxis.setLowerBound(0);
    xAxis.setUpperBound(1);
    yAxis.setLabel(resources.getString("photometricdata.magnitude"));
    yAxis.setAutoRanging(true);
    yAxis.setTickLabelFormatter(invertedNegative(yAxis));
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:14,代码来源:PeriodPhotometricChartData.java

示例4: setUpChart

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
@Override
public void setUpChart(XYChart<Number, Number> chart, ResourceBundle resources) {
    NumberAxis xAxis = (NumberAxis) chart.getXAxis();
    NumberAxis yAxis = (NumberAxis) chart.getYAxis();
    xAxis.setLabel(resources.getString("photometricdata.jd"));
    xAxis.setAutoRanging(true);
    xAxis.setTickUnit(1000);
    yAxis.setLabel(resources.getString("photometricdata.magnitude"));
    yAxis.setAutoRanging(true);
    yAxis.setTickLabelFormatter(invertedNegative(yAxis));
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:12,代码来源:JulianDatePhotometricChartData.java

示例5: 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;
}
 
开发者ID:danielhuson,项目名称:megan-ce,代码行数:40,代码来源:LRInspectorController.java

示例6: setAxisProperties

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private static void setAxisProperties(final Axis<Number> axisOrig, final Axis<Number> axisNew) {
	if (axisOrig instanceof NumberAxis && axisNew instanceof NumberAxis) {
		NumberAxis nAxisOrig = (NumberAxis)axisOrig;
		NumberAxis nAxisNew = (NumberAxis)axisNew;
		nAxisNew.setLowerBound(nAxisOrig.getLowerBound());
		nAxisNew.setUpperBound(nAxisOrig.getUpperBound());
		nAxisNew.setTickUnit(nAxisOrig.getTickUnit());
	}
	axisNew.setAutoRanging(axisOrig.isAutoRanging());
	axisNew.setLabel(axisOrig.getLabel());
}
 
开发者ID:qupath,项目名称:qupath,代码行数:12,代码来源:ExportChartPanel.java

示例7: updateHistogram

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private void updateHistogram() {
		if (table == null || !isInitialized())
			return;
		ChannelDisplayInfo infoSelected = getCurrentInfo();
		Histogram histogram = (imageDisplay == null || infoSelected == null) ? null : imageDisplay.getHistogram(infoSelected);
//		histogram = histogramMap.get(infoSelected);
		if (histogram == null) {
			histogramPanel.getHistogramData().clear();
		}
		else {
			// Any animation is slightly nicer if we can modify the current data, rather than creating a new one
			if (histogramPanel.getHistogramData().size() == 1) {
				Color color = infoSelected.getColor() == null ? ColorToolsFX.TRANSLUCENT_BLACK_FX : ColorToolsFX.getCachedColor(infoSelected.getColor());
				histogramPanel.getHistogramData().get(0).setHistogram(histogram, color);
			} else
				histogramPanel.getHistogramData().setAll(HistogramPanelFX.createHistogramData(histogram, true, infoSelected.getColor()));
		}
		
		
		NumberAxis xAxis = (NumberAxis)histogramPanel.getChart().getXAxis();
		if (infoSelected != null && infoSelected.getMaxAllowed() == 255 && infoSelected.getMinAllowed() == 0) {
			xAxis.setAutoRanging(false);
			xAxis.setLowerBound(0);
			xAxis.setUpperBound(255);
		} else if (infoSelected != null) {
			xAxis.setAutoRanging(false);
			xAxis.setLowerBound(infoSelected.getMinAllowed());
			xAxis.setUpperBound(infoSelected.getMaxAllowed());
//			xAxis.setAutoRanging(true);
		}
		if (infoSelected != null)
			xAxis.setTickUnit(infoSelected.getMaxAllowed() - infoSelected.getMinAllowed());
		
		histogramPanel.getChart().getXAxis().setTickLabelsVisible(true);
		histogramPanel.getChart().getXAxis().setLabel("Pixel value");
		histogramPanel.getChart().getYAxis().setTickLabelsVisible(true);
//		histogramPanel.getChart().getYAxis().setLabel("Frequency");
		
		GridPane pane = new GridPane();
		pane.setHgap(4);
		pane.setVgap(2);
		int r = 0;
		// TODO: Show min & max somewhere - but beware of the need to stay updated!
//		if (infoSelected != null) {
//			pane.add(new Label("Min display"), 0, r);
//			pane.add(new Label(df.format(infoSelected.getMinDisplay())), 1, r);
//			r++;
//			pane.add(new Label("Max display"), 0, r);
//			pane.add(new Label(df.format(infoSelected.getMaxDisplay())), 1, r);
//			r++;
//		}
		if (histogram != null) {
			pane.add(new Label("Min"), 0, r);
			pane.add(new Label(df.format(histogram.getMinValue())), 1, r);
			r++;
			pane.add(new Label("Max"), 0, r);
			pane.add(new Label(df.format(histogram.getMaxValue())), 1, r);
			r++;
			pane.add(new Label("Mean"), 0, r);
			pane.add(new Label(df.format(histogram.getMeanValue())), 1, r);
			r++;
			pane.add(new Label("Std.dev"), 0, r);
			pane.add(new Label(df.format(histogram.getStdDev())), 1, r);
			r++;
		}
		chartTooltip.setGraphic(pane);
		
		if (r == 0)
			Tooltip.uninstall(histogramPanel.getChart(), chartTooltip);
		else
			Tooltip.install(histogramPanel.getChart(), chartTooltip);
		
////	case 0: return columnIndex == 0 ? "Min display" : df.format(channel.getMinDisplay());
////	case 1: return columnIndex == 0 ? "Max display" : df.format(channel.getMaxDisplay());
////	case 2: return columnIndex == 0 ? "Min" : df.format(histogram.getMinValue());
////	case 3: return columnIndex == 0 ? "Max" : df.format(histogram.getMaxValue());
////	case 4: return columnIndex == 0 ? "Mean" : df.format(histogram.getMeanValue());
////	case 5: return columnIndex == 0 ? "Std.dev" : df.format(histogram.getStdDev());
//		
//		histogramTableModel.setHistogram(infoSelected, histogram);
	}
 
开发者ID:qupath,项目名称:qupath,代码行数:82,代码来源:BrightnessContrastCommand.java

示例8: createChart

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private XYChart<Number, Number> createChart() {
	final XYChart.Series<Number, Number> series = new XYChart.Series<>();

	final double divisionWidth = (this.story.getRange().getLength() * 1.0) / (numDivisions * 1.0);

	for (int i = 0; i < numDivisions; ++i) {
		final TextRange range = new TextRange((int) Math.round(i * divisionWidth), (int) Math.round((i + 1) * divisionWidth));
		final double count = getNumOverlaps(range, this.ranges);
		series.getData().add(new Data<Number, Number>(range.getStartIndex(), count));
	}

	final StringConverter<Number> tickLabelFormatter = new StringConverter<Number>() {

		@Override
		public String toString(final Number n) {
			return String.valueOf((int) Math.round(n.doubleValue()));
		}

		@Override
		public Number fromString(final String string) {
			return Double.valueOf(string);
		}
	};

	final NumberAxis xAxis = new NumberAxis(0, this.story.getRange().getLength() - divisionWidth, divisionWidth);
	xAxis.setLabel("Text Position");
	xAxis.setTickLabelsVisible(true);
	xAxis.setTickLabelFormatter(tickLabelFormatter);
	final NumberAxis yAxis = new NumberAxis();
	yAxis.setTickUnit(1);
	yAxis.setLabel("# Found");
	yAxis.setTickLabelsVisible(true);
	yAxis.setTickLabelFormatter(tickLabelFormatter);

	final AreaChart<Number, Number> chart = new AreaChart<>(xAxis, yAxis);
	chart.setAnimated(false);
	chart.getData().add(series);
	chart.setLegendVisible(false);
	chart.setPrefWidth(600);
	chart.setPrefHeight(400);
	chart.setTitle("Heat Map");

	return chart;
}
 
开发者ID:mizitch,项目名称:story-inspector,代码行数:45,代码来源:HeatMapSummaryComponent.java

示例9: initializePercentileChartAxes

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
void initializePercentileChartAxes() {
    checkNotNull(percentileChart);
    final NumberAxis xAxis = (NumberAxis) percentileChart.getXAxis();
    xAxis.setAutoRanging(false);
    xAxis.setTickUnit(1); // log axis -> 10^x steps
    xAxis.setLowerBound(0);
    xAxis.setUpperBound(0);

    // Limit X range to max value to avoid empty space
    percentileChart.getData().addListener((ListChangeListener<XYChart.Series<Number, Number>>) c -> {
        double maxX = percentileChart.getData().stream()
                .flatMap(series -> series.getData().stream())
                .mapToDouble(point -> point.getXValue().doubleValue())
                .max()
                .orElse(0);
        xAxis.setUpperBound(maxX);
    });

    // Format labels such that e.g. 10^6 is shown as 6 nines
    xAxis.setTickLabelFormatter(new StringConverter<Number>() {
        @Override
        public String toString(Number object) {
            int intValue = object.intValue();
            if (object.doubleValue() > intValue)
                return ""; // Only label full 10^x steps
            switch (intValue) {
                case 0:
                    return "0%";
                case 1:
                    return "90%";
                case 2:
                    return "99%";
                default:
                    String percentile = "99.";
                    for (int i = 2; i < intValue; i++) {
                        percentile += "9";
                    }
                    return percentile + "%";
            }

        }

        @Override
        public Number fromString(String string) {
            return null;
        }
    });
}
 
开发者ID:ennerf,项目名称:HdrHistogramVisualizer,代码行数:49,代码来源:VisualizerPresenter.java


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