Mercurial > hg > dml-open-vis
comparison src/DML/MainVisBundle/Resources/assets/marionette/modules/RepresentationModule/RepresentationModule.31-Master.view.collection._histogram.js @ 0:493bcb69166c
added public content
author | Daniel Wolff |
---|---|
date | Tue, 09 Feb 2016 20:54:02 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:493bcb69166c |
---|---|
1 "use strict"; | |
2 | |
3 App.module("RepresentationModule", function(RepresentationModule, App, Backbone, Marionette, $, _, Logger) { | |
4 | |
5 RepresentationModule.addInitializer(function(options){ | |
6 | |
7 RepresentationModule.registerMaster({ | |
8 id: "view.collection._histogram", | |
9 inherit: "view._histogram", | |
10 | |
11 options: { | |
12 }, | |
13 | |
14 | |
15 // ================================================================= | |
16 // dynamic derived vis instance data | |
17 | |
18 | |
19 // ----------------------------------------------------------------- | |
20 // dynamic derived vis instance data - base | |
21 | |
22 | |
23 // ================================================================= | |
24 // vis instance rendering | |
25 | |
26 _generateHistogramOptions: function(pid) { | |
27 var options = {}; | |
28 options.colorForBars = "#3182bd"; | |
29 options.colorForOverlay = "#31a354"; | |
30 | |
31 options.dataDefinition = {}; | |
32 options.dataDefinition.forXs = null; | |
33 options.dataDefinition.forBars = null; | |
34 options.dataDefinition.forFlats = null; | |
35 | |
36 switch (pid) { | |
37 case "tempo-histogram": | |
38 case "pitch-histogram": | |
39 options.dataDefinition.forXs = "edges"; | |
40 options.dataDefinition.forBars = "counts"; | |
41 break; | |
42 case "midi-pitch-histogram": | |
43 options.dataDefinition.forXs = "values"; | |
44 options.dataDefinition.forBars = "counts"; | |
45 break; | |
46 case "mean-tempo-curve": | |
47 options.dataDefinition.forXs = function(data){return _.range(0, data.means.length);}; | |
48 options.dataDefinition.forBars = "means"; | |
49 options.dataDefinition.forFlats = "std_devs"; | |
50 break; | |
51 case "tuning-stats": | |
52 options.dataDefinition.forXs = function(data){return data.stats.hist.edges;}; | |
53 options.dataDefinition.forBars = function(data){return data.stats.hist.counts;}; | |
54 options.dataDefinition.forXMean = function(data){return data.stats.mean;}; | |
55 options.dataDefinition.forXStdDev = function(data){return data.stats["std-dev"];}; | |
56 break; | |
57 case "tonic-histogram": | |
58 options.dataDefinition.forXs = "values"; | |
59 options.dataDefinition.forBars = "counts"; | |
60 break; | |
61 case "pitch-class-histogram": | |
62 case "tonic-relative-pitch-class-histogram": | |
63 options.dataDefinition.forXs = "values"; | |
64 options.dataDefinition.forBars = "counts"; | |
65 break; | |
66 } | |
67 return options; | |
68 } | |
69 }); | |
70 }); | |
71 }, Logger); |