From 4cb326c837d8a63061738dbf6a24dbbe7738af5b Mon Sep 17 00:00:00 2001 From: dsc Date: Thu, 29 Mar 2012 02:12:20 -0700 Subject: [PATCH] Renames 'chart-library' to 'chart-type', as it makes sense that one library might service multiple chart types, each with their own options schema. --- lib/chart/chart-option-model.co | 123 ++++++++++++++++++++++++++++++++++++++ lib/chart/chart-option-view.co | 106 ++++++++++++++++++++++++++++++++ lib/chart/chart-type.co | 19 +++--- lib/chart/dygraphs.co | 2 +- lib/chart/index.co | 8 ++- lib/graph/graph-model.co | 114 ----------------------------------- lib/graph/graph-view.co | 107 --------------------------------- lib/graph/index.co | 6 +- lib/main.co | 9 +-- lib/template/chart-option.jade | 41 +++++++++++++ lib/template/chart-scaffold.jade | 3 + lib/template/graph-option.jade | 41 ------------- lib/template/graph-scaffold.jade | 3 - lib/util/index.co | 3 +- lib/vis/vis-model.co | 2 +- lib/vis/vis-view.co | 8 +-- www/misc/test.co | 15 ++--- www/modules.yaml | 22 ++++--- 18 files changed, 319 insertions(+), 313 deletions(-) create mode 100644 lib/chart/chart-option-model.co create mode 100644 lib/chart/chart-option-view.co delete mode 100644 lib/graph/graph-model.co delete mode 100644 lib/graph/graph-view.co create mode 100644 lib/template/chart-option.jade create mode 100644 lib/template/chart-scaffold.jade delete mode 100644 lib/template/graph-option.jade delete mode 100644 lib/template/graph-scaffold.jade diff --git a/lib/chart/chart-option-model.co b/lib/chart/chart-option-model.co new file mode 100644 index 0000000..e5277f8 --- /dev/null +++ b/lib/chart/chart-option-model.co @@ -0,0 +1,123 @@ +_ = require 'kraken/util/underscore' +{ Field, FieldList, FieldView, Scaffold, +} = require 'kraken/scaffold' + + +/** + * @class A set of tags. + */ +class exports.TagSet extends Array + tags : {} + + (values=[]) -> + @tags = {} + @add values if values?.length + + has: (tag) -> + @tags[tag]? + + get: (tag) -> + return -1 unless tag + unless @tags[tag]? + @tags[tag] = @length + @push tag + @tags[tag] + + update: (tags) -> + is_single = typeof tags is 'string' + tags = [tags] if is_single + indices = ( for tag of tags then @get tag ) + if is_single then indices[0] else indices + + toString: -> "TagSet(length=#{@length}, values=[\"#{@join '", "'}\"])" + + + +/** + * @namespace All known tags, for mapping consistently onto colors. + */ +KNOWN_TAGS = exports.KNOWN_TAGS = new TagSet() + + + +/** + * @class Field with chart-option-specific handling for validation, parsing, tags, etc. + */ +ChartOption = exports.ChartOption = Field.extend do # {{{ + ctorName : 'ChartOption' + IGNORED_TAGS : <[ callback deprecated debugging ]> + + + initialize : -> + # console.log "#this.initialize!" + Field::initialize ... + + # Notify Tag indexer of category when created, to ensure all category-tags + # get indices with colors :P + KNOWN_TAGS.update @getCategory() + + # Ignore functions/callbacks and, ahem, hidden tags. + type = @get 'type', '' .toLowerCase() + tags = @get 'tags', [] + if _.str.include(type, 'function') or _.intersection(tags, @IGNORED_TAGS).length + @set 'ignore', true + + + # Wrapper to ensure @set('tags') is called, as tags.push() + # will not trigger the 'changed:tags' event. + addTag: (tag) -> + return this unless tag + tags = @get('tags', []) + tags.push tag + @set 'tags', tags + this + + # Wrapper to ensure @set('tags') is called, as tags.push() + # will not trigger the 'changed:tags' event. + removeTag: (tag) -> + return this unless tag + tags = @get('tags', []) + _.remove tags, tag + @set 'tags', tags + this + + # Keep tag list up to date + onTagUpdate: -> + KNOWN_TAGS.update @get 'tags' + this + + getTagIndex: (tag) -> + KNOWN_TAGS.get tag + + # A field's category is its first tag. + getCategory: -> + @get('tags', [])[0] + + getCategoryIndex: -> + @getTagIndex @getCategory() + + + toJSON: -> + o = Field::toJSON ... + for k, v in o + o[k] = '' if v!? + o +# }}} + + + +/** + * @class List of ChartOption fields. + */ +ChartOptionList = exports.ChartOptionList = FieldList.extend do # {{{ + ctorName : 'ChartOptionList' + model : ChartOption + + /** + * Override to omit defaults from URL. + */ + toKVPairs: -> + _.collapseObject @values {-keepDefaults, +serialize} + +# }}} + diff --git a/lib/chart/chart-option-view.co b/lib/chart/chart-option-view.co new file mode 100644 index 0000000..fa68de9 --- /dev/null +++ b/lib/chart/chart-option-view.co @@ -0,0 +1,106 @@ +_ = require 'kraken/util/underscore' +{ Field, FieldList, FieldView, Scaffold, +} = require 'kraken/scaffold' +{ ChartOption, ChartOptionList, +} = require 'kraken/chart/chart-option-model' + +DEBOUNCE_RENDER = exports.DEBOUNCE_RENDER = 100ms + + +/** + * @class View for a single configurable option in a chart type. + */ +ChartOptionView = exports.ChartOptionView = FieldView.extend do # {{{ + # __bind__ : <[ onClick ]> + ctorName : 'ChartOptionView' + tagName : 'div' + className : 'field option' + template : require 'kraken/template/chart-option' + + isCollapsed : true + + events : + 'blur .value' : 'update' + 'click input[type="checkbox"].value' : 'update' + 'submit .value' : 'update' + 'click .close' : 'toggleCollapsed' + 'click h3' : 'toggleCollapsed' + 'click .collapsed' : 'onClick' + + + render: -> + @__super__.render ... + @$el.addClass 'collapsed' if @isCollapsed + this + + onClick: (evt) -> + target = $ evt.target + # console.log "#this.onClick()", target + @toggleCollapsed() if @$el.hasClass('collapsed') and not target.hasClass('close') + + toggleCollapsed: -> + starting = @$el.hasClass 'collapsed' #@isCollapsed + @$el.toggleClass 'collapsed' + @isCollapsed = not starting + # console.log "#this.toggleCollapsed!", starting, '->', @isCollapsed + @trigger 'change:collapse', this, @isCollapsed + this + +# }}} + + + +/** + * @class View for configuring a chart type. + */ +ChartOptionScaffold = exports.ChartOptionScaffold = Scaffold.extend do # {{{ + ctorName : 'ChartOptionScaffold' + tagName : 'form' + className : 'options scaffold' + template : require 'kraken/template/chart-scaffold' + collectionType : ChartOptionList + subviewType : ChartOptionView + fields : '.fields' + + # GraphView will set this + ready : false + + + + initialize : -> + @render = _.debounce @render.bind(this), DEBOUNCE_RENDER + Scaffold::initialize ... + + render: -> + # console.log "#this.render() -> .isotope()" + # @__super__.render ... + return this unless @ready + container = if @fields then @$el.find @fields else @$el + container + .addClass 'isotope' + .find '.field.option' .addClass 'isotope-item' + container.isotope do + # itemPositionDataEnabled : true + itemSelector : '.field.option' + layoutMode : 'masonry' + masonry : columnWidth : 10 + getSortData : + category: ($el) -> + $el.data 'model' .getCategory() + sortBy: 'category' + + /** + * Add a ChartOption to this scaffold, rerendering the isotope + * layout after collapse events. + */ + addOne: (field) -> + view = @__super__.addOne ... + view.on 'change:collapse render', @render + view + + toKV: -> + @collection.toKV ... + +# }}} + + diff --git a/lib/chart/chart-type.co b/lib/chart/chart-type.co index 6a145f5..637477b 100644 --- a/lib/chart/chart-type.co +++ b/lib/chart/chart-type.co @@ -1,5 +1,4 @@ _ = require 'kraken/util/underscore' -op = require 'kraken/util/op' {EventEmitter} = require 'events' {Parsers, ParserMixin} = require 'kraken/util/parser' @@ -7,7 +6,7 @@ op = require 'kraken/util/op' /** * @class Specification for an option. */ -class exports.ChartOption +class exports.ChartTypeOption SPEC_KEYS : <[ name type default desc tags examples ]> name : null @@ -19,13 +18,13 @@ class exports.ChartOption (@chartType, @spec) -> - throw new Error('Each ChartOption requires a name!') unless @spec.name + throw new Error('Each ChartTypeOption requires a name!') unless @spec.name for k of @SPEC_KEYS v = @spec[k] @[k] = v if v? @tags or= [] - @parse = @lookup.getParser @type + @parse = @chartType.getParser @type parse : Parsers.parseString @@ -50,14 +49,14 @@ KNOWN_CHART_TYPES = exports.KNOWN_CHART_TYPES = {} */ class exports.ChartType extends EventEmitter /** - * Ordered ChartOption objects. - * @type ChartOption[] + * Ordered ChartTypeOption objects. + * @type ChartTypeOption[] */ options_ordered : null /** - * Map of option name to ChartOption objects. - * @type { name:ChartOption, ... } + * Map of option name to ChartTypeOption objects. + * @type { name:ChartTypeOption, ... } */ options : null @@ -70,13 +69,13 @@ class exports.ChartType extends EventEmitter * name, type, default, description (etc) of a chart option. */ (@name, options) -> - @options_ordered = _.map options, (opt) ~> new ChartOption this, opt + @options_ordered = _.map options, (opt) ~> new ChartTypeOption this, opt @options = _.synthesize @options_ordered, -> [it.name, it] ChartType.register this /** - * @returns {ChartOption} Get an option's spec by name. + * @returns {ChartTypeOption} Get an option's spec by name. */ get: (name, def) -> @options[name] or def diff --git a/lib/chart/dygraphs.co b/lib/chart/dygraphs.co index 056bc39..bdaada1 100644 --- a/lib/chart/dygraphs.co +++ b/lib/chart/dygraphs.co @@ -1,5 +1,5 @@ _ = require 'kraken/util/underscore' -{ ChartType, ChartOption, +{ ChartType, ChartTypeOption, } = require 'kraken/chart/chart-type' diff --git a/lib/chart/index.co b/lib/chart/index.co index 6709cab..e25febb 100644 --- a/lib/chart/index.co +++ b/lib/chart/index.co @@ -1,3 +1,5 @@ -chart_type = require 'kraken/chart/chart-type' -dygraphs = require 'kraken/chart/dygraphs' -exports import chart_type import dygraphs +chart_type = require 'kraken/chart/chart-type' +dygraphs = require 'kraken/chart/dygraphs' +models = require 'kraken/chart/chart-option-model' +views = require 'kraken/chart/chart-option-view' +exports import chart_type import dygraphs import models import views diff --git a/lib/graph/graph-model.co b/lib/graph/graph-model.co deleted file mode 100644 index 39e1109..0000000 --- a/lib/graph/graph-model.co +++ /dev/null @@ -1,114 +0,0 @@ -_ = require 'kraken/util/underscore' -{ BaseModel, BaseView, -} = require 'kraken/base' -{ Field, FieldList, FieldView, Scaffold, -} = require 'kraken/scaffold' - -IGNORED_TAGS = exports.IGNORED_TAGS = <[ callback deprecated debugging ]> - - - -class exports.TagSet extends Array - tags : {} - - (values=[]) -> - @tags = {} - @add values if values?.length - - has: (tag) -> - @tags[tag]? - - get: (tag) -> - return -1 unless tag - unless @tags[tag]? - @tags[tag] = @length - @push tag - @tags[tag] - - update: (tags) -> - is_single = typeof tags is 'string' - tags = [tags] if is_single - indices = ( for tag of tags then @get tag ) - if is_single then indices[0] else indices - - toString: -> "TagSet(length=#{@length}, values=[\"#{@join '", "'}\"])" - - -KNOWN_TAGS = exports.KNOWN_TAGS = new TagSet() - - -/** - * Field with graph-option-specific handling for validation, parsing, tags, etc. - */ -GraphOption = exports.GraphOption = Field.extend do # {{{ - ctorName : 'GraphOption' - - initialize : -> - # console.log "#this.initialize!" - Field::initialize ... - - # Notify Tag indexer of category when created, to ensure all category-tags - # get indices with colors :P - KNOWN_TAGS.update @getCategory() - - # Ignore functions/callbacks and, ahem, hidden tags. - type = @get 'type', '' .toLowerCase() - tags = @get 'tags', [] - if _.str.include(type, 'function') or _.intersection(tags, IGNORED_TAGS).length - @set 'ignore', true - - - # Wrapper to ensure @set('tags') is called, as tags.push() - # will not trigger the 'changed:tags' event. - addTag: (tag) -> - return this unless tag - tags = @get('tags', []) - tags.push tag - @set 'tags', tags - this - - # Wrapper to ensure @set('tags') is called, as tags.push() - # will not trigger the 'changed:tags' event. - removeTag: (tag) -> - return this unless tag - tags = @get('tags', []) - _.remove tags, tag - @set 'tags', tags - this - - # Keep tag list up to date - onTagUpdate: -> - KNOWN_TAGS.update @get 'tags' - this - - getTagIndex: (tag) -> - KNOWN_TAGS.get tag - - # A field's category is its first tag. - getCategory: -> - @get('tags', [])[0] - - getCategoryIndex: -> - @getTagIndex @getCategory() - - - toJSON: -> - o = Field::toJSON ... - for k, v in o - o[k] = '' if v!? - o -# }}} - - -GraphOptionList = exports.GraphOptionList = FieldList.extend do # {{{ - ctorName : 'GraphOptionList' - model : GraphOption - - /** - * Override to omit defaults from URL. - */ - toKVPairs: -> - _.collapseObject @values {-keepDefaults, +serialize} - -# }}} - diff --git a/lib/graph/graph-view.co b/lib/graph/graph-view.co deleted file mode 100644 index ad07954..0000000 --- a/lib/graph/graph-view.co +++ /dev/null @@ -1,107 +0,0 @@ -_ = require 'kraken/util/underscore' -{BaseView} = require 'kraken/base' -{ Field, FieldList, FieldView, Scaffold, -} = require 'kraken/scaffold' -{ GraphOption, GraphOptionList, TagSet, KNOWN_TAGS, -} = require 'kraken/graph/graph-model' - -DEBOUNCE_RENDER = exports.DEBOUNCE_RENDER = 100ms - - -/** - * The view for a single configurable option. - */ -GraphOptionView = exports.GraphOptionView = FieldView.extend do # {{{ - # __bind__ : <[ onClick ]> - ctorName : 'GraphOptionView' - tagName : 'div' - className : 'field option' - template : require 'kraken/template/graph-option' - - isCollapsed : true - - events : - 'blur .value' : 'update' - 'click input[type="checkbox"].value' : 'update' - 'submit .value' : 'update' - 'click .close' : 'toggleCollapsed' - 'click h3' : 'toggleCollapsed' - 'click .collapsed' : 'onClick' - - - render: -> - @__super__.render ... - @$el.addClass 'collapsed' if @isCollapsed - this - - onClick: (evt) -> - target = $ evt.target - # console.log "#this.onClick()", target - @toggleCollapsed() if @$el.hasClass('collapsed') and not target.hasClass('close') - - toggleCollapsed: -> - starting = @$el.hasClass 'collapsed' #@isCollapsed - @$el.toggleClass 'collapsed' - @isCollapsed = not starting - # console.log "#this.toggleCollapsed!", starting, '->', @isCollapsed - @trigger 'change:collapse', this, @isCollapsed - this - -# }}} - - - -/** - * - */ -GraphOptionsScaffold = exports.GraphOptionsScaffold = Scaffold.extend do # {{{ - ctorName : 'GraphOptionsScaffold' - tagName : 'form' - className : 'options scaffold' - template : require 'kraken/template/graph-scaffold' - collectionType : GraphOptionList - subviewType : GraphOptionView - fields : '.fields' - - # GraphView will set this - ready : false - - - - initialize : -> - @render = _.debounce @render.bind(this), DEBOUNCE_RENDER - Scaffold::initialize ... - - render: -> - # console.log "#this.render() -> .isotope()" - # @__super__.render ... - return this unless @ready - container = if @fields then @$el.find @fields else @$el - container - .addClass 'isotope' - .find '.field.option' .addClass 'isotope-item' - container.isotope do - # itemPositionDataEnabled : true - itemSelector : '.field.option' - layoutMode : 'masonry' - masonry : columnWidth : 10 - getSortData : - category: ($el) -> - $el.data 'model' .getCategory() - sortBy: 'category' - - /** - * Add a GraphOption to this scaffold, rerendering the isotope - * layout after collapse events. - */ - addOne: (field) -> - view = @__super__.addOne ... - view.on 'change:collapse render', @render - view - - toKV: -> - @collection.toKV ... - -# }}} - - diff --git a/lib/graph/index.co b/lib/graph/index.co index cd7b8be..5437dcc 100644 --- a/lib/graph/index.co +++ b/lib/graph/index.co @@ -1,3 +1,3 @@ -models = require 'kraken/graph/graph-model' -views = require 'kraken/graph/graph-view' -exports import models import views +# models = require 'kraken/graph/graph-model' +# views = require 'kraken/graph/graph-view' +# exports import models import views diff --git a/lib/main.co b/lib/main.co index 2098f7e..2134b50 100644 --- a/lib/main.co +++ b/lib/main.co @@ -3,15 +3,14 @@ Backbone = require 'backbone' { _, op, } = require 'kraken/util' -{ ChartType, DygraphsChartType, -} = require 'kraken/chart' { BaseView, BaseModel, BaseList, } = require 'kraken/base' { Field, FieldList, FieldView, Scaffold, } = require 'kraken/scaffold' -{ GraphOption, GraphOptionList, GraphOptionView, - GraphOptionsScaffold, TagSet, -} = require 'kraken/graph' +{ ChartType, DygraphsChartType, + ChartOption, ChartOptionList, TagSet, + ChartOptionView, ChartOptionScaffold, +} = require 'kraken/chart' { VisView, VisModel, VisList, } = require 'kraken/vis' diff --git a/lib/template/chart-option.jade b/lib/template/chart-option.jade new file mode 100644 index 0000000..08695bd --- /dev/null +++ b/lib/template/chart-option.jade @@ -0,0 +1,41 @@ +include browser-helpers +- var option_id = _.domize('option', id) + +- var value_id = _.domize('value', id) +- var type_cls = _.domize('type', type) + +- var category_cls = _.domize('category', model.getCategoryIndex()) + ' ' + _.domize('category', model.getCategory()) +- var tags_cls = tags.map(_.domize('tag')).join(' ') + + +.field.option(id=option_id, class="#{category_cls} #{tags_cls}") + a.close(title="Click to collapse") × + + h3.shortname(title="Click to collapse") #{name} + //- h3.shortname #{_.shortname(name)} + + label.name(for=value_id) #{name} + + if ( /object|array|function/i.test(type) ) + textarea.value(id=value_id, name=name, class=type_cls) #{value} + else + - var input_type = (/boolean/i.test(type) ? 'checkbox' : 'text'); + - var checked = ((/boolean/i.test(type) && value) ? 'checked' : null); + input.value(type=input_type, id=value_id, name=name, class=type_cls, value=value, checked=checked) + + .type(class=type_cls) #{type} + .default(class=type_cls, title="Default: #{def} (#{type})") #{def} + .desc + != jade.filters.markdown(desc) + + //- .tags(data-toggle="collapse", data-target="##{option_id} .tags ul"): ul.collapse + .tags + for tag in tags + - var tag_cls = _.domize('tag',tag) + ' ' + _.domize('category',model.getTagIndex(tag)) + span.tag(class=tag_cls) #{tag} + | + .examples(data-toggle="collapse", data-target="##{option_id} .examples ul"): ul.collapse + for example in examples + li.example + a(href="http://dygraphs.com/tests/#{example}.html", target="_blank") #{example} + diff --git a/lib/template/chart-scaffold.jade b/lib/template/chart-scaffold.jade new file mode 100644 index 0000000..ba4d6a6 --- /dev/null +++ b/lib/template/chart-scaffold.jade @@ -0,0 +1,3 @@ +form.options.scaffold + .fields.control-group + diff --git a/lib/template/graph-option.jade b/lib/template/graph-option.jade deleted file mode 100644 index 08695bd..0000000 --- a/lib/template/graph-option.jade +++ /dev/null @@ -1,41 +0,0 @@ -include browser-helpers -- var option_id = _.domize('option', id) - -- var value_id = _.domize('value', id) -- var type_cls = _.domize('type', type) - -- var category_cls = _.domize('category', model.getCategoryIndex()) + ' ' + _.domize('category', model.getCategory()) -- var tags_cls = tags.map(_.domize('tag')).join(' ') - - -.field.option(id=option_id, class="#{category_cls} #{tags_cls}") - a.close(title="Click to collapse") × - - h3.shortname(title="Click to collapse") #{name} - //- h3.shortname #{_.shortname(name)} - - label.name(for=value_id) #{name} - - if ( /object|array|function/i.test(type) ) - textarea.value(id=value_id, name=name, class=type_cls) #{value} - else - - var input_type = (/boolean/i.test(type) ? 'checkbox' : 'text'); - - var checked = ((/boolean/i.test(type) && value) ? 'checked' : null); - input.value(type=input_type, id=value_id, name=name, class=type_cls, value=value, checked=checked) - - .type(class=type_cls) #{type} - .default(class=type_cls, title="Default: #{def} (#{type})") #{def} - .desc - != jade.filters.markdown(desc) - - //- .tags(data-toggle="collapse", data-target="##{option_id} .tags ul"): ul.collapse - .tags - for tag in tags - - var tag_cls = _.domize('tag',tag) + ' ' + _.domize('category',model.getTagIndex(tag)) - span.tag(class=tag_cls) #{tag} - | - .examples(data-toggle="collapse", data-target="##{option_id} .examples ul"): ul.collapse - for example in examples - li.example - a(href="http://dygraphs.com/tests/#{example}.html", target="_blank") #{example} - diff --git a/lib/template/graph-scaffold.jade b/lib/template/graph-scaffold.jade deleted file mode 100644 index ba4d6a6..0000000 --- a/lib/template/graph-scaffold.jade +++ /dev/null @@ -1,3 +0,0 @@ -form.options.scaffold - .fields.control-group - diff --git a/lib/util/index.co b/lib/util/index.co index caba6e5..35cb297 100644 --- a/lib/util/index.co +++ b/lib/util/index.co @@ -11,7 +11,8 @@ root.jQuery?.fn.invoke = (method, ...args) -> op = require 'kraken/util/op' backbone = require 'kraken/util/backbone' parser = require 'kraken/util/parser' -exports import { root, _, op, backbone, parser, } +Cascade = require 'kraken/util/cascade' +exports import { root, _, op, backbone, parser, Cascade, } # HashSet = require 'kraken/util/hashset' # BitString = require 'kraken/util/bitstring' diff --git a/lib/vis/vis-model.co b/lib/vis/vis-model.co index 0ff9361..bbd2e7a 100644 --- a/lib/vis/vis-model.co +++ b/lib/vis/vis-model.co @@ -4,7 +4,7 @@ _ = require 'kraken/util/underscore' Cascade = require 'kraken/util/cascade' { ChartType, } = require 'kraken/chart' -{ BaseModel, BaseView, BaseList, +{ BaseModel, BaseList, } = require 'kraken/base' root = do -> this diff --git a/lib/vis/vis-view.co b/lib/vis/vis-view.co index 40a7e89..8275daa 100644 --- a/lib/vis/vis-view.co +++ b/lib/vis/vis-view.co @@ -3,10 +3,8 @@ root = do -> this _ = require 'kraken/util/underscore' { BaseView, } = require 'kraken/base' -{ Field, FieldList, FieldView, Scaffold -} = require 'kraken/scaffold' -{ GraphOptionsScaffold, GraphOption, GraphOptionList, DEBOUNCE_RENDER, -} = require 'kraken/graph' +{ ChartOptionScaffold, ChartOption, ChartOptionList, DEBOUNCE_RENDER, +} = require 'kraken/chart' { VisModel, } = require 'kraken/vis/vis-model' @@ -73,7 +71,7 @@ VisView = exports.VisView = BaseView.extend do # {{{ @viewport = @$el.find '.viewport' - @scaffold = new GraphOptionsScaffold + @scaffold = new ChartOptionScaffold @$el.find '.graph-options-pane' .append @scaffold.el @scaffold.collection.reset that if o.graph_spec diff --git a/www/misc/test.co b/www/misc/test.co index 4bc97e1..5c3033a 100644 --- a/www/misc/test.co +++ b/www/misc/test.co @@ -1,19 +1,16 @@ Seq = require 'seq' Backbone = require 'backbone' -{ _, op, +{ _, op, Cascade, } = require 'kraken/util' -Cascade = require 'kraken/util/cascade' - -{ ChartLibrary, DygraphsLibrary, -} = require 'kraken/chart' { BaseView, BaseModel, BaseList, } = require 'kraken/base' { Field, FieldList, FieldView, Scaffold, } = require 'kraken/scaffold' -{ GraphOption, GraphOptionList, GraphOptionView, - GraphOptionsScaffold, TagSet, -} = require 'kraken/graph' +{ ChartType, DygraphsChartType, + ChartOption, ChartOptionList, TagSet, + ChartOptionView, ChartOptionScaffold, +} = require 'kraken/chart' { VisView, VisModel, VisList, } = require 'kraken/vis' @@ -31,7 +28,7 @@ main = -> # for opt of root.CHART_OPTIONS_SPEC # opts[opt.name] = opt.default - dyglib = new DygraphsLibrary CHART_OPTIONS_SPEC + dyglib = new DygraphsChartType CHART_OPTIONS_SPEC # TODO: create a preset manager # Remove chart options from data so we don't have to deepcopy diff --git a/www/modules.yaml b/www/modules.yaml index 99cb4f0..d1c2c45 100644 --- a/www/modules.yaml +++ b/www/modules.yaml @@ -57,22 +57,24 @@ dev: - cascade - index - base + - scaffold: + - scaffold-model + - scaffold-view + - index - chart: - chart-type - dygraphs + - chart-option-model + - chart-option-view - index - template: + - chart-option.jade + - chart-scaffold.jade - graph.jade - - graph-option.jade - - graph-scaffold.jade - - scaffold: - - scaffold-model - - scaffold-view - - index - - graph: - - graph-model - - graph-view - - index + # - graph: + # - graph-model + # - graph-view + # - index - vis: - vis-model - vis-view -- 1.7.0.4