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


Java Data类代码示例

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


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

示例1: addDataItemStrNum

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
public static void addDataItemStrNum(final XYChart<String, Number> chart) {
    if (chart.getData() == null) {
        chart.setData(FXCollections.<XYChart.Series<String, Number>>observableArrayList());
    }
    if (chart.getData().isEmpty()) {
        chart.getData().add(new XYChart.Series<String, Number>());
    }
    
    int sIndex = (int) (Math.random() * chart.getData().size());
    XYChart.Series<String, Number> series = chart.getData().get(sIndex);
    
    Set<String> existingYears = new HashSet<String>();
    for (Data<String, Number> data : series.getData()) {
        existingYears.add(data.getXValue());
    }
    
    int randomYear = 1900 + (int) (Math.round(12 * Math.random()) * 10);
    while (existingYears.contains(Integer.toString(randomYear))) {
        randomYear++;
    }
    series.getData().add(new XYChart.Data<String, Number>(Integer.toString(randomYear), 10 + (Math.random() * 3800)));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:ChartActions.java

示例2: addDataItemNumStr

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
public static void addDataItemNumStr(final XYChart<Number, String> chart) {
    if (chart.getData() == null) {
        chart.setData(FXCollections.<XYChart.Series<Number, String>>observableArrayList());
    }
    if (chart.getData().isEmpty()) {
        chart.getData().add(new XYChart.Series<Number, String>());
    }
    
    int sIndex = (int) (Math.random() * chart.getData().size());
    XYChart.Series<Number, String> series = chart.getData().get(sIndex);
    
    Set<String> existingYears = new HashSet<String>();
    for (Data<Number, String> data : series.getData()) {
        existingYears.add(data.getYValue());
    }
    
    int randomYear = 1900 + (int) (Math.round(12 * Math.random()) * 10);
    while (existingYears.contains(Integer.toString(randomYear))) {
        randomYear++;
    }
    series.getData().add(new XYChart.Data<Number, String>(10 + (Math.random() * 3800), Integer.toString(randomYear)));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:ChartActions.java

示例3: swapClusteredChartSeriesColors

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
private void swapClusteredChartSeriesColors() {
	List<Series<Number, Number>> clusteredSeries = new ArrayList<>();
	// we have to copy the original data to swap the series
	clusteredChart.getData().forEach(serie -> {
		Series<Number, Number> series = new Series<>();
		series.setName(serie.getName());
		serie.getData().stream().map(d -> new Data<Number, Number>(d.getXValue(), d.getYValue()))
				.forEach(series.getData()::add);
		clusteredSeries.add(series);
	});
	int i = swapColorsCombinations[swapIndex][0];
	int j = swapColorsCombinations[swapIndex][1];
	Collections.swap(clusteredSeries, i, j);
	clusteredChart.getData().clear();
	clusteredChart.getData().addAll(clusteredSeries);
	swapIndex = swapIndex == NUMBER_OF_CLASSES - 1 ? 0 : swapIndex + 1;
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:18,代码来源:Clustering.java

示例4: newData

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
@Override
public void newData(byte[] data) {
	if(data[0] == FlashboardXYChart.VALUE_UPDATE){
		synchronized (dataCollection) {
			double x = FlashUtil.toDouble(data, 1);
			double y = FlashUtil.toDouble(data, 9);
			
			dataCollection.add(new Data<Number, Number>(x, y));
		}
	}
	if(data[0] == FlashboardXYChart.CONFIG_UPDATE){
		synchronized (configMutex) {
			minX = FlashUtil.toDouble(data, 1);
			maxX = FlashUtil.toDouble(data, 9);
			minY = FlashUtil.toDouble(data, 17);
			maxY = FlashUtil.toDouble(data, 25);
			configUpdate = true;
		}
	}
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:21,代码来源:AreaChartControl.java

示例5: update

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
@Override
protected void update() {
	synchronized (configMutex) {
		if(configUpdate){
			configUpdate = false;
			
			axisY.setUpperBound(maxY);
			axisY.setLowerBound(minY);
		}
	}
	
	Enumeration<BarChartSeriesControl> controlEnum = controls.elements();
	while(controlEnum.hasMoreElements()){
		BarChartSeriesControl control = controlEnum.nextElement();
		
		if(control.hasData()){
			double dataY = Mathf.roundDecimal(control.getData());
			Data<String, Number> data = new Data<String, Number>(control.getName(), dataY);
			
			//chart.setTitle(getName()+": "+dataY);
			chartSeries.getData().add(data);
			((StackPane)data.getNode()).getChildren().add(new Label(String.valueOf(dataY)));
		}
	}
}
 
开发者ID:Flash3388,项目名称:FlashLib,代码行数:26,代码来源:BarChartControl.java

示例6: deepCopySeriesData

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
static <X, Y> ObservableList<XYChart.Data<X, Y>> deepCopySeriesData(
        final Collection<? extends XYChart.Data<X, Y>> data) {
    final ObservableList<XYChart.Data<X, Y>> result = FXCollections.observableArrayList();
    for (final Data<X, Y> i : data) {
        result.add(new Data<>(i.getXValue(), i.getYValue()));
    }
    return result;
}
 
开发者ID:gransort,项目名称:Java-oscilloscope-project,代码行数:9,代码来源:ZoomManager.java

示例7: deepCopySeriesData

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
static <X, Y> ObservableList<XYChart.Data<X, Y>> deepCopySeriesData(
		final Collection<? extends XYChart.Data<X, Y>> data) {
	final ObservableList<XYChart.Data<X, Y>> result = FXCollections.observableArrayList();
	for (final Data<X, Y> i : data) {
		result.add(new Data<>(i.getXValue(), i.getYValue()));
	}
	return result;
}
 
开发者ID:kerner1000,项目名称:javafx-chart-zooming,代码行数:9,代码来源:ZoomManager.java

示例8: getValue

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
@Override
public Data<String, Number> getValue(int columnIndex, String columnName, int row) {
	Map<String, List<Map<String, String>>> map = this.rows.get().get(row);
	List<Map<String, String>> list = map.get("c");
	Map<String, String> dateInfo = list.get(0);

	Map<String, String> query = list.get(columnIndex + 1);
	if (query == null)
		return null;

	String colName = dateInfo.get("f");
	String value = query.get("f");
	if (colName == null || value == null)
		return null;
	Integer valueOf = Integer.valueOf(value, 10);
	return new Data<>(colName, valueOf);
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:18,代码来源:BaseGoogleTrendAdapter.java

示例9: initialize

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
@FXML
public void initialize() {
	items.addListener(this);
	//		chart.getData().add(chartSeries);

	slider.setMin(0D);
	slider.setMax(displaySize.get());
	this.displaySize.bind(slider.maxProperty());

	slider.valueProperty().addListener((oba, oldval, newval) -> {

		int start = newval.intValue();
		int end = (int) (start + displaySize.get());
		if (end > items.size())
			end = items.size();
		ObservableList<Data<String, Number>> subList = items.stream().skip(start).limit(5).map(v -> converter.apply(v))
				.collect(FxCollectors.toObservableList());
		Series<String, Number> chartSeries = new Series<>("", subList);
		chart.getData().remove(0);
		chart.getData().add(chartSeries);

	});
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:SliderLineChartComposite.java

示例10: setDataNode

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
private void setDataNode(SVNLogEntry entry, Data<String, String> data) {

		Group group = new Group();
		group.setManaged(false);
		Text value = new Text(entry.getRevision() + "");
		value.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
		value.translateYProperty().set(-15);
		Circle circle = new Circle(4, Color.WHITE);
		circle.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
		circle.setStroke(Color.web("#f3622d"));
		StackPane stackPane = new StackPane(value, circle);
		stackPane.setPrefSize(30, 60);
		group.getChildren().add(stackPane);
		data.setNode(group);

	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:17,代码来源:SVNViewer.java

示例11: seriesLegendLabelCustomAction

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
@Override
	public void seriesLegendLabelCustomAction(Data t, Node u) {

//		u.setOnMouseEntered(ev -> {
//			u.setCursor(Cursor.HAND);
//		});
//
//		u.setOnMouseExited(ev -> {
//			u.setCursor(Cursor.DEFAULT);
//		});
//
//		u.setOnMouseClicked(ev -> {
//
//			ListView<RuleViolation> lvViolation = this.checkedListComposite.getLvViolation();
//			ObservableList<RuleViolation> items = lvViolation.getItems();
//			ObservableList<RuleViolation> violationList = this.checkedListComposite.getViolationList();
//			List<RuleViolation> collect = violationList.stream().filter(ruleViolationFilter())
//					.filter(v -> ValueUtil.equals(t.getName(), ValueUtil.getSimpleFileName(v.getFilename()))).collect(Collectors.toList());
//			items.setAll(collect);
//
//		});

	}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:24,代码来源:PMDViolationFilebyLineChartComposite.java

示例12: getChartData

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
public static ObservableList<XYChart.Series<String, Number>> getChartData()
{
	Debugger.out("Diagramm getChartData says : Hello ! ");
		if (Data != null || Data.get(0).equals(null))
		{
			resetData();
		} else
		{
			Logger.out("ObservableList Data in Diagramm is already empty");
		}

		getKarteien();
		getPunkte();

		for (int i = 0; i < Stacks.size(); i++)
		{
			Series<String, Number> thisSerie = new Series<String, Number>();
			thisSerie.setName(Stacks.get(i));
			Number forChart = (Number) Punkte.get(i);
			thisSerie.getData().add(new Data<String, Number>(Stacks.get(i), forChart));
			Data.add(thisSerie);
		}
	return Data;
}
 
开发者ID:RookStudios,项目名称:Lernkartei,代码行数:25,代码来源:Diagramm.java

示例13: plotProjections

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
private static void plotProjections(ScatterChart<Number, Number> chart,
		AnchorPane overlay, List<Label> labels, List<Data<Number,Number>> data,
		Projection[] projections, String name, double[][][] points) {
	final Series<Number, Number> series = new Series<Number, Number>();
	series.setName(name);
	
	for (Projection projection: projections) {
		System.out.print(projection+": ");
		final double[] params = projection.getDefaultParameters();
		final double distortion[] = projection.avgDistortion(points, params);
		final Data<Number, Number> datum = new Data<Number, Number>(
				distortion[0]/DECIBEL, distortion[1]/DECIBEL);
		series.getData().add(datum);
		final Label lbl = new Label(projection.getName());
		overlay.getChildren().add(lbl);
		labels.add(lbl);
		data.add(datum);
		System.out.println(distortion[0]+", "+distortion[1]);
	}
	
	chart.getData().add(series);
}
 
开发者ID:jkunimune15,项目名称:Map-Projections,代码行数:23,代码来源:MapPlotter.java

示例14: drawLabelsAndSave

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
private void drawLabelsAndSave(ScatterChart<Number,Number> chart,
		List<Label> labels, List<Data<Number,Number>> data) {
	for (int i = 0; i < labels.size(); i ++) {
		AnchorPane.setLeftAnchor(labels.get(i),
				chart.getXAxis().localToParent(chart.getXAxis().getDisplayPosition(data.get(i).getXValue()), 0).getX() + chart.getPadding().getLeft() + 3);
		AnchorPane.setTopAnchor(labels.get(i),
				chart.getYAxis().localToParent(0, chart.getYAxis().getDisplayPosition(data.get(i).getYValue())).getY() + chart.getPadding().getTop() - labels.get(i).getHeight()
				);
	}
	Platform.runLater(() -> {
			try {
				ImageIO.write(
						SwingFXUtils.fromFXImage(stack.snapshot(null, null), null),
						"png", new File("output/graph - plotter.png"));
			} catch (IOException e) {
				e.printStackTrace();
			}
		});
}
 
开发者ID:jkunimune15,项目名称:Map-Projections,代码行数:20,代码来源:MapPlotter.java

示例15: updateExpectedPulse

import javafx.scene.chart.XYChart.Data; //导入依赖的package包/类
public void updateExpectedPulse(){
	
	chart.getData().remove(expectedPulseSeries);
	if(showExpectedIncidentPulseCheckBox.isSelected() && getActivatedData() instanceof IncidentPulse && strikerBar.isValid() && barSetup != null){
		IncidentPulse pulse = (IncidentPulse)getActivatedData();
		expectedPulseSeries = new XYChart.Series<Number, Number>();
		expectedPulseSeries.setName("Expected Incident Pulse");
		ArrayList<Data<Number, Number>> expectedPulseDataPoints = new ArrayList<Data<Number, Number>>();
       	int begin = getChartBeginIndex();
       	int end = getChartEndIndex();
       	int totalDataPoints = end - begin;
       	double[] xData = getActivatedData().Data.timeData;
       	xData = Arrays.stream(xData).map(x -> x * timeUnits.getMultiplier()).toArray();
		for (int i = begin; i <= end; i++) {
			int sign = isCompressionSample ? -1 : 1;
			if (i >= getActivatedData().getBegin() && i <= getActivatedData().getEnd()) {
				expectedPulseDataPoints
						.add(new Data<Number, Number>(xData[i], sign * barSetup.IncidentBar.getExpectedPulse(strikerBar,pulse.strainGauge)) );
			}
			i += totalDataPoints / dataPointsToShow;
		}
       	expectedPulseSeries.getData().addAll(expectedPulseDataPoints);
       	chart.getData().add(expectedPulseSeries);
	}
}
 
开发者ID:relinc,项目名称:SurePulseDataProcessor,代码行数:26,代码来源:TrimDataController.java


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