~ko-de-r-de/zabbix/precise

« back to all changes in this revision

Viewing changes to frontends/php/include/classes/class.cchart.php

  • Committer: guntis
  • Date: 2013-08-01 06:46:25 UTC
  • Revision ID: svn-v4:f4e7fd02-d210-4e34-a1e0-d4093fb66cc2:trunk:37472
..F....... [ZBX-4986] absolute urls replaced with relative and fixed commit bugs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1417
1417
                );
1418
1418
        }
1419
1419
 
1420
 
        private function drawSides() {
1421
 
                if (isset($this->axis_valuetype[GRAPH_YAXIS_SIDE_RIGHT])
1422
 
                                && ($this->yaxisright != 0 || $this->skipRightScale != 1)) {
1423
 
                        $sides[] = GRAPH_YAXIS_SIDE_RIGHT;
1424
 
                }
1425
 
 
1426
 
                if (((isset($this->axis_valuetype[GRAPH_YAXIS_SIDE_LEFT]))
1427
 
                                && ($this->yaxisleft != 0 || $this->skipLeftScale != 1)) || !isset($sides)) {
1428
 
                        $sides[] = GRAPH_YAXIS_SIDE_LEFT;
1429
 
                }
1430
 
 
1431
 
                foreach ($sides as $side) {
1432
 
                        $minY = $this->m_minY[$side];
1433
 
                        $maxY = $this->m_maxY[$side];
1434
 
                        $units = null;
1435
 
                        $unitsLong = null;
1436
 
                        $byteStep = false;
1437
 
 
1438
 
                        for ($item = 0; $item < $this->num; $item++) {
1439
 
                                if ($this->items[$item]['axisside'] == $side) {
1440
 
                                        // check if items use B or Bps units
1441
 
                                        if ($this->items[$item]['units'] == 'B' || $this->items[$item]['units'] == 'Bps') {
1442
 
                                                $byteStep = true;
1443
 
                                        }
1444
 
                                        if (is_null($units)) {
1445
 
                                                $units = $this->items[$item]['units'];
1446
 
                                        }
1447
 
                                        elseif ($this->items[$item]['units'] != $units) {
1448
 
                                                $units = '';
1449
 
                                        }
1450
 
                                }
1451
 
                        }
1452
 
 
1453
 
                        if (is_null($units) || $units === false) {
1454
 
                                $units = '';
1455
 
                        }
1456
 
                        else {
1457
 
                                for ($item = 0; $item < $this->num; $item++) {
1458
 
                                        if ($this->items[$item]['axisside'] == $side && !empty($this->items[$item]['unitsLong'])) {
1459
 
                                                $unitsLong = $this->items[$item]['unitsLong'];
1460
 
                                                break;
1461
 
                                        }
1462
 
                                }
1463
 
                        }
1464
 
 
1465
 
                        if (!empty($unitsLong)) {
1466
 
                                $dims = imageTextSize(9, 90, $unitsLong);
1467
 
 
1468
 
                                $tmpY = $this->sizeY / 2 + $this->shiftY + $dims['height'] / 2;
1469
 
                                if ($tmpY < $dims['height']) {
1470
 
                                        $tmpY = $dims['height'] + 6;
1471
 
                                }
1472
 
 
1473
 
                                $tmpX = $side == GRAPH_YAXIS_SIDE_LEFT ? $dims['width'] + 8 : $this->fullSizeX - $dims['width'];
1474
 
 
1475
 
                                imageText(
1476
 
                                        $this->im,
1477
 
                                        9,
1478
 
                                        90,
1479
 
                                        $tmpX,
1480
 
                                        $tmpY,
1481
 
                                        $this->getColor($this->graphtheme['textcolor'], 0),
1482
 
                                        $unitsLong
1483
 
                                );
1484
 
                        }
1485
 
 
1486
 
                        $step = $this->gridStep[$side];
1487
 
                        $hstr_count = $this->gridLinesCount[$side];
1488
 
 
1489
 
                        // ignore milliseconds if  -1 <= maxY => 1 or -1 <= minY => 1
1490
 
                        $ignoreMillisec = (bccomp($maxY, -1) <= 0 || bccomp($maxY, 1) >= 0
1491
 
                                        || bccomp($minY, -1) <= 0 || bccomp($minY, 1) >= 0);
1492
 
 
1493
 
                        $newPow = false;
1494
 
                        if ($byteStep) {
1495
 
                                $maxYPow = convertToBase1024($maxY, 1024);
1496
 
                                $minYPow = convertToBase1024($minY, 1024);
1497
 
                                $powStep = 1024;
1498
 
                        } else {
1499
 
                                $maxYPow = convertToBase1024($maxY);
1500
 
                                $minYPow = convertToBase1024($minY);
1501
 
                                $powStep = 1000;
1502
 
                        }
1503
 
 
1504
 
                        if (abs($maxYPow['pow']) > abs($minYPow['pow']) && $maxYPow['value'] != 0) {
1505
 
                                $newPow = $maxYPow['pow'];
1506
 
                                if (abs(bcdiv($minYPow['value'], bcpow($powStep, $maxYPow['pow']))) > 1000) {
1507
 
                                        $newPow = $minYPow['pow'];
1508
 
                                }
1509
 
                        }
1510
 
                        if (abs($maxYPow['pow']) < abs($minYPow['pow']) && $minYPow['value'] != 0) {
1511
 
                                $newPow = $minYPow['pow'];
1512
 
                                if (abs(bcdiv($maxYPow['value'], bcpow($powStep, $minYPow['pow']))) > 1000) {
1513
 
                                        $newPow = $maxYPow['pow'];
1514
 
                                }
1515
 
                        }
1516
 
                        if ($maxYPow['pow'] == $minYPow['pow']) {
1517
 
                                $newPow = $maxYPow['pow'];
1518
 
                        }
1519
 
 
1520
 
                        $maxLength = false;
1521
 
                        // get all values in y-axis if units != 's'
1522
 
                        if ($units != 's') {
1523
 
                                $calcValues = array();
1524
 
                                for ($i = 0; $i <= $hstr_count; $i++) {
1525
 
                                        $hstr_count = ($hstr_count == 0) ? 1 : $hstr_count;
1526
 
 
1527
 
                                        $val = bcadd(bcmul($i, $step), $minY);
1528
 
 
1529
 
                                        if (bccomp(bcadd($val, bcdiv($step,2)), $maxY) == 1) {
1530
 
                                                continue;
1531
 
                                        }
1532
 
 
1533
 
                                        $calcValues[] = convert_units(array(
1534
 
                                                'value' => $val,
1535
 
                                                'convert' => ITEM_CONVERT_NO_UNITS,
1536
 
                                                'byteStep' => $byteStep,
1537
 
                                                'pow' => $newPow
1538
 
                                        ));
1539
 
                                }
1540
 
 
1541
 
                                $calcValues[] = convert_units(array(
1542
 
                                        'value' => $maxY,
1543
 
                                        'convert' => ITEM_CONVERT_NO_UNITS,
1544
 
                                        'byteStep' => $byteStep,
1545
 
                                        'pow' => $newPow
1546
 
                                ));
1547
 
 
1548
 
                                $maxLength = calcMaxLengthAfterDot($calcValues);
1549
 
                        }
1550
 
 
1551
 
                        for ($i = 0; $i <= $hstr_count; $i++) {
1552
 
                                $hstr_count = ($hstr_count == 0) ? 1 : $hstr_count;
1553
 
 
1554
 
                                $val = bcadd(bcmul($i, $step), $minY);
1555
 
 
1556
 
                                if (bccomp(bcadd($val, bcdiv($step, 2)), $maxY) == 1) {
1557
 
                                        continue;
1558
 
                                }
1559
 
 
1560
 
                                $str = convert_units(array(
1561
 
                                        'value' => $val,
1562
 
                                        'units' => $units,
1563
 
                                        'convert' => ITEM_CONVERT_NO_UNITS,
1564
 
                                        'byteStep' => $byteStep,
1565
 
                                        'pow' => $newPow,
1566
 
                                        'ignoreMillisec' => $ignoreMillisec,
1567
 
                                        'length' => $maxLength
1568
 
                                ));
1569
 
 
1570
 
                                if ($side == GRAPH_YAXIS_SIDE_LEFT) {
1571
 
                                        $dims = imageTextSize(8, 0, $str);
1572
 
                                        $posX = $this->shiftXleft - $dims['width'] - 9;
1573
 
                                }
1574
 
                                else {
1575
 
                                        $posX = $this->sizeX + $this->shiftXleft + 12;
1576
 
                                }
1577
 
 
1578
 
                                // marker Y coordinate
1579
 
                                $posY = $this->sizeY + $this->shiftY - $this->gridStepX[$side] * $i + 4;
1580
 
 
1581
 
                                imageText(
1582
 
                                        $this->im,
1583
 
                                        8,
1584
 
                                        0,
1585
 
                                        $posX,
1586
 
                                        $posY,
1587
 
                                        $this->getColor($this->graphtheme['textcolor'], 0),
1588
 
                                        $str
1589
 
                                );
1590
 
                        }
1591
 
 
1592
 
                        $str = convert_units(array(
1593
 
                                'value' => $maxY,
1594
 
                                'units' => $units,
1595
 
                                'convert' => ITEM_CONVERT_NO_UNITS,
1596
 
                                'byteStep' => $byteStep,
1597
 
                                'pow' => $newPow,
1598
 
                                'ignoreMillisec' => $ignoreMillisec,
1599
 
                                'length' => $maxLength
1600
 
                        ));
1601
 
 
1602
 
                        if ($side == GRAPH_YAXIS_SIDE_LEFT) {
1603
 
                                $dims = imageTextSize(8, 0, $str);
1604
 
                                $posX = $this->shiftXleft - $dims['width'] - 9;
1605
 
                                $color = $this->getColor(GRAPH_ZERO_LINE_COLOR_LEFT);
1606
 
                        }
1607
 
                        else {
1608
 
                                $posX = $this->sizeX + $this->shiftXleft + 12;
1609
 
                                $color = $this->getColor(GRAPH_ZERO_LINE_COLOR_RIGHT);
1610
 
                        }
1611
 
 
1612
 
                        imageText(
1613
 
                                $this->im,
1614
 
                                8,
1615
 
                                0,
1616
 
                                $posX,
1617
 
                                $this->shiftY + 4,
1618
 
                                $this->getColor($this->graphtheme['textcolor'], 0),
1619
 
                                $str
1620
 
                        );
1621
 
 
1622
 
                        if ($this->zero[$side] != $this->sizeY + $this->shiftY && $this->zero[$side] != $this->shiftY) {
1623
 
                                zbx_imageline(
1624
 
                                        $this->im,
1625
 
                                        $this->shiftXleft,
1626
 
                                        $this->zero[$side],
1627
 
                                        $this->shiftXleft + $this->sizeX,
1628
 
                                        $this->zero[$side],
1629
 
                                        $color
1630
 
                                );
1631
 
                        }
 
1420
        private function drawLeftSide() {
 
1421
                if ($this->yaxisleft == 0 || $this->skipLeftScale == 1) {
 
1422
                        return;
 
1423
                }
 
1424
 
 
1425
                $minY = $this->m_minY[GRAPH_YAXIS_SIDE_LEFT];
 
1426
                $maxY = $this->m_maxY[GRAPH_YAXIS_SIDE_LEFT];
 
1427
 
 
1428
                $units = null;
 
1429
                $unitsLong = null;
 
1430
                $byteStep = false;
 
1431
                for ($item = 0; $item < $this->num; $item++) {
 
1432
                        if ($this->items[$item]['axisside'] == GRAPH_YAXIS_SIDE_LEFT) {
 
1433
                                // check if items use B or Bps units
 
1434
                                if ($this->items[$item]['units'] == 'B' || $this->items[$item]['units'] == 'Bps') {
 
1435
                                        $byteStep = true;
 
1436
                                }
 
1437
                                if (is_null($units)) {
 
1438
                                        $units = $this->items[$item]['units'];
 
1439
                                }
 
1440
                                elseif ($this->items[$item]['units'] != $units) {
 
1441
                                        $units = '';
 
1442
                                }
 
1443
                        }
 
1444
                }
 
1445
 
 
1446
                if (is_null($units) || $units === false) {
 
1447
                        $units = '';
 
1448
                }
 
1449
                else {
 
1450
                        for ($item = 0; $item < $this->num; $item++) {
 
1451
                                if ($this->items[$item]['axisside'] == GRAPH_YAXIS_SIDE_LEFT && !empty($this->items[$item]['unitsLong'])) {
 
1452
                                        $unitsLong = $this->items[$item]['unitsLong'];
 
1453
                                        break;
 
1454
                                }
 
1455
                        }
 
1456
                }
 
1457
 
 
1458
                if (!empty($unitsLong)) {
 
1459
                        $dims = imageTextSize(9, 90, $unitsLong);
 
1460
 
 
1461
                        $tmpY = $this->sizeY / 2 + $this->shiftY+$dims['height'] / 2;
 
1462
                        if ($tmpY < $dims['height']) {
 
1463
                                $tmpY = $dims['height'] + 6;
 
1464
                        }
 
1465
 
 
1466
                        imageText(
 
1467
                                $this->im,
 
1468
                                9,
 
1469
                                90,
 
1470
                                $dims['width'] + 8,
 
1471
                                $tmpY,
 
1472
                                $this->getColor($this->graphtheme['textcolor'], 0),
 
1473
                                $unitsLong
 
1474
                        );
 
1475
                }
 
1476
 
 
1477
                $step = $this->gridStep[GRAPH_YAXIS_SIDE_LEFT];
 
1478
                $hstr_count = $this->gridLinesCount[GRAPH_YAXIS_SIDE_LEFT];
 
1479
 
 
1480
                // ignore milliseconds if  -1 <= maxY => 1 or -1 <= minY => 1
 
1481
                $ignoreMillisec = (bccomp($maxY, -1) <= 0 || bccomp($maxY, 1) >= 0
 
1482
                                || bccomp($minY, -1) <= 0 || bccomp($minY, 1) >= 0);
 
1483
 
 
1484
                $newPow = false;
 
1485
                if ($byteStep) {
 
1486
                        $maxYPow = convertToBase1024($maxY, 1024);
 
1487
                        $minYPow = convertToBase1024($minY, 1024);
 
1488
                        $powStep = 1024;
 
1489
                } else {
 
1490
                        $maxYPow = convertToBase1024($maxY);
 
1491
                        $minYPow = convertToBase1024($minY);
 
1492
                        $powStep = 1000;
 
1493
                }
 
1494
 
 
1495
                if (abs($maxYPow['pow']) > abs($minYPow['pow']) && $maxYPow['value'] != 0) {
 
1496
                        $newPow = $maxYPow['pow'];
 
1497
                        if (abs(bcdiv($minYPow['value'], bcpow($powStep, $maxYPow['pow']))) > 1000) {
 
1498
                                $newPow = $minYPow['pow'];
 
1499
                        }
 
1500
                }
 
1501
                if (abs($maxYPow['pow']) < abs($minYPow['pow']) && $minYPow['value'] != 0) {
 
1502
                        $newPow = $minYPow['pow'];
 
1503
                        if (abs(bcdiv($maxYPow['value'], bcpow($powStep, $minYPow['pow']))) > 1000) {
 
1504
                                $newPow = $maxYPow['pow'];
 
1505
                        }
 
1506
                }
 
1507
                if ($maxYPow['pow'] == $minYPow['pow']) {
 
1508
                        $newPow = $maxYPow['pow'];
 
1509
                }
 
1510
 
 
1511
                for ($i = 0; $i <= $hstr_count; $i++) {
 
1512
                        // division by zero
 
1513
                        $hstr_count = ($hstr_count == 0) ? 1 : $hstr_count;
 
1514
 
 
1515
                        // using bc library, incase of large numbers
 
1516
                        $val = bcadd(bcmul($i, $step), $minY);
 
1517
 
 
1518
                        if (bccomp(bcadd($val, bcdiv($step,2)), $maxY) == 1) {
 
1519
                                continue;
 
1520
                        }
 
1521
 
 
1522
                        $str = convert_units($val, $units, ITEM_CONVERT_NO_UNITS, $byteStep, $newPow, $ignoreMillisec);
 
1523
 
 
1524
                        $dims = imageTextSize(8, 0, $str);
 
1525
 
 
1526
                        // marker Y coordinate
 
1527
                        $posY = $this->sizeY + $this->shiftY - $this->gridStepX[GRAPH_YAXIS_SIDE_LEFT] * $i + 4;
 
1528
 
 
1529
                        imageText(
 
1530
                                $this->im,
 
1531
                                8,
 
1532
                                0,
 
1533
                                $this->shiftXleft - $dims['width'] - 9,
 
1534
                                $posY,
 
1535
                                $this->getColor($this->graphtheme['textcolor'], 0),
 
1536
                                $str
 
1537
                        );
 
1538
                }
 
1539
 
 
1540
                $str = convert_units($maxY, $units, ITEM_CONVERT_NO_UNITS, $byteStep, $newPow, $ignoreMillisec);
 
1541
 
 
1542
                $dims = imageTextSize(8, 0, $str);
 
1543
                imageText(
 
1544
                        $this->im,
 
1545
                        8,
 
1546
                        0,
 
1547
                        $this->shiftXleft - $dims['width'] - 9,
 
1548
                        $this->shiftY  + 4,
 
1549
                        $this->getColor($this->graphtheme['textcolor'], 0),
 
1550
                        $str
 
1551
                );
 
1552
 
 
1553
                if ($this->zero[GRAPH_YAXIS_SIDE_LEFT] != ($this->sizeY + $this->shiftY) && $this->zero[GRAPH_YAXIS_SIDE_LEFT] != $this->shiftY) {
 
1554
                        zbx_imageline(
 
1555
                                $this->im,
 
1556
                                $this->shiftXleft,
 
1557
                                $this->zero[GRAPH_YAXIS_SIDE_LEFT],
 
1558
                                $this->shiftXleft + $this->sizeX,
 
1559
                                $this->zero[GRAPH_YAXIS_SIDE_LEFT],
 
1560
                                $this->getColor(GRAPH_ZERO_LINE_COLOR_LEFT)
 
1561
                        );
 
1562
                }
 
1563
        }
 
1564
 
 
1565
        private function drawRightSide() {
 
1566
                if ($this->yaxisright == 0 || $this->skipRightScale == 1) {
 
1567
                        return;
 
1568
                }
 
1569
 
 
1570
                $minY = $this->m_minY[GRAPH_YAXIS_SIDE_RIGHT];
 
1571
                $maxY = $this->m_maxY[GRAPH_YAXIS_SIDE_RIGHT];
 
1572
 
 
1573
                $units = null;
 
1574
                $unitsLong = null;
 
1575
                $byteStep = false;
 
1576
                for ($item = 0; $item < $this->num; $item++) {
 
1577
                        if ($this->items[$item]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT) {
 
1578
                                // check if items use B or Bps units
 
1579
                                if ($this->items[$item]['units'] == 'B' || $this->items[$item]['units'] == 'Bps') {
 
1580
                                        $byteStep = true;
 
1581
                                }
 
1582
                                if (is_null($units)) {
 
1583
                                        $units = $this->items[$item]['units'];
 
1584
                                }
 
1585
                                elseif ($this->items[$item]['units'] != $units) {
 
1586
                                        $units = '';
 
1587
                                }
 
1588
                        }
 
1589
                }
 
1590
 
 
1591
                if (is_null($units) || $units === false) {
 
1592
                        $units = '';
 
1593
                }
 
1594
                else {
 
1595
                        for ($item = 0; $item < $this->num; $item++) {
 
1596
                                if ($this->items[$item]['axisside'] == GRAPH_YAXIS_SIDE_RIGHT && !empty($this->items[$item]['unitsLong'])) {
 
1597
                                        $unitsLong = $this->items[$item]['unitsLong'];
 
1598
                                        break;
 
1599
                                }
 
1600
                        }
 
1601
                }
 
1602
 
 
1603
                if (!empty($unitsLong)) {
 
1604
                        $dims = imageTextSize(9, 90, $unitsLong);
 
1605
 
 
1606
                        $tmpY = $this->sizeY / 2 + $this->shiftY + $dims['height'] / 2;
 
1607
                        if ($tmpY < $dims['height']) {
 
1608
                                $tmpY = $dims['height'] + 6;
 
1609
                        }
 
1610
 
 
1611
                        imageText(
 
1612
                                $this->im,
 
1613
                                9,
 
1614
                                90,
 
1615
                                $this->fullSizeX - $dims['width'],
 
1616
                                $tmpY,
 
1617
                                $this->getColor($this->graphtheme['textcolor'], 0),
 
1618
                                $unitsLong
 
1619
                        );
 
1620
                }
 
1621
 
 
1622
                $step = $this->gridStep[GRAPH_YAXIS_SIDE_RIGHT];
 
1623
                $hstr_count = $this->gridLinesCount[GRAPH_YAXIS_SIDE_RIGHT];
 
1624
 
 
1625
                // ignore milliseconds if  -1 <= maxY => 1 or -1 <= minY => 1
 
1626
                $ignoreMillisec = (bccomp($maxY, -1) <= 0 || bccomp($maxY, 1) >= 0
 
1627
                                || bccomp($minY, -1) <= 0 || bccomp($minY, 1) >= 0);
 
1628
 
 
1629
                $newPow = false;
 
1630
                if ($byteStep) {
 
1631
                        $maxYPow = convertToBase1024($maxY, 1024);
 
1632
                        $minYPow = convertToBase1024($minY, 1024);
 
1633
                        $powStep = 1024;
 
1634
                } else {
 
1635
                        $maxYPow = convertToBase1024($maxY);
 
1636
                        $minYPow = convertToBase1024($minY);
 
1637
                        $powStep = 1000;
 
1638
                }
 
1639
 
 
1640
                if (abs($maxYPow['pow']) > abs($minYPow['pow']) && $maxYPow['value'] != 0) {
 
1641
                        $newPow = $maxYPow['pow'];
 
1642
                        if (abs(bcdiv($minYPow['value'], bcpow($powStep, $maxYPow['pow']))) > 1000) {
 
1643
                                $newPow = $minYPow['pow'];
 
1644
                        }
 
1645
                }
 
1646
                if (abs($maxYPow['pow']) < abs($minYPow['pow']) && $minYPow['value'] != 0) {
 
1647
                        $newPow = $minYPow['pow'];
 
1648
                        if (abs(bcdiv($maxYPow['value'], bcpow($powStep, $minYPow['pow']))) > 1000) {
 
1649
                                $newPow = $maxYPow['pow'];
 
1650
                        }
 
1651
                }
 
1652
                if ($maxYPow['pow'] == $minYPow['pow']) {
 
1653
                        $newPow = $maxYPow['pow'];
 
1654
                }
 
1655
 
 
1656
                for ($i = 0; $i <= $hstr_count; $i++) {
 
1657
                        if ($hstr_count == 0) {
 
1658
                                continue;
 
1659
                        }
 
1660
 
 
1661
                        // using bc module in case of large numbers
 
1662
                        $val = bcadd(bcmul($i, $step), $minY);
 
1663
 
 
1664
                        if (bccomp(bcadd($val, bcdiv($step, 2)), $maxY) == 1) {
 
1665
                                continue;
 
1666
                        }
 
1667
 
 
1668
                        $str = convert_units($val, $units, ITEM_CONVERT_NO_UNITS, $byteStep, $newPow, $ignoreMillisec);
 
1669
 
 
1670
                        // marker Y coordinate
 
1671
                        $posY = $this->sizeY + $this->shiftY - $this->gridStepX[GRAPH_YAXIS_SIDE_RIGHT] * $i + 4;
 
1672
 
 
1673
                        imageText(
 
1674
                                $this->im,
 
1675
                                8,
 
1676
                                0,
 
1677
                                $this->sizeX + $this->shiftXleft + 12,
 
1678
                                $posY,
 
1679
                                $this->getColor($this->graphtheme['textcolor'], 0),
 
1680
                                $str
 
1681
                        );
 
1682
                }
 
1683
 
 
1684
                $str = convert_units($maxY, $units, ITEM_CONVERT_NO_UNITS, $byteStep, $newPow, $ignoreMillisec);
 
1685
                imageText(
 
1686
                        $this->im,
 
1687
                        8,
 
1688
                        0,
 
1689
                        $this->sizeX + $this->shiftXleft + 12,
 
1690
                        $this->shiftY + 4,
 
1691
                        $this->getColor($this->graphtheme['textcolor'], 0),
 
1692
                        $str
 
1693
                );
 
1694
 
 
1695
                if ($this->zero[GRAPH_YAXIS_SIDE_RIGHT] != $this->sizeY + $this->shiftY
 
1696
                                && $this->zero[GRAPH_YAXIS_SIDE_RIGHT] != $this->shiftY) {
 
1697
                        zbx_imageline(
 
1698
                                $this->im,
 
1699
                                $this->shiftXleft,
 
1700
                                $this->zero[GRAPH_YAXIS_SIDE_RIGHT],
 
1701
                                $this->shiftXleft + $this->sizeX,
 
1702
                                $this->zero[GRAPH_YAXIS_SIDE_RIGHT],
 
1703
                                $this->getColor(GRAPH_ZERO_LINE_COLOR_RIGHT)
 
1704
                        );
1632
1705
                }
1633
1706
        }
1634
1707
 
1847
1920
                                $legend->addCell($rowNum, array('text' => $item_caption));
1848
1921
                                $legend->addCell($rowNum, array('text' => '['.$fncRealName.']'));
1849
1922
                                $legend->addCell($rowNum, array(
1850
 
                                        'text' => convert_units(array(
1851
 
                                                'value' => $this->getLastValue($i),
1852
 
                                                'units' => $this->items[$i]['units'],
1853
 
                                                'convert' => ITEM_CONVERT_NO_UNITS
1854
 
                                        )),
1855
 
                                        'align' => 2
1856
 
                                ));
1857
 
                                $legend->addCell($rowNum, array(
1858
 
                                        'text' => convert_units(array(
1859
 
                                                'value' => min($data['min']),
1860
 
                                                'units' => $this->items[$i]['units'],
1861
 
                                                'convert' => ITEM_CONVERT_NO_UNITS
1862
 
                                        )),
1863
 
                                        'align' => 2
1864
 
                                ));
1865
 
                                $legend->addCell($rowNum, array(
1866
 
                                        'text' => convert_units(array(
1867
 
                                                'value' => $data['avg_orig'],
1868
 
                                                'units' => $this->items[$i]['units'],
1869
 
                                                'convert' => ITEM_CONVERT_NO_UNITS
1870
 
                                        )),
1871
 
                                        'align' => 2
1872
 
                                ));
1873
 
                                $legend->addCell($rowNum, array(
1874
 
                                        'text' => convert_units(array(
1875
 
                                                'value' => max($data['max']),
1876
 
                                                'units' => $this->items[$i]['units'],
1877
 
                                                'convert' => ITEM_CONVERT_NO_UNITS
1878
 
                                        )),
 
1923
                                        'text' => convert_units($this->getLastValue($i), $this->items[$i]['units'], ITEM_CONVERT_NO_UNITS),
 
1924
                                        'align' => 2
 
1925
                                ));
 
1926
                                $legend->addCell($rowNum, array(
 
1927
                                        'text' => convert_units(min($data['min']), $this->items[$i]['units'], ITEM_CONVERT_NO_UNITS),
 
1928
                                        'align' => 2
 
1929
                                ));
 
1930
                                $legend->addCell($rowNum, array(
 
1931
                                        'text' => convert_units($data['avg_orig'], $this->items[$i]['units'], ITEM_CONVERT_NO_UNITS),
 
1932
                                        'align' => 2
 
1933
                                ));
 
1934
                                $legend->addCell($rowNum, array(
 
1935
                                        'text' => convert_units(max($data['max']), $this->items[$i]['units'], ITEM_CONVERT_NO_UNITS),
1879
1936
                                        'align' => 2
1880
1937
                                ));
1881
1938
                        }
1916
1973
                        foreach ($this->percentile as $side => $percentile) {
1917
1974
                                if ($percentile['percent'] > 0 && $percentile['value']) {
1918
1975
                                        $percentile['percent'] = (float) $percentile['percent'];
1919
 
                                        $convertedUnit = convert_units(array(
1920
 
                                                'value' => $percentile['value'],
1921
 
                                                'units' => $units[$side]
1922
 
                                        ));
1923
1976
                                        $legend->addCell($rowNum, array(
1924
 
                                                'text' => $percentile['percent'].'th percentile: '.$convertedUnit.' ('.$side.')',
 
1977
                                                'text' => $percentile['percent'].'th percentile: '.convert_units($percentile['value'], $units[$side]).' ('.$side.')',
1925
1978
                                                ITEM_CONVERT_NO_UNITS
1926
1979
                                        ));
1927
1980
                                        if ($side == 'left') {
2448
2501
                        }
2449
2502
                }
2450
2503
 
2451
 
                $this->drawSides();
 
2504
                if (isset($this->axis_valuetype[GRAPH_YAXIS_SIDE_LEFT])) {
 
2505
                        $this->drawLeftSide();
 
2506
                }
 
2507
 
 
2508
                if (isset($this->axis_valuetype[GRAPH_YAXIS_SIDE_RIGHT])) {
 
2509
                        $this->drawRightSide();
 
2510
                }
2452
2511
 
2453
2512
                if ($this->drawLegend) {
2454
2513
                        $this->drawTriggers();