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


Java NumberAxis.setUpperBound方法代码示例

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


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

示例1: mouseDraggedHandler

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
/**
 * Handles drag events on xAxis.
 *
 * @param event mouse event
 */
private void mouseDraggedHandler(MouseEvent event) {
  Point2D point2D = getView().sceneToLocal(event.getSceneX(), event.getScreenY());
  double newXPosition = point2D.getX();
  double delta = newXPosition - dragState.startXPosition;
  double deltaAsAxis = delta * dragState.screenDistanceToAxisRatio;
  if (dragState.startLowerBound - deltaAsAxis < 0) {
    deltaAsAxis = dragState.startLowerBound;
  }
  NumberAxis xaxis = getView().getXaxis();
  xaxis.setLowerBound(Math.max(dragState.startLowerBound - deltaAsAxis, 0));
  xaxis.setUpperBound(Math.max(dragState.startUpperBound - deltaAsAxis, visibleRange.get()));
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:18,代码来源:TimingDiagramCollectionController.java

示例2: AreaChartControl

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
public AreaChartControl(String name) {
	super(name, FlashboardSendableType.AREACHART);
	
	axisX = new NumberAxis();
	axisX.setForceZeroInRange(false);
	axisX.setAutoRanging(false);
	axisX.setUpperBound(maxX);
	axisX.setLowerBound(minX);
	axisY = new NumberAxis();
	axisY.setForceZeroInRange(false);
	axisY.setAutoRanging(false);
	axisY.setUpperBound(maxY);
	axisY.setLowerBound(minY);
	
	chart = new AreaChart<Number, Number>(axisX, axisY);
	chart.setLegendVisible(false);
	chart.setAnimated(false);
	
	chartSeries = new AreaChart.Series<Number, Number>();
	chart.setTitle(name);
	chart.getData().add(chartSeries);
	
	root = new VBox();
	root.setAlignment(Pos.CENTER);
	root.setMaxSize(WIDTH, HEIGHT);
	root.getChildren().add(chart);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:28,代码来源:AreaChartControl.java

示例3: BarChartControl

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
public BarChartControl(String name) {
	super(name, FlashboardSendableType.BARCHART);
	
	axisX = new CategoryAxis();
	axisX.setAutoRanging(true);
	axisY = new NumberAxis();
	axisY.setForceZeroInRange(false);
	axisY.setAutoRanging(false);
	axisY.setUpperBound(maxY);
	axisY.setLowerBound(minY);
	
	chart = new BarChart<String, Number>(axisX, axisY);
	chart.setLegendVisible(false);
	chart.setAnimated(false);
	
	chartSeries = new BarChart.Series<String, Number>();
	chart.setTitle(name);
	chart.getData().add(chartSeries);
	
	root = new VBox();
	root.setAlignment(Pos.CENTER);
	root.setMaxSize(WIDTH, HEIGHT);
	root.getChildren().add(chart);
	
	
	charts.put(name, this);
	List<BarChartSeriesControl> controls = unallocatedControls.get(name);
	if(unallocatedControls != null){
		unallocatedControls.remove(name);
		for (int i = 0; i < unallocatedControls.size(); i++)
			addControl(controls.get(i));
	}
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:34,代码来源:BarChartControl.java

示例4: LineChartControl

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
public LineChartControl(String name) {
	super(name, FlashboardSendableType.LINECHART);
	
	axisX = new NumberAxis();
	axisX.setForceZeroInRange(false);
	axisX.setAutoRanging(false);
	axisX.setUpperBound(maxX);
	axisX.setLowerBound(minX);
	axisY = new NumberAxis();
	axisY.setForceZeroInRange(false);
	axisY.setAutoRanging(false);
	axisY.setUpperBound(maxY);
	axisY.setLowerBound(minY);
	
	chart = new LineChart<Number, Number>(axisX, axisY);
	chart.setLegendVisible(false);
	chart.setAnimated(false);
	
	chartSeries = new LineChart.Series<Number, Number>();
	chart.setTitle(name);
	chart.getData().add(chartSeries);
	
	root = new VBox();
	root.setAlignment(Pos.CENTER);
	root.setMaxSize(WIDTH, HEIGHT);
	root.getChildren().add(chart);
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:28,代码来源:LineChartControl.java

示例5: StackedAreaChartClass

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
/**
 * the constructor is responsible for initialize the chart (lower and upper buonds, name, colors)
 * @param stackedAreaChart is the type of chart for battery performance
 */
public StackedAreaChartClass(StackedAreaChart stackedAreaChart){
    NumberAxis yaxis = (NumberAxis) stackedAreaChart.getYAxis();

    //getter and setting proprieties for y and x axes
    xAxis = (NumberAxis) stackedAreaChart.getXAxis();
    xAxis.setLowerBound(0);
    xAxis.setUpperBound(10);
    xAxis.setAutoRanging(false);
    xAxis.setTickLabelsVisible(false); //hide numbers on x axis
    stackedAreaChart.setVerticalGridLinesVisible(false);//hide vertical lines
    stackedAreaChart.animatedProperty().setValue(false);
    yaxis.setAutoRanging(false);
    yaxis.setLowerBound(0);
    yaxis.setUpperBound(100);

    //set series of content to draw chart
    series = new XYChart.Series();
    series.setName("Battery level");
    stackedAreaChart.getData().add(series);

    //setting colors of charts
    Node fill = series.getNode().lookup(".chart-series-area-fill");
    fill.setStyle("-fx-fill: #fff7ad;");
    Node line = series.getNode().lookup(".chart-series-area-line");
    line.setStyle("-fx-stroke: #8bc34a;" +
            "-fx-stroke-width: 3px;"); // set width of line
    stackedAreaChart.setStyle("CHART_COLOR_1: #8bc34a;"); //color of dots
}
 
开发者ID:andrea9293,项目名称:pcstatus,代码行数:33,代码来源:StackedAreaChartClass.java

示例6: resetResultsChartBounds

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
private void resetResultsChartBounds() {
    int min = Integer.MAX_VALUE;
    int max = Integer.MIN_VALUE;
    for (ChartSeries chartSeries : mResultsChartData) {
        ObservableList<XYChart.Data<Number, Number>> data = chartSeries.getData().getData();
        int size = data.size();
        if (size == 0) {
            continue;
        }
        int startPoint = chartSeries.getStartPoint();
        int endPoint = data.get(size - 1).getXValue().intValue();
        if (startPoint < min) {
            min = startPoint;
        }
        if (endPoint > max) {
            max = endPoint;
        }
    }
    if (min == Integer.MAX_VALUE) {
        min = 0;
    }
    if (max == Integer.MIN_VALUE) {
        max = 100;
    }
    setResultsChartBounds(min, max);
    NumberAxis xAxis = (NumberAxis) mResultsChart.getXAxis();
    xAxis.setLowerBound(min);
    xAxis.setUpperBound(max);
    updateAxisTickUnit(xAxis);
}
 
开发者ID:yuriy-budiyev,项目名称:population,代码行数:31,代码来源:PrimaryController.java

示例7: 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

示例8: 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

示例9: 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

示例10: GraphModel

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
public GraphModel() {
	xAxis = new CategoryAxis();
	xAxis.setLabel("Sätze");
	xAxis.setTickLabelRotation(70d);
	yAxis = new NumberAxis();
	yAxis.setUpperBound(100);
	yAxis.setLowerBound(0);
	yAxis.setAutoRanging(false);
	yAxis.setLabel("Prozent");
}
 
开发者ID:talpalaru,项目名称:polTool,代码行数:11,代码来源:GraphModel.java

示例11: createChart

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
public LineChart<String, Number> createChart(LabelledRadiusPane pane) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    
    chart = new LineChart<>(xAxis, yAxis);
    chart.setTitle("Tweet Trend Analysis");
    chart.setCreateSymbols(false);
    chart.setLegendVisible(false);

    xAxis.setLabel("Time of Tweet");
    yAxis.setUpperBound(1.0);
    yAxis.setLowerBound(0.0);
    yAxis.setLabel("Anomaly\n  Score");
    yAxis.setForceZeroInRange(true);
    
    series = new XYChart.Series<>();
    series.setName("Tweet Data");
    chart.getData().add(series);
    chartSeriesProperty.set(series);
    
    Node line = series.getNode().lookup(".chart-series-line");
    line.setStyle("-fx-stroke: rgb(20, 164, 220)");
    
    chart.setPrefWidth(1200);
    chart.setPrefHeight(275);
    chart.setLayoutY(pane.labelHeightProperty().get() + 10);
    
    return chart;
}
 
开发者ID:numenta,项目名称:htm.java-examples,代码行数:30,代码来源:BreakingNewsDemoView.java

示例12: draw

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
@Override
public void draw() {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setMinorTickVisible(false);
    xAxis.setTickMarkVisible(false);
    xAxis.setTickLabelsVisible(false);
    xAxis.setAutoRanging(false);
    yAxis.setMinorTickVisible(false);
    yAxis.setTickMarkVisible(false);
    yAxis.setLabel("ms");

    XYChart.Series<Number, Number> youngSeries = new XYChart.Series<>();
    XYChart.Series<Number, Number> concurrentSeries = new XYChart.Series<>();
    XYChart.Series<Number, Number> fullSeries = new XYChart.Series<>();
    ScatterChart<Number, Number> chart = new ScatterChart<Number, Number>(xAxis, yAxis, FXCollections.observableArrayList(youngSeries, concurrentSeries, fullSeries));
    chart.setAnimated(false);
    chart.setLegendVisible(false);
    Stage stage = super.createStage(chart, "Pause time");


    for(LogData log : super.logdata){
        String phase;
        double time;

        if(!super.shouldProcess(log) || (log.getTags().size() != 1)){
            continue;
        }

        long gcid = super.getGcId();
        Matcher matcher = PAUSE_TIME_PATTERN.matcher(super.getLogBody());
        if(!matcher.matches()){
            continue;
        }

        phase = matcher.group(1);
        time = Double.parseDouble(matcher.group(2));
        LogTimeValue logTimeValue = LogTimeValue.getLogTimeValue(log, super.chartWizardController.getTimeRange());

        XYChart.Data<Number, Number> data = new XYChart.Data<>(logTimeValue.getValue(), time);
        if(phase.startsWith("Full")){
            fullSeries.getData().add(data);
            data.getNode().setStyle("-fx-background-color: black;");
        }
        else if(phase.startsWith("Young")) {
            youngSeries.getData().add(data);
            data.getNode().setStyle("-fx-background-color: skyblue;");
        }
        else{
            concurrentSeries.getData().add(data);
            data.getNode().setStyle("-fx-background-color: orange;");
        }

        data.getNode().addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> setTooltipValue(logTimeValue.toString(), phase, gcid));
        data.getNode().addEventHandler(MouseEvent.MOUSE_CLICKED, e -> super.showLogWindow(super.gcEventList.get(gcid), "GC ID: " + gcid));
        Tooltip.install(data.getNode(), tooltip);
    }
    
    if(youngSeries.getData().isEmpty() && concurrentSeries.getData().isEmpty() && fullSeries.getData().isEmpty()){
        (new Alert(Alert.AlertType.ERROR, "No GC data", ButtonType.OK)).showAndWait();
        return;
    }

    DoubleSummaryStatistics stats = Stream.concat(youngSeries.getData().stream(), Stream.concat(concurrentSeries.getData().stream(), fullSeries.getData().stream()))
                                          .mapToDouble(d -> d.getXValue().doubleValue())
                                          .summaryStatistics();

    xAxis.setLowerBound(stats.getMin());
    xAxis.setUpperBound(stats.getMax());

    stage.show();
}
 
开发者ID:YaSuenag,项目名称:ulviewer,代码行数:73,代码来源:PauseTimeChartViewer.java

示例13: draw

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
@Override
public void draw() {
    collectVmOpInfo();

    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setMinorTickVisible(false);
    xAxis.setTickMarkVisible(false);
    xAxis.setTickLabelsVisible(false);
    xAxis.setAutoRanging(false);
    yAxis.setMinorTickVisible(false);
    yAxis.setTickMarkVisible(false);

    XYChart.Series<Number, Number> series = new XYChart.Series<>();
    ScatterChart<Number, Number> chart = new ScatterChart<Number, Number>(xAxis, yAxis, FXCollections.observableArrayList(series));
    chart.setAnimated(false);
    chart.setLegendVisible(false);
    Stage stage = super.createStage(chart, "VM Operations");

    for(Map.Entry<LogTimeValue, List<LogData>> entry : vmOpMap.entrySet()){
        double elapsedTime = LogTimeValue.getLogTimeValue(entry.getValue().get(entry.getValue().size() - 1), super.chartWizardController.getTimeRange()).getValue().doubleValue() - entry.getKey().getValue().doubleValue();
        XYChart.Data<Number, Number> data = new XYChart.Data<>(entry.getKey().getValue(), elapsedTime);
        series.getData().add(data);

        Matcher matcher = VMOP_START_PATTERN.matcher(entry.getValue().get(0).getMessage());
        matcher.matches();
        String opName = matcher.group(2);

        data.getNode().addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> setTooltipText(entry.getKey().toString(), opName, elapsedTime));
        data.getNode().addEventHandler(MouseEvent.MOUSE_CLICKED, e -> super.showLogWindow(entry.getValue(), entry.getKey().toString() + ": " + opName));

        Tooltip.install(data.getNode(), tooltip);
    }

    if(series.getData().isEmpty()){
        (new Alert(Alert.AlertType.ERROR, "No VM Operation data", ButtonType.OK)).showAndWait();
        return;
    }

    DoubleSummaryStatistics stats = series.getData()
                                          .stream()
                                          .mapToDouble(d -> d.getXValue().doubleValue())
                                          .summaryStatistics();

    xAxis.setLowerBound(stats.getMin());
    xAxis.setUpperBound(stats.getMax());

    stage.show();
}
 
开发者ID:YaSuenag,项目名称:ulviewer,代码行数:50,代码来源:VMOperationChartViewer.java

示例14: draw

import javafx.scene.chart.NumberAxis; //导入方法依赖的package包/类
@Override
public void draw() {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setMinorTickVisible(false);
    xAxis.setTickMarkVisible(false);
    xAxis.setTickLabelsVisible(false);
    xAxis.setAutoRanging(false);
    yAxis.setMinorTickVisible(false);
    yAxis.setTickMarkVisible(false);
    yAxis.setLabel("MB");

    XYChart.Series<Number, Long> capacitySeries = new XYChart.Series<>();
    XYChart.Series<Number, Long> usageSeries = new XYChart.Series<>();
    AreaChart<Number, Long> chart = new AreaChart(xAxis, yAxis, FXCollections.observableArrayList(capacitySeries, usageSeries));
    chart.setAnimated(false);
    chart.setLegendVisible(false);
    chart.lookup(".series0").setStyle("-fx-fill: red; -fx-stroke: red;"); // capacity
    chart.lookup(".series1").setStyle("-fx-fill: blue; -fx-stroke: blue;"); // usage

    Stage stage = super.createStage(chart, "Metaspace usage");

    for(LogData log : super.logdata){
        long capacity;
        long usage;

        if(!super.shouldProcess(log) || (log.getTags().size() != 2) || !log.getTags().contains("metaspace")){
            continue;
        }

        long gcid = super.getGcId();
        Matcher matcher = METASPACE_USAGE_PATTERN.matcher(super.getLogBody());
        if(!matcher.matches()){
            continue;
        }

        usage = Long.parseLong(matcher.group(1)) / 1024; // in MB
        capacity = Long.parseLong(matcher.group(2)) / 1024; // in MB
        LogTimeValue logTimeValue = LogTimeValue.getLogTimeValue(log, super.chartWizardController.getTimeRange());

        XYChart.Data<Number, Long> capacityData = new XYChart.Data<>(logTimeValue.getValue(), capacity);
        XYChart.Data<Number, Long> usageData = new XYChart.Data<>(logTimeValue.getValue(), usage);
        capacitySeries.getData().add(capacityData);
        usageSeries.getData().add(usageData);

        Node capacityDataNode = capacityData.getNode();
        Node usageDataNode = usageData.getNode();
        capacityDataNode.lookup(".chart-area-symbol").setStyle(BASE_SYMBOL_STYLE + "-fx-background-color: white, red;");
        usageDataNode.lookup(".chart-area-symbol").setStyle(BASE_SYMBOL_STYLE + "-fx-background-color: white, blue;");
        capacityDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> capacityDataNode.setOpacity(1.0d));
        capacityDataNode.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, e -> capacityDataNode.setOpacity(0.0d));
        usageDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> usageDataNode.setOpacity(1.0d));
        usageDataNode.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, e -> usageDataNode.setOpacity(0.0d));
        capacityDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> setTooltipValue(logTimeValue.toString(), capacity, usage, gcid));
        usageDataNode.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> setTooltipValue(logTimeValue.toString(), capacity, usage, gcid));
        capacityDataNode.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> super.showLogWindow(super.gcEventList.get(gcid), "GC ID: " + gcid));
        usageDataNode.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> super.showLogWindow(super.gcEventList.get(gcid), "GC ID: " + gcid));

        Tooltip.install(capacityData.getNode(), tooltip);
        Tooltip.install(usageData.getNode(), tooltip);
    }
    
    if(capacitySeries.getData().size() == 0){
        (new Alert(Alert.AlertType.ERROR, "No GC data", ButtonType.OK)).showAndWait();
        return;
    }

    xAxis.setLowerBound(capacitySeries.getData().get(0).getXValue().doubleValue());
    xAxis.setUpperBound(capacitySeries.getData().get(capacitySeries.getData().size() - 1).getXValue().doubleValue());

    stage.show();
}
 
开发者ID:YaSuenag,项目名称:ulviewer,代码行数:73,代码来源:MetaspaceChartViewer.java

示例15: 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


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