Line Graphs on Web Apps

I am a huge advocate of the MBS plug-in for desktop apps (chart director), but it doesn’t work on web apps :confused:

SO! What do you all do to graph on web apps? I have written a series of CSS code to use in a CSS viewer, but I rather graph in a canvas… Any ideas? Thanks!

I use Chart Director in WebApps. Just return the results as a Picture and place it into your object. I also export them to JPEG/PNG/PDF from the web so the user can have a copy. I also embed the ChartDirector JPEGs into HTML on the WebApp then display it in an HTMLViewer as a report. If the user wants a copy of this I use wkHTML2PDF to download a PDF version of the report for them.

If you just need a simple line graph, you can do that easily enough in the WebCanvas. The Eddie’s Electronics app has an example (click on Sales Report):

Could you explain your process? For some reason I have had errors tryings with CD in the past on web apps.

using CD with the web works fine for me. It’s more complicated to do interactive things and mouseovers to show values and such, but it can be done.

Once you render the graph into a picture object just pass that to the .picture property of the webImageView control. It will display in the browser. If you’re sending the same picture to many people in many sessions at once it probably makes sense to use a webPicture object instead and set the session to empty so that it can be loaded by everyone, but you’ll need to manage your objects too so they hang around until everyone is done watching them. But just to display the output sending the picture to a webImageView will get you started more quickly than messing with all that.

If you’re getting the graph from some other source or it is updating not inline with the loading of the page then you may need to set the session context object before you try to access the control. This is where I got into trouble in the past doing such things where I was redrawing the graph from real data that came in a socket and it was thus not connected to the session or context it was going to. Just adding this to the top of the method where you’re going to send the picture will fix that:

dim Context as new WebSessionContext( app.SessionForControl( self.Page))

I THINK that is still the recommended way of doing that, but things change rapidly and I’m not always watching as closely as I should be :wink: Apart from those things I can’t think why it would cause any other kinds of trouble. Tell us more about how it didn’t work or the errors you got doing it before.

Graffitisuite has nice charts for web apps.