private CategoryPlot createBarChartPlot(DefaultCategoryDataset dataset, String yAxisLabel, NumberFormat yAxisNumberFormat) { CategoryAxis xAxis = new CategoryAxis("Data"); xAxis.setCategoryMargin(0.40); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setNumberFormatOverride(yAxisNumberFormat); BarRenderer renderer = createBarChartRenderer(yAxisNumberFormat); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
private CategoryPlot createBoxAndWhiskerChartPlot(DefaultBoxAndWhiskerCategoryDataset dataset, String yAxisLabel, NumberFormat yAxisNumberFormat) { CategoryAxis xAxis = new CategoryAxis("Data"); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setNumberFormatOverride(yAxisNumberFormat); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setItemMargin(0.10); renderer.setMeanVisible(false); // Improve readability by avoiding low contrast with light colors renderer.setUseOutlinePaintForWhiskers(true); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
BarChart<String, Number> chart = new BarChart<>(new CategoryAxis(), new NumberAxis()); final XYChart.Series<String, Number> series1 = new XYChart.Series<>(); chart.getData().addAll(series1); SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); Date date = new Date(); for (int i = 0; i <= 10; i += 1) { date.setTime(date.getTime() + i * 11111); series1.getData().add(new XYChart.Data(dateFormat.format(date), Math.random() * 500)); }
/** * Default constructor. */ public CombinedDomainCategoryPlot() { this(new CategoryAxis()); }
/** * Default constructor. */ public CombinedDomainCategoryPlot() { this(new CategoryAxis()); }
@FXML private CategoryAxis xAxis = new CategoryAxis();
@FXML NumberAxis xAxis = new NumberAxis(); @FXML CategoryAxis yAxis = new CategoryAxis();
final CategoryAxis yAxis = new CategoryAxis(); final NumberAxis zAxis = new NumberAxis(); XYChart<String, Number> chart = null ; if (cbTypeGraphView.equals("Bar Chart")) { chart = new BarChart<String, Number>(yAxis,xAxis); } if (cbTypeGraphView.equals("Line Chart")) { chart = new LineChart<String, Number>(yAxis,xAxis); } AnchorPane.setTopAnchor(chart, 110d); AnchorPane.setLeftAnchor(chart, 10d); AnchorPane.setRightAnchor(chart, 5d); AnchorPane.setBottomAnchor(chart, 50d);
LineChart<Number, Number> testChart ; testChart = new LineChart<>(new CategoryAxis(), new NumberAxis());
CategoryAxis xAxis = new CategoryAxis(); NumberAxis yAxis = new NumberAxis(); LineChart<String,Number> chart = new LineChart<String,Number>(xAxis,yAxis);
CategoryAxis xAxis = new CategoryAxis(); xAxis.tickLabelFontProperty().set(Font.font(15));
CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot(numberAxis); CategoryAxis domain = new CategoryAxis(); domain.setLowerMargin(0.2); domain.setUpperMargin(0.2); plot.add(new CategoryPlot(data, domain, null, renderer));
TableView<List<String>> table = new TableView<>(); ObservableList<List<String>> tableData = loadTableDataFromDatabase(); int userChosenDataNameColumnIndex ; int userChosenDataValueColumnIndex ; ObservableList<PieChart.Data> pieChartData = EasyBind.map(tableData, rowData -> { String name = rowData.get(userChosenDataNameColumnIndex); double value = Double.parseDouble(rowData.get(userChosenDataValueColumnIndex)); return new PieChart.Data(name, value); }); PieChart pieChart = new PieChart(pieChartData); ObservableList<XYChart.Data<String, Number>> barChartData = EasyBind.map(tableData, rowData -> { String name = rowData.get(userChosenDataNameColumnIndex); Double value = new Double(rowData.get(userChosenDataValueColumnIndex)); return new XYChart.Data(name, value); }); BarChart<String, Number> barChart = new BarChart<>(new CategoryAxis(), new NumberAxis(), barChartData)
CategoryAxis axis = new CategoryAxis(); axis.setLabel("Date"); axis.setLabelFont(new Font("Courier", Font.BOLD, 16)); axis.setTickLabelFont(new Font("Courier", Font.BOLD, 11)); categoryplot.setDomainAxis(axis);
lineCharModelFinanceiro = new LineChartModel(); lineCharModelFinanceiro.getAxes().put(AxisType.X, new CategoryAxis("Meses")); Axis yAxis = lineCharModelFinanceiro.getAxis(AxisType.Y); yAxis.setTickFormat("%.2f"); yAxis.setLabel("Valor R$"); yAxis.setMin(-1);
CategoryPlot plot = (CategoryPlot) chart.getPlot(); CategoryAxis cx = new CategoryAxis(); cx.setTickLabelsVisible(false); cx.setTickMarksVisible(false); plot.setDomainAxis(cx);
/** * Returns a CategoryPlot. */ private CategoryPlot getCategoryPlot( CategoryDataset dataSet, CategoryItemRenderer renderer, PlotOrientation orientation, CategoryLabelPositions labelPositions ) { CategoryPlot plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), renderer ); plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD ); plot.setOrientation( orientation ); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions( labelPositions ); return plot; }
private void configureDomainAxis(CategoryPlot plot, Font font) { CategoryAxis categoryAxis = new CategoryAxis(); categoryAxis.setTickMarksVisible(true); categoryAxis.setTickLabelFont(font); categoryAxis.setTickLabelPaint(OUTLINE_COLOR); plot.setDomainAxis(categoryAxis); plot.setDomainGridlinesVisible(false); }
protected CategoryPlot drawChart4FOI(String featureID, String timeString, ObservedValueTuple tuple) { BarRenderer3D barRenderer = new BarRenderer3D(); CategoryPlot plot = new CategoryPlot(); plot.setDomainAxis(new CategoryAxis(featureID)); for (int i = 0; i < observedProperties.length; i++) { plot.setDataset(i, createDataset(i, timeString, tuple)); plot.setRangeAxis(i, new NumberAxis(tuple.getPhenomenonNames()[i].split(":")[tuple.getPhenomenonNames()[i].split(":").length - 1])); plot.setRenderer(i, barRenderer); plot.mapDatasetToRangeAxis(i, i); } return plot; }
final CategoryAxis xAxis = new CategoryAxis(); xAxis.setLabel("Month"); xAxis.setCategories(FXCollections.<String> observableArrayList(monthLabels)); final NumberAxis yAxis = new NumberAxis(); yAxis.setLabel("Values"); yAxis.setAutoRanging(false); yAxis.setLowerBound(0d); double max= Math.max( myList.xyList1.stream().mapToDouble(d->d.getYValue()).max().getAsDouble(), myList.xyList2.stream().mapToDouble(d->d.getYValue()).max().getAsDouble()); yAxis.setUpperBound(max); yAxis.setTickUnit((yAxis.getUpperBound()-yAxis.getLowerBound())/10); final BarChart<String,Number> barChart = new BarChart<>(xAxis,yAxis);