RGraph drawing API Y axis not working on IE8


« 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 AJ on 20th January 2014
I am trying to set y axis label on rgraph on IE8 and it is breaking on RGraph.common.core.js with 'undefined' is null or not an object.

Here is code for same

         window.onload = function () {
             var bar = new RGraph.Bar('myCanvas', [[50],[115]])
                     .Set('gutter.top', 5)
                     .Set('gutter.left', 35)
                     .Set('gutter.right', 15)
                     .Set('background.grid.vlines', false)
                     .Set('background.grid.border', false)
                     .Set('colors', ['Gradient(white:#f11:#f11)', 'Gradient(white:#1cc:#1cc)'])
                     .Set('tooltips.event', 'mousemove')
                     .Set('tooltips', ['Bob on Monday: 50 sales', 'Jamie on Monday: 65 sales'])
                     .Set('labels', ['Bob', 'Jamie'])
                     .Set('highlight.stroke', 'rgba(0,0,0,0.1)')
                     .Set('strokestyle', 'rgba(0,0,0,0)')
                     .Set('noaxes', true)
                     .Set('ylabels', false)
                     .Set('labels.above', true)
                     .Set('linewidth', 2)
                     .Set('hmargin', 15)
                     .Draw();

             var yaxis = new RGraph.Drawing.YAxis('myCanvas', bar.gutterLeft)
                         .Set('max', 150)
                         .Set('title', 'Widgets sold')
                         .Set('colors', ['black'])
                         .Draw();
         };


It works on Chrome/FF...is this a limitation of rgraph for IE8<
Posted by Richard on 20th January 2014
Hi there,

Have you included all the relevant libraries (including ExCanvas) ? This works:

www.rgraph.net/fiddle/view/a-bar-chart-with-drawing-api-y-axis




Richard, RGraph Support
www.rgraph.net
Please link to the RGraph website. Thanks!
Posted by AJ on 20th January 2014
Thanks for your prompt response, i did include all the libraries as suggested also followed the same order as in your example.

Tried the above link on IE8 and the graph is still missing y axis and there is same js error on page.

If i remove below

              var yaxis = new RGraph.Drawing.YAxis('myCanvas', bar.gutterLeft)
                          .Set('max', 150)
                          .Set('title', 'Widgets sold')
                          .Set('colors', ['black'])
                          .Draw()

the error is gone but of course i need to set labels on y axis.

Please confirm if RGraph.Drawing.YAxis is not supported on IE8<
Posted by Richard on 20th January 2014
Hi there,

Are you comfortable editing the source?

In RGraph.common.core.js in the RGraph.Path function there's a check on the obj argument that looks like this:




/**
* Allow either the RGraph object or the context to be used as the first argument
*/
if (obj.isRGraph && typeof obj.type === 'string') {
     var co = obj.context;
} else if (obj.toString().indexOf('CanvasRenderingContext2D') > 0) {
     var co = obj;
}




Change it to this:





/**
* Allow either the RGraph object or the context to be used as the first argument
*/
if (obj.isRGraph && typeof obj.type === 'string') {
    var co = obj.context;
} else {
     var co = obj;
}





Richard
www.rgraph.net
Please link to the RGraph website. Thanks!
Posted by AJ on 20th January 2014
Thanks works like a charm now :)

Add a reply

 




« Back to message list
RGraph on social media