Link to home
Start Free TrialLog in
Avatar of Espavo
EspavoFlag for South Africa

asked on

Create Chart in Class

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 User generated image
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

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

Avatar of Espavo

ASKER

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?)
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Espavo

ASKER

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?
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).
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.
Avatar of Espavo

ASKER

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...
Espavo
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).