Commits

Anonymous committed 9e3add2

updated the graphs

Comments (0)

Files changed (3)

docs/installation.rst

 ------------
 
 mustache box has no particular dependencies. As a django-app it need a
-working version of Django >= 1.3 so just clone this repository : 
+working version of Django >= 1.3.
+
+But in order to use the example backend, particulary the page listing
+all the graphs you can use, you have to install the docutils.
+
+so just clone this repository :
 
 Cloning the repository
 ----------------------
 
 ::
 
-    GRAPH_BACKEND="mustachebox.backends.monitoring_backend"
+    GRAPH_BACKEND="mustachebox.backends.example_backend"
 
 Add the mustachebox urls to your project
 ________________________________________
 Testing
 -------
 
-To validate that everything is correctly installed you can use those
-urls :
+To start playing with MustacheBox, you can visit :
 
-For testing the main views :
+(http://localhost:8000/grapher/all/)
 
-- http://localhost:8000/graphs/monitoring/
-
-For testing the templatetag system :
-
-- http://localhost:8000/grapher/template_tag_test/
-
-This is the same graph but rendered using a templatetags instead of
-the view.
+That list all the graphs the example backend can give you.

docs/quickstart.rst

 ========
 
 In this tutorial I will show you how to create your own backend and
-how to render graph using this backend. 
+how to render graph using this backend.
 
 Create the Backend
 ------------------
 
 The backend file can be located anywhere in your project. For example,
-the monitoring backend of mustachebox is located in
+the example backend of mustachebox is located in
 
 ::
 
-    mustachebox/backends/monitoring_backend
+    mustachebox/backends/example_backend
 
 But this is only an example and you can create your own backend in
 your own apps if you prefer.
 Your method will be given a kwarg parameter. You can use this
 parameter to change the data this method return.
 
-for this tutorial, we will use random to generate a time serie. This
+for this tutorial, we will use pre-generated data to generate a time serie. This
 time serie will be render as is by the method because mustachebox will
 convert it to json befor rendering the template.
 
     def test_method(self, **kwargs):
         """
         render a simple time serie suitable for javascript graphs :
-        {
-            "expenses": [1442, 2357, 8080, 765],
-            "sales": [5205, 264, 3701, 324],
-            "year": [2004, 2005, 2006, 2007]
-        }
+            {
+                2004: ['2004', 7160, 546],
+                2005: ['2005', 5654, 5435],
+                2006: ['2006', 7656, 6545],
+                2007: ['2007', 5435, 6545],
+                'label': ['year', 'sales', 'expenses']
+            }
         """
-
-        response = {'year':[2004, 2005, 2006, 2007],'sales': [], 'expenses': []}
-        for i in range(4):
-            response['sales'].append(
-                int((random.random() * random.random()) * 10000))
-            response['expenses'].append(
-                int((random.random() * random.random()) * 10000))
+        response = {
+                2004: ['2004', 7160, 546],
+                2005: ['2005', 5654, 5435],
+                2006: ['2006', 7656, 6545],
+                2007: ['2007', 5435, 6545],
+                'label': ['year', 'sales', 'expenses']
+            }
         return response
 
 
     python manage.py shell
     >>> from mustachebox.backends.tutorial_backend import Backend
     >>> Backend(name="test_method").data
-    '{"expenses": [1616, 3772, 3, 1439], "sales": [3085, 8789, 7445, 1782], "year": [2004, 2005, 2006, 2007]}'
+    '{2004: ['2004', 7160, 546], 2005: ['2005', 5654, 5435], 2006:
+    ['2006', 7656, 6545], 2007: ['2007', 5435, 6545], 'label': ['year', 'sales', 'expenses']}'
 
 
 Rendering

mustachebox/tests.py

 
 
 class TestTemplateTags(TestCase):
+
     def test_area(self):
         t = template.Template("{% load graph %} {% graph area %}")
         c = template.Context({"STATIC_URL": "/static/"})