开发者

Plotting a graph with flot using sqlite db information

开发者 https://www.devze.com 2023-01-27 10:25 出处:网络
I\'m trying to read data from the internal sqlite database, and plot a graph using flot based on this data.

I'm trying to read data from the internal sqlite database, and plot a graph using flot based on this data.

I have an activity which inserts data into the db, accesses the db and even returns an array with the desired data.

I also have an activity which creates a webview, and adds a javascript interface to a class so that I can use flot and javascr开发者_运维问答ipt to create the graph.

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.

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.

This is driving me crazy, any help at all would be much appreciated.

Thank you, 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
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/

0

精彩评论

暂无评论...
验证码 换一张
取 消