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

CategoryAxis - getValueForDisplay(double) checks wrong boundaries

    Details

      Description

      The method getValueForDisplay() in the class CategoryAxis checks the wrong boundaries, i.e. for a horizontal axis, the max is the height and not the width. Same mix up for a vertical axis where the max is the width, not the height.

      See following code for clarification:
      {code}
          @Override public String getValueForDisplay(double displayPosition) {
              if (getSide().equals(Side.TOP) || getSide().equals(Side.BOTTOM)) { // HORIZONTAL
                  if (displayPosition < 0 || displayPosition > getHeight()) return null; // <-------------- WRONG SHOULD BE displayPosition > getWidth()
                  double d = (displayPosition - firstCategoryPos.get()) / categorySpacing.get();
                  return toRealValue(d);
              } else { // VERTICAL
                  if (displayPosition < 0 || displayPosition > getWidth()) return null; // <-------------- WRONG SHOULD BE displayPosition > getHeight()
                  double d = (displayPosition - firstCategoryPos.get()) / (categorySpacing.get() * -1);
                  return toRealValue(d);
              }
          }
      {code}

        Attachments

          Activity

            People

            • Assignee:
              psomashe Parvathi Somashekar (Inactive)
              Reporter:
              duke J. Duke (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: