gpt4 book ai didi

javascript - 未捕获错误 : Invalid type, 未定义,对于列 "0"

转载 作者:行者123 更新时间:2023-12-03 07:19:15 26 4
gpt4 key购买 nike

我收到上述错误。可能 JSON 表有问题,但我无法弄清楚。

PHP:

createLineGraphH(<?php echo "'".$value_m."'"; ?>, <?php echo $key_m; ?>, <?php echo "'".$metric_legend[$key_m]."'"; ?>, <?php echo "'".$date."'"; ?>, 7, <?php echo json_encode($table[$key_m]); ?>);

错误发生在“google.visualization.DataTable”调用处:

function createLineGraphH(cName, cID, cUnit, cEndDay, cDays, jTable2) {
google.setOnLoadCallback(drawChart);
var data2 = new google.visualization.DataTable(jTable2);

生成的 HTML 为:

createLineGraphH('consistent changes', 2, 'Count', '29/03/2016', 7, {"cols":[[{"label":"time","type":"datetime"}],{"label":"average","type":"number"},{"type":"number","id":"i0","p":{"role":"interval"}},{"type":"number","id":"i1","p":{"role":"interval"}}],"rows":[{"c":[{"v":"Date(2016,2,29,12,0,0)"},{"v":"38982.12"},{"v":"51435.26"},{"v":"54939.79"}]},{"c":[{"v":"Date(2016,2,29,11,0,0)"},{"v":"73005.87"},{"v":"62051.51"},{"v":"59883.32"}]},{"c":[{"v":"Date(2016,2,29,10,0,0)"},{"v":"43581.72"},{"v":"38202.77"},{"v":"53449.8"}]},{"c":[{"v":"Date(2016,2,29,9,0,0)"},{"v":"21436.59"},{"v":"6910.77"},{"v":"37333.91"}]},{"c":[{"v":"Date(2016,2,29,8,0,0)"},{"v":"4546.18"},{"v":"3037.48"},{"v":"6398.66"}]},{"c":[{"v":"Date(2016,2,29,7,0,0)"},{"v":"2754.73"},{"v":"3192.32"},{"v":"2893.09"}]},{"c":[{"v":"Date(2016,2,29,6,0,0)"},{"v":"3421.26"},{"v":"3176.69"},{"v":"3282.51"}]},{"c":[{"v":"Date(2016,2,29,5,0,0)"},{"v":"2720.64"},{"v":"2493.06"},{"v":"2857.98"}]},{"c":[{"v":"Date(2016,2,29,4,0,0)"},{"v":"2049.64"},{"v":"1794.1"},{"v":"2577.62"}]},{"c":[{"v":"Date(2016,2,29,3,0,2)"},{"v":"2123.85"},{"v":"2169.68"},{"v":"2107.24"}]},{"c":[{"v":"Date(2016,2,29,2,0,0)"},{"v":"2208.66"},{"v":"2705.09"},{"v":"2002.34"}]},{"c":[{"v":"Date(2016,2,29,1,0,0)"},{"v":"2674.14"},{"v":"2861.14"},{"v":"2475.2"}]},{"c":[{"v":"Date(2016,2,29,0,0,0)"},{"v":"3254.33"},{"v":"3552.5"},{"v":"2861.93"}]},{"c":[{"v":"Date(2016,2,28,23,0,1)"},{"v":"4560.39"},{"v":"5766.44"},{"v":"3873.07"}]},{"c":[{"v":"Date(2016,2,28,22,0,0)"},{"v":"10656.44"},{"v":"15838.88"},{"v":"5445.4"}]},{"c":[{"v":"Date(2016,2,28,21,0,0)"},{"v":"17427.72"},{"v":"18541.55"},{"v":"17866.66"}]},{"c":[{"v":"Date(2016,2,28,20,0,1)"},{"v":"24763.87"},{"v":"29749.01"},{"v":"18182.14"}]},{"c":[{"v":"Date(2016,2,28,19,0,0)"},{"v":"39484.7"},{"v":"52324.68"},{"v":"28083.66"}]},{"c":[{"v":"Date(2016,2,28,18,0,0)"},{"v":"77662.44"},{"v":"99224.67"},{"v":"59403.07"}]},{"c":[{"v":"Date(2016,2,28,17,0,0)"},{"v":"150287.06"},{"v":"225203.76"},{"v":"92146.29"}]},{"c":[{"v":"Date(2016,2,28,16,0,0)"},{"v":"282831.5"},{"v":"258541.03"},{"v":"250485.63"}]},{"c":[{"v":"Date(2016,2,28,15,0,0)"},{"v":"194811.33"},{"v":"164683.8"},{"v":"233259.16"}]},{"c":[{"v":"Date(2016,2,28,14,0,0)"},{"v":"128709.93"},{"v":"113920.82"},{"v":"169280.56"}]},{"c":[{"v":"Date(2016,2,28,13,0,0)"},{"v":"114108.28"},{"v":"101910.32"},{"v":"120251.35"}]},{"c":[{"v":"Date(2016,2,28,12,0,0)"},{"v":"94065.65"},{"v":"104982.01"},{"v":"95922.3"}]},{"c":[{"v":"Date(2016,2,28,11,0,0)"},{"v":"70901.71"},{"v":"25546.84"},{"v":"106600.21"}]},{"c":[{"v":"Date(2016,2,28,10,0,0)"},{"v":"10002.05"},{"v":"2849.84"},{"v":"19646.72"}]},{"c":[{"v":"Date(2016,2,28,9,0,0)"},{"v":"2832.08"},{"v":"2877.06"},{"v":"2790.32"}]},{"c":[{"v":"Date(2016,2,24,17,0,0)"},{"v":"10894.73"},{"v":"10758.72"},{"v":"9824.93"}]},{"c":[{"v":"Date(2016,2,24,16,0,0)"},{"v":"18931.83"},{"v":"29540.97"},{"v":"10758.72"}]},{"c":[{"v":"Date(2016,2,24,15,0,0)"},{"v":"25282.61"},{"v":"21942.05"},{"v":"29540.97"}]},{"c":[{"v":"Date(2016,2,24,14,0,0)"},{"v":"15007.62"},{"v":"14263.22"},{"v":"15633.4"}]},{"c":[{"v":"Date(2016,2,23,23,1,5)"},{"v":"1395.87"},{"v":"1883.52"},{"v":"1414.09"}]},{"c":[{"v":"Date(2016,2,23,22,1,5)"},{"v":"3793.2"},{"v":"5681.08"},{"v":"1883.52"}]},{"c":[{"v":"Date(2016,2,23,21,1,5)"},{"v":"6045.81"},{"v":"5576.8"},{"v":"5681.08"}]},{"c":[{"v":"Date(2016,2,23,20,1,5)"},{"v":"4483.1"},{"v":"4039.81"},{"v":"5576.8"}]},{"c":[{"v":"Date(2016,2,23,19,1,5)"},{"v":"4123.17"},{"v":"3713.93"},{"v":"4039.81"}]},{"c":[{"v":"Date(2016,2,23,18,1,5)"},{"v":"3741.24"},{"v":"4270.38"},{"v":"3713.93"}]},{"c":[{"v":"Date(2016,2,23,17,1,5)"},{"v":"5266.17"},{"v":"6532.85"},{"v":"4270.38"}]},{"c":[{"v":"Date(2016,2,23,16,1,5)"},{"v":"12331.24"},{"v":"20548.85"},{"v":"6532.85"}]},{"c":[{"v":"Date(2016,2,23,15,1,5)"},{"v":"19658.73"},{"v":"18625.04"},{"v":"20548.85"}]},{"c":[{"v":"Date(2016,2,23,14,1,5)"},{"v":"36802.81"},{"v":"78254.19"},{"v":"18625.04"}]},{"c":[{"v":"Date(2016,2,23,13,1,5)"},{"v":"149318.1"},{"v":"218283.1"},{"v":"78254.19"}]},{"c":[{"v":"Date(2016,2,23,12,1,5)"},{"v":"158930.24"},{"v":"79974.9"},{"v":"218283.1"}]},{"c":[{"v":"Date(2016,2,23,11,1,5)"},{"v":"51573.94"},{"v":"15219.55"},{"v":"79974.9"}]},{"c":[{"v":"Date(2016,2,23,10,1,5)"},{"v":"10361.49"},{"v":"8453.61"},{"v":"15219.55"}]},{"c":[{"v":"Date(2016,2,23,9,1,5)"},{"v":"4587.22"},{"v":"1139.99"},{"v":"8453.61"}]},{"c":[{"v":"Date(2016,2,23,8,1,5)"},{"v":"789.44"},{"v":"719.07"},{"v":"1139.99"}]},{"c":[{"v":"Date(2016,2,23,7,1,5)"},{"v":"722.94"},{"v":"730.23"},{"v":"719.07"}]},{"c":[{"v":"Date(2016,2,23,6,1,5)"},{"v":"704"},{"v":"706.07"},{"v":"730.23"}]},{"c":[{"v":"Date(2016,2,23,5,1,5)"},{"v":"726.52"},{"v":"736.78"},{"v":"706.07"}]},{"c":[{"v":"Date(2016,2,23,4,1,5)"},{"v":"709.63"},{"v":"704.59"},{"v":"736.78"}]},{"c":[{"v":"Date(2016,2,23,3,1,5)"},{"v":"769.31"},{"v":"807.6"},{"v":"704.59"}]},{"c":[{"v":"Date(2016,2,23,2,1,5)"},{"v":"788.87"},{"v":"1076.4"},{"v":"807.6"}]},{"c":[{"v":"Date(2016,2,23,1,1,5)"},{"v":"1102.2"},{"v":"1079.21"},{"v":"1076.4"}]},{"c":[{"v":"Date(2016,2,23,0,1,5)"},{"v":"1408.36"},{"v":"1789.65"},{"v":"1079.21"}]},{"c":[{"v":"Date(2016,2,22,23,1,5)"},{"v":"1599.59"},{"v":"1155.25"},{"v":"1792.64"}]},{"c":[{"v":"Date(2016,2,22,22,1,11)"},{"v":"2077.01"},{"v":"2559.49"},{"v":"1610.35"}]},{"c":[{"v":"Date(2016,2,22,21,1,5)"},{"v":"2380.5"},{"v":"2602.4"},{"v":"2104.05"}]},{"c":[{"v":"Date(2016,2,22,20,1,5)"},{"v":"2966.88"},{"v":"4203.7"},{"v":"2602.4"}]},{"c":[{"v":"Date(2016,2,22,19,1,5)"},{"v":"7545.82"},{"v":"12938.84"},{"v":"4203.7"}]},{"c":[{"v":"Date(2016,2,22,18,1,5)"},{"v":"14164.97"},{"v":"9832.6"},{"v":"12938.84"}]},{"c":[{"v":"Date(2016,2,22,17,1,5)"},{"v":"19584.18"},{"v":"32988.43"},{"v":"9832.6"}]},{"c":[{"v":"Date(2016,2,22,16,1,5)"},{"v":"36489.04"},{"v":"44280.68"},{"v":"32988.43"}]},{"c":[{"v":"Date(2016,2,22,15,1,5)"},{"v":"37010.95"},{"v":"31666.63"},{"v":"44280.68"}]},{"c":[{"v":"Date(2016,2,22,14,1,5)"},{"v":"36066.6"},{"v":"25241.92"},{"v":"31666.63"}]}]});

感谢您的帮助。

最佳答案

好的,我找到了,这是 PHP 中的一个错误。

$table[$key_m]['cols'][] = array(array('label' => 'time', 'type' => 'datetime'));

正确的是:

$table[$key_m]['cols'] = array(array('label' => 'time', 'type' => 'datetime'));

关于javascript - 未捕获错误 : Invalid type, 未定义,对于列 "0",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36281453/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com