FusionCharts Forum: xml builder structure for multi-series 3d column charts - FusionCharts Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

xml builder structure for multi-series 3d column charts

#1 User is offline   asmuts 

  • Forum Newbie
  • Group: Members
  • Posts: 2
  • Joined: 27-May 09

Posted 04 June 2009 - 01:45 PM

My single series charts work great! However I am struggling with the correct structure for a multi-series chart.

The structure for single series 3D column chart that works:


This represents test(assessment) results for student over a period(terms 1 - 2)



xml = Builder::XmlMarkup.new(:indent=>0)

options = { ....}

xml.graph(options) do

  for result in @user_results.results do

     assessment_name = result.assessment.name

     xml.set(:name => assessment_name, :value => result.percentage, :color=>''+get_FC_color)

  end

end



My structure for a multi-series 3D column chart. Note I have changed the SWF to 3D column

multi-series chart. This obviously si not working. What am I doing wrong?




This represents the same data as above but including the variables for the category and dataset elements.



xml = Builder::XmlMarkup.new(:indent=>0)

options = { ....}

xml.graph(options) do

  for result in @user_results.results do

      category_name = result.assessment.term

      series_name = result.assessment.subject_class.name

      xml.categories(:font => "Arial", :fontSize => "11", :fontColor => "000000")

 xml.category(:name => category_name)

 xml.dataset(:seriesname => series_name, :color => ''+get_FC_color)

 xml.set(:value => result.percentage)



  end

end





Thanks

Archie
0

Other Replies To This Topic

#2 User is offline   srividya_sharma 

  • Supreme Being
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 943
  • Joined: 01-October 07

Posted 04 June 2009 - 10:11 PM

Hello Archie,

Welcome to FusionCharts For Ruby On Rails!

The xml for multi-series chart should be in the following format:

<graph caption='Business Results 2005 v 2006' xAxisName='Month' yAxisName='Revenue' showValues='0' numberPrefix='$' decimalPrecision='0' bgcolor='F3f3f3' bgAlpha='70' showColumnShadow='1' divlinecolor='c5c5c5' divLineAlpha='60' showAlternateHGridColor='1' alternateHGridColor='f8f8f8' alternateHGridAlpha='60' > <categories> <category name='Jan' /> <category name='Feb' /> <category name='Mar' /> <category name='Apr' /> <category name='May' /> </categories> <dataset seriesName='2006' color='c4e3f7' > <set value='27400' /> <set value='29800' /> <set value='25800' /> <set value='26800' /> <set value='29600' /> </dataset> <dataset seriesName='2005' color='Fad35e' > <set value='10000'/> <set value='11500'/> <set value='12500'/> <set value='15000'/> <set value='11000' /> </dataset> </graph>

In the builder, your code will be something like this:

xml = Builder::XmlMarkup.new(:indent=>0) options = { ....} xml.graph(options) do

  for result in @user_results.results do category_name = result.assessment.term    xml.categories(:font => "Arial", :fontSize => "11", :fontColor => "000000") do     xml.category(:name => category_name)

  end end

   for result in @user_results.results do   series_name = result.assessment.subject_class.name       xml.dataset(:seriesname => series_name, :color => ''+get_FC_color) do      xml.set(:value => result.percentage)

  end   end end

Please refer to SampleAppappviewsfusionchartsarray_examplems_array_data.builder for clarification.

Hope this helps! :)

regards,
Srividya Sharma
0

Other Replies To This Topic

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic