我有一个折线图,我试图在 x 轴上设置日期格式,但它改为显示时间。
$this->Widget('ext.highcharts.HighchartsWidget', array(
'options'=>array(
'type'=>'spline',
'title' => array('text' => 'Project Report'),
'xAxis' => array(
'type'=> 'datetime',
'dateTimeLabelFormats'=>array( // don't display the dummy year
'month'=> '%e %b',
'year'=> '%y'
),
),
'yAxis' =>array(
'title' => array('text' => 'Percent %'),
'min'=>0,
'max'=>100
),
'series' =>$series['series']
)
));
这将显示以下图片
我的系列数组:
$date_from = date("Y, m, d",strtotime($data->StartDATE) - 2*86400);
$date_to = date("Y, m, d",strtotime($data->ProjectEndDate) + 2*86400);
$series['series'][] = array("name"=>$data->PROJECT,"data"=>array(array($date_from,0),array( date("Y, m, d",strtotime( date('Y-m-d') + + 2*86400) ) ,(int) 30),array( $date_to ,100 ))) ;
这个数组的输出是:Array ( [name] => Fastnet OffshWest Shetland [data] => Array ( [0] => Array ( [0] => 2013, 06, 09 [1] => 0 ) [1] => Array ( [0] => 2013, 06, 20 [1] => 30 ) [2] => Array ( [0] => 2013, 12, 13 [1] => 100 ) ) )
我也试过
$date_from = gmdate('d.m.Y H:i', strtotime($data->StartDATE) );
$date_to = gmdate('d.m.Y H:i', strtotime($data->ProjectEndDate));
$series['series'][] = array("name"=>$data->PROJECT,"data"=>array(array($date_from,0),array( gmdate('d.m.Y H:i', strtotime( date('Y-m-d') ) ) ,(int) 30),array( $date_to ,100 ))) ;
也不起作用
这是我想要的示例,但是我缺少结束日期信息。这是一个甘特图。我还想包括enddate
. 目前显示从 完成的百分比startdate
。如果可能的话,我还想用另一种颜色显示使用当前日期应该完成多少。