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


Java Series类代码示例

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


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

示例1: getExpenseData

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
public static Series<String, Number> getExpenseData(String monthName) {
	
	XYChart.Series<String, Number> sector = new XYChart.Series<>();
	String allSector[] = new ComboboxList().getSectorList();
	
	//chart data for all other Sectors
	for (String sectorName : allSector) {
		String sectorShortName = getAbbreviateName(sectorName);
		double amount = longToDouble(new Sector().getAmountBySectorFromExpense(monthName, sectorName));
		sector.getData().add(new XYChart.Data<>(sectorShortName, amount));
	}			
	
	//chart data for "Adjusted Balance" Sector
	String srtName = getAbbreviateName("Adjusted Balance");
	double amnt = longToDouble(new Sector().getAmountBySectorFromExpense(monthName, "Adjusted Balance"));
	sector.getData().add(new XYChart.Data<>(srtName, amnt));
			
	return sector;
}
 
开发者ID:krHasan,项目名称:Money-Manager,代码行数:20,代码来源:ExpenseChart.java

示例2: createChart

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
protected LineChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
    // setup chart
    lc.setTitle("Basic LineChart");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Data Series 1");
    series.getData().add(new XYChart.Data<Number,Number>(20d, 50d));
    series.getData().add(new XYChart.Data<Number,Number>(40d, 80d));
    series.getData().add(new XYChart.Data<Number,Number>(50d, 90d));
    series.getData().add(new XYChart.Data<Number,Number>(70d, 30d));
    series.getData().add(new XYChart.Data<Number,Number>(170d, 122d));
    lc.getData().add(series);
    return lc;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:AdvancedLineChartSample.java

示例3: createChart

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
protected BubbleChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final BubbleChart<Number,Number> bc = new BubbleChart<Number,Number>(xAxis,yAxis);
    // setup chart
    bc.setTitle("Advanced BubbleChart");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<Number,Number> series1 = new XYChart.Series<Number,Number>();
    series1.setName("Data Series 1");
    for (int i=0; i<20; i++) series1.getData().add(
            new XYChart.Data<Number,Number>(Math.random()*100, Math.random()*100, (Math.random()*10)));
    XYChart.Series<Number,Number> series2 = new XYChart.Series<Number,Number>();
    series2.setName("Data Series 2");
    for (int i=0; i<20; i++) series2.getData().add(
            new XYChart.Data<Number,Number>(Math.random()*100, Math.random()*100, (Math.random()*10)));
    bc.getData().addAll(series1, series2);
    return bc;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:AdvancedBubbleChartSample.java

示例4: createChart

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
protected AreaChart<Number, Number> createChart() {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setTitle("Area Chart Example");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<3;s++) {
        XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
        series.setName("Data Series "+s);
        double x = 0;
        while (x<95) {
            series.getData().add(new XYChart.Data<Number,Number>(x, Math.random()*99));
            x += 5 + (15*Math.random());
        }
        series.getData().add(new XYChart.Data<Number,Number>(99d, Math.random()*99));
        ac.getData().add(series);
    }
    return ac;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:AdvancedAreaChartSample.java

示例5: MonitorPaneTemplate

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
public MonitorPaneTemplate()
{
    super();
    super.getStyleClass().add("pane");
    
    x = new NumberAxis();
    x.setAutoRanging(false);
    
    y = new NumberAxis();
    y.setAutoRanging(false);
    
    chart = new LineChart<>(x, y);
    chart.setCreateSymbols(false);
    chart.legendVisibleProperty().setValue(false);
    chart.setPrefHeight(250);
    chart.setPrefWidth(750);
    
    data = new Series<>();
    
    chart.getData().add(data);
    
    super.getChildren().add(chart);
}
 
开发者ID:BlueGoliath,项目名称:Goliath-Overclocking-Utility-FX,代码行数:24,代码来源:MonitorPaneTemplate.java

示例6: swapClusteredChartSeriesColors

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

示例7: buildClusteredSeries

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
private List<Series<Number, Number>> buildClusteredSeries() throws Exception {
	List<XYChart.Series<Number, Number>> clusteredSeries = new ArrayList<>();

	// to build the cluster we remove the class information
	Remove remove = new Remove();
	remove.setAttributeIndices("3");
	remove.setInputFormat(data);
	Instances dataToBeClustered = Filter.useFilter(data, remove);

	SimpleKMeans kmeans = new SimpleKMeans();
	kmeans.setSeed(10);
	kmeans.setPreserveInstancesOrder(true);
	kmeans.setNumClusters(3);
	kmeans.buildClusterer(dataToBeClustered);

	IntStream.range(0, 3).mapToObj(i -> {
		Series<Number, Number> newSeries = new XYChart.Series<>();
		newSeries.setName(String.valueOf(i));
		return newSeries;
	}).forEach(clusteredSeries::add);

	int[] assignments = kmeans.getAssignments();
	for (int i = 0; i < assignments.length; i++) {
		int clusterNum = assignments[i];
		clusteredSeries.get(clusterNum).getData().add(instancetoChartData(data.get(i)));
	}

	return clusteredSeries;
}
 
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:30,代码来源:Clustering.java

