Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8118371

Axis: setTickLabelRotation does not work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7u6
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      b19

      Description

      setTickLabelRotation does not work if used before showing of scene.

      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.chart.Axis;
      import javafx.scene.chart.CategoryAxis;
      import javafx.scene.chart.Chart;
      import javafx.scene.chart.ScatterChart;
      import javafx.scene.chart.XYChart;
      import javafx.scene.chart.XYChart.Series;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class Main extends Application {

          @Override
          public void start(Stage stage) {
              VBox content = new VBox();
              Series s1 = new Series( FXCollections.observableArrayList(
                          new XYChart.Data("First", "Green"),
                          new XYChart.Data("Second", "Blue"),
                          new XYChart.Data("Fourth", "Red")
                      ));
              s1.setName("Set 1");
              Series s2 = new Series( FXCollections.observableArrayList(
                          new XYChart.Data("First", "Red"),
                          new XYChart.Data("Second", "Green"),
                          new XYChart.Data("Fourth", "Blue")
                      ));
              s2.setName("Set 2");
              Series s3 = new Series( FXCollections.observableArrayList(
                          new XYChart.Data("First", "Blue"),
                          new XYChart.Data("Second", "Red"),
                          new XYChart.Data("Third", "Green")
                      ));
              s3.setName("Set 3");
              ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
              Axis y_axis = new CategoryAxis();
              Axis x_axis = new CategoryAxis(FXCollections.<String>observableArrayList("First", "Second", "Third", "Fourth"));
              Chart chart = new ScatterChart(x_axis, y_axis, data);
              x_axis.setTickLabelRotation(45);
              y_axis.setTickLabelRotation(45);
              content.getChildren().add(chart);
              stage.setScene(new Scene(content, 400, 400));
              stage.show();
      // x_axis.setTickLabelRotation(45);
      // y_axis.setTickLabelRotation(45);
          }
          public static void main(String[] args) {
              launch(Main.class, args);
          }
      }

        Attachments

          Activity

            People

            Assignee:
            psomashe Parvathi Somashekar (Inactive)
            Reporter:
            ogb Oleg Barbashov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved:
              Imported: