Skip to content

Commit

Permalink
refactoring: cleaner calls and names, removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreaubert committed Dec 12, 2024
1 parent f0f72ec commit b5980bd
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 163 deletions.
10 changes: 5 additions & 5 deletions src/website/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,30 @@ getMetadata()
measurement === 'Horizontal Reflections' ||
measurement === 'Vertical Reflections'
) {
graphsConfigs = setGraph(speakersName, graphs, windowWidth, windowHeight);
graphsConfigs = setGraph(measurement, speakersName, graphs, windowWidth, windowHeight);
} else if (measurement === 'SPL Horizontal Radar' || measurement === 'SPL Vertical Radar') {
graphsConfigs = setRadar(speakersName, graphs, windowWidth, windowHeight);
graphsConfigs = setRadar(measurement, speakersName, graphs, windowWidth, windowHeight);
} else if (
measurement === 'SPL Horizontal Contour' ||
measurement === 'SPL Vertical Contour' ||
measurement === 'SPL Horizontal Contour Normalized' ||
measurement === 'SPL Vertical Contour Normalized'
) {
graphsConfigs = setContour(speakersName, graphs, windowWidth, windowHeight);
graphsConfigs = setContour(measurement, speakersName, graphs, windowWidth, windowHeight);
} else if (
measurement === 'SPL Horizontal Contour 3D' ||
measurement === 'SPL Vertical Contour 3D' ||
measurement === 'SPL Horizontal Contour Normalized 3D' ||
measurement === 'SPL Vertical Contour Normalized 3D'
) {
graphsConfigs = setSurface(speakersName, graphs, windowWidth, windowHeight);
graphsConfigs = setSurface(measurement, speakersName, graphs, windowWidth, windowHeight);
} else if (
measurement === 'SPL Horizontal Globe' ||
measurement === 'SPL Vertical Globe' ||
measurement === 'SPL Horizontal Globe Normalized' ||
measurement === 'SPL Vertical Globe Normalized'
) {
graphsConfigs = setGlobe(speakersName, graphs, windowWidth, windowHeight);
graphsConfigs = setGlobe(measurement, speakersName, graphs, windowWidth, windowHeight);
} else {
console.error('Measurement ' + measurement + ' is unknown');
}
Expand Down
2 changes: 1 addition & 1 deletion src/website/graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
const spec = fetch("${graph | space2url}.json")
.then( (response) => response.json() )
.then( (spec) => {
displayGraph("${graph}.json", visGraph, spec);
displayGraph("${graph}", "${graph}.json", visGraph, spec);
});
</script>

Expand Down
16 changes: 8 additions & 8 deletions src/website/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ import Plotly from 'plotly-dist-min';

import { setGraph } from './plot.js';

export function displayGraph(jsonName, divName, graphSpec) {
export function displayGraph(measurementName, jsonName, divName, graphSpec) {
async function run() {
const w = window.innerWidth;
const h = window.innerHeight;

const title = graphSpec.layout.title.text;
const graphOptions = setGraph([title], [graphSpec], w, h, 1);
const graphOptions = setGraph(measurementName, [title], [graphSpec], w, h, 1);

if (graphOptions?.length >= 1) {
let options = graphOptions[0];
if (jsonName.indexOf('3D') !== -1) {
if (options.layout && options.layout?.shapes) {
options.layout.shapes = null;
}
}
let options = graphOptions[0];
if (jsonName.indexOf('3D') !== -1) {
if (options.layout && options.layout?.shapes) {
options.layout.shapes = null;
}
}

Plotly.newPlot(divName, options);
}
Expand Down
Loading

0 comments on commit b5980bd

Please sign in to comment.