[英]Get values as list from PHP array to use with Google Charts
I am pretty new to PHP and I am trying to use the googlechartphplib... 我对PHP相当陌生,我正在尝试使用googlechartphplib ...
The api requires data to be entered in the form: api需要以以下形式输入数据:
$data = new GoogleChartData(array(3450,800,700,5,50,67,1000,1250,900));
Long story short I have a PHP array that, when using: 长话短说,当使用时,我有一个PHP数组:
echo '<pre>' . print_r($usersteps, true) . '</pre>';
looks like: 看起来像:
Array
(
[0] => 3450
[1] => 800
[2] => 700
[3] => 5
[4] => 50
[5] => 67
[6] => 1000
[7] => 1250
[8] => 900
)
What I am not sure about is getting a list values that seems to work with GoogleChartData; 我不确定要获取的列表值似乎可以与GoogleChartData一起使用; any ideas?
有任何想法吗?
I've tried implode(), and the formatting looks correct but that results in a string and doesn't seem to work. 我尝试了implode(),格式看起来正确,但结果是一个字符串,似乎不起作用。
array_values($usersteps)
just returns Array
. array_values($usersteps)
仅返回Array
。
I'm sure it's straightforwards but I am not sure which function to use get the array data to work with GoogleChartData. 我敢肯定这很简单,但是我不确定要使用哪个函数来使数组数据与GoogleChartData一起使用。
Why not use: 为什么不使用:
$data = new GoogleChartData($usersteps);
GoogleChartData need an array and you have one :) GoogleChartData需要一个数组,并且您有一个:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.