Spline drawing overshoots outside ymax

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Lodewijk on 10th April 2014
Hi,

When I changed ymax, spline drawing seems to be incorrect for the range above ymax (it concerns data point 25.72).

A complete example with three graphs:
1. correct one with ymax > yrange
2. incorrect one with ymax < yrange
3. both graphs drawn in same canvas, which clearly shows the effect

I used a canvas dimensions of width=400 and height=200 (effect may depend on canvas size)
 
Is this a bug or an (inconsistent) overshoot you may expect with splines?

Regards,

Lodewijk
--

             var data4 = [23.16, 17.03, 13.71, 25.72, 15.24, 19.72, 16.98, 18.72, 19.67, 19.81];

             var myLine = new RGraph.Line('cvs',data4)
                 .Set('labels', ['2004','2005','2006','2007','2008','2009','2010','2011','2012','2013'])
                 .Set('gutter.left', 40)
                 .Set('gutter.right', 15)
                 .Set('gutter.bottom', 20)
                 .Set('colors', ['black'])
                 .Set('units.post', '')
                 .Set('linewidth', 5)
                 .Set('hmargin', 15)
                 .Set('background.grid.autofit', true)
                 .Set('background.grid.autofit.numvlines', 11)
                 .Set('shadow', true)
                 .Set('shadow.color', 'rgba(20,20,20,0.3)')
                 .Set('shadow.blur', 10)
                 .Set('shadow.offsetx', 0)
                 .Set('shadow.offsety', 0)
                 .Set('background.grid.vlines', false)
                 .Set('background.grid.border', true)
                 .Set('noxaxis', true)
                 .Set('axis.color', '#666')
                 .Set('text.color', '#666')
                 .Set('spline', true)
                 .Set('ymax', 26)
                 .Draw();

             var myLine1 = new RGraph.Line('cvs2',data4)
                 .Set('labels', ['2004','2005','2006','2007','2008','2009','2010','2011','2012','2013'])
                 .Set('gutter.left', 40)
                 .Set('gutter.right', 15)
                 .Set('gutter.bottom', 20)
                 .Set('colors', ['red'])
                 .Set('units.post', '')
                 .Set('linewidth', 5)
                 .Set('hmargin', 15)
                 .Set('background.grid.autofit', true)
                 .Set('background.grid.autofit.numvlines', 11)
                 .Set('shadow', true)
                 .Set('shadow.color', 'rgba(20,20,20,0.3)')
                 .Set('shadow.blur', 10)
                 .Set('shadow.offsetx', 0)
                 .Set('shadow.offsety', 0)
                 .Set('background.grid.vlines', false)
                 .Set('background.grid.border', true)
                 .Set('noxaxis', true)
                 .Set('axis.color', '#666')
                 .Set('text.color', '#666')
                 .Set('spline', true)
                 .Set('ymax', 25)
                 .Draw();

  var myLine2 = new RGraph.Line('cvs3',data4)
                 .Set('labels', ['2004','2005','2006','2007','2008','2009','2010','2011','2012','2013'])
                 .Set('gutter.left', 40)
                 .Set('gutter.right', 15)
                 .Set('gutter.bottom', 20)
                 .Set('colors', ['red'])
                 .Set('units.post', '')
                 .Set('linewidth', 5)
                 .Set('hmargin', 15)
                 .Set('background.grid.autofit', true)
                 .Set('background.grid.autofit.numvlines', 11)
                 .Set('shadow', true)
                 .Set('shadow.color', 'rgba(20,20,20,0.3)')
                 .Set('shadow.blur', 10)
                 .Set('shadow.offsetx', 0)
                 .Set('shadow.offsety', 0)
                 .Set('background.grid.vlines', false)
                 .Set('background.grid.border', true)
                 .Set('noxaxis', true)
                 .Set('axis.color', '#666')
                 .Set('text.color', '#666')
                 .Set('spline', true)
                 .Set('ymax', 25)
                 .Draw();
            
              var myLine3 = new RGraph.Line('cvs3',data4)
                 .Set('labels', ['2004','2005','2006','2007','2008','2009','2010','2011','2012','2013'])
                 .Set('gutter.left', 40)
                 .Set('gutter.right', 15)
                 .Set('gutter.bottom', 20)
                 .Set('colors', ['black'])
                 .Set('units.post', '')
                 .Set('linewidth', 5)
                 .Set('hmargin', 15)
                 .Set('background.grid.autofit', true)
                 .Set('background.grid.autofit.numvlines', 11)
                 .Set('shadow', true)
                 .Set('shadow.color', 'rgba(20,20,20,0.3)')
                 .Set('shadow.blur', 10)
                 .Set('shadow.offsetx', 0)
                 .Set('shadow.offsety', 0)
                 .Set('background.grid.vlines', false)
                 .Set('background.grid.border', true)
                 .Set('noxaxis', true)
                 .Set('axis.color', '#666')
                 .Set('text.color', '#666')
                 .Set('spline', true)
                 .Set('ymax', 26)
                 .Draw();
Posted by Richard on 10th April 2014
Hi there,


With a spline the line will go through all of the points on the chart - but there may be some 'overshoot' between points. If you don't want this you'll need to turn the spline setting off.





Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

Add a reply




« Back to message list