示例8: createLineChart

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
/**
 * get the LineChart for this history
 * @return - the line chart
 */
@SuppressWarnings("rawtypes")
public LineChart<Number, Number> createLineChart() {
  //defining the axes
  final NumberAxis xAxis = new NumberAxis();
  final NumberAxis yAxis = new NumberAxis();
  xAxis.setLabel(xTitle);
  //creating the chart
  lineChart = 
          new LineChart<Number,Number>(xAxis,yAxis);
          
  lineChart.setTitle(title);
  for (CANProperty canProperty : this.canProperties.values()) {
    Series<Number, Number> series = this.createSeries(canProperty);
    seriesMap.put(canProperty.getName(), series);
    updateSeries(series,canProperty);
    lineChart.getData().add(series);
  }
  return lineChart;
}
 
开发者ID:BITPlan,项目名称:can4eve,代码行数:24,代码来源:JFXCanValueHistoryPlot.java

示例9: initialize

import javafx.scene.chart.XYChart.Series; //导入依赖的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: onChanged

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
@Override
public void onChanged(javafx.collections.ListChangeListener.Change<? extends T> c) {
	if (c.next()) {

		if (c.wasAdded()) {
			int start = (int) slider.getValue();
			int end = (int) (start + displaySize.get());
			Series<String, Number> chartSeries = new Series<>();
			chartSeries.getData().addAll(items.subList(start, end).stream().map(v -> converter.apply(v)).collect(Collectors.toList()));
			chart.getData().add(chartSeries);
		}

		else if (c.wasRemoved()) {

		}
		this.slider.setMax(items.size());
	}

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

示例11: getChartData

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

示例12: drawNode

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
@Override
public Node drawNode() {
    final XYChart chart = (XYChart)createObject();
    Platform.runLater(new Runnable() {
        public void run() {
            int counter = 0;
            chart.setAnimated(true);
            for (Series series : data) {
                if (add) {
                    if (counter > chart.getData().size()) {
                        chart.getData().add(series);
                    } else {
                        chart.getData().add(counter, series);
                    }
                    counter+= 2;
                } else {
                    if (counter++ < chart.getData().size()) {
                        chart.getData().set(counter, series);
                    }
                }
            }
        }
    });
    return chart;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:26,代码来源:XYChartBaseApp.java

示例13: getRemoveDataFromSerieDialog

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
public HBox getRemoveDataFromSerieDialog() {
    HBox hb = new HBox();
    Label lb1 = new Label("From serie");
    final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).build();

    Label lb2 = new Label("from index");
    final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).build();

    Button bt = ButtonBuilder.create().text("remove point!").id(REMOVE_BUTTON_ID).build();
    bt.setOnAction(new EventHandler() {
        public void handle(Event t) {
            int serie = Integer.parseInt(tf1.getText());
            int index = Integer.parseInt(tf2.getText());
            ((Series) testedScatterChart.getData().get(serie)).getData().remove(index);
        }
    });
    hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt);
    return hb;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:20,代码来源:NewNumberScatterChartApp.java

示例14: getRemovePointFromDataDialog

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
public HBox getRemovePointFromDataDialog() {
    HBox hb = new HBox();

    Label lb1 = new Label("From area");
    final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_AREA_POS_TEXT_FIELD_ID).build();

    Label lb2 = new Label("From index");
    final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).id(REMOVE_INDEX_TEXT_FIELD_ID).build();

    Button bt = ButtonBuilder.create().text("remove point!").id(REMOVE_BUTTON_ID).build();
    bt.setOnAction(new EventHandler() {
        public void handle(Event t) {
            int area = Integer.parseInt(tf1.getText());
            int point = Integer.parseInt(tf2.getText());
            ((Series) testedAreaChart.getData().get(area)).getData().remove(point);
        }
    });
    hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt);
    return hb;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:21,代码来源:NewAreaChartApp.java

示例15: getRemoveDataFromSerieDialog

import javafx.scene.chart.XYChart.Series; //导入依赖的package包/类
public HBox getRemoveDataFromSerieDialog() {
    HBox hb = new HBox();
    Label lb1 = new Label("From serie");
    final TextField tf1 = TextFieldBuilder.create().text("0").prefWidth(50).build();

    Label lb2 = new Label("from index");
    final TextField tf2 = TextFieldBuilder.create().text("0").prefWidth(50).build();

    Button bt = ButtonBuilder.create().text("remove bubble!").id(REMOVE_BUTTON_ID).build();
    bt.setOnAction(new EventHandler() {
        public void handle(Event t) {
            int serie = Integer.parseInt(tf1.getText());
            int index = Integer.parseInt(tf2.getText());
            ((Series) testedBubbleChart.getData().get(serie)).getData().remove(index);
        }
    });
    hb.getChildren().addAll(lb1, tf1, lb2, tf2, bt);
    return hb;
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:20,代码来源:NewBubbleChartApp.java


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