使用 highcharts,data 数据 Laravel 传递,但前端一直不显示内容,求大神帮忙
我后台用的laravel,将highcharts的参数通过compact传递到balde前台,但是一只不显示数据表格,以下是代码。
$res = HistoryData::where('product_id','1')->get();
$highchart= array();
//将获取的数据重新排版
if(count($res) > 0){
foreach($res as $value){
$timestamp = strtotime(str_replace('/','-',$value['time']));
$data[] = [$timestamp , $value['cumulativeNet']];
}
}
//highchart设置内容
//标题
$highchart['title'] = ['text'=>'历史业绩'];
//副标题
$highchart['subtitle'] = ['text'=>'2008年8月8日入市'];
//x坐标轴
$highchart['xAxis'] = ['title' => ['text'=>'时间']];
//y坐标轴
$highchart['yAxis'] = ['title' => ['text' => '净值']];
//数据
$highchart['series'] = ['name'=>'净值','data'=>$data];
$highchart['rangeSelector'] = array('selected'=>'1');
return view('index.index',compact('title','highchart'));
}
data数据输出
"series": {
"name": "数据",
"data": [[1423584000, 1], [1426003200, 1], [1428681600, 2], [1431273600, 2]]
}
求大神告诉我是哪里出了问题
推荐文章: