View Full Version : Clear Series in Ext JS 4 chart

25 Mar 2013, 7:00 AM

I'm having an issue clearing axes and series in Ext. JS.

I'm using the same chart object for a couple things in my app:

1. Line chart showing all requests for apps in our company
2. Line chart where you choose x number of apps and compare them in line chart

I'm running into a problem in the second case. I'm using the Ext. UX box select to choose multiple apps. Then, I clear the chart using:
var chart = Ext.ComponentQuery.query('primarychart')[0];


//then I add axes and series based on loops


What I'm finding is that if I keep the same applications in my list the lines seem to be getting darker each time. . .as if they are getting set twice the second time, three times the third time. It's strange because looking at the store this does not seem to be evident. Also, I've tested the clear functionality by returning false after all my clearing and not adding any series or axes to the chart and visually it looks like everything is destroyed. Am I missing something or do I just need to destroy and rebuild the chart each time?

**Update - Looks like this is an issue with my dynamic model. I'm creating fields on the fly. Is there a way to clear the fields or is it smarter to destroy and re-create the model?