anirudhb029 / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

example needed: load graph data from a url via json #115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There should be an example which loads graphs using data at a remote
location. It should be something like:

<button onclick="loadgraph('div1', 'bar', 'examples/data1.txt')">click to
view graph 1</button> 
<button onclick="loadgraph('div1', 'line', 'examples/data2.txt')">click to
view graph 2</button>
<button onclick="loadgraph('div1', 'line-point-filled',
'examples/data3.txt')">click to view graph 3</button>
<div id="div1"></div>

where loadgraph is (approx.):
function loadgraph(selector, style, datalocation) {
  //styles is a global datastructure
  $.getJSON(datalocation, function(data) {
    $.plot(selector, styles[style], data);
  });
}
(warning: notepad code from a user who hasn't used jquery in a while)

Such an example has the benefits:
1. makes it clear that flot works well with remote data storage
2. easy to see separation between data and styles
3. easy to see that the whole thing is dynamic

Original issue reported on code.google.com by after.fa...@gmail.com on 16 Feb 2009 at 4:40

GoogleCodeExporter commented 9 years ago
It's not a bad idea with a JSON example.

Original comment by olau%iol...@gtempaccount.com on 17 Feb 2009 at 10:37

GoogleCodeExporter commented 9 years ago
I've added one now, it's in SVN:

http://flot.googlecode.com/svn/trunk/

Original comment by olau%iol...@gtempaccount.com on 2 Jul 2009 at 5:16

GoogleCodeExporter commented 9 years ago
I have to evaluate this wonderful tool for a few requirements.
Wanted to ask that when we talk of remote data can it fetch data from a url via 
http. Pardon me if the question is stupid but i still need the answer.

Original comment by sameerd...@gmail.com on 8 Nov 2010 at 6:13