You are here

function pChart::ToMetric in Visitors 7.0

Same name and namespace in other branches
  1. 8 pchart/pChart.inc \pChart::ToMetric()
1 call to pChart::ToMetric()
pChart::drawScale in pchart/pChart.inc

File

pchart/pChart.inc, line 2609

Class

pChart

Code

function ToMetric($Value) {
  $Go = floor($Value / 1000000000);
  $Mo = floor(($Value - $Go * 1000000000) / 1000000);
  $Ko = floor(($Value - $Go * 1000000000 - $Mo * 1000000) / 1000);
  $o = floor($Value - $Go * 1000000000 - $Mo * 1000000 - $Ko * 1000);
  if ($Go != 0) {
    return $Go . "." . $Mo . "g";
  }
  if ($Mo != 0) {
    return $Mo . "." . $ko . "m";
  }
  if ($Ko != 0) {
    return $Ko . "." . $o . "k";
  }
  return $o;
}