You are here

function flotStyle::axis_range in Flot 7

Same name and namespace in other branches
  1. 6 flot.module \flotStyle::axis_range()

File

./flot.module, line 362

Class

flotStyle
Style class for the flot API.

Code

function axis_range($axis = 'yaxis', $range = array(), $granularity = 0) {
  if (count($range)) {
    $this->{$axis} = new stdClass();
    $this->{$axis}->min = min($range);
    $this->{$axis}->max = max($range);
    if (is_numeric($granularity) && $granularity != 0) {
      $tickSize = ($this->{$axis}->max - $this->{$axis}->min) / $granularity;
      $this->{$axis}->tickSize = floor($tickSize);
    }
  }
}