Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to update jqplot bar chart in phonegap 2.0.0 after retrieving updated value from SQLITE-DB?
    primarykey
    data
    text
    <p>Here is the HTML code:</p> <pre><code> &lt;body&gt; &lt;div data-role="page" id="missingNamazHistory"&gt; &lt;div data-role="header" data-theme="b"&gt;&lt;/div&gt; &lt;div data-role="content"&gt; &lt;div id="chart1" style="width: 600px; height: 350px;"&gt;&lt;/div&gt; &lt;a href="#" data-role="button" id="updateMissingNamaz"&gt;update Missing Prayer&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>code to get values from DB and to show graph.</p> <pre><code> $('#missingNamazHistory').live('pageshow', function() {getMissedNamazFromDB();$('#updateMissingNamaz').off('click').on('click', function() { getAllMissingNamaz(); $.mobile.changePage('#missingPrayerAtRegistrationPg', { transition : "none", changeHash : true, reloadPage : false }, false, true); }); }); function getMissedNamazFromDB() { //alert("getMissedNamazFromDB"); db.transaction(function(tx) { tx.executeSql( 'SELECT ump.missing_prayers FROM user_missing_prayers ump WHERE ump.user_id ="' + window.localStorage.getItem("userid") + '" ORDER BY missing_prayers ASC',[], successCBofMissedNamazFromDB, errorCBofMissedNamazFromDB); }, errorCB, successCB); } function successCBofMissedNamazFromDB(tx, results) { if (results != null &amp;&amp; results.rows.length &gt; 0 &amp;&amp; results.rows != null) { for ( var i = 0; i &lt;results.rows.length; i++) { prayersData[i] = results.rows.item(i).missing_prayers; } drawGraph(); } else { console.log("no records..... Graph cannot be seen");} function errorCBofMissedNamazFromDB() { console.log("errorCB MissedNamazFromDB:"); } function drawGraph() { alert("draw graph"); plot1 = null; //$('#chart1').empty().trigger('create'); s1 = [ prayersData[0], 0, 0, 0, 0 ]; s2 = [ 0, prayersData[1], 0, 0, 0 ]; s3 = [ 0, 0, prayersData[2], 0, 0 ]; s4 = [ 0, 0, 0, prayersData[3], 0 ]; s5 = [ 0, 0, 0, 0, prayersData[4] ]; // var s = [getF,getZ,getA,getM,getI]; var ticks = [ 'FAJR', 'ZOHAR', 'ASR', 'MAGHRIB', 'ISHA' ]; //var plot1 = $.jqplot('#chart1',[s], plot1 = $.jqplot('chart1', [ s1, s2, s3, s4, s5 ], { // The "seriesDefaults" option is an options object that will // be applied to all series in the chart. seriesDefaults : { title : 'Namaz Vs MissingPrayer', renderer : $.jqplot.BarRenderer, rendererOptions : { fillToZero : true } }, series : [{ label : 'Fajr' }, { label : 'ZOHAR' }, { label : 'ASR' }, { label : 'MAGHRIB' }, { label : 'ISHA' } ], legend : { show : true, placement : 'outsideGrid' }, axes : { // Use a category axis on the x axis and use our custom ticks. xaxis : { renderer : $.jqplot.CategoryAxisRenderer, label : 'NAMAZ', ticks : ticks, }, // Pad the y axis just a little so bars can get close to, but // not touch, the grid boundaries. 1.2 is the default padding. yaxis : { min : 0, label : 'MISSING PRAYERS', pad : 1.05, tickOptions : { formatString : '%d' } } } }).replot();} </code></pre> <p>this code is working fine on first time but when trying to click on "updateMissingNamaz" button and to open a page in which i can edit the info the info is editable and successfully updated in DB but failed to plot graph from updated values stored of DB.but every time getting differenet values in graph.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload