Solved

CFGRAPH

Posted on 2002-03-04
3
365 Views
Last Modified: 2013-12-24
I'm need to graph 2 lines (data sets from 2 different queries) on the same line graph. I can't seem to find a way to do this with cfgraph (type=line). Is this possible? If not, can you recommend another means to the end (coding, using a different graphing engine, whatever)?
0
Comment
Question by:leidson
3 Comments
 
LVL 14

Expert Comment

by:SBennett
ID: 6840262
From what I understand, It is not posible to have two lines on a <cfgraph type="line">.By using <cfgraphdata>, you can make a line that gets it's data from multiple sources, but I don't think thats what you had in mind.

I'll let you know if I can find any alternatives,

Scott
0
 
LVL 2

Accepted Solution

by:
Cyril_H earned 150 total points
ID: 6844177
Forget CFGRAPH in this case... SBennett is right. You have 2 solutions :

- the first one, buy a third-party product like KavaChart, PopChart Server or CFX_graphicsserver.

- The second one is to use Excel to create the graph and export it to gif or jpg...

Here's an example :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
     <title>Untitled</title>
</head>

<body>

<cfquery name="qM1" datasource="MydB">
SELECT MyValues1
  FROM T1
</cfquery>

<cfquery name="qM2" datasource="MydB">
SELECT MyValues2
  FROM T2
</cfquery>

<!--- Try to connect to the Excel application object --->
<CFTRY>
    <!--- If it exists, connect to it --->
    <CFOBJECT
        ACTION="CONNECT"
        CLASS="Excel.Application"
        NAME="objExcel"
        TYPE="COM">
  <CFCATCH>
    <!--- The object doesn't exist, so create it --->
    <CFOBJECT
        ACTION="CREATE"
        CLASS="Excel.Application"
        NAME="objExcel"
        TYPE="COM">
  </CFCATCH>
</CFTRY>

<CFSCRIPT>
    // Open Excel in the background
    objExcel.Visible = false;
     
    // Disable client alerts such as: 'Save this workbook?'
    objExcel.DisplayAlerts = false;    
     
    // Define the workbooks object
    objWorkBook = objExcel.Workbooks;

    // Add a new workbook
    objOpenedBook = objWorkBook.Add();
     
    // Get the WorkSheets' collection
    objWorkSheets = objExcel.WorkSheets;

    // Add a new worksheet (this will contain our data)
    objWorkSheet =  objWorkSheets.Add();

    // We cannot use the Cells(1,1) syntax, so we have to create a range
    // for EVERY value we want to insert -- yep, this really sucks.

    for(Loop1=1; Loop1 LTE #qM1.RecordCount#; Loop1 = Loop1 + 1){
     objRange = objExcel.Range("A#Loop1#:A#Loop1#");
    objRange.value = #qM1.MyValues1[Loop1]#;};
     
    for(Loop2=1; Loop2 LTE #qM2.RecordCount#; Loop2 = Loop2 + 1){
     objRange = objExcel.Range("B#Loop2#:B#Loop2#");
    objRange.value = #qM2.MyValues2[Loop2]#;};
     
    // Get all the values we just inserted
    objFullRange = objExcel.Range("A1:B#qM2.RecordCount#");
   
    // Select the range of values we inserted
    objActiveRange = objFullRange.Select();
   
    // Return the charts collection
    objCharts = objExcel.Charts;
   
    // Add a new chart (this will be applied to our active selection)
    objExcelChart = objCharts.Add();
   
    // Set the chart type (see end-of-page for all chart types)
    objExcelChart.Type = 4;
     
     objExcelChart.export("#GetDirectoryFromPath(GetCurrentTemplatePath())#\MyChart.jpg");

    // Close the document
    objWorkBook.Close();

    // Quit Excel
    objExcel.Quit();

    // Release the object
    objExcel = "Nothing";
     
</CFSCRIPT>

<IMG src="MyChart.jpg">

</body>
</html>

Hope it will help,
Cyril
0
 

Expert Comment

by:Lewis
ID: 6844506
I was looking into the new cfgraph tag, in order
to replace my cfx_graphicsserver.

However, cfgraph does not yet provide multiline
support for line graphs (read the message boards
on allaire.com)

The Allaire (or rather Macromedia) engineers
on the board are saying that this multiline
capability is in the wish list for a future
version.

So, for the time being I stick to cfx_graphicsserver.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
connection string question 2 66
CFFILE upload help 98 109
DNS, website, godaddy 6 41
Website URL redirection 10 52
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now