Sign in to follow this  
solace9

Decimals and properties when using URL-Encoded XML

Recommended Posts

Hello,

 

 

 

I'm calling charts in the following manner

 

 

 

script type="text/javascript">

 

var chart = new FusionCharts("charts/Area2D.swf","chart-earned-m","420","100");

 

chart.setDataURL("charts-days;labs;earned;0.00;0.00;1.21;1.62;1.27;0.04;0;0;0;0;0.xml");

 

chart.render("chart-earned-m");

 

/script>

 

 

 

My question is, how would I modify properties such as decimalSeparator, numberPrefix, decimalPrecision, ect?

 

I don't see the chart> html used, so am I missing something or is there a way to set properties in the javascript file?

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,

Welcome to FusionCharts Forum. :)

Could you please try using the attributes "decimalSeparator", "numberPrefix", "decimalPrecision" in the <chart> element of the XML (in the "charts-days;labs;earned;0.00;0.00;1.21;1.62;1.27;0.04;0;0;0;0;0.xml" file)?

Please refer to the following link for further details on the Area2D chart's <chart> element attributes:

Ref.- http://www.fusioncharts.com/docs/Contents/ChartSS/Area2D.html

Please revert in case you have further queries on the same.

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Apologies for the misunderstanding.

 

 

 

Please note that if you are passing the data of the chart itself from JavaScript as a string instead of passing it from a XML stream which is generated from some other source you need to URLEncode them.

 

 

 

I am afraid, "charts-days;labs;earned;0.00;0.00;1.21;1.62;1.27;0.04;0;0;0;0;0.xml" would be understood by FusionCharts not as string a providing value to the chart directly but as an XML file inside which you have provided chart data in XML format since you are using setDataURL() method. In short setDataURL() function expects the parameter to be an URL/path of the XML file (static or dynamically generated).

 

 

 

e.g. of an XML be it String or static XML or dynamically generated XML:

 

 

 

<chart caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'>

 

<set label='January' value='17400' />

 

<set label='February' value='19800' />

 

<set label='March' value='21800' />

 

<set label='April' value='23800' />

 

<set label='May' value='29600' />

 

<set label='June' value='27600' />

 

<set label='July' value='31800' />

 

<set label='August' value='39700' />

 

<set label='September' value='37800' />

 

<set label='October' value='21900' />

 

<set label='November' value='32900' />

 

<set label='December' value='39800' />

 

</chart>

 

 

 

NOTE: You can always make data come from any of the dynamic sources like database etc. and build an XML from that data and then send it. You can find lots of samples of the kind from our Guide for Web Developers section of our Online Documentation.

 

 

 

 

 

Examples provided in pages : http://www.fusioncharts.com/docs/Contents/FirstChart.html, http://www.fusioncharts.com/docs/Contents/JSEmbed.html.

 

 

 

In case you wish to provide the value as string without any XML file(static/dynamic) dependencies you need to use setDataXML() function where the data would go as XML string .

 

 

 

e.g.

 

 

 

http://www.fusioncharts.com/docs/Contents/DataXML.html

 

 

 

var myChart = new FusionCharts("../FusionCharts/Column3D.swf", "myChartId", "900", "300", "0", "0");

 

myChart.setDataXML("<chart caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'><set label='January' value='17400' /><set label='February' value='19800' /><set label='March' value='21800' /><set label='April' value='23800' /><set label='May' value='29600' /><set label='June' value='27600' /><set label='July' value='31800' /><set label='August' value='39700' /><set label='September' value='37800' /><set label='October' value='21900' /><set label='November' value='32900' /><set label='December' value='39800' /></chart>");

 

 

 

myChart.render("chartdiv");

 

 

 

 

 

Hope this helps.

 

 

 

Please let us know if we are missing something.

Share this post


Link to post
Share on other sites

Hi,

 

 

 

To add to the reply with respect to your first query:

 

 

 

in the XML that you provide to chart you need to add the attributes like:

 

 

 

decimalSeparator, numberPrefix, decimalPrecision,

 

 

 

e.g.

 

 

 

<chart decimalSeparator='.' numberPrefix='$' decimalPrecision='2' caption='Monthly Sales Summary' subcaption='For the year 2006' xAxisName='Month' yAxisName='Sales' numberPrefix='$'>

 

<set label='January' value='17400' />

 

<set label='February' value='19800' />

 

<set label='March' value='21800' />

 

<set label='April' value='23800' />

 

<set label='May' value='29600' />

 

<set label='June' value='27600' />

 

<set label='July' value='31800' />

 

<set label='August' value='39700' />

 

<set label='September' value='37800' />

 

<set label='October' value='21900' />

 

<set label='November' value='32900' />

 

<set label='December' value='39800' />

 

</chart>

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