The margin added to the chart makes correct alignment with y-axis number ranges impossible for horizontal bar charts. The max values returned by _chart_adjust_resolution() never equal 100. In my case, the max value is 94. Can/should the margin be optional or removed? I don't understand why it exists.

function _chart_adjust_resolution($chart_id, &$data, $max_value = NULL) {
  $max = &drupal_static(__FUNCTION__, array());

  if (count($data)) {
    // Set max data value
    if (!isset($max[$chart_id])) {
      $max[$chart_id] = isset($max_value) ? $max_value : _chart_get_max($data);
      $max[$chart_id] += $max[$chart_id] * 0.05; // Add a margin.
CommentFileSizeAuthor
#1 chart-remove-margin-1248066-1.patch451 bytes13rac1

Comments

13rac1’s picture

Status: Active » Needs review
StatusFileSize
new451 bytes

Suggested patch for this. Removes the margin.

13rac1’s picture

I'd like to apply this patch, but I am going to leave it until someone else comments.

13rac1’s picture

Status: Needs review » Fixed

Patch applied to 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.