【发布时间】:2015-01-19 07:49:44
【问题描述】:
我正在尝试显示具有 2 个系列的 Highcharts 图形来比较数据。
我正在使用以下 javascript 代码:
$(function () {
$.getJSON('test.php', function (data, data2) {
// create the chart
$('#container').highcharts('StockChart', {
chart: {
alignTicks: false
},
rangeSelector: {
selected: 1
},
title: {
text: 'AAPL Stock Volume'
},
plotOptions: {
column: {
stacking: 'normal',
}
},
series: [{
type: 'column',
name: 'AAPL Stock Volume',
data: data,
dataGrouping: {
units: [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]]
}
},{
type: 'column',
name: 'AAPL Stock Volume',
data: data,
dataGrouping: {
units: [[
'week', // unit name
[1] // allowed multiples
], [
'month',
[1, 2, 3, 4, 6]
]]
}
}]
});
});
});
还有这个 PHP 代码:
$arr = array([1147651200000,1],[1147737600000,3],[1147824000000,1]);
$arr2 = array([1147651200000,1],[1147737600000,3],[1147824000000,1]);
echo json_encode($arr, $arr2);?>
目前,我只有一个空白页,但如果只传输一个数组,它可以工作。
我做了不同的测试,我的问题是 json_encode 函数只接受一个参数。我的问题如下:如何将两个数组传输到 php 文件?
【问题讨论】:
-
把两个数组放到另一个数组中?
标签: json highcharts series