Example #1
0
 function addIndicator($height)
 {
     #create a new chart object
     $ret = new XYChart($this->m_totalWidth, $height + $this->m_topMargin + $this->m_bottomMargin, Transparent);
     $ret->setTrimData($this->m_extraPoints);
     if ($this->m_currentChart != null) {
         #if there is a chart before the newly created chart, disable its x-axis, and copy
         #its x-axis labels to the new chart
         $this->m_currentChart->xAxis->setColors(Transparent, Transparent);
         $ret->xAxis->copyAxis($this->m_currentChart->xAxis);
         #add chart to MultiChart and update the total height
         $this->addChart(0, $this->m_totalHeight + $this->m_plotAreaGap, $ret);
         $this->m_totalHeight = $this->m_totalHeight + $height + 1 + $this->m_plotAreaGap;
     } else {
         #no existing chart - create the x-axis labels from scratch
         $this->setXLabels($ret->xAxis);
         #add chart to MultiChart and update the total height
         $this->addChart(0, $this->m_totalHeight, $ret);
         $this->m_totalHeight = $this->m_totalHeight + $height + 1;
     }
     #the newly created chart becomes the current chart
     $this->m_currentChart = $ret;
     #update the size
     $this->setSize($this->m_totalWidth, $this->m_totalHeight + $this->m_topMargin + $this->m_bottomMargin);
     #configure the plot area
     $plotAreaObj = $ret->setPlotArea($this->m_leftMargin, $this->m_topMargin, $this->m_totalWidth - $this->m_leftMargin - $this->m_rightMargin, $height, $this->m_plotAreaBgColor, -1, $this->m_plotAreaBorder);
     $plotAreaObj->setGridColor($this->m_majorHGridColor, $this->m_majorVGridColor, $this->m_minorHGridColor, $this->m_minorVGridColor);
     $ret->setAntiAlias($this->m_antiAlias);
     #configure legend box
     $box = $ret->addLegend($this->m_leftMargin, $this->m_topMargin, false, $this->m_legendFont, $this->m_legendFontSize);
     $box->setFontColor($this->m_legendFontColor);
     $box->setBackground($this->m_legendBgColor);
     $box->setMargin2(5, 0, 2, 1);
     $box->setSize($this->m_totalWidth - $this->m_leftMargin - $this->m_rightMargin + 1, 0);
     #configure x-axis
     $a = $ret->xAxis;
     $a->setIndent(true);
     $a->setTickLength(2, 0);
     $a->setColors(Transparent, $this->m_xAxisFontColor, $this->m_xAxisFontColor, $this->m_xAxisFontColor);
     $a->setLabelStyle($this->m_xAxisFont, $this->m_xAxisFontSize, $this->m_xAxisFontColor, $this->m_xAxisFontAngle);
     #configure y-axis
     $ret->setYAxisOnRight($this->m_axisOnRight);
     $this->configureYAxis($ret->yAxis, $height);
     return $ret;
 }