简体   繁体   English

使用sqlite db信息绘制带有float的图形

[英]Plotting a graph with flot using sqlite db information

I'm trying to read data from the internal sqlite database, and plot a graph using flot based on this data. 我正在尝试从内部sqlite数据库读取数据,并根据此数据使用flot绘制图形。

I have an activity which inserts data into the db, accesses the db and even returns an array with the desired data. 我有一个将数据插入db,访问​​db甚至返回包含所需数据的数组的活动。

I also have an activity which creates a webview, and adds a javascript interface to a class so that I can use flot and javascript to create the graph. 我也有一个活动,它创建一个webview,并向类添加javascript接口,以便我可以使用flot和javascript创建图形。

Both of these activities function perfectly individually but my problem lies in getting the array of db data to a javascript interface class so that it can be accessed from javascript. 这两个活动都可以单独完美地运行,但是我的问题在于将db数据数组传递到javascript接口类,以便可以从javascript访问它。

I've tried to use "Bundle.getExtra()"..etc.. to send the array from one activity to the other, but when I go to retrieve it in the js class it can only be retrieved from the onCreate method, and hence cannot be accessed from a javascript interface. 我尝试使用“ Bundle.getExtra()” .. etc ..将数组从一个活动发送到另一个活动,但是当我去在js类中检索它时,只能从onCreate方法中检索它,因此无法从javascript界面​​访问。

This is driving me crazy, any help at all would be much appreciated. 这让我发疯,所有帮助将不胜感激。

Thank you, D 谢谢你D

Note sure what you want, but here i go: 请注意确定您想要什么,但是我在这里:

If you want to fill out some data from a query you could do it quick and easy by doing something like this in php: 如果您想从查询中填写一些数据,则可以通过在php中执行以下操作来快速简便地完成它:

<?php
foreach($res in $query )
{
echo "var d1 = [[0, ". $res['xxx'] ."], [1, ". $res['yyy'] ."], [2, ". $res['zzz'] ."]];";
}
?>

where you normally fill in the datavalues. 通常在其中填写数据值。 You might even use Ajax, and then i recomend reading http://api.jquery.com/jQuery.get/ 您甚至可以使用Ajax,然后建议阅读http://api.jquery.com/jQuery.get/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM