Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a tool to dynamically build a graph as GIF/JPEG?

Status
Not open for further replies.

foxdev

Programmer
Feb 11, 2000
1,995
US
I'm building some reports in HTML format for an intranet. It would be help some of the reports immensely if I could include a basic graph.

Is there a tool, or a function of a suite, that would allow be to create a graph on-the-fly and save it as a graphic image? I've briefly explored using some of the MS Office apps to make the graph, but they don't seem to provide a way of saving just the graph as a single image. Robert Bradley
Do you have too much money? Visit
 
I don't know much about business graphics apps but if you know one that will procuce the graph that you are happy with you could just use Alt + Print screen to copy the page, then take it into Photoshop or similar, crop away the unwanted bits and save for the web.

But there is probably a package that would do it for you. I know macromedia generator will produce graphs and graphics on the fly, making them dynamic, but the cost is prohibitive. Really prohibitive!
 
Thanks, GollyG. Its true that for ad-hoc use the ALT+PrtScr would work, but this is for an automated process (I have a Visual FoxPro program that tallies the data and spits out ~50 HTML files).

We do have some Macromedia products, though I don't know if Generator is one of them. Thanks for the tip. Robert Bradley
Do you have too much money? Visit
 
If you're using Visual FoxPro to generate the pages you could very easily create your own graphs. I've implemented this using Coldfusion and it was really very simple.

Create a series of 1x1 pixel colored gifs. Using your data, just stretch these out to the length/width required to portray each element. You could place them in a table one in each row. Or you could put one in each column and valign=bottom the thing.

This would be much faster and much more reliable than calling an outside program. Having the added control and flexibility is also a plus.

Just food for thought! Andrew
 
Thanks, Andrew; I had thought about doing something like the old days, using ASCII block characters to make the graphs - but I was hoping that would be a last resort. It is seeming more and more like that is going to be the answer.

It turns out we do have Macromedia Generator, but it seems it is heavily married to Flash and requires some substantial learning and configuring - it seems quite powerful, but too complex for what I'm trying to do. Robert Bradley
Do you have too much money? Visit
 
I have just had a quick play around with cutting and pasting graphs from MS Excel to MS Paint programme and it works sweet as and you can then save it as .gif or .jpeg etc. Likewise you should be able to paste/import into Flash and then use File/Export Image to export as a gif or jpeg if you need to add graphics.

As an alternative you can use ASP to produces dynamic graphs from a database as outlined here


and there is heaps of third party software around that is designed specifically to produce reports for the web.

Hope all this helps.


Justin. X-)

"Creativity is the ability to introduce order into the randomness of nature." Eric Hoffer

Visit me at
 
Thanks for the info, Shilohcity, but remember these graphs must be created programmatically - manual cut and paste won't work in my situation.

But I have found the solution (for me, anyway). It is the Office Web Components or OWC. Works well and is perfectly suited for what I need. Below is a quick example of how I use it (the code is Visual FoxPro, but easily understandable):

[tt]
dimension Categories(5)
dimension Vals(5)
for i = 1 to 5 && create sample data
Categories(i) = "Level " + Str(i)
Vals(i) = nData * Rand(100)
endfor

oChart = CreateObject("OWC.Chart")
cCaption = "Sample Graph"

oChart.Charts.Add
oChart.Charts(0).Type = oChart.Constants.chChartTypeColumnClustered
oChart.Charts(0).SeriesCollection.Add
oChart.Charts(0).SeriesCollection(0).Caption = cCaption
oChart.Charts(0).SeriesCollection(0).SetData(oChart.Constants.chDimCategories, oChart.Constants.chDataLiteral, @Categories)
oChart.Charts(0).SeriesCollection(0).SetData(oChart.Constants.chDimValues, oChart.Constants.chDataLiteral, @Vals)
oChart.Charts(0).HasLegend = .F.
oChart.Charts(0).HasTitle = .T.

cFname = "e:\temp\testchart.gif"
oChart.ExportPicture(cFname, "gif", 400, 400)
release oChart
[/tt] Robert Bradley
Do you have too much money? Visit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top