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


Java AreaChart.setAnimated方法代码示例

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


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

示例1: createChart

import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
protected AreaChart<Number,Number> createChart() {
    final NumberAxis xAxis = new NumberAxis(0,128,8);
    final NumberAxis yAxis = new NumberAxis(0,50,10);
    final AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setId("audioAreaDemo");
    ac.setLegendVisible(false);
    ac.setTitle("Live Audio Spectrum Data");
    ac.setAnimated(false);
    xAxis.setLabel("Frequency Bands");
    yAxis.setLabel("Magnitudes");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Audio Spectrum");
    //noinspection unchecked
    series1Data = new XYChart.Data[(int)xAxis.getUpperBound()];
    for (int i=0; i<series1Data.length; i++) {
        series1Data[i] = new XYChart.Data<Number,Number>(i,50);
        series.getData().add(series1Data[i]);
    }
    ac.getData().add(series);
    return ac;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ChartAudioArea.java

示例2: draw

import javafx.scene.chart.AreaChart; //导入方法依赖的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

示例3: setHistogram

import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
void setHistogram(final PathTableData<?> model, final String columnName) {
	if (model != null && model.getMeasurementNames().contains(columnName)) {
		double[] values = model.getDoubleValues(columnName);
		int nBins = params.getIntParameterValue("nBins");
		if (nBins < 2)
			nBins = 2;
		else if (nBins > 1000)
			nBins = 1000;

		// We can have values in the 'wrong' order to facilitate comparison...
		Arrays.sort(values);

		// Check if we've actually changed anything - if not, then abort
		if (nBins == currentBins && currentValues != null && Arrays.equals(currentValues, values))
			return;

		Histogram histogram = new Histogram(values, nBins);
		histogram.setNormalizeCounts(params.getBooleanParameterValue("normalizeCounts"));

		panelHistogram.getHistogramData().setAll(HistogramPanelFX.createHistogramData(histogram, false, (Integer)null));


		AreaChart<Number, Number> chart = panelHistogram.getChart();
		chart.setVerticalGridLinesVisible(true);
		chart.setHorizontalGridLinesVisible(true);
		chart.setLegendVisible(false);
		chart.setCreateSymbols(false); // Can't stop them being orange...
		chart.getXAxis().setLabel("Values");
		chart.getYAxis().setLabel("Counts");
		chart.getYAxis().setTickLabelsVisible(true);
		chart.getYAxis().setTickMarkVisible(true);
		chart.getXAxis().setTickLabelsVisible(true);
		chart.getXAxis().setTickMarkVisible(true);
		
		chart.setAnimated(params.getBooleanParameterValue("animate"));

		updateTable(histogram);

		currentColumn = columnName;
		currentBins = nBins;
		currentValues = values;
		this.model = model;
	} else
		panelHistogram.getHistogramData().clear();
}
 
开发者ID:qupath,项目名称:qupath,代码行数:46,代码来源:HistogramDisplay.java

示例4: createChart

import javafx.scene.chart.AreaChart; //导入方法依赖的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

示例5: initialize

import javafx.scene.chart.AreaChart; //导入方法依赖的package包/类
private void initialize(Stage primaryStage) 
{
    logger = Logger.getLogger(getClass().getName());
    
    xAxis = new NumberAxis(0,MAX_DATA_POINTS,MAX_DATA_POINTS/10);
    xAxis.setForceZeroInRange(false);
    xAxis.setAutoRanging(false);
    
    NumberAxis yAxis = new NumberAxis();
    yAxis.setAutoRanging(true);

    // Chart
    final AreaChart<Number, Number> sc = new AreaChart<Number, Number>(xAxis, yAxis) 
    {
        @Override 
        protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) 
        {
            ; // This method is overriden with empty statement, to remove symbols on each data point.
        }
    };
    sc.setAnimated(false);
    sc.setId("liveAreaChart");
    sc.setTitle("Lizard Enclosure Sensor Readings");

    // internal temperature Series
    internalTemperatureSeries = new AreaChart.Series<Number, Number>();
    internalTemperatureSeries.setName("Internal Temperature");
    sc.getData().add(internalTemperatureSeries);        
    
    externalTemperatureSeries = new AreaChart.Series<Number, Number>();
    externalTemperatureSeries.setName("External Temperature");
    sc.getData().add(externalTemperatureSeries);
    
    internalHumiditySeries = new AreaChart.Series<Number, Number>();
    internalHumiditySeries.setName("Internal Humidity");
    sc.getData().add(internalHumiditySeries);

    primaryStage.setScene(new Scene(sc));
    
    primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() 
    {
        @Override
        public void handle(WindowEvent t) 
        {
            Platform.exit();
            System.exit(0);
        }
    });
}
 
开发者ID:onebeartoe,项目名称:lizard-enclosure,代码行数:50,代码来源:SensorReadingsVisualizer.java


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