Add to pDraw.class.php:
Code:
function drawVerticalLine($SeriesName, $Index, $Format="") {
$VerticalLineR = isset($Format["VerticalLineR"]) ? $Format["VerticalLineR"] : 0;
$VerticalLineG = isset($Format["VerticalLineG"]) ? $Format["VerticalLineG"] : 0;
$VerticalLineB = isset($Format["VerticalLineB"]) ? $Format["VerticalLineB"] : 0;
$VerticalLineAlpha = isset($Format["VerticalLineAlpha"]) ? $Format["VerticalLineAlpha"] : 40;
$VerticalLineTicks = isset($Format["VerticalLineTicks"]) ? $Format["VerticalLineTicks"] : 2;
$Data = $this->DataSet->getData();
list($XMargin,$XDivs) = $this->scaleGetXSettings();
if ( $XDivs == 0 ) { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1)/4; } else { $XStep = ($this->GraphAreaX2-$this->GraphAreaX1-$XMargin*2)/$XDivs; }
$X = $this->GraphAreaX1 + $XMargin + $Index * $XStep;
$this->drawLine(
$X,
$this->GraphAreaY1 + $Data["YMargin"],
$X,
$this->GraphAreaY2-$Data["YMargin"],
array("R"=>$VerticalLineR,"G"=>$VerticalLineG,"B"=>$VerticalLineB,"Alpha"=>$VerticalLineAlpha,"Ticks"=>$VerticalLineTicks)
);
}
Now if you have an Y-Date-Axis and you want to put a vertical line on each Friday and Monday (to separate Saturday and Sunday), just go like this:
Code:
foreach($this->pChartData->getValues("Date") as $index => $date) {
$dateSplit = preg_split ('/\./', $date); /* this depends on your format.. mine is DD.MM.YYYY */
$weekDay = date('N', mktime(0, 0, 0, (int)$dateSplit[1], (int)$dateSplit[0], (int)$dateSplit[2]));
if ( $weekDay == 5 | $weekDay == 1) {
$this->pChart->drawVerticalLine("Date", $index, $LabelSettings);
}
}
Will look like attached (in combination with "BreakVoid"=>FALSE format for drawLineChart)..