Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从svggraph(php库)反转y轴数据?_Php_Graph_Charts_Svggraph - Fatal编程技术网

如何从svggraph(php库)反转y轴数据?

如何从svggraph(php库)反转y轴数据?,php,graph,charts,svggraph,Php,Graph,Charts,Svggraph,我需要从图表中反转数据,比如当我得到2015年3月到2014年4月的数据时,我希望2015年3月(实际时间)在右边,而不是左边。我正在使用SVGGraph库。谢谢大家! $graph = new SVGGraph($w, $h, $settings); $data = []; for ($i = 1; $i <= 12; $i++) { switch ($op) { case "eaqf-f": $data["$y-$m"] = StatUt

我需要从图表中反转数据,比如当我得到2015年3月到2014年4月的数据时,我希望2015年3月(实际时间)在右边,而不是左边。我正在使用SVGGraph库。谢谢大家!

$graph = new SVGGraph($w, $h, $settings);
$data = [];
for ($i = 1; $i <= 12; $i++) {
    switch ($op) {
        case "eaqf-f":
            $data["$y-$m"] = StatUtil::getTotalEaInvoiced($y, $m, $oid);
            $data["$y-$m"] = $data["$y-$m"]['q'];
        break;

        case "cv-val":
            $data["$y-$m"] = StatUtil::getInvoicedCVs($y, $m, $oid);
        break;

        case "eaqf-r":
            $data["$y-$m"] = StatUtil::getTotalConsumption($y, $m, $oid);
        break;

        default: throw RuntimeException("Unsupported op: $op");
    }

    if (--$m == 0) {
        $m = 12;
        --$y;
    }
}

$graph ->Values($data);
$graph ->Render("Linegraph");
$graph=新的SVGGraph($w,$h,$settings);
$data=[];
对于($i=1;$i值($data);
$graph->Render(“线条图”);
for ($i = 1; $i <= 12; $i++) {
$_key = sprintf('%1$04d-%2$02d', $y, $m);
    switch ($op) {
    case "eaqf-f":
        $data[$_key] = StatUtil::getTotalEaInvoiced($y, $m, $oid);
        $data[$_key] = $data[$_key]['q'];
        break;
ksort($data, SORT_STRING);