Java Code Examples for javafx.scene.chart.LineChart#setTitle()
The following examples show how to use
javafx.scene.chart.LineChart#setTitle() .
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: AdvancedLineChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: SinChartComponent.java From spring-labs with Apache License 2.0 | 6 votes |
public SinChartComponent() { NumberAxis xAxis = new NumberAxis(); xAxis.setLabel("x"); NumberAxis yAxis = new NumberAxis(); yAxis.setLabel("y"); XYChart.Series<Number, Number> series = new XYChart.Series<>(); series.setName("Sine"); ObservableList<XYChart.Data<Number, Number>> data = series.getData(); for (double x = -Math.PI; x < Math.PI; x += 0.5) { data.add(new XYChart.Data<Number, Number>(x, 10 * Math.sin(x))); } LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis); lineChart.setTitle("Sine function"); lineChart.getData().add(series); getChildren().add(lineChart); }
Example 3
Source File: MenuController.java From zest-writer with GNU General Public License v3.0 | 6 votes |
private void displayIndex(Map<String, Double> resultIndex, String title, String header) { BaseDialog dialog = new BaseDialog(title, header); dialog.getDialogPane().setPrefSize(800, 600); dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE)); // draw final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final LineChart<String,Number> lineChart = new LineChart<>(xAxis, yAxis); lineChart.setTitle(title); lineChart.setLegendVisible(false); xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis")); yAxis.setLabel(Configuration.getBundle().getString("ui.actions.readable.yaxis")); XYChart.Series<String, Number> series = new XYChart.Series(); for(Map.Entry<String, Double> st:resultIndex.entrySet()) { series.getData().add(new XYChart.Data(st.getKey(), st.getValue())); } lineChart.getData().addAll(series); dialog.getDialogPane().setContent(lineChart); dialog.setResizable(true); dialog.showAndWait(); }
Example 4
Source File: IndexChart - MainApp.java From Java-for-Data-Science with MIT License | 6 votes |
public void simpleIndexChart(Stage stage) { stage.setTitle("Index Chart"); final LineChart<String, Number> lineChart = new LineChart<>(xAxis, yAxis); lineChart.setTitle("Belgium Population"); yAxis.setLabel("Population"); series.setName("Population"); addDataItem(series, "1950", 8639369); addDataItem(series, "1960", 9118700); addDataItem(series, "1970", 9637800); addDataItem(series, "1980", 9846800); addDataItem(series, "1990", 9969310); addDataItem(series, "2000", 10263618); Scene scene = new Scene(lineChart, 800, 600); lineChart.getData().add(series); stage.setScene(scene); stage.show(); }
Example 5
Source File: AdvLineCategoryChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
protected LineChart<String, Number> createChart() { final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final LineChart<String,Number> lc = new LineChart<String,Number>(xAxis,yAxis); // setup chart lc.setTitle("LineChart with Category Axis"); xAxis.setLabel("X Axis"); yAxis.setLabel("Y Axis"); // add starting data XYChart.Series<String,Number> series = new XYChart.Series<String,Number>(); series.setName("Data Series 1"); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[0], 50d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[1], 80d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[2], 90d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[3], 30d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[4], 122d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[5], 10d)); lc.getData().add(series); return lc; }
Example 6
Source File: AdvancedLineChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
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; }
Example 7
Source File: AdvLineCategoryChartSample.java From marathonv5 with Apache License 2.0 | 6 votes |
protected LineChart<String, Number> createChart() { final CategoryAxis xAxis = new CategoryAxis(); final NumberAxis yAxis = new NumberAxis(); final LineChart<String,Number> lc = new LineChart<String,Number>(xAxis,yAxis); // setup chart lc.setTitle("LineChart with Category Axis"); xAxis.setLabel("X Axis"); yAxis.setLabel("Y Axis"); // add starting data XYChart.Series<String,Number> series = new XYChart.Series<String,Number>(); series.setName("Data Series 1"); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[0], 50d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[1], 80d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[2], 90d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[3], 30d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[4], 122d)); series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[5], 10d)); lc.getData().add(series); return lc; }
Example 8
Source File: AdvancedStockLineChartSample.java From marathonv5 with Apache License 2.0 | 5 votes |
protected LineChart<Number, Number> createChart() { xAxis = new NumberAxis(0,24,3); final NumberAxis yAxis = new NumberAxis(0,100,10); final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis); // setup chart lc.setId("lineStockDemo"); lc.setCreateSymbols(false); lc.setAnimated(false); lc.setLegendVisible(false); lc.setTitle("ACME Company Stock"); xAxis.setLabel("Time"); xAxis.setForceZeroInRange(false); yAxis.setLabel("Share Price"); yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null)); // add starting data hourDataSeries = new XYChart.Series<Number,Number>(); hourDataSeries.setName("Hourly Data"); minuteDataSeries = new XYChart.Series<Number,Number>(); minuteDataSeries.setName("Minute Data"); // create some starting data hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY)); minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY)); for (double m=0; m<(60); m++) { nextTime(); plotTime(); } lc.getData().add(minuteDataSeries); lc.getData().add(hourDataSeries); return lc; }
Example 9
Source File: ChartAdvancedStockLine.java From netbeans with Apache License 2.0 | 5 votes |
protected LineChart<Number, Number> createChart() { xAxis = new NumberAxis(0,24,3); final NumberAxis yAxis = new NumberAxis(0,100,10); final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis); // setup chart lc.setId("lineStockDemo"); lc.setCreateSymbols(false); lc.setAnimated(false); lc.setLegendVisible(false); lc.setTitle("ACME Company Stock"); xAxis.setLabel("Time"); xAxis.setForceZeroInRange(false); yAxis.setLabel("Share Price"); yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null)); // add starting data hourDataSeries = new XYChart.Series<Number,Number>(); hourDataSeries.setName("Hourly Data"); minuteDataSeries = new XYChart.Series<Number,Number>(); minuteDataSeries.setName("Minute Data"); // create some starting data hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY)); minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY)); for (double m=0; m<(60); m++) { nextTime(); plotTime(); } lc.getData().add(minuteDataSeries); lc.getData().add(hourDataSeries); return lc; }
Example 10
Source File: AdvancedStockLineChartSample.java From marathonv5 with Apache License 2.0 | 5 votes |
protected LineChart<Number, Number> createChart() { xAxis = new NumberAxis(0,24,3); final NumberAxis yAxis = new NumberAxis(0,100,10); final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis); // setup chart lc.setId("lineStockDemo"); lc.setCreateSymbols(false); lc.setAnimated(false); lc.setLegendVisible(false); lc.setTitle("ACME Company Stock"); xAxis.setLabel("Time"); xAxis.setForceZeroInRange(false); yAxis.setLabel("Share Price"); yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,"$",null)); // add starting data hourDataSeries = new XYChart.Series<Number,Number>(); hourDataSeries.setName("Hourly Data"); minuteDataSeries = new XYChart.Series<Number,Number>(); minuteDataSeries.setName("Minute Data"); // create some starting data hourDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY)); minuteDataSeries.getData().add(new XYChart.Data<Number,Number>(timeInHours,prevY)); for (double m=0; m<(60); m++) { nextTime(); plotTime(); } lc.getData().add(minuteDataSeries); lc.getData().add(hourDataSeries); return lc; }
Example 11
Source File: RattingGraph.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void start(Stage s) throws Exception { s.setTitle("Price - Distance graph"); final NumberAxis xAxis = new NumberAxis(), yAxis = new NumberAxis(); xAxis.setLabel("Ratting"); yAxis.setLabel("Price"); //creating the chart final LineChart<Number,Number> lineChart = new LineChart<Number,Number>(xAxis,yAxis); lineChart.setTitle("Price - Ratting"); //defining a series XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>(); series.setName("Price - Ratting"); //get data to present Graph g = new Graph(); Map<Double, Double> data = g.CreatePriceRanttingData(dest); //populating the series with data for (Map.Entry<Double, Double> entry : data.entrySet()){ LOGGER.info("ratting: "+ entry.getKey() + " price: " + entry.getValue()); series.getData().add(new Data<Number, Number>(entry.getKey(), entry.getValue())); } Scene scene = new Scene(lineChart,800,600); lineChart.getData().addAll(series); s.setScene(scene); s.show(); }
Example 12
Source File: ChooseParkingSlotController.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
@FXML public void showRatingChartButtonClicked(ActionEvent event) throws Exception{ Stage s = new Stage(); s.setTitle("Price - Rating graph"); final NumberAxis xAxis = new NumberAxis(), yAxis = new NumberAxis(); xAxis.setLabel("Rating"); yAxis.setLabel("Price"); //creating the chart final LineChart<Number,Number> lineChart = new LineChart<Number,Number>(xAxis,yAxis); lineChart.setTitle("Price - Rating"); //defining a series XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>(); series.setName("Price - Rating"); //get data to present Graph g = new Graph(); Map<Double, Double> data = g.CreatePriceRanttingData(getSelectedDestination()); //populating the series with data for (Map.Entry<Double, Double> entry : data.entrySet()){ Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info("rating: "+ entry.getKey() + " price: " + entry.getValue()); series.getData().add(new Data<Number, Number>(entry.getKey(), entry.getValue())); } Scene scene = new Scene(lineChart,800,600); lineChart.getData().addAll(series); s.setScene(scene); s.show(); }
Example 13
Source File: ChooseParkingSlotController.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
@FXML public void showDistanceChartButtonClicked(ActionEvent event) throws Exception{ Stage s = new Stage(); //Fill stage with content s.setTitle("Price - Distance graph"); final NumberAxis xAxis = new NumberAxis(), yAxis = new NumberAxis(); xAxis.setLabel("Distance"); yAxis.setLabel("Price"); //creating the chart final LineChart<Number,Number> lineChart = new LineChart<Number,Number>(xAxis,yAxis); lineChart.setTitle("Price - Distance"); //defining a series XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>(); series.setName("Price - Distance"); //get data to present Graph g = new Graph(); Map<Double, Double> data = g.CreatePriceDistanceData(getSelectedDestination()); //populating the series with data for (Map.Entry<Double, Double> entry : data.entrySet()){ Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info("distance: "+ entry.getKey() + " price: " + entry.getValue()); series.getData().add(new Data<Number, Number>(entry.getKey(), entry.getValue())); } Scene scene = new Scene(lineChart,800,600); lineChart.getData().addAll(series); s.setScene(scene); s.show(); }
Example 14
Source File: DistanceGraph.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") public void start(Stage s) throws Exception { s.setTitle("Price - Distance graph"); final NumberAxis xAxis = new NumberAxis(), yAxis = new NumberAxis(); xAxis.setLabel("Distance"); yAxis.setLabel("Price"); //creating the chart final LineChart<Number,Number> lineChart = new LineChart<Number,Number>(xAxis,yAxis); lineChart.setTitle("Price - Distance"); //defining a series XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>(); series.setName("Price - Distance"); //get data to present Graph g = new Graph(); Map<Double, Double> data = g.CreatePriceDistanceData(dest); //populating the series with data for (Map.Entry<Double, Double> entry : data.entrySet()){ LOGGER.info("distance: "+ entry.getKey() + " price: " + entry.getValue()); series.getData().add(new Data<Number, Number>(entry.getKey(), entry.getValue())); } Scene scene = new Scene(lineChart,800,600); lineChart.getData().addAll(series); s.setScene(scene); s.show(); }
Example 15
Source File: TrainingView.java From gluon-samples with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Chart createChart(Series<Integer, Double> series) { NumberAxis xAxis = new NumberAxis(); xAxis.setUpperBound(620d); xAxis.setMinorTickCount(25); xAxis.setTickUnit(100); xAxis.setAutoRanging(false); NumberAxis yAxis = new NumberAxis(); LineChart answer = new LineChart(xAxis, yAxis); answer.setTitle("score evolution"); answer.setCreateSymbols(false); ObservableList<XYChart.Series<Integer, Double>> data = FXCollections.observableArrayList(); data.add(series); answer.setData(data); return answer; }
Example 16
Source File: ParetoChartController.java From OEE-Designer with MIT License | 5 votes |
private LineChart<String, Number> createLineChart(String categoryLabel) { // X-Axis category (not shown) CategoryAxis xAxis = new CategoryAxis(); xAxis.setLabel(categoryLabel); xAxis.setOpacity(0); // Y-Axis (%) NumberAxis yAxis = new NumberAxis(0, 100, 10); yAxis.setLabel(DesignerLocalizer.instance().getLangString("cum.percent")); yAxis.setSide(Side.RIGHT); yAxis.setAutoRanging(false); yAxis.setUpperBound(100.0d); yAxis.setLowerBound(0.0d); // create the line chart LineChart<String, Number> chLineChart = new LineChart<>(xAxis, yAxis); chLineChart.setTitle(chartTitle); chLineChart.setLegendVisible(false); chLineChart.setAnimated(false); chLineChart.setCreateSymbols(true); chLineChart.getData().add(lineChartSeries); // plot the points double total = totalCount.doubleValue(); Float cumulative = new Float(0f); for (ParetoItem paretoItem : this.paretoItems) { cumulative += new Float(paretoItem.getValue().floatValue() / total * 100.0f); XYChart.Data<String, Number> point = new XYChart.Data<>(paretoItem.getCategory(), cumulative); lineChartSeries.getData().add(point); } return chLineChart; }
Example 17
Source File: MainApp - Simple Regression.java From Java-for-Data-Science with MIT License | 4 votes |
@Override public void start(Stage stage) { //Belgium 1950 8639369 //Belgium 1960 9118700 //Belgium 1970 9637800 //Belgium 1980 9846800 //Belgium 1990 9969310 //Belgium 2000 10263618 double[][] input = { {1950, 8639369}, {1960, 9118700}, {1970, 9637800}, {1980, 9846800}, {1990, 9969310}, {2000, 10263618}}; double[] predictionYears = {1950, 1960, 1970, 1980, 1990, 2000, 2010, 2020, 2030, 2040}; NumberFormat yearFormat = NumberFormat.getNumberInstance(); yearFormat.setMaximumFractionDigits(0); yearFormat.setGroupingUsed(false); NumberFormat populationFormat = NumberFormat.getNumberInstance(); populationFormat.setMaximumFractionDigits(0); SimpleRegression regression = new SimpleRegression(); regression.addData(input); projectedSeries.setName("Projected"); for (int i = 0; i < predictionYears.length; i++) { out.println(yearFormat.format(predictionYears[i]) + "-" + populationFormat.format(regression.predict(predictionYears[i]))); addDataItem(projectedSeries, predictionYears[i], regression.predict(predictionYears[i])); } displayAttribute("Slope",regression.getSlope()); displayAttribute("Intercept", regression.getIntercept()); displayAttribute("InterceptStdEr", regression.getInterceptStdErr()); displayAttribute("MeanSquareError", regression.getMeanSquareError()); displayAttribute("N", + regression.getN()); displayAttribute("R", + regression.getR()); displayAttribute("RSquare", regression.getRSquare()); //Create index chart stage.setTitle("Simple Linear Regression"); xAxis.setTickLabelFormatter(new StringConverter<Number>() { @Override public String toString(Number object) { return (object.intValue()) + ""; } @Override public Number fromString(String string) { return 0; } }); final LineChart<Number, Number> lineChart = new LineChart<>(xAxis, yAxis); lineChart.setTitle("Belgium Population"); yAxis.setLabel("Population"); originalSeries.setName("Actual"); addDataItem(originalSeries, 1950, 8639369); addDataItem(originalSeries, 1960, 9118700); addDataItem(originalSeries, 1970, 9637800); addDataItem(originalSeries, 1980, 9846800); addDataItem(originalSeries, 1990, 9969310); addDataItem(originalSeries, 2000, 10263618); Scene scene = new Scene(lineChart, 800, 600); lineChart.getData().addAll(originalSeries, projectedSeries); stage.setScene(scene); stage.show(); }