Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render linechart will crash when more times #52

Open
samuelltk opened this issue Oct 30, 2016 · 5 comments
Open

render linechart will crash when more times #52

samuelltk opened this issue Oct 30, 2016 · 5 comments

Comments

@samuelltk
Copy link

The app will crash when states change more times. please help me, thanks.

getRandomData(){
var data={};
data['xValues']=[];
data['yValues']=[
{
data:[],
label:'test1',
config:{
color:'blue'
}
}
];
for (var i = 0; i < 50; i++) {
data.xValues.push(i+'');
data.yValues[0].data.push(Math.random()*100);
};
return data;
}
componentDidMount() {
var num=0;
setInterval(() => {
var datas=this.getRandomData();
this.setState({
randomDatas:datas
});
}, 1000);
}
render() {
return (


<LineChart
style={{flex:1}}
data={this.state.randomDatas}
visibleXRange={[0,30]}
maxVisibleValueCount={50}
xAxis={{drawGridLines:false,gridLineWidth:1,position:"BOTTOM"}}
yAxisRight={{enable:false}}
yAxis={{startAtZero:false,drawGridLines:false,position:"INSIDE_CHART"}}
drawGridBackground={false}
backgroundColor={"WHITE"}
description={""}
legend={{enable:true,position:'ABOVE_CHART_LEFT',direction:"LEFT_TO_RIGHT"}}
/>


);
}

@hongyin163
Copy link
Owner

is there some exception log ?

@samuelltk
Copy link
Author

samuelltk commented Oct 31, 2016

10-27 23:09:21.858 15712-15762/com.myvictorytest A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x90cd005c in tid 15762 (mqt_js)
10-27 23:09:24.828 15712-15712/com.myvictorytest I/Choreographer: Skipped 170 frames! The application may be doing too much work on its main thread.
@hongyin163

@hongyin163
Copy link
Owner

how do you update your view?

@samuelltk
Copy link
Author

@hongyin163 i update the state per 1 seconds, the render will be run, wait for a moment, my app will crash on android...i am use the Galaxy S4, 5.0.1....My code look on the top.

@hongyin163
Copy link
Owner

时间间隔设置长一点呢?
或者使用setTimeout试试?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants