Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Got it!

First step was to bind the results to a javascript:

Image

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Second step was to keep adding the results to local storage variables as each value arrives:

Image

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Once this is complete. Setup the jqplot arrays:

Image

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

And plot away:

Image

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Not sure if this is the most efficient method, but it works just fine.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Loading data into jqplot from database

Hi Peter,

Thank you for sharing this!

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Not a problem.

Any tips on how to refresh a jqplot graph? Each time the graph updates, it simply writes directly over the last one making a mess.

I have tried the following:

-----------------------------------------------------------------------------------------------------

var plot = JSON.parse(localStorage.getItem("plot"));

if(plot)
{
plot.destroy();
}

plot = $.jqplot(.....);

localStorage.setItem('plot', JSON.stringify(plot));

----------------------------------------------------------------------------------------------------

Unfortunately I am unable to store and retrieve the 'plot' variable in local storage between plots. Each time I try to read it back from local storage, it is clear again.

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Here you can see the axis labels are messy:

Image

Peter Castle
Posts: 0
Joined: Mon Jul 07, 2014 8:11 am

Loading data into jqplot from database

Maybe there is a simple way of clearing the html object?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Loading data into jqplot from database

Hi Peter,

Here is how to delete jqplot:
pre$("#myplot").html("");/pre

Return to “Issues”