Esempio n. 1
0
 function createGraph($name, $type)
 {
     YDInclude('YDGraph.php');
     // generate chart
     $values = array();
     for ($i = 0; $i < 12; $i++) {
         $values[] = rand(20, 60);
     }
     $labels = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
     // Create a new graph
     $g1 = new YDGraph(550, 250);
     $g1->setLimits(0, 20);
     $g1->setOffset(5);
     $g1->setFormat(1, ',', '.');
     $g1->addSeries($values, $type, 'Series1', SOLID, '#444444', '#4682B4');
     $g1->setYAxis('#4682B4', SOLID, 5, 'example');
     $g1->setLabels($labels, '#000000', 1, HORIZONTAL);
     $g1->plot(dirname(__FILE__) . '/' . $name);
 }
 /**
  *  This function sets the title
  *
  *  @param $title       title.
  *  @param $textColor   textColor.
  *  @param $font        font.
  */
 function setTitle($title, $textColor, $font)
 {
     $this->m_title = $title;
     $vTextColor = YDGraph::_decode_color($textColor);
     $this->m_textColor = imagecolorallocate($this->m_image, $vTextColor[0], $vTextColor[1], $vTextColor[2]);
     $this->m_font = $font;
     $this->m_fontWidth = imagefontwidth($font);
     $this->m_fontHeight = imagefontheight($font);
 }
Esempio n. 3
0
 function actionDemo12()
 {
     $ochart = new YDGraph(300, 130, 7, '#bbeebb');
     $ochart->setTitle("Impuls, line & dot", "#004400", 2);
     $ochart->setPlotArea(SOLID, "#888888", '#bbbbbb');
     $ochart->setLimits(0, 70, 10);
     $ochart->addSeries($this->vCht4, 'impuls', 'Series1', SOLID, '#000000', '#ffff00');
     $ochart->addSeries($this->vCht4, 'line', 'Series2', SOLID, '#ff0000', '#ffff00');
     $ochart->addSeries($this->vCht4, 'dot', 'Series3', SOLID, '#ff0000', '#ffff00');
     $ochart->setXAxis('#006600', MEDIUM_SOLID, 1, "", '%s');
     $ochart->setYAxis('#006600', SOLID, 5, "Y Axis", '%d');
     $ochart->setLabels($this->vLabels, '#000000', 1, HORIZONTAL);
     $ochart->plot();
 }