monsieurmark

XML for Multi-Series Bar Chart with different number/ order of data values

Recommended Posts

Hi,

 

I have set category labels as below. I have two data sets for the multi-series bar chart.

 

The first dataset has all data points, in the right order. The second dataset ('BENCHMARK FUEL MIX') does not have a value for "NUCLEAR" and the data is generated in a different order in sql, so comes out in a different order when constructing the xml.

 

The second dataset : set name='HYDRO' does not pass the value to the 'Hydro' category. Because it is the first in the dataset list, its value is passed to the first category in the category list, Nuclear.

 

How do I get fusioncharts to recognise that I am passing a value for hydro, that needs to show in in the hydro category?

 

<chart caption='YOUR PORFOLIO AND BENCHMARK'

xAxisName='FUEL' yAxisName='Persentage' showValues='0' numberSuffix='%'

 chartOrder='line,area,column' >

<categories>

<category label='NUCLEAR'/>

<category label='COAL'/>

<category label='HYDRO'/>

</categories>

<dataset seriesName='USER FUEL MIX'>

<set name='NUCLEAR' value='0.51314510033995527343252'/>

<set name='COAL' value='0.16717460403856217640270'/>

<set name='HYDRO' value='0.15279657767844008918241'/>

</dataset>

<dataset seriesName='BENCHMARK FUEL MIX'>

<set name='HYDRO' value='0.00001690385748955934983'/>

<set name='COAL' value='0.98261366271075040777074'/>

</dataset>

</chart>

 

Many thanks,

 

Mark

Share this post


Link to post
Share on other sites
Guest Sumedh

Hello Mark,

 

You would need to check on the value for NUCLEAR label and you would need to pass it in the 'BENCHMARK FUEL MIX' dataset.

 

If the data for 'NUCLEAR' label is not present in your database, then you would need to simply insert (build <set> element with null) the 'null' for 'NUCLEAR' label 

 

Ref. Code:

<dataset seriesName='BENCHMARK FUEL MIX'>

<set name='NUCLEAR' value=''/>  ----------------------------------------------------------------------- [<set> element with null]
<set name='COAL' value='0.98261366271075040777074'/>
<set name='HYDRO' value='0.000016'/>
</dataset>
 
You would need to put condition accordingly for the NUCLEAR label (<dataset seriesName='BENCHMARK FUEL MIX'>) and you would need to apply own logic for this.
 
Hope this helps!

Share this post


Link to post
Share on other sites

Thanks Sumedh,

 

That answers my question thanks! Assigning values to categories on the fly like I would a variable doesn't work, you're right...I changed my stored procedure so that it outputs the same amount of data points, in the same order... job done!

 

Thanks for your help.

 

Mark

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