Sign in to follow this  
techtween

Scatter Plot Huge Gap In X Axis

Recommended Posts

I am using FusionCharts XT with Rails 3.2. In one scenario, i'm using scatter(XY Plot) chart to present my data. There is a huge gap(marked as red box) in x axis and the max value(180) doesnt occupy the full chart. also i'm not getting the X axis values(140 to 180) displayed horizontally.What possible reason could that be?

 

 

My xml builder file is as follows(i've also attached a screenshot of my chart for yours understanding),

 

xml = Builder::XmlMarkup.new

xml.chart(:palette=>'2', :caption=>'', :subcaption=>'', :showLegend=>'1', :showNames=>'1', :xAxisMinValue=>'140', :xAxisMaxValue=>'180', :adjustDiv=>'0', :numDivLines=>'22', :divLineColor=>'b2dde3', :divLineThickness=>'2', :alternateHGridColor=>'edfdff', :yAxisMinValue=>'2.0', :yAxisMaxValue=>'4.4', :yAxisValueDecimals=>'1', :decimals=>'1', :forcedecimals=>'1', :bgColor=>"196bdb,b2dde3", :bgAlpha=>"10,40", :showValues=>'140', :labelStep=>'2') do

# Run a loop to create the <category> tags within <categories>

xml.categories(:verticalLineColor=>'b2dde3', :verticalLineThickness=>'1') do

xml.category(:label=>'140', :x=>'140', :showVerticalLine=>'1')

xml.category(:label=>'142', :x=>'142', :showVerticalLine=>'1')

xml.category(:label=>'144', :x=>'144', :showVerticalLine=>'1')

xml.category(:label=>'146', :x=>'146', :showVerticalLine=>'1')

xml.category(:label=>'148', :x=>'148', :showVerticalLine=>'1')

xml.category(:label=>'150', :x=>'150', :showVerticalLine=>'1')

xml.category(:label=>'152', :x=>'152', :showVerticalLine=>'1')

xml.category(:label=>'154', :x=>'154', :showVerticalLine=>'1')

xml.category(:label=>'156', :x=>'156', :showVerticalLine=>'1')

xml.category(:label=>'158', :x=>'158', :showVerticalLine=>'1')

xml.category(:label=>'160', :x=>'160', :showVerticalLine=>'1')

xml.category(:label=>'162', :x=>'162', :showVerticalLine=>'1')

xml.category(:label=>'164', :x=>'164', :showVerticalLine=>'1')

xml.category(:label=>'166', :x=>'166', :showVerticalLine=>'1')

xml.category(:label=>'168', :x=>'168', :showVerticalLine=>'1')

xml.category(:label=>'170', :x=>'170', :showVerticalLine=>'1')

xml.category(:label=>'172', :x=>'172', :showVerticalLine=>'1')

xml.category(:label=>'174', :x=>'174', :showVerticalLine=>'1')

xml.category(:label=>'176', :x=>'176', :showVerticalLine=>'1')

xml.category(:label=>'178', :x=>'178', :showVerticalLine=>'1')

xml.category(:label=>'180', :x=>'180', :showVerticalLine=>'1')

end

 

 

# Run a loop to create the <set> tags within dataset for series 'Accepted'

xml.dataset(:seriesName=>'Accepted', :color=>'008000', :showPlotBorder=>'1', :anchorRadius=>'4', :anchorBgColor=>'008000') do

accepted.each do |accepted|

xml.set(:y=>accepted.gpa_lsdas, :x=>accepted.lsat)

end

end

# Run a loop to create the <set> tags within dataset for series 'Waitlisted'

xml.dataset(:seriesName=>'Waitlisted', :color=>'ffd700', :showPlotBorder=>'1', :anchorRadius=>'4', :anchorBgColor=>'ffd700') do

waitlisted.each do |waitlisted|

xml.set(:y=>waitlisted.gpa_lsdas, :x=>waitlisted.lsat)

end

end

# Run a loop to create the <set> tags within dataset for series 'Rejected'

xml.dataset(:seriesName=>'Rejected', :color=>'FF0000', :showPlotBorder=>'1', :anchorRadius=>'4', :anchorBgColor=>'FF0000') do

rejected.each do |rejected|

xml.set(:y=>rejected.gpa_lsdas, :x=>rejected.lsat)

end

end

end

post-28583-0-53071600-1344943422_thumb.jpg

Edited by techtween

Share this post


Link to post
Share on other sites

After quite a bit of head scratching I solved my problem. I was rounding the category values, and not the xAxisMin / xAxisMax values. Apparently, if there's any difference between the first category and the xAxisMin, or the last category and the xAxisMax, then you will have this problem.

 

 

 

Brett

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

As you have mentioned, if you are defining the range of values for X-Axis ( xAxisMinValue, xAxisMaxValue) and the data points are not fully spread over this range of values, you will get the blank space at the right most side of the chart.

 

So, you need to apply the categories and the X-Axis min and max values as per the data set range.

 

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