You are here

private function Symbols::generate in Flot 8

Generate sin waves.

1 call to Symbols::generate()
Symbols::content in flot_examples/src/Controller/Symbols.php
Symbols.

File

flot_examples/src/Controller/Symbols.php, line 64

Class

Symbols
Generate a chart using different point symbols.

Namespace

Drupal\flot_examples\Controller

Code

private function generate($offset, $amplitude) {
  $res = [];
  $start = 0;
  $end = 10;
  for ($i = 0; $i <= 50; $i++) {
    $x = start + $i / 50 * ($end - $start);
    $res[] = [
      $x,
      $amplitude * sin($x + $offset),
    ];
  }
  return $res;
}