Skip to content
Snippets Groups Projects
Commit 9fd261b7 authored by Jaden Diefenbaugh's avatar Jaden Diefenbaugh
Browse files

plots update when aliases change, fixed table alias update, #20

parent 3d81e30e
No related branches found
No related tags found
1 merge request!223Reports overhaul
......@@ -47,6 +47,25 @@ angular.module('reportApp')
PlotService.addPlot(scope.group, scope.id, scope.renderDivId);
});
let plotTimer;
const updatePlot = () => {
clearTimeout(plotTimer);
const queueUpdate = () => {
let el = document.querySelector(`#${scope.renderDivId}`);
// if the container is rendered and it already has had a render,
// redo the render
if(el && el.childNodes.length > 0){
el.innerHTML = '';
PlotService.addPlot(scope.group, scope.id, scope.renderDivId);
}
};
plotTimer = setTimeout(queueUpdate, 1000);
};
// if the group has exps added/removed, rerender the plot
scope.$watch(
// angular doesnt watch arrays properly (i.e. watching scope.group._experimentNames),
......@@ -55,15 +74,13 @@ angular.module('reportApp')
// because it compares shallowly and getters commonly return a new obj each time.
// so, watch the getters length instead
() => scope.group.experiments.length,
(newExps, oldExps) => {
let el = document.querySelector(`#${scope.renderDivId}`);
// if the container is rendered and it already has had a render,
// redo the render
if(el && el.childNodes.length > 0){
el.innerHTML = '';
PlotService.addPlot(scope.group, scope.id, scope.renderDivId);
}
}
updatePlot
);
// if the group has aliases changed, rerender the plot
scope.$watch(
() => JSON.stringify(scope.group._aliases),
updatePlot
);
scope.exportSrcFunc = () => () => {
......
......@@ -72,12 +72,20 @@ angular.module('reportApp')
};
// gets the field val for the given exp
scope.getFieldVal = (expName, field) => {
const alias = scope.group.aliases[expName].length > 0 ? scope.group.aliases[expName] : expName;
const alias = scope.group.aliases[expName].length > 0 ?
scope.group.aliases[expName] : expName;
let fVal = scope.tableables[alias] ?
scope.tableables[alias][field] : undefined;
const name = scope.tableables[alias] ?
alias : expName;
let fVal = scope.tableables[name] ? scope.tableables[name][field] : undefined;
let val;
console.log(expName);
console.log(alias);
console.log(scope.tableables);
console.log(fVal);
if(field === scope.fields[0]){
val = alias;
} else if(!fVal){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment