Sign in to follow this  
nabyendu

Programatically Change Angular Gauge properties

Recommended Posts

Hi,

I am integrating FusionWidget Angular Gauge in my web application. I am using setDataUrl(string path_to_xml). This will render the gauge with the values supplied in XML file. This is fine.

Now I want to change some properties for gauge e.g, lowerLimitDisplay,upperLimitDisplay,gaugeStartAngle,gaugeEndAngle,

paletteThemeColor etc. before rendering gauge. That mean  I want to change those property values supplied in XML file before rendering the gauge.

Could you tell me how to acheive this ?

Thanks & Regards

Nabyendu Adhikari

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

Welcome to FusionCharts Forum.

You would need to add and set values to these attributes in the <chart> element inside the XML.

e.g. <chart lowerLimitDisplay='0'  upperLimitDisplay='100' >

I hope this helps you.

 

Share this post


Link to post
Share on other sites

Hi Madhumita,

My data.xml file content is like that

<

chart lowerLimit='0' upperLimit='100' lowerLimitDisplay='Bad' upperLimitDisplay='Good' gaugeStartAngle='135' gaugeEndAngle='45' gaugeOriginX='130' gaugeOriginY='180' gaugeOuterRadius='140' palette='1' numberSuffix='%' tickValueDistance='20' showValue='1' majorTMHeight='10' minorTMHeight='5'>

....

</chart>

I am using this code

var chart = new FusionCharts( "Charts/AngularGauge.swf", div, width, height, "0", "1" );

chart.setDataURL( "data.xml" );

<--------------- Here I want to change gaugeStartAngle to '0' and  gaugeEndAngle to '180'

chart.render( divId );

Is this possible?

Thanks & regards

Nabyendu Adhikari

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

Firstly give an unique id to your chart.

var chart = new FusionCharts( "Charts/AngularGauge.swf", 'Chart1Id', width, height, "0", "1" );

After rendering the chart you can create a string XML say var XMLData = <here you provide the new XML>

Now, you get the chart by its id and do a setdataXMl on that. The chart gets updated internally.

e.g. var chartObj= getChartFromID('id of the chart');

chartObj.setDataXML(XMLData);

 

 

Edited by Guest

Share this post


Link to post
Share on other sites

Hi Madhumita,

I have used chart.setAttribute("width", "600"); chart.setAttribute("height", "180"); which changes the chart size. I have also found other two methods in FusionCharts.js file viz; addParam and addVariable.

var chart = new FusionCharts( "Charts/AngularGauge.swf", "chartID", "200", "200", "0", "1" );

chart.setDataURL("data.xml");

chart.setAttribute("width", "600");  <---- final chart width is 600 although in constructor we provide width value as 200

chart.setAttribute("height", "180"); <---- final chart height is 180 although in constructor we provided height value as 200

chart.render( "chartID");

But I want to change other properties like gaugeStartAngle,gaugeEndAngle.

Can we do it without creating new XML  ?

Thanks & Regards

Nabyendu Adhikari

 

 

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