Posted on 2002-03-04
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)?
Question by:leidson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 14

Expert Comment

by:Scott Bennett
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,


Accepted Solution

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">



<cfquery name="qM1" datasource="MydB">
SELECT MyValues1

<cfquery name="qM2" datasource="MydB">
SELECT MyValues2

<!--- Try to connect to the Excel application object --->
    <!--- If it exists, connect to it --->
    <!--- The object doesn't exist, so create it --->

    // 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;

    // Close the document

    // Quit Excel

    // Release the object
    objExcel = "Nothing";

<IMG src="MyChart.jpg">


Hope it will help,

Expert Comment

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

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

So, for the time being I stick to cfx_graphicsserver.

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

628 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