当前位置: 首页>>代码示例>>PHP>>正文


PHP Graph::output方法代码示例

本文整理汇总了PHP中Graph::output方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::output方法的具体用法?PHP Graph::output怎么用?PHP Graph::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graph的用法示例。


在下文中一共展示了Graph::output方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

require_api('compress_api.php');
require_api('config_api.php');
require_api('graphviz_api.php');
require_api('workflow_api.php');
auth_ensure_user_authenticated();
if (!config_get('relationship_graph_enable')) {
    access_denied();
}
compress_enable();
$t_status_arr = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
$t_graph_fontname = config_get('relationship_graph_fontname');
$t_graph_fontsize = config_get('relationship_graph_fontsize');
$t_graph_fontpath = get_font_path();
$t_dot_tool = config_get('dot_tool');
$t_graph_attributes = array();
if (!empty($t_graph_fontpath)) {
    $t_graph_attributes['fontpath'] = $t_graph_fontpath;
}
$t_graph = new Graph('workflow', $t_graph_attributes, $t_dot_tool);
$t_graph->set_default_node_attr(array('fontname' => $t_graph_fontname, 'fontsize' => $t_graph_fontsize, 'shape' => 'record', 'style' => 'filled', 'height' => '0.2', 'width' => '0.4'));
$t_graph->set_default_edge_attr(array('style' => 'solid', 'color' => '#0000C0', 'dir' => 'forward'));
foreach ($t_status_arr as $t_from_status => $t_from_label) {
    $t_enum_status = MantisEnum::getAssocArrayIndexedByValues(config_get('status_enum_string'));
    foreach ($t_enum_status as $t_to_status_id => $t_to_status_label) {
        if (workflow_transition_edge_exists($t_from_status, $t_to_status_id)) {
            $t_graph->add_edge(string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_from_status)), string_no_break(MantisEnum::getLabel(lang_get('status_enum_string'), $t_to_status_id)), array());
        }
    }
}
$t_graph->output('png', true);
开发者ID:nextgens,项目名称:mantisbt,代码行数:30,代码来源:workflow_graph_img.php

示例2: relgraph_output_map

/**
 * Outputs an image map in XHTML format using the <map> element for the given
 * relationship graph.
 * @param Graph $p_graph Relationship graph object generated from relgraph_generate_graph_for_bug()
 * @param string $p_name The XHTML name attribute to apply to the containing <map> element
 * @return null
 */
function relgraph_output_map($p_graph, $p_name)
{
    echo '<map name="' . $p_name . '">' . "\n";
    $p_graph->output('cmapx');
    echo '</map>' . "\n";
}
开发者ID:nextgens,项目名称:mantisbt,代码行数:13,代码来源:relationship_graph_api.php

示例3: create_graph

function create_graph($type, $range = null)
{
    global $db;
    // Do we have date range criteria?
    if ($range['end'] || $range['start']) {
        $start = (int) $range['start'];
        $end = (int) $range['end'];
    } else {
        $start = TIME_NOW - 60 * 60 * 24 * 30;
        $end = TIME_NOW;
    }
    $allowed_types = array('users', 'threads', 'posts');
    if (!in_array($type, $allowed_types)) {
        die;
    }
    require_once MYBB_ROOT . 'inc/class_graph.php';
    $points = $stats = $datelines = array();
    if ($start == 0) {
        $query = $db->simple_select("stats", "dateline,num{$type}", "dateline <= '" . (int) $end . "'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 2));
        while ($stat = $db->fetch_array($query)) {
            $stats[] = $stat['num' . $type];
            $datelines[] = $stat['dateline'];
            $x_labels[] = date("m/j", $stat['dateline']);
        }
        $points[$datelines[0]] = 0;
        $points[$datelines[1]] = $stats[0] - $stats[1];
        ksort($points, SORT_NUMERIC);
    } elseif ($end == 0) {
        $query = $db->simple_select("stats", "dateline,num{$type}", "dateline >= '" . (int) $start . "'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 2));
        while ($stat = $db->fetch_array($query)) {
            $stats[] = $stat['num' . $type];
            $datelines[] = $stat['dateline'];
            $x_labels[] = date("m/j", $stat['dateline']);
        }
        $points[$datelines[0]] = 0;
        $points[$datelines[1]] = $stats[1] - $stats[0];
        ksort($points, SORT_NUMERIC);
    } else {
        $query = $db->simple_select("stats", "dateline,num{$type}", "dateline >= '" . (int) $start . "' AND dateline <= '" . (int) $end . "'", array('order_by' => 'dateline', 'order_dir' => 'asc'));
        while ($stat = $db->fetch_array($query)) {
            $points[$stat['dateline']] = $stat['num' . $type];
            $datelines[] = $stat['dateline'];
            $x_labels[] = date("m/j", $stat['dateline']);
        }
    }
    sort($datelines, SORT_NUMERIC);
    // Find our year(s) label
    $start_year = date('Y', $datelines[0]);
    $last_year = date('Y', $datelines[count($datelines) - 1]);
    if ($last_year - $start_year == 0) {
        $bottom_label = $start_year;
    } else {
        $bottom_label = $start_year . " - " . $last_year;
    }
    // Create the graph outline
    $graph = new Graph();
    $graph->add_points(array_values($points));
    $graph->add_x_labels($x_labels);
    $graph->set_bottom_label($bottom_label);
    $graph->render();
    $graph->output();
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:62,代码来源:statistics.php

示例4: array

    $graph->output($png);
    $graph->terminal = "epslatex linewidth 3";
    $graph->output($eps);
    // echo $graph;
}
$generators = array('simple' => 'Populate/Clear (high)');
$algorithms = array($lrpair, $pairs, $preev);
foreach ($generators as $generator => $generatorName) {
    $png = "graphs/{$generator}_high.png";
    $eps = "graphs/{$generator}_high.eps";
    if (file_exists($png) && file_exists($eps)) {
        if (filemtime($file) < filemtime($png) && filemtime(__FILE__) < filemtime($png)) {
            continue;
        }
    }
    $graph = new Graph();
    $graph->xrange = '[0:2000000]';
    $graph->title = "\"{$generatorName} benchmark\"";
    foreach ($algorithms as $algo) {
        $plot = new Plot();
        $plot->datafile = "< grep \"{$algo->selector}_{$generator}\" {$file}";
        $plot->datamodifiers = "using 2:5";
        $plot->style = "{$stdline} '{$algo->color}'";
        $plot->title = $algo->name;
        $graph->addPlot($plot);
    }
    $graph->output($png);
    $graph->terminal = "epslatex linewidth 3";
    $graph->output($eps);
    // echo $graph;
}
开发者ID:hvidgaard,项目名称:AADS,代码行数:31,代码来源:generate_graphs.php


注:本文中的Graph::output方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。