Skip to content

Commit

Permalink
fixed uneccessary updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chgibb committed Aug 13, 2019
1 parent 55f40f3 commit 82cff7a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/req/renderer/containers/charts/alignerDoughnut.tsx
Expand Up @@ -50,12 +50,17 @@ export class AlignerDoughnut extends React.Component<AlignerDoughnutProps,{}>
}
if(this.chartRef.current)
{
if(this.chart)
this.chart.destroy();

this.chart = new Chart(this.chartRef.current.getContext("2d")!,{
if(!this.chart)
{
this.chart = new Chart(this.chartRef.current.getContext("2d")!,{
type: "doughnut",
data : {
options : {
animation : {
animateRotate : true
}
}});
}
let data = {
datasets: [
{
data : [numBowtie2,numHisat2,numUnknown],
Expand All @@ -71,13 +76,10 @@ export class AlignerDoughnut extends React.Component<AlignerDoughnutProps,{}>
"Hisat2",
"Unknown"
]
},
options : {
animation : {
animateRotate : true
}
}
});
};

this.chart.data = data;
this.chart.update();
}
}
}
Expand Down

0 comments on commit 82cff7a

Please sign in to comment.