DebugKit\View\Helper\SimpleGraphHelper::bar PHP Method

bar() public method

bar method
public bar ( float $value, integer $offset, array | Graph $options = [] ) : string
$value float Value to be graphed
$offset integer how much indentation
$options array | Graph Graph options
return string Html graph
    public function bar($value, $offset, $options = [])
    {
        $settings = array_merge($this->_defaultSettings, $options);
        /* @var int $max */
        /* @var int $width */
        /* @var string $valueType */
        extract($settings);
        $graphValue = $value / $max * $width;
        $graphValue = max(round($graphValue), 1);
        if ($valueType === 'percentage') {
            $graphOffset = 0;
        } else {
            $graphOffset = $offset / $max * $width;
            $graphOffset = round($graphOffset);
        }
        return sprintf('<div class="graph-bar" style="%s"><div class="graph-bar-value" style="%s" title="%s"> </div></div>', "width: {$width}px", "margin-left: {$graphOffset}px; width: {$graphValue}px", __d('debug_kit', "Starting {0}ms into the request, taking {1}ms", $offset, $value));
    }
SimpleGraphHelper