コード例 #1
0
ファイル: Plot.php プロジェクト: ronaldoof/geocloud2
 /**
  * PlotType [Constructor]
  *
  * Valid values for multiType are:
  *
  * 'normal' Plot is normal, multiple datasets are displayes next to one
  * another
  *
  * 'stacked' Datasets are stacked on top of each other
  *
  * 'stacked100pct' Datasets are stacked and displayed as percentages of the
  * total sum
  *
  * I no title is specified a default is used, which is basically the plot
  * type (fx. for a 'Image_Graph_Plot_Smoothed_Area' default title is
  * 'Smoothed Area')
  *
  * @param Image_Graph_Dataset $dataset The data set (value containter) to
  *   plot or an array of datasets
  * @param string $multiType The type of the plot
  * @param string $title The title of the plot (used for legends,
  *   {@link Image_Graph_Legend})
  */
 function Image_Graph_Plot(&$dataset, $multiType = 'normal', $title = '')
 {
     if (!is_a($dataset, 'Image_Graph_Dataset')) {
         if (is_array($dataset)) {
             $keys = array_keys($dataset);
             foreach ($keys as $key) {
                 if (!is_a($dataset[$key], 'Image_Graph_Dataset')) {
                     $this->_error('Invalid dataset passed to ' . get_class($this));
                 }
             }
             unset($keys);
         } else {
             $this->_error('Invalid dataset passed to ' . get_class($this));
         }
     }
     parent::Image_Graph_Common();
     if ($dataset) {
         if (is_array($dataset)) {
             $this->_dataset =& $dataset;
         } else {
             $this->_dataset = array(&$dataset);
         }
     }
     if ($title) {
         $this->_title = $title;
     } else {
         $this->_title = str_replace('_', ' ', substr(get_class($this), 17));
     }
     $multiType = strtolower($multiType);
     if ($multiType == 'normal' || $multiType == 'stacked' || $multiType == 'stacked100pct') {
         $this->_multiType = $multiType;
     } else {
         $this->_error('Invalid multitype: ' . $multiType . ' expected (normal|stacked|stacked100pct)');
         $this->_multiType = 'normal';
     }
 }