/** * Calculate suitable colors for each defined isobar * */ function CalculateColors() { if ($this->highcontrast) { if ($this->highcontrastbw) { for ($ib = 0; $ib < $this->nbrIsobars; $ib++) { $this->isobarColors[$ib] = 'black'; } } else { // Use only blue/red scale $step = round(255 / ($this->nbrIsobars - 1)); for ($ib = 0; $ib < $this->nbrIsobars; $ib++) { $this->isobarColors[$ib] = array($ib * $step, 50, 255 - $ib * $step); } } } else { $n = $this->nbrIsobars; $v = 0; $step = 1 / ($this->nbrIsobars - 1); for ($ib = 0; $ib < $this->nbrIsobars; $ib++) { $this->isobarColors[$ib] = RGB::GetSpectrum($v); $v += $step; } } }
/** * Calculate suitable colors for each defined isobar * */ function CalculateColors() { if ($this->highcontrast) { if ($this->highcontrastbw) { for ($ib = 0; $ib <= $this->nContours; $ib++) { $this->contcolors[$ib] = 'black'; } } else { // Use only blue/red scale $step = 255.0 / $this->nContours; for ($ib = 0; $ib <= $this->nContours; $ib++) { $this->contcolors[$ib] = array(round($ib * $step), 50, round(255 - $ib * $step)); } } } else { // This will return a basic spectrum from blue to red in even steps // this should probably be upgraded to our newer spectrum method introduced // with matrix plots $n = $this->nContours; $v = 0; $step = 1 / $this->nContours; for ($ib = 0; $ib <= $this->nContours; $ib++) { $this->contcolors[$ib] = RGB::GetSpectrum($v); $v += $step; } } }