Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.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
Php JP图形线图:x轴时间值_Php_Jpgraph - Fatal编程技术网

Php JP图形线图:x轴时间值

Php JP图形线图:x轴时间值,php,jpgraph,Php,Jpgraph,我写了一个代码来画线图。X轴包含时间值,即小时01:00、02:00等。Y轴包含频率编号。问题是X轴从01:00开始,尽管我希望它从00:00开始。有人知道为什么会发生这种情况,以及如何避免这种转变吗 <?php ob_start(); include_once ( "../jpgraph-3.5.0b1/src/jpgraph.php"); include_once ("../jpgraph-3.5.0b1/src/jpgraph_bar.php"); inclu

我写了一个代码来画线图。X轴包含时间值,即小时01:00、02:00等。Y轴包含频率编号。问题是X轴从01:00开始,尽管我希望它从00:00开始。有人知道为什么会发生这种情况,以及如何避免这种转变吗

<?php
ob_start();
    include_once ( "../jpgraph-3.5.0b1/src/jpgraph.php");
    include_once ("../jpgraph-3.5.0b1/src/jpgraph_bar.php");
    include_once ("../jpgraph-3.5.0b1/src/jpgraph_line.php");
    include_once ("../jpgraph-3.5.0b1/src/jpgraph_date.php");
    include_once "../jpgraph-3.5.0b1/src/jpgraph_canvas.php";

//...data array

        $totalSec = 0; $stepSec = 60;
        $ntimepoints = 1440;
        $datax = array(); 
        $datay = array();
        for( $i=0; $i < $ntimepoints; $i++ ) {
            $datax[$i] = $totalSec;
            $datay[$i] = numberOfFits($data,$totalSec);
            $totalSec = $totalSec + $stepSec;
        }

        // Create the new graph
        $graph = new Graph(1200,300,"auto");

        // Slightly larger than normal margins at the bottom to have room for
        // the x-axis labels
        $graph->SetMargin(60,30,30,40);

        // Fix the Y-scale and use date for the x-axis
        $graph->SetScale('datlin');

        // Set the angle for the labels to 90 degrees
        $graph->xaxis->SetLabelAngle(90);
        $graph->xaxis->SetColor("black","#274E7D");
        $graph->yaxis->SetColor("black","#274E7D");
        $graph->yaxis->SetTitleMargin(40);

        // Set up font for axis
        //$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,8);
        $graph->yaxis->SetFont(FF_VERDANA,FS_NORMAL,10);
        $graph->yaxis->title->Set("Nr of resources");
        $graph->yaxis->title->SetColor("#274E7D");
        $graph->yaxis->title->SetFont(FF_VERDANA,FS_NORMAL,10);

        // Set up X-axis title (color &amp; font)
        //$graph->xaxis->title->Set("Time");
        $graph->xaxis->title->SetColor("#274E7D");
        $graph->xaxis->title->SetFont(FF_VERDANA,FS_NORMAL,10);

        $graph->xaxis->scale->SetTimeAlign(MINADJ_60);

        $graph->xaxis->scale->SetDateFormat('H:i');

        $line = new LinePlot($datay,$datax);

        $line->SetFillColor('#6899D3@0.5');
        //$line->SetStepStyle();

        $graph->Add($line);
        $graph->Stroke();
    }