尝试创建类似于图像的谷歌图表

时间:2016-01-07 06:42:14

标签: php charts google-visualization yii2

我们正在尝试创建与此图片类似的Google图表

chart

我们正在使用YII2扩展来创建图表

https://github.com/ScottHuangZL/yii2-google-chart

所以我们在php中编写这段代码

$chartdata= array(
            array('Month', 'SÃO PAULO','Perdizes (2 bedrooms)','Perdizes',array('type'=>'string', 'role'=>'style')),
                array('Jan', 9000,2000,5800,null),
                array('Feb', 9100,5000,7890,null),
                array('Mar', 9400,8500,3569,null),
                array('Apr', 9600,3500,5986,null),
                array('May', 9800,7840,2569,null),
                array('Jun', 5000,6980,9856,null),
                array('Jul', 5400,3698,2589,null),
                array('Aug', 6400,7689,2365,null),
                array('Sep', 2400,2369,8956,null),
                array('Oct', 7400,5872,9586,null),
                array('Nov', 8400,5981,1236,null),
                array('Dec', 8800,1589,5698,'point { size: 15; shape-type: diamond; fill-color: #68ae0d; }')

            );

 echo GoogleChart::widget(array('visualization' => 'AreaChart',
                                    'data' => $chartdata,
                                    'options' => array(
                                        'titleTextStyle' => array('fontSize' => 20),

                                        'width'=>672,
                                        'height'=>365,
                                        'vAxis' => array(
                                            'gridlines' => array(
                                                'color' => 'grey' , //set grid line transparent
                                                'count' =>8
                                            ),  
                                        ),  
                                        'hAxis' => array(
                                            'gridlines' => array(
                                                'color' => 'grey' , 
                                                'count' =>8
                                                )),
                                         'series'=> array('lineWidth'=> 10),
                                        'legend' => array('position' => 'bottom'),
                                        'curveType'  => 'function',
                                        'pointSize'  => 1,
                                        'colors'  => ['#4094c8', '#efb151','#68ae0d'],
                                        'chartArea'=>array(
                                          'backgroundColor'=>array(
                                              'fill'=> '#F4F4F4',
                                             ),
   )
                                        )));

但这是创建这样的图表

enter image description here

这可以像图像一样更改此图表吗?

0 个答案:

没有答案