Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Including Graphs in PrintDocuments

Including Graphs in PrintDocuments

Including Graphs in PrintDocuments

I have what appears to be an initialization problem when including graphs in a reporting scheme. I hope you understand this:
1. I have a dll that creates and populates a System.Windows.Forms.DataVisualization.Charting object
2. A SQL string is passed into this DLL as a part of the setup.
3. One of the setups, of course, will produce Y-axis labels based on the overall SQL results.
4. The first time I run my report with certain parameters set, the Y-axis labels are perfect.
5. If I then change my input parameters, the Y-axis labels are a repeat of the first run.

This shouldn't be since I create new instances of the charting object each time. Something, however, is left over from the first run.

I have attached a document for you to look at. There are screenshots of the run time results and I've also included the source code of my DLL and how it is setup.

Jerry Scannell

RE: Including Graphs in PrintDocuments

This is odd. I solved the problem but I don't understand why I had to do it.

In my code, x and y points are added to each series. Of course, this is how the graph gets created in the first place. Not earth-shattering.

But it is what I had to do for each series that has me confused. I had to explicitly clear() out each series' points before I could add new ones. The reason why that is troubling is because I create new instances of the class each time, so why would data points from a previous instance of the object still be in there?

I've attached my new code with the bottom 3 lines being what I added.

I don't know why the points from the previous runs would have still been there. They caused my y-axis labels to stay the same from run to run. Whichever report I ran first would permanently set the labels.

Jerry Scannell

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close