From 8d94678edeb4c23d4fcb3e45f4a704b90964c293 Mon Sep 17 00:00:00 2001 From: "olau@iola.dk" Date: Fri, 3 Jul 2009 13:46:37 +0000 Subject: [PATCH] Extended the AJAX example with a setTimeout example of polling git-svn-id: https://flot.googlecode.com/svn/trunk@175 1e0a6537-2640-0410-bfb7-f154510ff394 --- examples/ajax.html | 72 +++++++++++++++++++++++++++--- examples/data-eu-gdp-growth-1.json | 4 ++ examples/data-eu-gdp-growth-2.json | 4 ++ examples/data-eu-gdp-growth-3.json | 4 ++ examples/data-eu-gdp-growth-4.json | 4 ++ examples/data-eu-gdp-growth-5.json | 4 ++ examples/index.html | 2 +- 7 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 examples/data-eu-gdp-growth-1.json create mode 100644 examples/data-eu-gdp-growth-2.json create mode 100644 examples/data-eu-gdp-growth-3.json create mode 100644 examples/data-eu-gdp-growth-4.json create mode 100644 examples/data-eu-gdp-growth-5.json diff --git a/examples/ajax.html b/examples/ajax.html index 1ee68f7..385a834 100644 --- a/examples/ajax.html +++ b/examples/ajax.html @@ -21,33 +21,47 @@ extracts it from a database and serializes it to JSON.

- - + - data -

- - + - data -

- - + - data -

+

If you combine AJAX with setTimeout, you can poll the server + for new data.

+ +

+ +

+ diff --git a/examples/data-eu-gdp-growth-1.json b/examples/data-eu-gdp-growth-1.json new file mode 100644 index 0000000..4372bf5 --- /dev/null +++ b/examples/data-eu-gdp-growth-1.json @@ -0,0 +1,4 @@ +{ + label: 'Europe (EU27)', + data: [[1999, 3.0], [2000, 3.9]] +} diff --git a/examples/data-eu-gdp-growth-2.json b/examples/data-eu-gdp-growth-2.json new file mode 100644 index 0000000..6199882 --- /dev/null +++ b/examples/data-eu-gdp-growth-2.json @@ -0,0 +1,4 @@ +{ + label: 'Europe (EU27)', + data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2]] +} diff --git a/examples/data-eu-gdp-growth-3.json b/examples/data-eu-gdp-growth-3.json new file mode 100644 index 0000000..607f178 --- /dev/null +++ b/examples/data-eu-gdp-growth-3.json @@ -0,0 +1,4 @@ +{ + label: 'Europe (EU27)', + data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5]] +} diff --git a/examples/data-eu-gdp-growth-4.json b/examples/data-eu-gdp-growth-4.json new file mode 100644 index 0000000..df60fa9 --- /dev/null +++ b/examples/data-eu-gdp-growth-4.json @@ -0,0 +1,4 @@ +{ + label: 'Europe (EU27)', + data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1]] +} diff --git a/examples/data-eu-gdp-growth-5.json b/examples/data-eu-gdp-growth-5.json new file mode 100644 index 0000000..e722bcc --- /dev/null +++ b/examples/data-eu-gdp-growth-5.json @@ -0,0 +1,4 @@ +{ + label: 'Europe (EU27)', + data: [[1999, 3.0], [2000, 3.9], [2001, 2.0], [2002, 1.2], [2003, 1.3], [2004, 2.5], [2005, 2.0], [2006, 3.1], [2007, 2.9], [2008, 0.9]] +} diff --git a/examples/index.html b/examples/index.html index fbada6d..1255948 100644 --- a/examples/index.html +++ b/examples/index.html @@ -17,7 +17,7 @@
  • Basic example
  • Different graph types
  • Setting various options and annotating a chart
  • -
  • Using AJAX with JSON data
  • +
  • Updating graphs with AJAX
  • Being interactive: