# HG changeset patch # User Lucas Thompson # Date 1481215530 0 # Node ID bb2bbb192e2b6922a4f4806d4ca1ec28fc0c04a5 # Parent 6ece58c968681ed995ef6fdf00a894067b60c017 Normalise time series values. diff -r 6ece58c96868 -r bb2bbb192e2b src/app/waveform/waveform.component.ts --- a/src/app/waveform/waveform.component.ts Thu Dec 08 16:23:22 2016 +0000 +++ b/src/app/waveform/waveform.component.ts Thu Dec 08 16:45:30 2016 +0000 @@ -137,10 +137,16 @@ // TODO refactor - this doesn't belong here private renderFeatures(features: FeatureList): void { + const normalisationFactor = 1.0 / + features.reduce((currentMax, feature) => { + return (feature.featureValues) + ? Math.max(currentMax, feature.featureValues[0]) + : currentMax; + }, -Infinity); const plotData = features.map(feature => { return { cx: toSeconds(feature.timestamp), - cy: feature.featureValues[0] + cy: feature.featureValues[0] * normalisationFactor }; }); this.addLayer(