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

BarChart bars become invisible if forceZeroInRange=false for the NumberAxis

    Details

    • Subcomponent:
    • Introduced In Version:
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      openjdk version "1.8.0_121"
      OpenJDK Runtime Environment (build 1.8.0_131-b13)
      OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux 4.10.8-1-ARCH #1 SMP PREEMPT x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      If "forceZeroInRange" is set to "false" for the NumberAxis of a BarChart the bars of the chart get a width of NaN and thus nothing is displayed. If this is intended it should be documented or otherwise calculation of bar widths in the method "layoutPlotChildren" of the class "BarChart" should be fixed.

      Some implementation details: The variable "zeroPos" in line 346 of BarChart.class becomes "NaN" if "forceZeroInRange" is "false". This is not checked in subsequent tests that occur within the double for loop. That causes the variables "bottom" and "top" to also become "NaN" in lines 371 and 372 of BarChart.class.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a BarChart, set "forceZeroInRange" to "false", and add some bars that all have negative values which causes the zero line of the BarChart not to be displayed.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Bars should be plotted or it should be clearly documented that "forceZeroInRange" cannot be "false" for BarCharts.
      ACTUAL -
      No bars are drawn.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Set "forceZeroInRange" to "true" for the NumberAxis of the BarChart.

        Attachments

          Activity

            People

            • Assignee:
              aghaisas Ajit Ghaisas
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: