lumpo

Can't pass color attribute using setXML data

Recommended Posts

In the following the XMLdata is sent as a http GET from a webviewer in filemaker pro advanced 15. It is decoded by a php server script and returns the chart. However, whenever I try to pass any color params so that each segment of say a pie chart of stacked column can have the colour I select, the chart won't draw. If I remove the color attribute, it draws immediately.

Here's the xml data being sent that works - note that it accepts color in the last segment only:

 

"<set label=\"fruit\" value=\""& try::fruit&"\" />
<set label=\"grains\" value=\""& try::grains&"\"  />
<set label=\"dairy\" value=\""& try::dairy&"\" />
<set label=\"veges\" value=\""& try::veges&"\"  />
<set label=\"protein\" value=\""& try::protein&"\" />
<set label=\"goodXtra\" value=\""& try::goodXtra&"\"/>
<set label=\"badXtra\" value=\""& try::badXtra&"\" color=\"ff4c3b\" issliced=\"1\"/>"
 
If this is sent, it fails:
 
"<set label=\"fruit\" value=\""& try::fruit&"\" />
 
...
 
<set label=\"goodXtra\" value=\""& try::goodXtra&"\" color=\"5de07d\"/>
<set label=\"badXtra\" value=\""& try::badXtra&"\" color=\"ff4c3b\" issliced=\"1\"/>"
 
Can't see what the solution might be - certainly can't use the standard colours.  BTW, setting the colorpalette to the colours I want also doesn't work.
 
Here's the php code:
 
<html>
<head>
<title>tryPie after v3</title>
<?php include 'includes/fusioncharts.php' ?>
<script type="text/javascript" src="js/fusioncharts.js"></script>
<script type="text/javascript" src="js/themes/fusioncharts.theme.fint.js"></script>
 
<script type="text/javascript">
 FusionCharts.ready(function(){
  var pData= <?php   echo  $_GET["data"] ?>;
    
     var allServesChart = new FusionCharts({
        'type': 'pie3d',
        'renderAt': 'allServes-container',
        'width': '400',
        'height': '320',
        'dataFormat': 'xml',
        'dataSource': '<chart></chart>'
         });
    allServesChart.render(); 
    allServesChart.setXMLData(pData);
    
    });
</script>
</head>
<body>
<div>
  <div id="allServes-container">A pie chart should load here!</div>
</div>
</body>
</html>

 

Share this post


Link to post
Share on other sites

Yes - afaict it's up to date. My syntax is correct and I can adjust most things guided by the on-line docs. Colours do NOT work. Tried passing and decoding a json object. Chart works, colours fail. ('hard wiring' all the colors and data statement works fine of course, but that defeats the purpose of using setXMLdata).

Show stopper unfortunately.

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