Hi all, I’m using a Coldfusion form to calculate and output variables in a form. Most of the forms values come from a database. In the code I apply various conversion factors , the user chooses their values and the form calculates the results upon submission. Currently I am simply outputting the results using the <cfoutput tag to a table however I would really like to output the results to a chart however so far all my research shows that the only way to chart data is if the user queries the database which this is not what I am doing. I have the example forms here if anyone would care to take a look (no design has been applied to them yet) http://www.carbonacs.com/fcalc/eocalc.cfm Any input is gratefully received, Thanks, Garrett
You can create charts without using a query. Though its often easier. You could also put your calculations/values into a manual query. Then use the manual query in your chart. HTH <!--- option 1 ---> <cfset form.numberOfApples = 35> <cfset form.numberOfOranges = 28> <cfset form.numberOfPears = 30> <cfchart show3D="yes"> <cfchartseries type="bar"> <cfchartdata item="Apples" value="#form.numberOfApples#"> <cfchartdata item="Oranges" value="#form.numberOfOranges#"> <cfchartdata item="Pears" value="#form.numberOfPears#"> </cfchartseries> </cfchart> <!--- option 2 ---> <cfset yourManualQuery = QueryNew("Item,Value")> <cfset queryAddRow(yourManualQuery, 3)> <cfset yourManualQuery["Item"][1] = "Apples"> <cfset yourManualQuery["Value"][1] = form.numberOfApples> <cfset yourManualQuery["Item"][2] = "Oranges"> <cfset yourManualQuery["Value"][2] = form.numberOfOranges> <cfset yourManualQuery["Item"][3] = "Pears"> <cfset yourManualQuery["Value"][3] = form.numberOfPears> <cfchart show3D="yes"> <cfchartseries type="bar" query="yourManualQuery" itemcolumn="Item" valuecolumn="Value" /> </cfchart> Code (markup):
Thank so much for that. Your solution worked perfectly. After hours of fruitless research last night I have never been so happy to see a chart work. Thanks again, Garrett