Jump to content
Software FX Community

Drawing a chart 2 different times results in two different drawings?!


rms2219

Recommended Posts

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...