我需要分析来自供应商和数据库的交付预测我得到以下数据数组:
Array
(
[0] => Array
(
[delivery_date] => 2012-05-10
[imported] => 2012-05-10 11:20:37
[qty] => 114
)
[1] => Array
(
[delivery_date] => 2012-05-10
[imported] => 2012-05-11 11:20:37
[qty] => 228
)
[2] => Array
(
[delivery_date] => 2012-05-10
[imported] => 2012-05-15 11:20:37
[qty] => 380
)
[3] => Array
(
[delivery_date] => 2012-05-10
[imported] => 2012-05-16 11:20:37
[qty] => 380
)
[4] => Array
(
[delivery_date] => 2012-05-10
[imported] => 2012-05-17 11:20:37
[qty] => 380
)
)
我的问题是客户每天都没有提供完全相同的预测 - 这是正常的,但我需要在客户未预测他们需要xxs产品的情况下绘制“缺失”日期2012-05- 10。
我对可能的解决方案的想法是:
然而到目前为止,我自己还没有成功完成以下任何一种选择:(
从代码中提取: google.load('visualization','1',{packages:['motionchart']});
function drawVisualization() {
var data = new google.visualization.DataTable();
data.addRows(<?PHP echo count($data); ?>);
data.addColumn('string', 'Artikkel@kuupäev');
data.addColumn('date', 'Imporditud');
data.addColumn('number', 'Qty, pcs');
<?PHP
$jrk=0;
foreach ($data as $row) {
$date_import = date("Y, m, d",strtotime(substr($row[imported],0,10)." -1 month"));
echo "data.setValue($jrk, 0, '".$row[delivery_date]."');\n";
echo "data.setValue($jrk, 1, new Date (".$date_import."));\n";
echo "data.setValue($jrk, 2, ".$row[qty].");\n";
$jrk++;
}
?>
var options = {};
options['state'] =
'{"yAxisOption":"2","time":"2012-03-12","sizeOption":"_UNISIZE","xAxisOption":"_TIME","yZoomedIn":false,"xZoomedDataMax":1331510400000,"yLambda":1,"xZoomedIn":false,"yZoomedDataMin":0,"nonSelectedAlpha":0,"uniColorForNonSelected":false,"orderedByY":false,"dimensions":{"iconDimensions":["dim0"]},"duration":{"timeUnit":"D","multiplier":1},"orderedByX":false,"xLambda":1,"colorOption":"_UNICOLOR","yZoomedDataMax":300000,"showTrails":false,"iconType":"LINE","xZoomedDataMin":1304985600000,"iconKeySettings":[],"playDuration":15000};';
options['width'] = 1200;
options['height'] = 600;
var motionchart = new google.visualization.MotionChart(
document.getElementById('visualization'));
motionchart.draw(data, options);
}
google.setOnLoadCallback(drawVisualization);
答案 0 :(得分:1)
此“问题”现已由Google工程师解决,因此无需再破解它。如果缺少值,将立即制动线。
https://code.google.com/p/google-visualization-api-issues/issues/detail?id=25