1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-16 00:00:03 +01:00

plot widget x scale now freezes if dashboard is paused

This commit is contained in:
Laura Fuentes Grau 2020-03-16 20:36:23 +01:00
parent a63c943d2f
commit fe3c783054

View file

@ -65,7 +65,8 @@ class Plot extends React.Component {
xAxis,
yAxis,
labelMargin,
identifier: uniqueIdentifier++
identifier: uniqueIdentifier++,
stopTime: null,
};
}
@ -86,20 +87,30 @@ class Plot extends React.Component {
// check if data is invalid
if (props.data == null || props.data.length === 0 || props.data[0].length === 0) {
// create empty plot axes
const xScale = scaleTime().domain([Date.now() - props.time * 1000, Date.now()]).range([0, props.width - leftMargin - labelMargin - rightMargin]);
let xScale;
let yScale;
let stopTime;
if(!props.paused){
xScale = scaleTime().domain([Date.now() - props.time * 1000, Date.now()]).range([0, props.width - leftMargin - labelMargin - rightMargin]);
stopTime = Date.now();
}else{
stopTime = state.stopTime;
xScale = scaleLinear().domain([state.stopTime - props.time * 1000, state.stopTime]).range([0, props.width - leftMargin - labelMargin - rightMargin]);
}
if (props.yUseMinMax) {
yScale = scaleLinear().domain([props.yMin, props.yMax]).range([props.height + topMargin - bottomMargin, topMargin]);
} else {
yScale = scaleLinear().domain([0, 10]).range([props.height + topMargin - bottomMargin, topMargin]);
}
const xAxis = axisBottom().scale(xScale).ticks(5).tickFormat(timeFormat("%M:%S"));
const yAxis = axisLeft().scale(yScale).ticks(5).tickFormat(format(".3s"));
return{
stopTime: stopTime,
data: null,
xAxis,
yAxis,