title: Angular5 + ChartJS - Multiple charts stacking on top of each other?
body: <p>So could use some help, i thought i had this working, but upon playing with the graph i realized i do not.</p>
  
  <p>In ngOnInit i subscribe to one of my services that returns an observable containing the data i need to produce the chart  that i need.  This subscription is inside of a router params subscription that monitors when the user changes child pages within the same component so i can update the page data, standard Angular stuff.</p>
  
  <p>I thought it was working perfectly, i would switch routes, my chart would rebuild, all my other data values would update on the page and life was good.</p>
  
  <p>Until i started playing with the Y axis after changing routes, my chart started flickering between my current route's chart and the chart from the previous route!  I am pretty sure i am doing things in the wrong order, or missing something to keep it from rebuilding another chart on top of the existing one?</p>
  
  <p>Heres a gif of  whats happening
  <a href="https://gyazo.com/dd87de46b282094f88cda41189910c00" rel="nofollow noreferrer">https://gyazo.com/dd87de46b282094f88cda41189910c00</a></p>
  
  <p>Here is a high level look at the order i do things, i wont bother filling in the hundred or so lines of other stuff going on unless necessary i think this gives the jist.</p>
  
  <pre><code>chart = [] as Chart;
  
  ngOnInit
  {
      router.params.subscribe(params =&gt; {
      //Set a few var's based on param's here
       apiService.getData()
      .subscribe(res =&gt; {
          timestamps = res.history.map((x) =&gt;x.time)
          data = res.data.map((y) =&gt; y.data)
          chart = new Chart('canvas' }{
          //Normal  ChartJS stuff in here
          labels = timestamps;
          data = data;
          }
      }
      }
  }
  </code></pre>
  
  <p>Ive tried clearing my chart with this.chart = [] as Chart; inside my params subscription to clear it and its data when the child route changes, but it didnt seem to make a difference.</p>