rms2219 Posted January 21, 2010 Report Share Posted January 21, 2010 This is odd. I have a combobox filled with strings that represent keys in a database. When the application loads, the data is loaded into a dictionary. When the user selects one of the strings from the combobox, the appropriate data is filtered from the Dictionary and populates a chart. On the first couple of selections from the combobox, the charts draw correctly, but sometimes it draw with the final data point off of the readable chart area. If I resize the window (even just a little), the chart fixes itself. The only workaround I can think of for the time being is after every selection from the combobox, "programatically" resize the window. I've attached two screenshots: one of the first selection (draws fine) and one of the second selection (draws incorrectly) Quote Link to comment Share on other sites More sharing options...
rms2219 Posted January 21, 2010 Author Report Share Posted January 21, 2010 The second screenshot Quote Link to comment Share on other sites More sharing options...
JuanC Posted January 21, 2010 Report Share Posted January 21, 2010 Can you describe how you populate the chart when the combobox is changed? Are you passing data manually? Are you using ObservableCollection? JuanC Quote Link to comment Share on other sites More sharing options...
rms2219 Posted January 21, 2010 Author Report Share Posted January 21, 2010 I am populating the charts manually. When the program loads, there is a call made to database to retrieve all of the rows of data. From that, I fill a couple of lists with different sets of data (i.e. one list consists entirely of all of the distinct strings from a column of the database...they are months and this is used to populate the X-Axis). Next, when the user selects something from the drop down box, the data is added to the chart. I looked at my code while I was doing this and I noticed that I am not clearing the existing X-Axis LabelCollection before adding the new set (so the first time through, I would have 12 months, whereas the second time through, I'd have 24 months, which could explain the issue). Is there a simple method call to ensure all data and labels are reset before adding new data? EDIT: I just changed it to clear the X-Axis labels before adding new ones and that did not solve the problem, it results in the same error. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.