示例#1
0
<?php

include 'gauge.class.php';
$gauge = new gauge();
$gauge->setPos(85);
$gauge->setLegend('SALES');
$gauge->plot();
示例#2
0
文件: gauge.php 项目: name256/crm42
<?php

include 'gauge.class.php';
$value = $_GET['value'];
$size = $_GET['size'];
$text = $_GET['text'];
$red = $_GET['red'];
$yellow = $_GET['yellow'];
$min = $_GET['min'];
$max = $_GET['max'];
$span = $_GET['span'];
$used = $_GET["used"];
$ava = $_GET["available"];
if ($used != '' && $ava != '') {
    $value = $used / $ava * 100;
}
if ($value > 100) {
    $value = 100;
}
$gauge = new gauge();
$gauge->setPos($value);
$gauge->setImagesize($size);
$gauge->setLegend($text);
//$gauge->setGreen($green);
//$gauge->setYellow($yellow);
//$gauge->setMax($max);
//$gauge->setMin($min);
//$gauge->setSpan($span);
$gauge->plot();
示例#3
0
            $array[$c]['LineMax'] = $this->coordinates($radiusLineMax, $degreelb, $indentLineMax, $indentLineMax);
        }
        return $array;
    }
    public function coordinates($radius, $degree, $margin_left, $margin_top)
    {
        //Катет b
        $b = (double) sin(deg2rad($degree)) * $radius;
        //Катет c
        $c = (double) cos(deg2rad($degree)) * $radius;
        $L = $radius - ($radius - ($radius - $b));
        $T = $radius + $c;
        return array('leftOuter' => $L + $margin_left, 'topOuter' => $T + $margin_top, 'degree' => $radius);
    }
}
$classFauge = new gauge();
$array = $classFauge->params();
$width = 400;
?>
<svg height="<?php 
echo $width;
?>
" version="1.1" width="<?php 
echo $width;
?>
" xmlns="http://www.w3.org/2000/svg" style="margin-left: 100px; border: solid 1px #ccc;">
    <defs>
        <linearGradient id="GaugeRadiusBig">
            <stop offset="100%" stop-color="#999"></stop>
        </linearGradient>
    </defs>