juniordev Report post Posted April 5, 2011 Hi guys i have data from SQL server and it was working and creating a linegraph before, but when i decided that i needed a scroll 2d line i thought it would be as easy as changing the data type from 'line.swf' to 'ScrollLine2d.swf' , this was NOT the case as i get a error stating ' No data to display' help me if you can guys know its probably something simple <?php //We've included ../Includes/FusionCharts.php and ../Includes/DBConn.php, which contains //functions to help us easily embed the charts and connect to a database. include("FusionCharts/FusionCharts_PHP/App/Includes/FusionCharts.php"); //include("\FusionCharts\FusionCharts_PHP\App\Includes\Connection_inc.php"); ?> <HTML> <HEAD> <TITLE>CPU MONITORING</TITLE> <script LANGUAGE="Javascript" SRC="/FusionCharts/Charts/FusionCharts.js"></SCRIPT> </HEAD> <BODY> <CENTER> <?php //In this example, we show how to connect FusionCharts to a database. //For the sake of ease, we've used a MySQL database containing two //tables. //Connect to the DB $serverName = "CWIHQLA3FF813J\SQLEXPRESS"; $connectionOptions = array("Database" => "PerfMon"); $conn = sqlsrv_connect( $serverName, $connectionOptions); //$strXML will be used to store the entire XML document generated //Generate the graph element $strXML = "<chart caption='CPU History' subCaption='By Load Percentage' formatNumberScale='0' numberSuffix=' %' linethickness = '2' showvalues = '0' anchorradius = '3' anchorbgalpha = '50' numvdivlines = '24' showalternatevgridcolor = '1' alternatevgridalpha = '3' animation = '0'>"; //Fetch all factory records $queryString = "SELECT TOP 50 time, LoadPercentage FROM [PerfMon].[dbo].[CPUUsage] order by time"; $result = sqlsrv_query($conn, $queryString) or die ("Problem in executing query"); //Iterate through each factory if ($result) { while($ors = sqlsrv_fetch_array($result)) { //Generate <set name='..' value='..'/> $strXML .= "<set name='" . $ors['time'] . "' value='" . $ors['LoadPercentage'] . "' />"; } } sqlsrv_close($conn); //Finally, close <graph> element $strXML .= "</chart>"; //Create the chart - Pie 3D Chart with data from $strXML echo renderChart("FusionCharts/Charts/ScrollLine2D.swf", "", $strXML, "Load", 600, 500, false, true); ?> </BODY> </HTML> Share this post Link to post Share on other sites