Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Commit

Permalink
Initialize the trend map once, other operations are to change the val…
Browse files Browse the repository at this point in the history
…ue; if the packaging fails, you can upgrade the node to a non-6 version
  • Loading branch information
cuiyuan committed May 22, 2018
1 parent e0445e7 commit 4403ff3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
11 changes: 6 additions & 5 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"antd": "^2.13.11",
"antd": "^2.13.13",
"autoprefixer": "7.1.1",
"axios": "^0.16.2",
"babel-core": "6.25.0",
Expand All @@ -12,6 +12,7 @@
"babel-loader": "7.0.0",
"babel-preset-react-app": "^3.1.1",
"babel-runtime": "6.23.0",
"babel-polyfill": "6.26.0",
"case-sensitive-paths-webpack-plugin": "2.1.1",
"chalk": "1.1.3",
"css-loader": "0.28.4",
Expand All @@ -33,12 +34,12 @@
"html-webpack-plugin": "2.29.0",
"jest": "20.0.4",
"jquery": "3.2.1",
"moment": "^2.20.1",
"moment": "^2.21.0",
"object-assign": "4.1.1",
"postcss-flexbugs-fixes": "3.0.0",
"postcss-loader": "2.0.6",
"promise": "7.1.1",
"prop-types": "^15.5.10",
"prop-types": "^15.6.1",
"rc-upload": "^2.4.1",
"react": "^15.6.1",
"react-cookies": "^0.1.0",
Expand Down Expand Up @@ -106,9 +107,9 @@
"extends": "react-app"
},
"devDependencies": {
"babel-plugin-import": "^1.6.5",
"babel-plugin-import": "^1.6.7",
"less": "^2.7.2",
"less-loader": "^4.0.4"
"less-loader": "^4.1.0"
},
"proxy": ""
}
38 changes: 27 additions & 11 deletions web/src/index/component/trend.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export default class Trend extends Component {
});
return;
}
self.getTrendData(url, undefined, undefined, false);
self.getTrendData(url, undefined, undefined, false, true);
});

let TREND_LOADING = 'The trend is loading, please wait';
Expand Down Expand Up @@ -397,7 +397,7 @@ export default class Trend extends Component {
+ '/curves?'
+ 'startTime=' + startTime
+ '&endTime=' + endTime;
self.getTrendData(url, undefined, undefined, false);
self.getTrendData(url, undefined, undefined, false, true);
}
// Scroll around one screen
// 65: prev screen
Expand All @@ -415,7 +415,7 @@ export default class Trend extends Component {
+ '/curves?'
+ 'startTime=' + start
+ '&endTime=' + end;
this.getTrendData(url, undefined, undefined, false);
this.getTrendData(url, undefined, undefined, false, true);
}

shouldComponentUpdate(nextProps) {
Expand Down Expand Up @@ -810,11 +810,12 @@ export default class Trend extends Component {
events: {
load: loadFunction,
selection: selectionFunction
},
}
// ,
// animation: {
// duration: 0
// }
animation: false
// animation: false
},
title: {
text: '',
Expand Down Expand Up @@ -858,7 +859,8 @@ export default class Trend extends Component {
week: '%Y<br/>%m-%d',
month: '%Y-%m',
year: '%Y'
}
},
animation: false
},
rangeSelector: {
buttons: [{
Expand Down Expand Up @@ -1051,7 +1053,8 @@ export default class Trend extends Component {
}
},
events: {
},
}
,
// point: {
// events: {
// mouseOver: mouseOverFunction
Expand Down Expand Up @@ -1145,7 +1148,7 @@ export default class Trend extends Component {
}

// Rendering trend graph
getTrendData(url, options, setExtremes, reflowThumb) {
getTrendData(url, options, setExtremes, reflowThumb, setData) {
const self = this;
if (!options) {
options = self.state.options;
Expand Down Expand Up @@ -1232,8 +1235,21 @@ export default class Trend extends Component {
loading: false,
neverReflow: reflowThumb
};
// redraw trend
self.setState(paramsOptions);
if (setData) {
//setdata
trends.forEach((trendItem, trendIndex) => {
self.chart.series.forEach((seriesItem, seriesIndex) => {
if (self.chart.series[seriesIndex].name === trendItem.name) {
self.chart.series[seriesIndex].setData(trendItem.data);
return;
}
});
});
}
else {
// redraw trend
self.setState(paramsOptions);
}
eventProxy.trigger('loadBand', {
name,
trendsBands
Expand Down Expand Up @@ -1508,7 +1524,7 @@ export default class Trend extends Component {
+ '/curves?'
+ 'startTime=' + startTime
+ '&endTime=' + endTime;
self.getTrendData(url, option, true, false);
self.getTrendData(url, option, true, false, true);
}
else {
if (e.target.chart) {
Expand Down

0 comments on commit 4403ff3

Please sign in to comment.