# HG changeset patch # User Chris Cannam # Date 1493377255 -3600 # Node ID 3018e853184089ee58cf5b3974d24a17d59ae9fb # Parent 7bd5152e2edbaef0c062e9207c1a02aeb88b26b6 Don't normalise the feature data to 0,1 here: instead set the yDomain of the layer to its actual extent diff -r 7bd5152e2edb -r 3018e8531840 src/app/waveform/waveform.component.ts --- a/src/app/waveform/waveform.component.ts Fri Apr 28 10:51:52 2017 +0100 +++ b/src/app/waveform/waveform.component.ts Fri Apr 28 12:00:55 2017 +0100 @@ -626,23 +626,22 @@ if (featureData.length === 0) { return; } - const normalisationFactor = 1.0 / - featureData.reduce( - (currentMax, feature) => Math.max(currentMax, feature), - -Infinity - ); - const plotData = [...featureData].map((feature, i) => { return { cx: i * stepDuration, - cy: feature * normalisationFactor, - value: feature + cy: feature }; }); - + let min = featureData.reduce((m, f) => Math.min(m, f), Infinity); + let max = featureData.reduce((m, f) => Math.max(m, f), -Infinity); + if (min === Infinity) { + min = 0; + max = 1; + } const lineLayer = new wavesUI.helpers.LineLayer(plotData, { color: colour, - height: height + height: height, + yDomain: [ min, max ] }); this.addLayer( lineLayer, @@ -652,7 +651,8 @@ this.highlightLayer = new wavesUI.helpers.HighlightLayer(lineLayer, { opacity: 0.7, height: height, - color: '#c33c54' + color: '#c33c54', + yDomain: [ min, max ] }); this.addLayer( this.highlightLayer,