initialize : (o={}) ->
+ {graph_spec} = o
@model or= new GraphModel
@$el.data { model:@model, view:this }
@viewport = @$el.find '.viewport'
@scaffold = new GraphOptionsScaffold do
el: @$el.find 'form.settings'
- @scaffold.collection.reset CHART_OPTIONS_SPEC
+ @scaffold.collection.reset graph_spec
@render()
root = do -> this
main = ->
-
graph = root.graph = new Graph do
el : $ 'section.graph' .eq 0
+ graph_spec : CHART_OPTIONS_SPEC
+
+
+jQuery.ajax do
+ url : '/graph/dygraph-options.json',
+ dataType : 'json'
+
+ success : (data) ->
+ CHART_OPTIONS_SPEC = data
+ jQuery main
+ error : (err) -> console.error err
-jQuery main
\ No newline at end of file
//- mixin text_field('data', 'data/page_views_by_project.csv')
block page-scripts
- script
- var CHART_OPTIONS_SPEC = !{ fs.readFileSync('www/graph/dygraph-options.json', 'utf8') };
+ //-
+ script
+ var CHART_OPTIONS_SPEC = !{ fs.readFileSync('www/graph/dygraph-options.json', 'utf8') };