We help IT Professionals succeed at work.

Create Chart in Class

Espavo asked
Last Modified: 2013-11-26
Is there a way to create an image in a "Class" (Function) pass a batch of parameters (52 parameters) to it and stream an image to the browser? (Possibly create a User Control that'll do this...)

I'm needing to create a number of "Custom Graphs" and think that "drawing" them may be the easiest way to do this... (I've looked at the Charting Control and can't figure-out if it'll be able to do what I need...)

I don't (particularly) want to pass the paramters via QueryString though I know that is an option...

There'll need to be at least 5 unique charts per page rendered...

This is for a Web-Application that I'm creating in VB.Net v4.0

Thanks in advance

Espavo Rough sample of the chart
Watch Question

Jens FiedererTest Developer/Validator

You can stream image data from a .NET page as shown here: http://articles.sitepoint.com/article/generating-asp-net-images-fly


Thanks, I know how to do this... (And it's not what I'm after...)
Is it possible to create a User Control that will be "placed" in an .aspx page, and that can generate an image... (One that I can pass all my parameters too?)
Test Developer/Validator
This one is on us!
(Get your first solution completely free - no credit card required)


So, basically I'm "forced" to generate the image on the fly, and I may well have to pass all my parameters to the .aspx page via QueryString?
(Embedding it with an <img /> tag is going to be the easiest way?)
BTW, how does the MS Charting control do it?
Jens FiedererTest Developer/Validator

If you mean the MSChart control ( http://msdn.microsoft.com/en-us/library/3ks53324(v=VS.71).aspx ), this is an ActiveX (OCX) control - something that gets installed on the client and communicates with the browser.  You can write ActiveX controls, but they will not work in all browsers, or on all operating systems.

I haven't personally used MSChart, but I've used chart controls by ChartFX (long ago, also an ActiveX control at the time, although I believe they have versions out for WPF now) and from Infragistics (UltraWebChart - this works by either generating storing image files in a director on the server and making <img tags referencing them or by generating Flash code).
Jens FiedererTest Developer/Validator

By the way,  HTML 5 has the <canvas> element - so you COULD code a normal user control that supports graphics, but it won't work on Internet Explorer versions before 9, so that's probably premature.


Thanks for giving me some tips here...
BTW, I've been using MS Charting in VS 2008 and now VS 2010 and it isn't an ActiveX Control... it's (in VS 2010) a standard .Net control now... (Nothing needed on the client...)
The control is really powerfull, but I find the documentation to be really lacking, and to do what I need to do now needs a lot more control than the MS Chart control will give me...

I've decided to go with a simple .aspx page the will stream the graph (image) to the browser, and I'll embed that in the page with a <img /> tag...
Jens FiedererTest Developer/Validator

OK, looked at the documentation for the newer stuff for MS Charting..,

The Chart there has an ImageStorageMode attribute that controls whether it creates images in a temporary file location ( UseImageLocation), or whether it uses an HttpHandler (UseHttpHandler)... in the latter case I assume it generates image tags with a file name that doesn't actually exist on the system but that clue an HttpHandler to a page that generates the image data (much like the ImageGenerator.aspx page I suggested, but done behind the scenes for you).

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.