You are here

class flotStyle in Flot 6

Same name and namespace in other branches
  1. 7 flot.module \flotStyle

Style class for the flot API.

Provides some sensible defaults and helper methods for managing axes.

Hierarchy

Expanded class hierarchy of flotStyle

File

./flot.module, line 132

View source
class flotStyle {
  public $colors;
  public $grid;
  public $lines;
  public $bars;
  public $points;
  function __construct() {
    $this->lines = new StdClass();
    $this->bars = new StdClass();
    $this->points = new StdClass();
    $this->lines->show = FALSE;
    $this->bars->show = FALSE;
    $this->points->show = FALSE;
    $this->colors = array(
      '#666',
      '#999',
      '#ccc',
    );
    $this->shadowSize = 0;
    $this->grid = new StdClass();
    $this->grid->labelMargin = 0;
    $this->grid->tickColor = '#eee';
    $this->grid->backgroundColor = '#f8f8f8';
    $this->grid->borderWidth = 0;
    $this->grid->hoverable = true;
    $this->grid->autoHighlight = true;
    $this->grid->clickable = false;
  }
  function axis_ticks($axis = 'yaxis', $ticks = array()) {
    if (count($ticks)) {
      $this->{$axis} = new StdClass();
      $this->{$axis}->ticks = $ticks;
    }
  }
  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);
      }
    }
  }

}

Members