diff --git a/_includes/recline-deps.html b/_includes/recline-deps.html index 270855cc..ee0d4750 100644 --- a/_includes/recline-deps.html +++ b/_includes/recline-deps.html @@ -3,6 +3,7 @@ + diff --git a/_includes/tutorial-views-timeline.js b/_includes/tutorial-views-timeline.js new file mode 100644 index 00000000..cfb91cc7 --- /dev/null +++ b/_includes/tutorial-views-timeline.js @@ -0,0 +1,15 @@ +var $el = $('#mytimeline'); +var timeline = new recline.View.Timeline({ + model: dataset +}); +$el.append(timeline.el); +// set the headline/title for each record with x column +timeline.convertRecord = function(record, fields) { + var out = this._convertRecord(record); + if (out) { + out.headline = record.get('x').toString(); + } + return out; +} +timeline.render(); + diff --git a/docs/tutorial-views.markdown b/docs/tutorial-views.markdown index f297c16a..6752bb86 100644 --- a/docs/tutorial-views.markdown +++ b/docs/tutorial-views.markdown @@ -227,3 +227,39 @@ $el.append(map.el); map.render(); +### Creating a Timeline + +Now, let's create a timeline for this dataset using the date information which is +present on these data points. + +First, add the additional dependencies for the timeline view. The timeline is built on the excellent Verite Timeline widget so that library is the key one for this view: + +{% highlight html %} + + + + + + +{% endhighlight %} + +Now, create a new div for the map: + +{% highlight html %} +
+{% endhighlight %} + +Now let's create the timeline, we will use the existing dataset object created +previously: + +{% highlight javascript %} +{% include tutorial-views-timeline.js %} +{% endhighlight %} + +