• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

create cfchart

I did create this chart to show graph data, but it doesn't show me any data
here is what i did so far

<cfquery name="chart" datasource="testrequest" maxrows="20">
SELECT survey_ID, class_name, overall
FROM survey
ORDER BY overall
</cfquery>
<cfquery name="sortedQuery" dbtype="query">
select * from chart
ORDER BY overall


</cfquery>
<html>
<head>
<title>Display Training Evaluation chart</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<cfchart chartwidth="500" chartheight="500" yaxistitle="class_name">
<cfchartseries type="bar" query="sortedQuery" valuecolumn="class-name" itemcolumn="overall" >

</cfchart>
</body>
</html>
0
asamuel
Asked:
asamuel
  • 8
  • 6
  • 4
1 Solution
 
pinaldaveCommented:
hi,
You should dump your query <cfdump var="#sortedQuery#">
and see what is the values in your query. Would you post some of the values. so we make sure that query is not empty.
Regards,
---Pinal

This is General Web Dev area do you want to move your Q to ColdFusion Topic Area. More expert will participate there in this Q? I can move it for you as I am Page Editor in ColdFusion.
0
 
asamuelAuthor Commented:
sure, no problem you can move it
0
 
pinaldaveCommented:
Asamuel have you tried to dump your query. is it empty?
0
[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

 
asamuelAuthor Commented:
No is not empty
0
 
asamuelAuthor Commented:
Any idea why the chart doesn't show
0
 
pinaldaveCommented:
It is hard to see from here as we do not the exact information.

Please see that you have format specified in the cfchart tag.

<cfchart chartwidth="500" chartheight="500" yaxistitle="class_name"  format="jpg">

Just some pointers to look into it.
1) valuecolumn="class-name" itemcolumn="overall"  should be correctly spelled and must have value more than 0
2) The scale of the graph is not too large so the graphs are visible.

Regards,
---Pinal
0
 
pinaldaveCommented:
any luck?
0
 
asamuelAuthor Commented:
I get the X and Y but I don't get any data graph, and when I choose Pie all i get the indicator for different type

No luck yet
0
 
asamuelAuthor Commented:
I think I figured out the problem, I need to have numbers,
but now I don't know how to do this,
I want to say that Excellent is 10, and like Very Good is 8 and so on I think this will work, How
I don't want to change the way stored in the database right now
Can i get help
0
 
mmc98dl1Commented:
So if your values are stored in the database as 'very good' etc, in the ideal world you should have these stored in the table as well along side the description.

In your case - you dont want to change the db do seomthing like this:
I have used a simple ist to store all the descritptions in order from 1-10, bad to best. Then used this list against the query value to find a numeric representation for your description that the chart can use.

<cfquery name="chart" datasource="testrequest" maxrows="20">
SELECT survey_ID, class_name, overall
FROM survey
ORDER BY overall
</cfquery>
<cfquery name="sortedQuery" dbtype="query">
select * from chart
ORDER BY overall
</cfquery>
<!--- 10 descriptions in order from 1 - 10 --->
<cfset descriptionList = "Bad, Poor, OK, Not so good, Average, Better than Average, Good, Very Good, Best, Excellent" />
<cfchart chartwidth="500" chartheight="500" yaxistitle="class_name">
<cfloop query="sortedQuery">
      <!--- gets the position number of the description - this is the numeric vale of the score --->
      <cfset score = ListFindNoCase(descriptionList, class_name,",") />
      <!--- output the data item with name and score --->
      <cfchartdata item="#class_name#" value="#score#" />
</cfloop>
</cfchart>
0
 
asamuelAuthor Commented:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.  
 
 
The error occurred in C:\Inetpub\wwwroot\ATCTESTnet\Surveychart.cfm: line 20
 
18 :        <cfchartseries type="pie" itemcolumn="class_name" valuecolumn="score" >
19 :       
20 : </cfloop>
21 : </cfchart>

 

that is the error i got, and before I have it in cfchartdata, and the system asked to nested inside cfchartseries tag
0
 
mmc98dl1Commented:
is this the error you got whilst using my code?
0
 
asamuelAuthor Commented:
yes this is the error
0
 
mmc98dl1Commented:
The code I provided you with doesnt have <cfchartseries in it. You must have been runnig your old code.
0
 
asamuelAuthor Commented:
I used your code, but the system asked to nested this inside cfchartseries
0
 
pinaldaveCommented:
if you are using chart data and have to use charseries in that case  use only
<cfchartseries type="pie" >
0
 
mmc98dl1Commented:
bugger - didnt spot it sorry - try this:

<cfchart chartwidth="500" chartheight="500" yaxistitle="class_name">
<cfchartseries type="line">
<cfloop query="sortedQuery">
     <!--- gets the position number of the description - this is the numeric vale of the score --->
     <cfset score = ListFindNoCase(descriptionList, class_name,",") />
     <!--- output the data item with name and score --->
     <cfchartdata item="#class_name#" value="#score#" />
</cfloop>
</cfchartseries>
</cfchart>
0
 
pinaldaveCommented:
Split mmc98dl1  and pinaldave
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 8
  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now