}
Base.prototype._series = null;
Base.prototype._labels = null;
+ Base.prototype._title = null;
Base.prototype.COLORSET = ['red', 'green', 'blue', 'yellow', 'pink', 'orange'];
Base.prototype.TYPE = null;
// to have a reference to the class in the sub classes, in PHP I'd do new self().
var Chart = new Klass();
Chart.setLabels(data.labels);
+ Chart.setTitle(data.title);
for (var i = 0; i < data.series.length; i++) {
Chart.addSeries(Series.prototype.create(data.series[i]));
}
return this._series;
};
+ Base.prototype.getTitle = function() {
+ return this._title;
+ };
+
Base.prototype.getType = function() {
if (!this.TYPE) {
throw new Error('The TYPE property has not been set.');
this._labels = labels;
};
+ Base.prototype.setTitle = function(title) {
+ this._title = title;
+ };
+
Base.prototype._validateSerie = function(serie) {
if (this._series.length && this._series[0].getCount() != serie.getCount()) {
throw new Error('Series do not have an equal number of values.');
protected $series = [];
protected $labels = [];
+ protected $title = null;
public function __construct() {
}
return [
'type' => $this->get_type(),
'series' => $this->series,
- 'labels' => $this->labels
+ 'labels' => $this->labels,
+ 'title' => $this->title
];
}
return $this->series;
}
+ public function get_title() {
+ return $this->title;
+ }
+
public function get_type() {
$classname = get_class($this);
return substr($classname, strpos($classname, '_') + 1);
$this->labels = $labels;
}
+ public function set_title($title) {
+ $this->title = $title;
+ }
}