Showing posts with label dashboard using cf. Show all posts
Showing posts with label dashboard using cf. Show all posts

Sunday, May 15, 2011

Dashboard Development using ColdFusion


Code Under construction:
------------------------------

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Dashboard -- Raghuram</title>
</head>

<body>
<cfpod name="pod01" headerstyle="background-color:brown; color:yellow;" bodystyle="background-color:gray; color:red;" height="325" width="1000"
title="Dashboard-Reporting">
<cfwindow
title="Contrast Window" name="contrast"
x="0" y="20"
draggable="true" resizable="true"
width="280" height="350" initShow="true">
</cfwindow>
<cfwindow
title="Grid Window" name="gridWindow"
x="280" y="20"
draggable="true" resizable="true"
width="390" height="350" initShow="true">
<!--- Query the database to fill up the grid.
SELECT Course_ID, Dept_ID, CorNumber,CorName, CorLevel
--->
<cfquery name = "GetCourses" dataSource = "cfdocexamples">
SELECT Dept_ID, CorName, CorLevel
FROM CourseList
ORDER by Dept_ID ASC, CorNumber ASC
</cfquery>

<h3>Exception Summary </h3>
<i>Grid View</i>
<!--- cfgrid must be inside a cfform tag. --->
<cfform>
<cfgrid name = "FirstGrid" format="Flash"
height="320" width="580"
font="Tahoma" fontsize="12"
query = "GetCourses">
</cfgrid>
</cfform>
</cfwindow>
<!---cfchart example --->
<!---The following example analyzes the salary data in the cfdocexamples database and
generates a bar chart showing average salary by department. The body of the
cfchartseries tag includes one cfchartdata tag to include data that is not available
from the query. --->

<!--- Get the raw data from the database. --->
<cfquery name="GetSalaries" datasource="cfdocexamples">
SELECT Departmt.Dept_Name,
Employee.Dept_ID,
Employee.Salary
FROM Departmt, Employee
WHERE Departmt.Dept_ID = Employee.Dept_ID
</cfquery>

<!--- Use a query of queries to generate a new query with --->
<!--- statistical data for each department. --->
<!--- AVG and SUM calculate statistics. --->
<!--- GROUP BY generates results for each department. --->
<cfquery dbtype = "query" name = "DataTable">
SELECT Dept_Name,
AVG(Salary) AS avgSal,
SUM(Salary) AS sumSal
FROM GetSalaries
GROUP BY Dept_Name
</cfquery>

<!--- Reformat the generated numbers to show only thousands. --->
<cfloop index = "i" from = "1" to = "#DataTable.RecordCount#">
<cfset DataTable.sumSal[i] = Round(DataTable.sumSal[i]/1000)*1000>
<cfset DataTable.avgSal[i] = Round(DataTable.avgSal[i]/1000)*1000>
</cfloop>

<cfwindow
title="Test Window2" name="myWindow2"
x="670" y="20"
draggable="true" resizable="true"
width="340" height="350" initShow="true">

<h1>Employee Salary Analysis</h1>
<!--- Bar graph, from Query of Queries --->
<cfchart format="flash"
xaxistitle="Department"
yaxistitle="Salary Average">

<cfchartseries type="bar"
query="DataTable"
itemcolumn="Dept_Name"
valuecolumn="avgSal">

<cfchartdata item="Facilities" value="35000">

</cfchartseries>
</cfchart>
</cfwindow>
</cfpod>
<cfpod name="pod03" title="Exception Report" bodystyle="background-color:MediumOrchid; color:yellow;" height="8" width="1000">
test middle pod
</cfpod>
<cfpod name="pod02" title="Summary Report" headerstyle="background-color:brown;" bodystyle="background-color:lightGray; color:red;" height="250" width="1000">
<!---<cfwindow
title="Test Window3" name="myWindow3"
x="250" y="470"
draggable="true" resizable="true"
width="200" height="200" initShow="true" >
</cfwindow>--->
</cfpod>


</body>
</html>