0

Please find the below code for load fusionchart on my home page, here 'newurl' loading data.xml from fusionchart folder. This works fine and showing graph, but my issue that, i m trying to load xml page from 'templates->data->data.xml'

<script type="text/javascript" src="fusioncharts/fusioncharts.js"></script>
<div id="chartContainer">FusionCharts XT will load here!</div> 

<script type="text/javascript">

  var myChart = new FusionCharts( "Column3D", 
                "myid here", "400", "300", "0" );
  //  var newurl =  "datatest.xml";
  var newurl =  "fusioncharts/data.xml";
  myChart.setDataURL(newurl);
  myChart.render("chartContainer");      

</script> 

and the xml page (templates->data->data.xml )like ,

{exp:weblog:entries weblog="school" entry_id="{segment_3}" limit="1"}
{reverse_related_entries weblog="school_results" limit="1"}
    <graph bgAlpha='0,0' xAxisName='Parties (roll over the bars to see their names)' yAxisName='Seats' showNames='0' decimalPrecision='0' formatNumberScale='0' outCnvBaseFontColor='ffffff' outCnvBaseFont='Verdana' outCnvBaseFontSize='12'>
{results}
{if segment_4}
    {if "{row_count}" <= "{segment_4}"}
        <set name='{name}' value='{content}' color='{colour}'/>
    {/if}
{if:else}
    <set name='{name}' value='{content}' color='{colour}'/>
{/if}
{/results}
</graph>
{/reverse_related_entries}
{/exp:weblog:entries}

How can call this , i mean how can call the template file to script?

1

Your data source needs to be a template you've created inside EE, it needs to be set as an XML template type, and it needs to know what entry to load.

So following your example, create a template group called data, then inside that template group create a template also called data, and use the template code you posted.

Then you could use data/data/{entry_id} as the value for the newurl variable in your javascript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.