|By Ben Forta||
|July 11, 2001 12:00 AM EDT||
More ColdFusion applications are running on intranets and extranets than just about anywhere else. This is not surprising - as ColdFusion makes data access and reporting so simple it is a natural fit for applications in these environments. And, as such, data reporting is one area that ColdFusion 5 addresses head-on with the introduction of a true graphing engine.
ColdFusion developers have always wanted a way to graph data. And so back in Cold-Fusion 2 days, a series of Java applets were introduced to simplify the creation of common business graphs (pie charts, bar charts, etc.). These worked, but they had some serious limitations:
- They were Java applets, and as such were not supported by all browsers.
- They suffered from long download times and poor performance.
- They could not be printed easily.
And Generator does not need any client-side software because the file formats it creates are standard formats like JPEG (which are supported by all browsers automatically) - the only exception to this is Flash, the use of which is optional (although with over 96% of all browsers supporting Flash it is pretty standard too).
Now before you ask, no, you cannot (yet) extend or enhance the graphing features exposed to ColdFusion. Yes, Generator can do much more than has been made available at this time, and, at some point in the future, there likely will be a way to better utilize more of Generator within ColdFusion. But for now you have to use the charts and graphs explicitly defined in ColdFusion - and, fortunately, they'll do most of what you need, as you are about to see.
The <CFGRAPH> Tag
As you have come to expect of ColdFusion, the way you create graphs is by using a tag. And as you've also come to expect, that tag is intuitively named <CFGRAPH>. This seemingly simple tag hides all the complexity of creating all sorts of business graphs and charts with all sorts of options and features.
But instead of telling you about <CFGRAPH>, let's look at an example. Figure 1 shows a simple bar chart showing the relative prices of items for sale. (All of the data in these examples are taken from the databases and example applications in my new ColdFusion 5 Web Application Construction Kit.)
The code I used to create the graph is in Listing 1.
First I retrieved data with a basic <CFQUERY> - the query name is Merchandise, and the two columns retrieved are MerchName and MerchPrice. To create the graph, all I had to do was pass that data to <CFGRAPH> - QUERY takes the name of the query to be used, TYPE specifies the graph type (BAR, PIE, AREA, etc.), ITEMCOLUMN takes the name of the query column to use as the item name, and VALUECOLUMN takes the name of the column containing the value to use. Simple as that, and ColdFusion does the rest.
Note: ITEMCOLUMN and VALUECOLUMN take column names, not values, so don't place pound signs around the column names.
So what did that tag actually do? In Listing 2 is the code that was embedded in the generated output. I know it looks a little complex, but that is because it is invoking the Flash player so as to display the above graph in Flash format. In other words, the four lines of ColdFusion code in Listing 1 generated and embedded Flash content - without you having to learn anything about Flash.
And, no, you are not limited to generating Flash-based graphs. <CFGRAPH> can also generate JPEG and PNG images (not GIF though, sorry). But as I did not specify a format in my <CFGRAPH> tag, the default format was used, and the default is Flash.
Lots of Options
The previous example used a minimal set of options and attributes. This next example, in Listing 3, is quite the other extreme, using all sorts of attributes (far more than you'd typically use, but it helps make a point).
Again, I started with a <CF-QUERY>, this time retrieving recent items sold and a count of each. Then comes the <CFGRAPH> tag. The type is specified as PIE, the query name is provided; the format is set to "jpg" (otherwise the default of Flash would have been used); and explicit height and widths are specified along with background and border colors, border size, and 3D depth. And finally, label font and size, title text and font, and legend position and font are specified. The end result is seen in Figure 2.
As you can see, <CFGRAPH> is very flexible and highly configurable. And the Tag Editor seen in Figure 3 (available for ColdFusion Studio 4.5x as well as in ColdFusion Studio 5 when it is available) makes using these attributes a breeze.
One other very important feature that I must mention is the ability to generate graphs that support data drill-down - that is, click on a pie slice or chart bar and go to a URL that provides additional (or more detailed) information.
<CFGRAPH> does not do this automatically, but it does provide a simple mechanism for associating URLs with graph components. Using this you can create your own drill-down interfaces by simply passing the URL of the next chart or graph to go to (see Listing 4).
This time the query retrieves a list of directors, and what they have been paid (converted into thousands by a division in the SELECT statement itself). The <CFGRAPH> tag is similar to the ones seen previously, although this one provides explicit colors (instead of using the defaults).
The important changes here are the last two attributes. URL takes the URL to go to if you click on a pie slice. But if the same URL is used for all slices, how would you know which slice was clicked? That's where the URLCOLUMN attribute comes in to play. It takes the name of a column, the value of which is appended to the URL specified in URL.
Here "details.cfm?- Name=" is the URL, and Name (whatever value is in column Name) is the URLCOLUMN. So, if the name were "Ben Forta" the generated URL for that slice would be "details.cfm?-Name=Ben+Forta". In other words, a unique URL is created for each slice by combining the fixed URL and a dynamic query column (see Figure 4).
Data drill-down is a valuable <CFGRAPH> feature, but it is important to note that it's available only when using Flash as the FORMAT (and not with JPG or PNG).
For Even Greater Control
You might have been wondering why <CFGRAPH> has a matching </CFGRAPH> tag. Well, this is why - <CFGRAPH> has a child tag named <CFGRAPHDATA> that can be used to explicitly populate graphs with data (without using the QUERY attribute). For example, the following creates a pie chart containing four pie slices:
<!--- Create graph --->
<!--- Pie slices --->
<CFGRAPHDATA ITEM="G" VALUE="7">
<CFGRAPHDATA ITEM="PG" VALUE="28">
<CFGRAPHDATA ITEM="PG13" VALUE="16">
<CFGRAPHDATA ITEM="R" VALUE="31">
Of course, you can also use <CF-GRAPHDATA> to populate a graph with query data - to do this simply use a <CFLOOP> to loop through the query results and then call <CF-GRAPHDATA> for reach row like this:
<!--- Create graph --->
<!--- Loop through data --->
<!--- Add item to graph --->
<CFGRAPHDATA ITEM="#Name#" VALUE="#Paid#">
Why would you ever want to do this? There are three primary reasons:
- <CFGRAPHDATA> takes an optional URL attribute that you can use to specify a totally unique URL for each data point (as opposed to using a single URL with just a different query string).
- <CFGRAPHDATA> takes an optional COLOR attribute that you can use for greater color control.
- By passing data manually to graphs you can use CFML formatting functions and other programmatic functions to manipulate the data as needed.
<CFGRAPH> is one of the most exciting new features in ColdFusion 5, and one that is built on top of a proven and scalable product - Macromedia Generator. With multiple graph types, three output formats, and dozens of configuration options, <CFGRAPH> proves once again that Macromedia and the ColdFusion team know what developers want, and are deeply committed to providing it.
|Jeff 01/09/03 12:29:00 PM EST|
I am creating an ecomm. site. I have a situation. If a user has opted to purchase 2 items and then once the user gets to the confirmation page the user decide that he / she would like to purchase 4 items instead of 2. Can this page be dynamically upadate without the use of an update button. ie. the page refreshes once the user changes the amount
|NAJIH 12/09/02 11:13:00 AM EST|
I am in france .
I want to programme a
|Bill Song 02/21/02 02:36:00 PM EST|
We have a site with frames, left menu, right top logo, right bottom content, with graghics. When Mac user loading the page, it always spinning even after the loading of the left menu which is larger in size than the right part. Actually, that part does not load until the user hit stop button or another link then click home page button. The web server is NT, and the ie browser is 4.5 for Mac. Any solution? pls help. Thanks.
It is one thing to build single industrial IoT applications, but what will it take to build the Smart Cities and truly society-changing applications of the future? The technology won’t be the problem, it will be the number of parties that need to work together and be aligned in their motivation to succeed. In his session at @ThingsExpo, Jason Mondanaro, Director, Product Management at Metanga, discussed how you can plan to cooperate, partner, and form lasting all-star teams to change the world and it starts with business models and monetization strategies.
Jul. 28, 2015 04:30 PM EDT Reads: 1,736
The Internet of Everything (IoE) brings together people, process, data and things to make networked connections more relevant and valuable than ever before – transforming information into knowledge and knowledge into wisdom. IoE creates new capabilities, richer experiences, and unprecedented opportunities to improve business and government operations, decision making and mission support capabilities.
Jul. 28, 2015 04:00 PM EDT Reads: 182
The Internet of Things is not only adding billions of sensors and billions of terabytes to the Internet. It is also forcing a fundamental change in the way we envision Information Technology. For the first time, more data is being created by devices at the edge of the Internet rather than from centralized systems. What does this mean for today's IT professional? In this Power Panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists addressed this very serious issue of profound change in the industry.
Jul. 28, 2015 03:00 PM EDT Reads: 1,233
Discussions about cloud computing are evolving into discussions about enterprise IT in general. As enterprises increasingly migrate toward their own unique clouds, new issues such as the use of containers and microservices emerge to keep things interesting. In this Power Panel at 16th Cloud Expo, moderated by Conference Chair Roger Strukhoff, panelists addressed the state of cloud computing today, and what enterprise IT professionals need to know about how the latest topics and trends affect their organization.
Jul. 28, 2015 02:00 PM EDT Reads: 1,149
SYS-CON Events announced today that HPM Networks will exhibit at the 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. For 20 years, HPM Networks has been integrating technology solutions that solve complex business challenges. HPM Networks has designed solutions for both SMB and enterprise customers throughout the San Francisco Bay Area.
Jul. 28, 2015 11:45 AM EDT Reads: 385
For IoT to grow as quickly as analyst firms’ project, a lot is going to fall on developers to quickly bring applications to market. But the lack of a standard development platform threatens to slow growth and make application development more time consuming and costly, much like we’ve seen in the mobile space. In his session at @ThingsExpo, Mike Weiner, Product Manager of the Omega DevCloud with KORE Telematics Inc., discussed the evolving requirements for developers as IoT matures and conducted a live demonstration of how quickly application development can happen when the need to comply wit...
Jul. 28, 2015 11:15 AM EDT Reads: 160
Converging digital disruptions is creating a major sea change - Cisco calls this the Internet of Everything (IoE). IoE is the network connection of People, Process, Data and Things, fueled by Cloud, Mobile, Social, Analytics and Security, and it represents a $19Trillion value-at-stake over the next 10 years. In her keynote at @ThingsExpo, Manjula Talreja, VP of Cisco Consulting Services, discussed IoE and the enormous opportunities it provides to public and private firms alike. She will share what businesses must do to thrive in the IoE economy, citing examples from several industry sectors.
Jul. 28, 2015 11:00 AM EDT Reads: 2,024
Growth hacking is common for startups to make unheard-of progress in building their business. Career Hacks can help Geek Girls and those who support them (yes, that's you too, Dad!) to excel in this typically male-dominated world. Get ready to learn the facts: Is there a bias against women in the tech / developer communities? Why are women 50% of the workforce, but hold only 24% of the STEM or IT positions? Some beginnings of what to do about it! In her Opening Keynote at 16th Cloud Expo, Sandy Carter, IBM General Manager Cloud Ecosystem and Developers, and a Social Business Evangelist, d...
Jul. 27, 2015 09:00 PM EDT Reads: 2,030
Explosive growth in connected devices. Enormous amounts of data for collection and analysis. Critical use of data for split-second decision making and actionable information. All three are factors in making the Internet of Things a reality. Yet, any one factor would have an IT organization pondering its infrastructure strategy. How should your organization enhance its IT framework to enable an Internet of Things implementation? In his session at @ThingsExpo, James Kirkland, Red Hat's Chief Architect for the Internet of Things and Intelligent Systems, described how to revolutionize your archit...
Jul. 27, 2015 05:30 PM EDT Reads: 1,350
There will be 150 billion connected devices by 2020. New digital businesses have already disrupted value chains across every industry. APIs are at the center of the digital business. You need to understand what assets you have that can be exposed digitally, what their digital value chain is, and how to create an effective business model around that value chain to compete in this economy. No enterprise can be complacent and not engage in the digital economy. Learn how to be the disruptor and not the disruptee.
Jul. 27, 2015 10:00 AM EDT Reads: 2,016
Akana has released Envision, an enhanced API analytics platform that helps enterprises mine critical insights across their digital eco-systems, understand their customers and partners and offer value-added personalized services. “In today’s digital economy, data-driven insights are proving to be a key differentiator for businesses. Understanding the data that is being tunneled through their APIs and how it can be used to optimize their business and operations is of paramount importance,” said Alistair Farquharson, CTO of Akana.
Jul. 27, 2015 09:00 AM EDT Reads: 175
Business as usual for IT is evolving into a "Make or Buy" decision on a service-by-service conversation with input from the LOBs. How does your organization move forward with cloud? In his general session at 16th Cloud Expo, Paul Maravei, Regional Sales Manager, Hybrid Cloud and Managed Services at Cisco, discusses how Cisco and its partners offer a market-leading portfolio and ecosystem of cloud infrastructure and application services that allow you to uniquely and securely combine cloud business applications and services across multiple cloud delivery models.
Jul. 27, 2015 08:00 AM EDT Reads: 1,888
The enterprise market will drive IoT device adoption over the next five years. In his session at @ThingsExpo, John Greenough, an analyst at BI Intelligence, division of Business Insider, analyzed how companies will adopt IoT products and the associated cost of adopting those products. John Greenough is the lead analyst covering the Internet of Things for BI Intelligence- Business Insider’s paid research service. Numerous IoT companies have cited his analysis of the IoT. Prior to joining BI Intelligence, he worked analyzing bank technology for Corporate Insight and The Clearing House Payment...
Jul. 26, 2015 09:00 PM EDT Reads: 1,539
In his keynote at 16th Cloud Expo, Rodney Rogers, CEO of Virtustream, discussed the evolution of the company from inception to its recent acquisition by EMC – including personal insights, lessons learned (and some WTF moments) along the way. Learn how Virtustream’s unique approach of combining the economics and elasticity of the consumer cloud model with proper performance, application automation and security into a platform became a breakout success with enterprise customers and a natural fit for the EMC Federation.
Jul. 26, 2015 08:00 AM EDT Reads: 2,131
"Optimal Design is a technology integration and product development firm that specializes in connecting devices to the cloud," stated Joe Wascow, Co-Founder & CMO of Optimal Design, in this SYS-CON.tv interview at @ThingsExpo, held June 9-11, 2015, at the Javits Center in New York City.
Jul. 25, 2015 02:00 PM EDT Reads: 377
SYS-CON Events announced today that CommVault has been named “Bronze Sponsor” of SYS-CON's 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. A singular vision – a belief in a better way to address current and future data management needs – guides CommVault in the development of Singular Information Management® solutions for high-performance data protection, universal availability and simplified management of data on complex storage networks. CommVault's exclusive single-platform architecture gives companies unp...
Jul. 25, 2015 01:00 PM EDT Reads: 1,932
Electric Cloud and Arynga have announced a product integration partnership that will bring Continuous Delivery solutions to the automotive Internet-of-Things (IoT) market. The joint solution will help automotive manufacturers, OEMs and system integrators adopt DevOps automation and Continuous Delivery practices that reduce software build and release cycle times within the complex and specific parameters of embedded and IoT software systems.
Jul. 25, 2015 12:15 PM EDT Reads: 408
"ciqada is a combined platform of hardware modules and server products that lets people take their existing devices or new devices and lets them be accessible over the Internet for their users," noted Geoff Engelstein of ciqada, a division of Mars International, in this SYS-CON.tv interview at @ThingsExpo, held June 9-11, 2015, at the Javits Center in New York City.
Jul. 25, 2015 12:00 PM EDT Reads: 1,516
Internet of Things is moving from being a hype to a reality. Experts estimate that internet connected cars will grow to 152 million, while over 100 million internet connected wireless light bulbs and lamps will be operational by 2020. These and many other intriguing statistics highlight the importance of Internet powered devices and how market penetration is going to multiply many times over in the next few years.
Jul. 25, 2015 09:00 AM EDT Reads: 1,474
SYS-CON Events announced today that Dyn, the worldwide leader in Internet Performance, will exhibit at SYS-CON's 17th International Cloud Expo®, which will take place on November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. Dyn is a cloud-based Internet Performance company. Dyn helps companies monitor, control, and optimize online infrastructure for an exceptional end-user experience. Through a world-class network and unrivaled, objective intelligence into Internet conditions, Dyn ensures traffic gets delivered faster, safer, and more reliably than ever.
Jul. 24, 2015 11:00 PM EDT Reads: 2,039