codeigniter中线图的动态数据 [英] Dynamic data for line graph in codeigniter
本文介绍了codeigniter中线图的动态数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试使用我拥有的值来准备一个图表,但不知怎的,我只能将数据传输到JSON。
什么我试过了:
print_r(json_encode($ graph,JSON_NUMERIC_CHECK)); // 这是在我的控制器中
以下代码在我的视图页面中。
$( document )。ready(函数(res){
var chart = new CanvasJS.Chart(< span class =code-string> chartContainer,{
title:{
text: 财务年度明智数据
},
数据:[{
类型:< span class =code-string> line,
dataPoints:res
}]
}) ;
< div id = chartContainer style = height:300px; width:100% > < / div >
解决方案
图表,JSON_NUMERIC_CHECK )); // 这是在我的控制器中
下面的代码在我的视图页面中。
( document ) .ready( function (res){
var chart = new CanvasJS.Chart( chartContainer,{
title :{
text: 财务年度明智数据
},
数据:[{
类型: 行,
dataPoints:res
}]
});
< div id = chartContainer 样式 = 身高:300px; width:100% > < / div >
传递给<$ c $的函数C>
I have been trying to prepare a graph using the values that I have but somehow all I could do is just getting data to JSON.
What I have tried:
print_r(json_encode($graph, JSON_NUMERIC_CHECK)); // This is in my controller
Below code is in my view page.
$(document).ready(function (res) {
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "Financial Year Wise Data"
},
data: [ {
type: "line",
dataPoints: res
} ]
});
<div id="chartContainer" style="height: 300px; width: 100%"></div>
解决方案
graph, JSON_NUMERIC_CHECK)); // This is in my controller
Below code is in my view page.
(document).ready(function (res) { var chart = new CanvasJS.Chart("chartContainer", { title:{ text: "Financial Year Wise Data" }, data: [ { type: "line", dataPoints: res } ] });
<div id="chartContainer" style="height: 300px; width: 100%"></div>
The function you pass to
这篇关于codeigniter中线图的动态数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文