diff --git a/index.html b/index.html index fbc70442..2f707218 100644 --- a/index.html +++ b/index.html @@ -92,9 +92,9 @@

Recline is two things:

@@ -126,19 +126,40 @@

Demo

For demo see the Data Explorer »

-

Documentation

-

Quickstart

-
-// Note: you should have included the relevant JS libraries (and CSS)
-// See above for dependencies
+    

Data Explorer Documentation

+

Usage instructions are built into the Data Explorer + itself so no specific additional documentation is provided on usage.

+

To embed the data explorer in another site you can use a simple iframe + in your web page:

+ +

Alternatively, you can initialize the explorer yourself from javascript. To see how + to do this just take at look at the Explorer's initialization javascript + in: app.js.

-// Dataset is a Backbone model so the first hash become model attributes -var dataset = recline.Model.Dataset({ - id: 'my-id' - }, - // Either a backend instance or string id for a backend in the registry - backend -); + +

Library Documentation

+ +

Examples

+

Note: A quick read through of the Concepts section will + likely be useful in understanding the details of the examples.

+

Note: for all the following examples you should have + included relevant Recline dependencies.

+

Simple in-memory dataset.

+
+// Some data you have
+// Your data must be in the form of list of documents / rows
+// Each document/row is an Object with keys and values
+var data = [
+    {id: 0, x: 1, y: 2, z: 3, country: 'UK', label: 'first'}
+    , {id: 1, x: 2, y: 4, z: 6, country: 'UK', label: 'second'}
+    , {id: 2, x: 3, y: 6, z: 9, country: 'US', label: 'third'}
+  ];
+
+// Create a Dataset object from local in-memory data
+// Dataset object is a Backbone model - more info on attributes in model docs below
+var dataset = recline.Backend.createDataset(data);
+
+// Now create the main explorer view (it will create other views as needed)
 // DataExplorer is a Backbone View
 var explorer = recline.View.DataExplorer({
   model: dataset,
@@ -147,10 +168,29 @@ var explorer = recline.View.DataExplorer({
 });
 // Start Backbone routing (if you want routing support)
 Backbone.history.start();
-    
-

More details and examples: see docs below and the Demo -- just hit view source (NB: the javascript for the - demo is in: app.js).

+
+ +

Creating a Dataset Explicitly with a Backend

+
+// Backend can be an instance or string id for a backend in the
+// recline.Model.backends registry
+var backend = 'elasticsearch'
+// alternatively you can create explicitly
+// var backend = new recline.Backend.ElasticSearch();
+// or even from your own backend ...
+// var backend = new myModule.Backend();
+
+// Dataset is a Backbone model so the first hash become model attributes
+var dataset = recline.Model.Dataset({
+    id: 'my-id',
+    // url for source of this dataset - will be used by backend
+    url: 'http://localhost:9200/my-index/my-type',
+    // any other metadata e.g.
+    title: 'My Dataset Title'
+  },
+  backend
+);
+

Concepts and Structure

Recline has a simple structure layered on top of the basic Model/View