Sign in to follow this  
FusionCharts Support

Dynamic Subcaptions and labels failing to display

Recommended Posts

Hello,

 

 

 

PHP/mySQL professional but a FusionCharts newbie here. The XML below is what I am sending from PHP/mySQL to the chart. If I manually type subcaption='10-1-09 to 11-10-09' it shows up no problem; same for xAxisName.

 

 

 

If I instead use subcaption='<?=$datePhrase?>' xAxisName='<?=$datePhrase?>' then they are not shown at all.

 

 

 

If I set $datePhrase to 'xxx' it does not display. If instead of echoing $datePhrase I add xAxisName='<?="xxx"?>' and just echo an uninterpolated string it shows up.

 

 

 

What am I doing wrong here?

 

 

 

TIA!

 

 

 

JG

 

 

 

Edit: the bbcode code tags were not displaying so I am trying to replace them

 

 

 


<chart caption='Driving Distance' subcaption='10-1-09 to 11-10-09' xAxisName='10-1-09 to 11-10-09' yAxisName='Distance' yAxisMinValue='0'  numberPrefix='' showValues='1' alternateHGridColor='FCB541' alternateHGridAlpha='20' divLineColor='FCB541' divLineAlpha='50' canvasBorderColor='666666' baseFontColor='666666' lineColor='FCB541'>

 <set label='10/24/09' value='139' />

 <set label='10/28/09' value='75' />

 <set label='11/9/09' value='126' />

 <set label='11/4/09' value='280' />

 <styles>

 <definition>

 <style name='Anim1' type='animation' param='_xscale' start='0' duration='1' />

 <style name='Anim2' type='animation' param='_alpha' start='0' duration='0.6' />

 <style name='DataShadow' type='Shadow' alpha='40'/>

 </definition>

 <application>

 <apply toObject='DIVLINES' styles='Anim1' />

 <apply toObject='HGRID' styles='Anim2' />

 <apply toObject='DATALABELS' styles='DataShadow,Anim2' />

 </application> 

 </styles>

</chart>

Edited by Guest

Share this post


Link to post
Share on other sites

Thank you for your reply!

 

 

 

Here is the code I am using. The fact that the dates are defined in the PHP is evidenced by successful changes to the date range of the displayed data.

 

 

 

 

 

[ code ]

 

<?

 

include_once("../classDBI/classDBI.php");

 

$uObj = new User;

 

$rObj = new Round;

 

$uObj->userSession();

 

$distances = $rObj->field_by_dates($_SESSION['user']->id, 'drivingDistance_avg_per_hole', $_GET['start'], $_GET['end']);

 

if ($_GET['start'] && $_GET['end']) {

 

$datePhrase = date("n-j-y", strtotime($_GET['start'])) . " to " . date("n-j-y", strtotime($_GET['end']));

 

}

 

?>

 

<chart caption='Driving Distance' subcaption='<?=$datePhrase?>' xAxisName='<?=$datePhrase?>' yAxisName='Distance' yAxisMinValue='0' numberPrefix='' showValues='1' alternateHGridColor='FCB541' alternateHGridAlpha='20' divLineColor='FCB541' divLineAlpha='50' canvasBorderColor='666666' baseFontColor='666666' lineColor='FCB541' canvasRightMargin='50' >

 

<? if ($distances) { foreach ($distances as $k => $v) { ?>

 

<set label='<?=date("n/j/y", strtotime($k))?>' value='<?=$v?>' />

 

<? }} ?>

 

<styles>

 

<definition>

 

<style name='Anim1' type='animation' param='_xscale' start='0' duration='1' />

 

<style name='Anim2' type='animation' param='_alpha' start='0' duration='0.6' />

 

<style name='DataShadow' type='Shadow' alpha='40'/>

 

</definition>

 

<application>

 

<apply toObject='DIVLINES' styles='Anim1' />

 

<apply toObject='HGRID' styles='Anim2' />

 

<apply toObject='DATALABELS' styles='DataShadow,Anim2' />

 

</application>

 

</styles>

 

</chart>

 

[ /code]

Share this post


Link to post
Share on other sites

Hi jerrygarciuh,

 

 

 

please add the Highlighted code in your page.

 

 

 

[ code ]

 

<?

 

include_once("../classDBI/classDBI.php" [Wink] ;

 

$uObj = new User;

 

$rObj = new Round;

 

$uObj->userSession();

 

$distances = $rObj->field_by_dates($_SESSION['user']->id, 'drivingDistance_avg_per_hole', $_GET['start'], $_GET['end']);

 

if ($_GET['start'] && $_GET['end']) {

 

$datePhrase = date("n-j-y", strtotime($_GET['start'])) . " to " . date("n-j-y", strtotime($_GET['end']));

 

}

 

header('Content-type: text/xml');

 

?>

 

[ /code]

Edited by Guest

Share this post


Link to post
Share on other sites

Hi Ayan,

 

Thank you for the reply!

 

 

 

I have now added <? header('Content-type: text/xml'); ?> to all of my XML generation pages directly before the output of the script. This has not resolved the disappearing text.

 

 

 

I also tried adding static text to the configuration like so: subcaption='x<?=$datePhrase?>' and the X I added shows up by itself and centered even though when the XML is viewed directly the date string is in place and correctly formatted with no illegal characters.

 

 

 

I also tried adding ob_start() and ob_flush() at the appropriate spots hoping this would resolve it.

 

 

 

I guess my next step will be to write the output to a static file and issue a redirect header to the static file.

 

 

 

Have you seen this issue before?

 

JG

Share this post


Link to post
Share on other sites

Hi,

Could you please cross-check whether the XML that is getting generated contains the desired text as value in those attributes?

So, Instead of passing the XML (URL of the file) to the chart could you please try once loading that in the browser (firefox) and see (and share with us) what values are exactly coming?

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