Sign in to follow this  
duderonomy

chart API options from within javascript

Recommended Posts

Hello,

 

In the documentation, I see this style of sending options to the FusionChart API via the setXMLUrl() method, which sends data like the following:

<chart caption='Chart Caption' palette="3" animation="1" xAxisName='June 2013' yAxisName='Homes Sold' >

I believe i read somewhere in the docs that I could send all these options via Javascript, say, in the new FusionChart(arg, arg, arg...) method. 

 

Can someone please point me to the documentation that describes this API. 

 

To be clear, our app does not write chart options into our XML chart data files. We need to set those options within Javascript.

 

Thank you!

 

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi Duderonomy,

 

FusionCharts XT is a JavaScript charting library and accepts data in JSON/XML formats.

 

setXMLUrl() sets or changes the XML data of the chart to a specified URL. If you don't want to set the XML data with specified URL, then you can make use of setXMLData().

 

setXMLData() changes the data of the chart to the specified XML string.

 

For more information, please refer the following link:

http://docs.fusioncharts.com/charts/contents/?FirstChart/DataXML.html

 

http://docs.fusioncharts.com/charts/contents/?FirstChart/FirstChart.html

 

Also, if you want to update the chart with new chart attributes, then you can make use of setChartAttribute function.

 

All you need to do is pass the name of the attribute and its new value to this function.

 

Ref. Code:

var chartReference = FusionCharts("myChartId"); 
chartReference.setChartAttribute({"subCaption" : "new sub-title"});
 
For more information, please refer the following link:
 
Also note, you can only update chart elements through this function. For updating/changing the data of the chart (<set> and <dataset> elements), you would need to pass updated JSON/XML to the chart.
 
If you are willing to bind chart XML using a JavaScript function, then please refer the following link:
 
For FusionCharts JavaScript API reference, refer the following links:
 
 
If this doesn't suffice your requirement, then please elaborate more on your requirement.
 
Hope this helps!

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