Daniel@0: "use strict"; Daniel@0: Daniel@0: App.module("RepresentationModule", function(RepresentationModule, App, Backbone, Marionette, $, _, Logger) { Daniel@0: Daniel@0: RepresentationModule.addInitializer(function(options){ Daniel@0: Daniel@0: RepresentationModule.registerMaster({ Daniel@0: id: "view.collection.key-relative-chord-seq", Daniel@0: inherit: "view._default", Daniel@0: Daniel@0: options: { Daniel@0: canHaveBase: true, Daniel@0: }, Daniel@0: Daniel@0: defaultConfigParameterValues: { Daniel@0: sequenceCount: 100, Daniel@0: sequenceRepresentation: "parallel-coordinates", Daniel@0: chordGrouppingIsByType: "", Daniel@0: guidesAreVisible: "1", Daniel@0: recordingsInMajorModeAreIncluded: "1", Daniel@0: recordingsInMinorModeAreIncluded: "1", Daniel@0: Daniel@0: chordTypesArePopularOnly: "", Daniel@0: chordSequencesWithCyclesAreIncluded: "1", Daniel@0: nIsIncluded: "", Daniel@0: sequenceStepCount: 2, Daniel@0: minSupport: 50 Daniel@0: }, Daniel@0: Daniel@0: Daniel@0: // ================================================================= Daniel@0: // config grid header Daniel@0: Daniel@0: _generateHeaderLabelSuffix: function(headerView) { Daniel@0: var sequenceCount = this.getConfigParameterValueOrDefaultValue(headerView.options.config, "sequenceCount", true); Daniel@0: return _.str.sprintf(" (%s most frequent)", sequenceCount); Daniel@0: //return _.str.sprintf(" (up to %s)", this.getConfigParameterValueOrDefaultValue(headerView.options.config, "limit")); Daniel@0: }, Daniel@0: Daniel@0: Daniel@0: // ================================================================= Daniel@0: // vis instance rendering Daniel@0: Daniel@0: calculateVisInstanceContentHeight: function(viewConfig, entityWidth) { Daniel@0: var representation = this.getConfigParameterValueOrDefaultValue(viewConfig, "representaton", true); Daniel@0: return entityWidth; Daniel@0: }, Daniel@0: Daniel@0: Daniel@0: // ----------------------------------------------------------------- Daniel@0: // vis instance rendering - base Daniel@0: Daniel@0: _generateCustomParamsForBasePerspectiveRequestParams: function(viewConfig) { Daniel@0: var result = { Daniel@0: "spm_maxseqs": this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceCount", true), Daniel@0: "spm_minlen": this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceStepCount", true), Daniel@0: "spm_ignore_n": this.getConfigParameterValueOrDefaultValue(viewConfig, "nIsIncluded", true) == "1" ? "0" : "1", Daniel@0: "spm_minsupport": this.getConfigParameterValueOrDefaultValue(viewConfig, "minSupport", true), Daniel@0: }; Daniel@0: return result; Daniel@0: }, Daniel@0: Daniel@0: Daniel@0: _doRenderVisInstanceViewBaseWithKnownComparisonMode: function(visInstanceView, comparisonMode) { Daniel@0: var viewConfig = visInstanceView.options.viewConfig; Daniel@0: Daniel@0: var options = {}; Daniel@0: options.comparisonMode = comparisonMode; Daniel@0: Daniel@0: options.chordGrouppingIsByType = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "chordGrouppingIsByType", true); Daniel@0: options.guidesAreVisible = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "guidesAreVisible", true); Daniel@0: options.recordingsInMajorModeAreIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "recordingsInMajorModeAreIncluded", true); Daniel@0: options.recordingsInMinorModeAreIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "recordingsInMinorModeAreIncluded", true); Daniel@0: options.nIsIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "nIsIncluded", true); Daniel@0: options.stepCount = this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceStepCount", true); Daniel@0: options.chordSequencesWithCyclesAreIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "chordSequencesWithCyclesAreIncluded", true); Daniel@0: options.sequenceOfUsedChordTypes = [0, 1, 2, 3, 4, 6]; Daniel@0: if (!!this.getConfigParameterValueOrDefaultValue(viewConfig, "chordTypesArePopularOnly", true)) { Daniel@0: //options.sequenceOfUsedChordTypes = [0, 3]; Daniel@0: } Daniel@0: Daniel@0: options.primaryColor = "#3182bd"; Daniel@0: options.secondaryColor = "#31a354"; Daniel@0: Daniel@0: var representation = this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceRepresentation", true); Daniel@0: App.GraphicsRenderingModule.render("chord-seq." + representation, visInstanceView.$content, this._groupDataForGraphicsRendering(visInstanceView, "base"), options); Daniel@0: }, Daniel@0: Daniel@0: }); Daniel@0: }); Daniel@0: }, Logger);