Skip to main content

Posts

Showing posts from July, 2005

Using JFreeChart with ColdFusion

This was originally posted in Christian Cantrell's blog.Well, your post just helped me figure out a long time nagging problem. I have been working on a CF wrapper for JFreeChart to generate on-the-fly charts, and have been stumped with corrupted output, until I saw your fix about the double getResponse() method calls. With that change, all works great! For those who don't understand WHY you might need to do this, here is sampe code that creates a bar chart on-the-fly (no caching on the file system) and outputs directly to the browser a JPEG image (or a PNG with incredible quality!): <!--- first generate some data --->

barDataset = CreateObject("java", "org.jfree.data.category.DefaultCategoryDataset");

Randomize(numberformat(timeformat(now(),"ss")));

rval = int(randrange(1,500));

barDataset.setValue(numberformat(rval), "2001", "Q1");

rval = int(randrange(1,500));

barDataset.setValue(numberformat(rval), "2001"…