diff --git a/src/components/widget-plot/plot.js b/src/components/widget-plot/plot.js index c79843c..702940d 100644 --- a/src/components/widget-plot/plot.js +++ b/src/components/widget-plot/plot.js @@ -19,6 +19,8 @@ const leftMargin = 30; const bottomMargin = 20; const rightMargin = 10; +let uniqueIdentifier = 0; + class Plot extends React.Component { constructor(props) { super(props); @@ -33,9 +35,9 @@ class Plot extends React.Component { let yScale; if (props.yUseMinMax) { - yScale = scaleLinear().domain([props.yMin, props.yMax]).range([props.height, 0]); + yScale = scaleLinear().domain([props.yMin, props.yMax]).range([props.height - bottomMargin, 0]); } else { - yScale = scaleLinear().domain([0, 10]).range([props.height, 0]); + yScale = scaleLinear().domain([0, 10]).range([props.height - bottomMargin, 0]); } const xAxis = axisBottom().scale(xScale).ticks(5).tickFormat(date => timeFormat("%M:%S")(date)); @@ -46,7 +48,8 @@ class Plot extends React.Component { lines: null, xAxis, yAxis, - labelMargin + labelMargin, + identifier: uniqueIdentifier++ }; } @@ -75,9 +78,9 @@ class Plot extends React.Component { let yScale; if (nextProps.yUseMinMax) { - yScale = scaleLinear().domain([nextProps.yMin, nextProps.yMax]).range([nextProps.height, 0]); + yScale = scaleLinear().domain([nextProps.yMin, nextProps.yMax]).range([nextProps.height - bottomMargin, 0]); } else { - yScale = scaleLinear().domain([0, 10]).range([nextProps.height, 0]); + yScale = scaleLinear().domain([0, 10]).range([nextProps.height - bottomMargin, 0]); } const xAxis = axisBottom().scale(xScale).ticks(5).tickFormat(date => timeFormat("%M:%S")(date)); @@ -174,12 +177,12 @@ class Plot extends React.Component { Time [s] - + - + {this.state.lines} ;