From: declerambaul Date: Tue, 17 Apr 2012 02:08:02 +0000 (-0400) Subject: Geo code coffe script X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=eb5d57e28abc068a7d24cae838f228b262bb64da;p=limn-bak.git Geo code coffe script --- diff --git a/lib/main-geo.co b/lib/main-geo.co new file mode 100644 index 0000000..32cabf4 --- /dev/null +++ b/lib/main-geo.co @@ -0,0 +1,52 @@ +Seq = require 'seq' +Backbone = require 'backbone' + +{ _, op, +} = require 'kraken/util' +{ BaseView, BaseModel, BaseList, +} = require 'kraken/base' +{ ChartType, DygraphsChartType, +} = require 'kraken/chart' +{ Graph, GraphList, GraphDisplayView, +} = require 'kraken/graph' +{ DashboardView, +} = require 'kraken/dashboard' + + + +root = this +CHART_OPTIONS_SPEC = [] +CHART_DEFAULT_OPTIONS = {} + + +# Create the Graph Scaffold +main = -> + # Set up Dygraph chart type spec + # TODO: load this on-demand + dyglib = new DygraphsChartType CHART_OPTIONS_SPEC + + # _.dump _.clone(data.options), 'data.options' + + # Instantiate model & view + dashboard = root.dashboard = new DashboardView do + graph_spec : root.CHART_OPTIONS_SPEC # FIXME: necessary? + + $ '#content .inner' .append dashboard.el + + + +# Load data files +Seq([ <[ CHART_OPTIONS_SPEC /schema/dygraph.json ]> +]) +.parEach_ (next, [key, url]) -> + jQuery.ajax do + url : url, + dataType : 'json' + success : (res) -> + root[key] = res + next.ok() + error : (err) -> console.error err +.seq -> + console.log 'All data loaded!' + jQuery main +