0

I have created a bar chart with multi series as you can see at the picture. The List ent has 2 Lists. I need to somehow write their xAxis value on top of their body diagonally (with a rotation of 45 degree). And set another value for xAxis later.

public class FunctionalRedundantController {
@FXML
private BarChart<String, Number> barchart;
@FXML
private CategoryAxis funcNameAxis;
@FXML
private NumberAxis yAxis;
private ObservableList<String> funcNames = FXCollections
        .observableArrayList();
private DataConstructor dc = new DataConstructor();

@FXML
private void initialize() {

    funcNameAxis.setLabel("Name of Functions");
    funcNameAxis.tickLabelFontProperty().set(Font.font(10));
    yAxis.setLabel("Redundant");
}

public void setfunctionalredundant() {
    XYChart.Series<String, Number> series = new XYChart.Series<>();
    XYChart.Series<String, Number> series2 = new XYChart.Series<>();
    int green = 0;
    int yellow = 0;

    List<String> compGreen = new ArrayList<String>();
    List<String> compyellow = new ArrayList<String>();
    for (List<String> ent : dc.getFuncTypeOrg().values()) {
        if (ent.size() > 10) {

            for (int k = 0; k < ent.size(); k++) {
                if (ent.get(k).equals("hasType")) {
                    if (ent.get(k+1).equals("Green")) {
                        series.getData().add(
                                new XYChart.Data<String, Number>(ent.get(k-2), 1));
                    }
                    else if(ent.get(k+1).equals("yellow")){                         

                        series2.getData().add(
                                new XYChart.Data<String, Number>(ent.get(k-2), 1));
                    }
                }
            }
        }

    }
    barchart.getYAxis().setVisible(false);
    barchart.getYAxis().setOpacity(0);
    barchart.getData().addAll(series, series2);
    barchart.setBarGap(1);
    barchart.setCategoryGap(20);

}

}

picture

Iman
  • 769
  • 1
  • 13
  • 51
  • possible duplicate of [how to display bar value on top of bar javafx](http://stackoverflow.com/questions/15237192/how-to-display-bar-value-on-top-of-bar-javafx) – Roland Apr 03 '15 at 01:21
  • This question has already been answered several times, see link above. All that's left to do is to invoke a setRotate/setTranslateX/setTranslateY on the text node. – Roland Apr 03 '15 at 01:23

0 Answers0