Skip to content

Commit

Permalink
Fix small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldhur committed Nov 24, 2017
1 parent d00128a commit 148484d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class Home extends Component {
});
};

handlerAvgValueChange = (e) => {
handlerAvgValueChange = (value) => {
let {avg} = this.state;
avg.value = parseInt(e.target.value);
avg.value = parseInt(value);
this.setState({
avg: avg
});
Expand Down
2 changes: 1 addition & 1 deletion app/components/dataSet/DataSetChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class DataSetChart extends Component {
tooltipDelay={100}
tooltipOnClick={this.handlerMouseClick}
antiAliasing={this.props.antiAliasing}
emptyMessage={<LoadingAlert onContextMenu={this.handlerContextMenu}/>}
emptyMessage={<NoDataAlert onContextMenu={this.handlerContextMenu}/>}
>
<TitleCurrentTime/>
</LineChart>
Expand Down
17 changes: 7 additions & 10 deletions app/workers/prepareValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import {
VALUES_MAX,
VALUES_MIN,
VALUES_RAW,
FORMAT_DATE_SQL
} from '../constants/app';

function calcTimeExtreme (period, data, avg, startOrEnd) {
function calcTimeExtreme(period, data, avg, startOrEnd) {
const timePeriod = period.valueOf();
const timeData = data.valueOf();

Expand Down Expand Up @@ -37,14 +36,12 @@ function prepareValues(data, time, rowLength) {

let format = VALUES_RAW;
rows = prepareRawValues(rows, time, rowLength, data.properties.badValue || 99999);
if (time.extreme.frequency !== avg.time) {
if (time.extreme.frequency < avg.time) {
format = VALUES_AVG;
rows = prepareFormatedValues(rows, time, format);
} else if (time.extreme.frequency > avg.time) {
format = VALUES_INTERPOLATED;
rows = prepareInterpolatedValues(rows, time);
}
if (time.extreme.frequency < avg.time) {
format = VALUES_AVG;
rows = prepareFormatedValues(rows, time, format);
} else if (Math.abs(time.extreme.start - rows[0][0].valueOf()) > 0) {
format = VALUES_INTERPOLATED;
rows = prepareInterpolatedValues(rows, time);
}

return {
Expand Down

0 comments on commit 148484d

Please sign in to comment.