구성 요소로 돌아 다니는 순간에는 도넛 형 차트를 업데이트해야하지만 그렇지 않은 경우 그대로 업데이트해야합니다. 이 차트를 렌더링하는 순간이기 때문에 멀리 이동하고 값이 업데이트됩니다 경우에 페이지가로드차트 새로 고침 이오니아 2 Chart.js
ionViewDidLoad() {
this.renderChart(this.title, this.score, this.difference);
}
는 HTML을
<chart [options]="options"></chart>
하지만, 그것은 나던 때
renderChart(oplTitle, oplScore, oplScoreDifference) {
this.options = {
type: 'doughnut',
data: {
labels: ["Opl progress", ""],
datasets: [{
borderWidth: 0,
data: [oplScore, oplScoreDifference],
backgroundColor: [
'rgba(250, 203, 27, 0.9)',
'rgba(255, 255, 255, 1)'
],
borderColor: [
'rgba(250, 203, 27, 1)',
'rgba(250, 203, 27, 1)'
],
}]
},
options: {
responsive: true,
title: {
display: true,
text: oplTitle,
position: 'bottom'
},
tooltips: {
enabled: false,
backgroundColor: 'rgba(250, 203, 27, 1)'
},
legend: {
display: false,
labels: {
boxWidth: 20
}
}
}
}
}
나는 renderChart 전화 페이지로 돌아 가면 새로 고침합니다. 페이지가로드되면 어떻게 ... 당신이 워드 프로세서에 ionViewDidLoad
이벤트를 볼 수 있습니다처럼 때문에
기본적으로 원하는 것은 navCtrl.pop()이 차트의 하위 페이지에서 실행될 때 값을 설정하거나 함수를 호출 할 수 있다는 것입니다. – Ivaro18
이 경우에이 질문에 대한 최고 대답은 내가 믿을만한 답변을 제공하기 때문입니다. http://stackoverflow.com/questions/36325641/how-to-reload-the-ion-page-after-pop-in-ionic2 – Ivaro18