You are here

function pScatter::getPosArray in Visitors 7

Same name and namespace in other branches
  1. 7.2 pChart/class/pScatter.class.php \pScatter::getPosArray()
7 calls to pScatter::getPosArray()
pScatter::drawScatterBestFit in pChart/class/pScatter.class.php
pScatter::drawScatterLineChart in pChart/class/pScatter.class.php
pScatter::drawScatterPlotChart in pChart/class/pScatter.class.php
pScatter::drawScatterSplineChart in pChart/class/pScatter.class.php
pScatter::drawScatterThreshold in pChart/class/pScatter.class.php

... See full list

File

pChart/class/pScatter.class.php, line 552

Class

pScatter

Code

function getPosArray($Values, $AxisID) {
  $Data = $this->pDataObject
    ->getData();
  if (!is_array($Values)) {
    $Values = array(
      $Values,
    );
  }
  if ($Data["Axis"][$AxisID]["Identity"] == AXIS_X) {
    $Height = $this->pChartObject->GraphAreaX2 - $this->pChartObject->GraphAreaX1 - $Data["Axis"][$AxisID]["Margin"] * 2;
    $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
    $Step = $Height / $ScaleHeight;
    $Result = "";
    foreach ($Values as $Key => $Value) {
      if ($Value == VOID) {
        $Result[] = VOID;
      }
      else {
        $Result[] = $this->pChartObject->GraphAreaX1 + $Data["Axis"][$AxisID]["Margin"] + $Step * ($Value - $Data["Axis"][$AxisID]["ScaleMin"]);
      }
    }
    if (count($Result) == 1) {
      return $Result[0];
    }
    else {
      return $Result;
    }
  }
  else {
    $Height = $this->pChartObject->GraphAreaY2 - $this->pChartObject->GraphAreaY1 - $Data["Axis"][$AxisID]["Margin"] * 2;
    $ScaleHeight = $Data["Axis"][$AxisID]["ScaleMax"] - $Data["Axis"][$AxisID]["ScaleMin"];
    $Step = $Height / $ScaleHeight;
    $Result = "";
    foreach ($Values as $Key => $Value) {
      if ($Value == VOID) {
        $Result[] = VOID;
      }
      else {
        $Result[] = $this->pChartObject->GraphAreaY2 - $Data["Axis"][$AxisID]["Margin"] - $Step * ($Value - $Data["Axis"][$AxisID]["ScaleMin"]);
      }
    }
    if (count($Result) == 1) {
      return $Result[0];
    }
    else {
      return $Result;
    }
  }
}