CMS  Version 3.9
HistogramSeries Class Reference
+ Inheritance diagram for HistogramSeries:

Public Member Functions

 __construct ($type, $title, $values)
 
 set ($attr, $val)
 
 getOptions ()
 
 toScript ()
 
 showTooltips ($tooltips=null)
 

Public Attributes

 $type
 
 $title
 
 $values
 
 $options = array()
 
 $onClick
 
 $tooltips = array()
 

Detailed Description

Definition at line 8 of file histogram.inc.

Constructor & Destructor Documentation

◆ __construct()

HistogramSeries::__construct (   $type,
  $title,
  $values 
)

Definition at line 17 of file histogram.inc.

18  {
19  $this->type = $type;
20  $this->title = $title;
21  $this->values = $values;
22  }
$bookmark title

Member Function Documentation

◆ getOptions()

HistogramSeries::getOptions ( )

Definition at line 30 of file histogram.inc.

31  {
32  $options = array();
33  foreach ($this->options as $opt => $val)
34  {
35  if ($val === false) $val = "false";
36  if ($val === true) $val = "true";
37 
38  $options[] = "'$opt': $val";
39  }
40 
41  if ($this->onClick)
42  {
43  $options[] = "'onClick': {$this->onClick} ";
44  }
45 
46  if (count($this->tooltips))
47  {
48  $tooltips = "['".implode("', '", array_map(jsSafe, $this->tooltips))."']";
49  $options[] = "'toolTips': $tooltips";
50  }
51 
52  $options = "{".implode(", ", $options)."}";
53 
54  return $options;
55  }

◆ set()

HistogramSeries::set (   $attr,
  $val 
)

Definition at line 24 of file histogram.inc.

25  {
26  $this->options[$attr] = $val;
27  return $this;
28  }

◆ showTooltips()

HistogramSeries::showTooltips (   $tooltips = null)

Definition at line 74 of file histogram.inc.

75  {
76  if ($tooltips)
77  {
78  $this->tooltips = $tooltips;
79  }
80  else
81  {
82  $this->tooltips = $this->values;
83  }
84  }

◆ toScript()

HistogramSeries::toScript ( )

Reimplemented in StackedHistogramSeries, and GroupedHistogramSeries.

Definition at line 57 of file histogram.inc.

58  {
59  $v = array();
60 
61  foreach($this->values as $value)
62  {
63  if ($value === "" || !isset($value)) $value = "null";
64  $v[] = $value;
65  }
66 
67  $values = implode(", ", $v);
68  $options = $this->getOptions();
69 
70  $out = "new HistogramSeries('{$this->type}', '" . jsSafe($this->title) . "', [{$values}], $options)";
71  return $out;
72  }
$out
Definition: page.inc:66

Member Data Documentation

◆ $onClick

HistogramSeries::$onClick

Definition at line 14 of file histogram.inc.

◆ $options

HistogramSeries::$options = array()

Definition at line 13 of file histogram.inc.

◆ $title

HistogramSeries::$title

Definition at line 11 of file histogram.inc.

◆ $tooltips

HistogramSeries::$tooltips = array()

Definition at line 15 of file histogram.inc.

◆ $type

HistogramSeries::$type

Definition at line 10 of file histogram.inc.

◆ $values

HistogramSeries::$values

Definition at line 12 of file histogram.inc.


The documentation for this class was generated from the following file: