javafx.scene.chart.AreaChart Java Examples
The following examples show how to use
javafx.scene.chart.AreaChart.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OverviewPanel.java From constellation with Apache License 2.0 | 6 votes |
private AreaChart<Number, Number> createHistogram() { // Create the axes: xAxis = new NumberAxis(); yAxis = new NumberAxis(); yAxis.setAutoRanging(true); xAxis.setAutoRanging(false); xAxis.setAnimated(false); yAxis.setAnimated(false); // Create the histogram: final AreaChart<Number, Number> chart = new AreaChart<>(xAxis, yAxis); chart.setPadding(new Insets(0.0, 0.0, 20.0, 0.0)); chart.setAnimated(true); // Hide non-relevant chart elements: chart.setLegendVisible(false); chart.setHorizontalGridLinesVisible(false); chart.setVerticalGridLinesVisible(false); // Set the min height so that elements can be sized to whatever level necessary: chart.setMinHeight(0d); // Return the newly created histogram: return chart; }
Example #2
Source File: AdvancedAreaChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: AdvAreaAudioChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
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; }
Example #4
Source File: AdvancedAreaChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
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; }
Example #5
Source File: AdvAreaAudioChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
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; }
Example #6
Source File: ChartAdvancedArea.java From netbeans with Apache License 2.0 | 6 votes |
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; }
Example #7
Source File: ChartAudioArea.java From netbeans with Apache License 2.0 | 6 votes |
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; }
Example #8
Source File: SupplyView.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
private Node createBSQIssuedChart(XYChart.Series<Number, Number> series) { NumberAxis xAxis = new NumberAxis(); configureAxis(xAxis); xAxis.setTickLabelFormatter(getTimestampTickLabelFormatter("MMM uu")); NumberAxis yAxis = new NumberAxis(); configureYAxis(yAxis); yAxis.setTickLabelFormatter(BSQPriceTickLabelFormatter); AreaChart<Number, Number> chart = new AreaChart<>(xAxis, yAxis); configureChart(chart); chart.setCreateSymbols(false); chart.getData().add(series); return chart; }
Example #9
Source File: AreaChartSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public AreaChartSample() { NumberAxis xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d); xAxis.setTickLength(12.0f); NumberAxis yAxis = new NumberAxis("Y Values", 0.0d, 10.0d, 2.0d); ObservableList<AreaChart.Series> areaChartData = FXCollections.observableArrayList( new AreaChart.Series("Series 1",FXCollections.observableArrayList( new AreaChart.Data(0,4), new AreaChart.Data(2,5), new AreaChart.Data(4,4), new AreaChart.Data(6,2), new AreaChart.Data(8,6), new AreaChart.Data(10,8) )), new AreaChart.Series("Series 2", FXCollections.observableArrayList( new AreaChart.Data(0,8), new AreaChart.Data(2,2), new AreaChart.Data(4,9), new AreaChart.Data(6,7), new AreaChart.Data(8,5), new AreaChart.Data(10,7) )), new AreaChart.Series("Series 3", FXCollections.observableArrayList( new AreaChart.Data(0,2), new AreaChart.Data(2,5), new AreaChart.Data(4,8), new AreaChart.Data(6,6), new AreaChart.Data(8,9), new AreaChart.Data(10,7) )) ); AreaChart chart = new AreaChart(xAxis, yAxis, areaChartData); getChildren().add(chart); }
Example #10
Source File: AreaChartSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public AreaChartSample() { NumberAxis xAxis = new NumberAxis("X Values", 1.0d, 9.0d, 2.0d); xAxis.setTickLength(12.0f); NumberAxis yAxis = new NumberAxis("Y Values", 0.0d, 10.0d, 2.0d); ObservableList<AreaChart.Series> areaChartData = FXCollections.observableArrayList( new AreaChart.Series("Series 1",FXCollections.observableArrayList( new AreaChart.Data(0,4), new AreaChart.Data(2,5), new AreaChart.Data(4,4), new AreaChart.Data(6,2), new AreaChart.Data(8,6), new AreaChart.Data(10,8) )), new AreaChart.Series("Series 2", FXCollections.observableArrayList( new AreaChart.Data(0,8), new AreaChart.Data(2,2), new AreaChart.Data(4,9), new AreaChart.Data(6,7), new AreaChart.Data(8,5), new AreaChart.Data(10,7) )), new AreaChart.Series("Series 3", FXCollections.observableArrayList( new AreaChart.Data(0,2), new AreaChart.Data(2,5), new AreaChart.Data(4,8), new AreaChart.Data(6,6), new AreaChart.Data(8,9), new AreaChart.Data(10,7) )) ); AreaChart chart = new AreaChart(xAxis, yAxis, areaChartData); getChildren().add(chart); }
Example #11
Source File: FinanceUI.java From StockInference-Spark with Apache License 2.0 | 5 votes |
private void addDataToSeries() { for (int i = 0; i < 50; i++) { if (stockDataQueue.isEmpty()) break; stockPriceSeries.getData().add(new AreaChart.Data(xSeriesDataStock++, stockDataQueue.remove())); if (predictionDataQueue.isEmpty() || emaDataQueue.isEmpty()) break; predictionSeries.getData().add(new AreaChart.Data(xSeriesDataPrediction, predictionDataQueue.remove())); emaPriceSeries.getData().add(new AreaChart.Data(xSeriesDataPrediction, emaDataQueue.remove())); xSeriesDataPrediction++; // series3.getData().add(new AreaChart.Data(xSeriesData++, dataQ3.remove())); } // remove points to keep us at no more than MAX_DATA_POINTS if (stockPriceSeries.getData().size() > MAX_DATA_POINTS) { stockPriceSeries.getData().remove(0, stockPriceSeries.getData().size() - MAX_DATA_POINTS); } if (predictionSeries.getData().size() > MAX_DATA_POINTS) { predictionSeries.getData().remove(0, predictionSeries.getData().size() - MAX_DATA_POINTS); } if (emaPriceSeries.getData().size() > MAX_DATA_POINTS) { emaPriceSeries.getData().remove(0, emaPriceSeries.getData().size() - MAX_DATA_POINTS); } xAxis.setLowerBound(xSeriesDataPrediction - MAX_DATA_POINTS); xAxis.setUpperBound(xSeriesDataStock - 1); }
Example #12
Source File: FinanceUI.java From StockPrediction with Apache License 2.0 | 5 votes |
private void addDataToSeries() { for (int i = 0; i < 50; i++) { if (stockDataQueue.isEmpty()) break; stockPriceSeries.getData().add(new AreaChart.Data(xSeriesDataStock++, stockDataQueue.remove())); if (predictionDataQueue.isEmpty() || emaDataQueue.isEmpty()) break; predictionSeries.getData().add(new AreaChart.Data(xSeriesDataPrediction, predictionDataQueue.remove())); emaPriceSeries.getData().add(new AreaChart.Data(xSeriesDataPrediction, emaDataQueue.remove())); xSeriesDataPrediction++; // series3.getData().add(new AreaChart.Data(xSeriesData++, dataQ3.remove())); } // remove points to keep us at no more than MAX_DATA_POINTS if (stockPriceSeries.getData().size() > MAX_DATA_POINTS) { stockPriceSeries.getData().remove(0, stockPriceSeries.getData().size() - MAX_DATA_POINTS); } if (predictionSeries.getData().size() > MAX_DATA_POINTS) { predictionSeries.getData().remove(0, predictionSeries.getData().size() - MAX_DATA_POINTS); } if (emaPriceSeries.getData().size() > MAX_DATA_POINTS) { emaPriceSeries.getData().remove(0, emaPriceSeries.getData().size() - MAX_DATA_POINTS); } xAxis.setLowerBound(xSeriesDataPrediction - MAX_DATA_POINTS); xAxis.setUpperBound(xSeriesDataStock - 1); }
Example #13
Source File: OfferBookChartView.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
private void createChart() { xAxis = new NumberAxis(); xAxis.setForceZeroInRange(false); xAxis.setAutoRanging(false); xAxis.setTickLabelGap(6); xAxis.setTickMarkVisible(false); xAxis.setMinorTickVisible(false); NumberAxis yAxis = new NumberAxis(); yAxis.setForceZeroInRange(false); yAxis.setSide(Side.RIGHT); yAxis.setAutoRanging(true); yAxis.setTickMarkVisible(false); yAxis.setMinorTickVisible(false); yAxis.setTickLabelGap(5); yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis, "", " " + Res.getBaseCurrencyCode())); seriesBuy = new XYChart.Series<>(); seriesSell = new XYChart.Series<>(); areaChart = new AreaChart<>(xAxis, yAxis); areaChart.setLegendVisible(false); areaChart.setAnimated(false); areaChart.setId("charts"); areaChart.setMinHeight(270); areaChart.setPrefHeight(270); areaChart.setCreateSymbols(true); areaChart.setPadding(new Insets(0, 10, 0, 10)); areaChart.getData().addAll(List.of(seriesBuy, seriesSell)); chartPane = new AnchorPane(); chartPane.getStyleClass().add("chart-pane"); AnchorPane.setTopAnchor(areaChart, 15d); AnchorPane.setBottomAnchor(areaChart, 10d); AnchorPane.setLeftAnchor(areaChart, 10d); AnchorPane.setRightAnchor(areaChart, 0d); chartPane.getChildren().add(areaChart); }
Example #14
Source File: AreaChartBuilderService.java From AsciidocFX with Apache License 2.0 | 5 votes |
@Override protected XYChart<Number, Number> createXYChart() { final NumberAxis xAxis = new NumberAxis(); final NumberAxis yAxis = new NumberAxis(); final XYChart<Number, Number> chart = new AreaChart<Number, Number>(xAxis, yAxis); chart.getStyleClass().add("chart-extension"); return chart; }