You are here

class flotStyle in Flot 7

Same name and namespace in other branches
  1. 6 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 329

View source
class flotStyle {

  // Use flot's default colors: public $colors;
  public $grid;
  public $series;
  function __construct() {
    $this->series = new stdClass();
    $this->series->lines = new stdClass();
    $this->series->bars = new stdClass();
    $this->series->points = new stdClass();
    $this->series->pie = new stdClass();

    // Use flot's default colors: $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);
      }
    }
  }
  function createPie() {
    $this->series->pie = new flotPie();
  }

}

Members