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

Axis class does not render ticks marks when tick labels are invisible

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_60"
        Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

        A DESCRIPTION OF THE PROBLEM :
        Use a Jfx Axis that the side is set to LEFT, RIGHT or TOP and call setTickLabelsVisible(false). When the Axis is displayed, the major tick marks are not rendered.

        Axis class does not render ticks marks when tick labels are invisible. Empty space in position where tick mark is supposed to display. Minor tick marks do display as expected.

        The problem looks to be in Axis.layoutChildren(). When ticklabels are not visible then the TickMark instances placed into the tickMarks list do not get updated with the position of the tickMarks. The position will remain 0 for each tickMark in the list. This is in lines 711 to 777.

        Then later (lines 780 to 911) when the tickMarks are to be rendered, the position is 0. So, each tickMark gets rendered at 0 position instead of the correct location.

        Interestingly though, for side == Bottom the position is not used from the tickMark instances. Instead, each tickMark position is recalculated by calling getDisplayPosition(tick.getValue()). This special case for position == Bottom explains why the tickMarks will render for Bottom Axes.

        REGRESSION. Last worked in version 7u79

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.7.0_79"
        Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
        Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        See sample code

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Tick marks should be visible.
        ACTUAL -
        Blank space in location of expected tick.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;
        import javafx.geometry.Side;
        import javafx.scene.Scene;
        import javafx.scene.chart.LineChart;
        import javafx.scene.chart.NumberAxis;
        import javafx.scene.chart.XYChart;
        import javafx.stage.Stage;


        public class LineChartSample extends Application {

           @Override public void start(Stage stage) {
              stage.setTitle("Line Chart Sample");
              //defining the axes
              final NumberAxis xAxis = new NumberAxis();
              final NumberAxis yAxis = new NumberAxis();
              xAxis.setLabel("Number of Month");
              xAxis.setTickLabelsVisible(false);
              xAxis.setSide(Side.TOP);

              yAxis.setTickLabelsVisible(false);

              //creating the chart
              final LineChart<Number,Number> lineChart =
                    new LineChart<Number,Number>(xAxis,yAxis);

              lineChart.setTitle("Stock Monitoring, 2010");
              //defining a series
              XYChart.Series series = new XYChart.Series();
              series.setName("My portfolio");
              //populating the series with data
              series.getData().add(new XYChart.Data(1, 23));
              series.getData().add(new XYChart.Data(2, 14));
              series.getData().add(new XYChart.Data(3, 15));
              series.getData().add(new XYChart.Data(4, 24));
              series.getData().add(new XYChart.Data(5, 34));
              series.getData().add(new XYChart.Data(6, 36));
              series.getData().add(new XYChart.Data(7, 22));
              series.getData().add(new XYChart.Data(8, 45));
              series.getData().add(new XYChart.Data(9, 43));
              series.getData().add(new XYChart.Data(10, 17));
              series.getData().add(new XYChart.Data(11, 29));
              series.getData().add(new XYChart.Data(12, 25));

              Scene scene = new Scene(lineChart,800,600);
              lineChart.getData().add(series);

              stage.setScene(scene);
              stage.show();
           }

           public static void main(String[] args) {
              launch(args);
           }
        }
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                vadim Vadim Pakhnushev
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: