Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-6109

Y Axis Maximum for Bar Charts Appears to be Wrong

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.1.3
    • Fix Version/s: 3.2
    • Component/s: CiviReport, Core CiviCRM
    • Labels:
      None

      Description

      Starting at line 86 of civicrm/CRM/Utils/OpenFlashChart.php we have:

      // calculate max scale for graph.
      $yMax = max( $yValues );
      if ( $mod = $yMax%(str_pad( 5, strlen($yMax)-1, 0)))

      { $yMax += str_pad( 5, strlen($yMax)-1, 0)-$mod; }

      This code works fine if $yMax is set in the first line to an integer value, but if it is a decimal value, with two places (like a currency value) then the following 3 lines will reset it to be far too high. If it's 85000.23 for example, then the $yMax will come out 5000000.23. If we use this as the first line:

      $yMax = round( max( $yValues ));

      however, then 85000.23 is recalculated as 90000, which is correct.

        Attachments

          Activity

            People

            • Assignee:
              sushant Sushant Paste
              Reporter:
              hershel Hershel Robinson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 30 minutes
                30m
                Remaining:
                Remaining Estimate - 30 minutes
                30m
                Logged:
                Time Spent - Not Specified
                Not Specified