使用CodeIgniter基于JSON数据创建Google饼图(Creating Google Pie Chart based on JSON data using CodeIgniter)
我试着在这里基于例子创建一个饼图
在我的控制器(mycontroller / json)中,我有以下代码:
public function json(){ $whatever = '{ "cols": [ {"id":"","label":"Topping","pattern":"","type":"string"}, {"id":"","label":"Slices","pattern":"","type":"number"} ], "rows": [ {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]}, {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]} ] }'; echo $whatever; }
在我看来,我有以下代码(部分代码显示)
var jsonData = $.ajax({ url: "<?= base_url()?>index.php/bunker/json", dataType:"json", async: false }).responseText; // Create and populate the data table. var popularCategory = google.visualization.DataTable(jsonData); new google.visualization.PieChart(document.getElementById('category')).draw(popularCategory, {title:"Popularity by Category"});
最后我有一个名为'category'的div。 但是,我总是收到一条消息,说明数据未定义。
使用firebug进行快速调试,我没有收到任何错误,$ whatever变量也被视为正确的JSON格式。 我在这里犯了什么错误?
干杯,
I tried to create a pie chart based on example here
In my controller (mycontroller/json) i have the following code:
public function json(){ $whatever = '{ "cols": [ {"id":"","label":"Topping","pattern":"","type":"string"}, {"id":"","label":"Slices","pattern":"","type":"number"} ], "rows": [ {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]}, {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]}, {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]} ] }'; echo $whatever; }
In my view i have the following code (partial code is shown)
var jsonData = $.ajax({ url: "<?= base_url()?>index.php/bunker/json", dataType:"json", async: false }).responseText; // Create and populate the data table. var popularCategory = google.visualization.DataTable(jsonData); new google.visualization.PieChart(document.getElementById('category')).draw(popularCategory, {title:"Popularity by Category"});
And lastly i have a div with an id called 'category'. However, i always get a message saying data is not defined.
A quick debug using firebug, i receive no error, the $whatever variable is also treated as a proper JSON format. What mistakes have i made here?
cheers,
原文:https://stackoverflow.com/questions/16317138
最满意答案
您的ISP也可以阻止端口445.请参阅此链接 。
要查看允许或禁止从端口445访问的ISP的摘要,请转到TechNet 。
您可以使用PortQry.exe进行检查。
PortQry.exe -n [storage account name].file.core.windows.net -p TCP -e 445
如果您的ISP阻止端口445,您可以创建VPN连接,请参阅此答案 。
Your ISP also could block port 445. Please refer to this link.
To see the summary of ISPs that allow or disallow access from port 445, go to TechNet.
You could use PortQry.exe to check it.
PortQry.exe -n [storage account name].file.core.windows.net -p TCP -e 445
If your ISP block port 445, you could create a VPN connection, please refer to this answer.
相关问答
更多-
Azure文件共享同步(Azure File Share synchronization)[2022-04-07]
据我所知,没有办法让Azure本身同步两个Azure文件共享。 作为一种解决方法,您需要在Azure上构建一个虚拟机并在其上安装这两个共享。 然后你只需要找到一个可以保持两个文件夹同步的解决方案。 在Windows和Linux上都有几种解决方案。 Here is the script that syncs some folders: function Copy-AzureFileStorageWithPS{ <# .SYNOPSIS Copy a file share from a from one sto ... -
您的ISP也可以阻止端口445.请参阅此链接 。 要查看允许或禁止从端口445访问的ISP的摘要,请转到TechNet 。 您可以使用PortQry.exe进行检查。 PortQry.exe -n [storage account name].file.core.windows.net -p TCP -e 445 如果您的ISP阻止端口445,您可以创建VPN连接,请参阅此答案 。 Your ISP also could block port 445. Please refer to this link. ...
-
要卸载File Share驱动器,只需使用: net use
/delete 这将分离驱动器。 To unmount a File Share drive, simply use: net use /delete This will detach the drive. -
是否可以将System.File.IO与Azure文件共享一起使用?(Is it possible to use System.File.IO with Azure File Share?)[2023-07-11]
我得到了以下解决方案,我在app start运行: System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo { FileName = "cmd.exe", Arg ... -
您可以使用以下cmdlet从Azure File Share下载文件。 $ctx = New-AzureStorageContext [storageaccountname] [storageaccountkey] ##sharename is your existed name. $s = Get-AzureStorageShare [sharename] –Context $ctx ##To download a file from the share to the local computer, us ...
-
Azure事件网格可以监听Azure文件共享中的更改吗?(Can Azure Event Grid listen to changes in Azure File Shares?)[2022-05-19]
事件网格不支持文件共享,但是存在一个开放的GitHub问题 ,它表示在Azure函数V2转到GA(通用可用性)时很可能会执行该问题 。 目前,以下Azure服务支持将事件发送到事件网格: Azure订阅(管理操作) 自定义主题 活动中心 物联网集线器 媒体服务 资源组(管理操作) 服务总线 存储Blob 存储通用v2(GPv2) 参考文档: https : //docs.microsoft.com/en-us/azure/event-grid/overview Event grid does not sup ... -
实际上,Azure文件共享没有触发器。 这里是一个类似的帖子,请参考它 。 这是反馈 ,你可以投票。 Actually, there is no trigger for Azure File Share. Here is a similar post, refer to it. This is the feedback, you could vote it.
-
挂载Azure文件共享导致挂载错误(13):权限被拒绝(Mounting Azure file share resulted in mount error(13):Permission denied)[2022-05-31]
我无法在Microsoft知识库中找到任何文档,要求不要这样做。 “安全传输所需”选项通过仅允许来自安全连接的帐户请求来增强您的存储帐户的安全性。 例如,当您调用REST API访问存储帐户时,必须使用HTTPS进行连接。 “需要安全传输”会拒绝使用HTTP的请求。 为什么我这是第一个问题。 没有启用此选项使我的文件共享更安全。 这里有一个关于你的类似案例 ,请参阅它。 使用此选项可以以任何方式装入我的文件共享吗? Centos 7.4支持SMB 3.0的加密功能,我们应该关闭所需的安全传输,并直接安装。 ... -
如果有人感兴趣我最终为blob创建了一个存储帐户,结果我可以直接从Visual Studio上传和编辑blob。 apk然后在这里获得了url 输入链接描述 If someones interested I ended up creating a Storage account for blobs and it turned out I could upload and edit the blobs directly from Visual Studio. The apk then got the url ...
-
对此没有真正的答案,您可以使用您想要的任何备份解决方案\技术。 至于Azure方面,Azure确实提供了一种方法来实现这一点,但仅限于blob。 https://blogs.msdn.microsoft.com/windowsazurestorage/2012/06/12/introducing-asynchronous-cross-account-copy-blob/ 编辑:正如Gaurav指出的那样,您可以异步复制Azure文件。 https://docs.microsoft.com/en-us/azu ...