annotate src/DML/MainVisBundle/Resources/assets/marionette/modules/RepresentationModule/RepresentationModule.31-Master.view.collection.key-relative-chord-seq.js @ 1:f38015048f48 tip

Added GPL
author Daniel Wolff
date Sat, 13 Feb 2016 20:43:38 +0100
parents 493bcb69166c
children
rev   line source
Daniel@0 1 "use strict";
Daniel@0 2
Daniel@0 3 App.module("RepresentationModule", function(RepresentationModule, App, Backbone, Marionette, $, _, Logger) {
Daniel@0 4
Daniel@0 5 RepresentationModule.addInitializer(function(options){
Daniel@0 6
Daniel@0 7 RepresentationModule.registerMaster({
Daniel@0 8 id: "view.collection.key-relative-chord-seq",
Daniel@0 9 inherit: "view._default",
Daniel@0 10
Daniel@0 11 options: {
Daniel@0 12 canHaveBase: true,
Daniel@0 13 },
Daniel@0 14
Daniel@0 15 defaultConfigParameterValues: {
Daniel@0 16 sequenceCount: 100,
Daniel@0 17 sequenceRepresentation: "parallel-coordinates",
Daniel@0 18 chordGrouppingIsByType: "",
Daniel@0 19 guidesAreVisible: "1",
Daniel@0 20 recordingsInMajorModeAreIncluded: "1",
Daniel@0 21 recordingsInMinorModeAreIncluded: "1",
Daniel@0 22
Daniel@0 23 chordTypesArePopularOnly: "",
Daniel@0 24 chordSequencesWithCyclesAreIncluded: "1",
Daniel@0 25 nIsIncluded: "",
Daniel@0 26 sequenceStepCount: 2,
Daniel@0 27 minSupport: 50
Daniel@0 28 },
Daniel@0 29
Daniel@0 30
Daniel@0 31 // =================================================================
Daniel@0 32 // config grid header
Daniel@0 33
Daniel@0 34 _generateHeaderLabelSuffix: function(headerView) {
Daniel@0 35 var sequenceCount = this.getConfigParameterValueOrDefaultValue(headerView.options.config, "sequenceCount", true);
Daniel@0 36 return _.str.sprintf(" (%s most frequent)", sequenceCount);
Daniel@0 37 //return _.str.sprintf(" (up to %s)", this.getConfigParameterValueOrDefaultValue(headerView.options.config, "limit"));
Daniel@0 38 },
Daniel@0 39
Daniel@0 40
Daniel@0 41 // =================================================================
Daniel@0 42 // vis instance rendering
Daniel@0 43
Daniel@0 44 calculateVisInstanceContentHeight: function(viewConfig, entityWidth) {
Daniel@0 45 var representation = this.getConfigParameterValueOrDefaultValue(viewConfig, "representaton", true);
Daniel@0 46 return entityWidth;
Daniel@0 47 },
Daniel@0 48
Daniel@0 49
Daniel@0 50 // -----------------------------------------------------------------
Daniel@0 51 // vis instance rendering - base
Daniel@0 52
Daniel@0 53 _generateCustomParamsForBasePerspectiveRequestParams: function(viewConfig) {
Daniel@0 54 var result = {
Daniel@0 55 "spm_maxseqs": this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceCount", true),
Daniel@0 56 "spm_minlen": this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceStepCount", true),
Daniel@0 57 "spm_ignore_n": this.getConfigParameterValueOrDefaultValue(viewConfig, "nIsIncluded", true) == "1" ? "0" : "1",
Daniel@0 58 "spm_minsupport": this.getConfigParameterValueOrDefaultValue(viewConfig, "minSupport", true),
Daniel@0 59 };
Daniel@0 60 return result;
Daniel@0 61 },
Daniel@0 62
Daniel@0 63
Daniel@0 64 _doRenderVisInstanceViewBaseWithKnownComparisonMode: function(visInstanceView, comparisonMode) {
Daniel@0 65 var viewConfig = visInstanceView.options.viewConfig;
Daniel@0 66
Daniel@0 67 var options = {};
Daniel@0 68 options.comparisonMode = comparisonMode;
Daniel@0 69
Daniel@0 70 options.chordGrouppingIsByType = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "chordGrouppingIsByType", true);
Daniel@0 71 options.guidesAreVisible = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "guidesAreVisible", true);
Daniel@0 72 options.recordingsInMajorModeAreIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "recordingsInMajorModeAreIncluded", true);
Daniel@0 73 options.recordingsInMinorModeAreIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "recordingsInMinorModeAreIncluded", true);
Daniel@0 74 options.nIsIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "nIsIncluded", true);
Daniel@0 75 options.stepCount = this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceStepCount", true);
Daniel@0 76 options.chordSequencesWithCyclesAreIncluded = !!this.getConfigParameterValueOrDefaultValue(viewConfig, "chordSequencesWithCyclesAreIncluded", true);
Daniel@0 77 options.sequenceOfUsedChordTypes = [0, 1, 2, 3, 4, 6];
Daniel@0 78 if (!!this.getConfigParameterValueOrDefaultValue(viewConfig, "chordTypesArePopularOnly", true)) {
Daniel@0 79 //options.sequenceOfUsedChordTypes = [0, 3];
Daniel@0 80 }
Daniel@0 81
Daniel@0 82 options.primaryColor = "#3182bd";
Daniel@0 83 options.secondaryColor = "#31a354";
Daniel@0 84
Daniel@0 85 var representation = this.getConfigParameterValueOrDefaultValue(viewConfig, "sequenceRepresentation", true);
Daniel@0 86 App.GraphicsRenderingModule.render("chord-seq." + representation, visInstanceView.$content, this._groupDataForGraphicsRendering(visInstanceView, "base"), options);
Daniel@0 87 },
Daniel@0 88
Daniel@0 89 });
Daniel@0 90 });
Daniel@0 91 }, Logger);