2 /* Libchart - PHP chart library
3 * Copyright (C) 2005-2008 Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 /*! \mainpage Libchart
22 * This is the reference API, automatically compiled by <a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a>.
23 * You can find here information that is not covered by the <a href="../samplecode/">tutorial</a>.
30 * @author Jean-Marc Trémeaux (jm.tremeaux at gmail.com)
32 abstract class Chart {
39 * Plot (holds graphical attributes).
44 * Abstract constructor of Chart.
46 * @param integer width of the image
47 * @param integer height of the image
49 protected function Chart($width, $height) {
51 $this->plot = new Plot($width, $height);
52 $this->plot->setTitle("Untitled chart");
53 $this->plot->setLogoFileName(dirname(__FILE__) . "/../../../images/PoweredBy.png");
57 * Checks the data model before rendering the graph.
59 protected function checkDataModel() {
60 // Check if a dataset was defined
61 if (!$this->dataSet) {
62 die("Error: No dataset defined.");
65 // Maybe no points are defined, but that's ok. This will yield and empty graph with default boundaries.
71 protected function createImage() {
72 $this->plot->createImage();
78 * @param dataSet The data set
80 public function setDataSet($dataSet) {
81 $this->dataSet = $dataSet;
89 public function getPlot() {
96 * @param string New title
98 public function setTitle($title) {
99 $this->plot->setTitle($title);