我有一个表在worodpress网站和输出从这个表是这样的:
{
{ [line1]=> array(3) {{'x'=>'5' , 'y'=>'8},{'x'=>'5' , 'y'=>'8},{'x'=>'5' , 'y'=>'8}},
{ [line2]=> array(3) {{'x'=>'5' , 'y'=>'8},{'x'=>'5' , 'y'=>'8},{'x'=>'5' , 'y'=>'8}}
}
我想通过此数据显示图表,所需的输出是这样的:
<script type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",
{
axisX: {
title: "Thick Axis line",
lineThickness: 6
},
data: [{
type: "line",
title: 'line1',
dataPoints: [{ x: 5, y:8 }, { x: 5, y: 8 }]
}, {
type: "column",
title: 'line2',
dataPoints: [{ x: 5, y: 8 }, { x: 5, y: 8}]
}
]
});
chart.render();
}
</script>
如何将php输出转换为客户需要数据?
当然,行数不同,可以从1行到20行
1条答案
按热度按时间xienkqul1#
希望这段代码能帮助你: