cfchart and cfimage - useless experiment

So after my last post on embedding cfchart in email, I’ve been playing with cfchart and image functions. The ability to create an image out of cfchart isn’t new, and we’ve got a butt load of new image functions in ColdFusion 8, so we should be able to mix the two up right? I whipped up a quick demo using imageUtils from RIAForge and a simple chart:

<cfset imageutils = createObject("component","imageutils.imageUtils")>

<cfchart format=”png” name=”mychart” chartheight=”200” chartwidth=”200” showlegend=”false”> <cfchartseries type=”pie”> <cfchartdata item=”1Q Sales” value=”500” /> <cfchartdata item=”2Q Sales” value=”400” /> <cfchartdata item=”3Q Sales” value=”700” /> <cfchartdata item=”4Q Sales” value=”200” /> </cfchartseries> </cfchart>

<cfset mychart = imageNew(mychart)> <cfset myfancychart = imageutils.reflectImage(mychart,”Bottom”) />

<cfimage action=”writetobrowser” source=”#myfancychart#” /> </code>

Nothing too crazy here. I save the image binary into a variable and then ‘load’ it as an Image object using imageNew. I then use the reflectImage function to create…

I then got artsy:

So yeah, this was a complete waste of time. I can’t think of anything I’d use CF8’s image functions for that I can’t do natively with cfchart itself, but maybe something intelligent will come to me later.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments