Sign in to follow this  
Rahul Kumar

Weird issue rendering multiple charts

Recommended Posts

A co-worker and I are running identical versions of Firefox. I have one page set up to display 5 charts. It works fine on my pc, but on his it only displays the first one - for the other 4 it just shows the text ".Chart". Any ideas?

Share this post


Link to post
Share on other sites

It is unique. As stated in my post, all 5 charts display perfectly fine in my browser. If the ID were not unique, they wouldn't display for me either.

Edited by Guest

Share this post


Link to post
Share on other sites

In Firefox 2.0.2 all charts display fine. In Firefox 3.0.5 it only shows the first chart.

 

 

 

 

 

===================

 

 

 

$q = "SELECT dayofweek(eventdate) as dow, date_format(eventdate,'%W') as dayname from $db1.event_detail WHERE locid = $locid AND eventtype IN(1,2) group by dayofweek(eventdate)";

 

$resultx = mysql_query($q) or die(mysql_error());

 

 

 

while($ors1 = mysql_fetch_array($resultx)) {

 

 

 

$dow = $ors1['dow'];

 

$dayname = $ors1['dayname'];

 

 

 

$strXML = "<chart showYAxisValues='1' yAxisMaxValue='125' yAxisMinValue='5' lineColor='863218' lineThickness='5' showZeroPlane='0' showLegend='0' anchorBorderColor='000000' anchorRadius='5' anchorBgColor='EDDFAF' bgColor='5E2312' bgAlpha='100' baseFontColor='000000' outCnvBaseFontColor='EDDFAF' baseFontSize='10' canvasBorderColor='000000' canvasBorderThickness='1' caption='Players Per Tournament'>";

 

 

 

 

 

$strXML .= "<categories>";

 

 

 

$strQuery = "SELECT date_format(eventdate,'%m/%d/%y') as eventdate1 from $db1.event_detail WHERE dayofweek(eventdate) = $dow AND event_detail.locid = $locid AND eventtype IN(1,2) order by eventdate desc";

 

$result = mysql_query($strQuery) or die(mysql_error());

 

 

 

if ($result) {

 

while($ors = mysql_fetch_array($result)) {

 

$strXML .= "<category label='" . $ors['eventdate1'] . "' /><vLine color='000000' thickness='1' />";

 

}

 

}

 

$strXML .="</categories>";

 

 

 

$strXML .="<dataset>";

 

 

 

$strQuery2 = "select eventdate,eventid,players,signups from $db1.event_detail where dayofweek(eventdate) = $dow AND locid=$locid and eventtype IN(1,2) order by eventdate desc";

 

 

 

$result3 = mysql_query($strQuery2) or die(mysql_error());

 

 

 

 

 

if ($result3) {

 

while($ors3 = mysql_fetch_array($result3)) {

 

 

 

$eventdate = $ors3['eventdate'];

 

 

 

$strXML .= "<set value='" . $ors3['players'] . "' link='P-detailsWin,width=500,height=500,toolbar=no,scrollbars=no, resizable=no-faq.php?locid=$locid%26amp;date=$eventdate' />";

 

 

 

 

 

}

 

}

 

$strXML .="</dataset>";

 

 

 

 

 

$strXML .="<dataset>";

 

 

 

$strQuery2 = "select signups from $db1.event_detail where dayofweek(eventdate) = $dow AND locid=$locid and eventtype IN(1,2) order by eventdate desc";

 

 

 

$result3 = mysql_query($strQuery2) or die(mysql_error());

 

 

 

 

 

if ($result3) {

 

while($ors3 = mysql_fetch_array($result3)) {

 

 

 

$eventdate = $ors3['eventdate'];

 

 

 

$strXML .= "<set value='" . $ors3['signups'] . "' link='P-detailsWin,width=500,height=500,toolbar=no,scrollbars=no, resizable=no-faq.php?locid=$locid%26amp;date=$eventdate' />";

 

 

 

 

 

}

 

}

 

$strXML .="</dataset>";

 

 

 

$strXML .="<trendLines>";

 

 

 

$strXML .= "<line startValue='60' color='009933' showOnTop='0' thickness='2' isTrendZone='0' displayvalue='Target' />";

 

$strXML .="</trendLines>";

 

 

 

$strXML .= "</chart>";

 

 

 

echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "", "725", 200, 0, false);

 

 

 

}

 

?>

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,
 
Thanks for the code.
We have found the issue, which is you are not using any unique id for the chart, infact there is no any chart id provided.
 
The parameter for renderChart function is as below:

// $chartSWF - SWF File Name (and Path) of the chart which you intend to plot

// $strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)

// $strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)

// $chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.

// $chartWidth - Intended width for the chart (in pixels)

// $chartHeight - Intended height for the chart (in pixels)

// $debugMode - Whether to start the chart in debug mode

// $registerWithJS - Whether to ask chart to register itself with JavaScript

function renderChart($chartSWF, $strURL, $strXML, $chartId, $chartWidth, $chartHeight, $debugMode, $registerWithJS) {..........}

 
 
Following is the function that you are using to render the chart:
 
echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "", "725", 200, 0, false);
 
You would need to modify your code as given below:
 
Consider this code for Chart No: 1
echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "chart1", 725, 200, false, false);

Consider this code for Chart No: 2

echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "chart2", 725, 200, false, false);
 
Consider this code for Chart No: 3
echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "chart3", 725, 200, false, false);
 
Consider this code for Chart No: 4
echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "chart4", 725, 200, false, false);
 
Consider this code for Chart No: 5
echo renderChart("Charts/ScrollLine2D.swf", "", $strXML, "chart5", 725, 200, false, false);
Edited by Guest

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this