Get and set methods: conversion error from camelCase (IE9)

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 L-W on 10th November 2015
The get and set methods use RegExp.$1 in the replacement function. Under IE9, RegExp.$1 is not updated "immediately" and returns an unexpected value.
Simple example: create a combined bar graph + line with gutters, in result, no gutters. The constructor calls the get method with gutterLeft, gutterRight, gutterTop, gutterBottom.
On the first call (gutterLeft) RegExp.$1 returns an empty string, name contains "chart.gutter.eft", the second call (gutterRight) RegExp.$1 returns "L", name contains "chart.gutter.light" etc.
By cons "str" contains the expected values (L, R, ...). It might be more appropriate to use this variable.

PS: In the constructor of combined graphics, redefine the gutters when i is zero is maybe not useful.
Posted by Richard on 10th November 2015
Hi,

Thanks for this report.

In the RGraph.bar.js file at approximately line 3165 there's a block of code that sets the gutters using camelCase notation. You can simply use dot notation instead (there's no difference), so I've changed it to this:


/**
* Set the Line chart gutters to match the Bar chart gutters
*
* ** Needs to use the dot form to skirt an IE9 bug **
*/
this.objects[i].set({
     gutterLeft: this.objects[0].get('gutter.left'),
     gutterRight: this.objects[0].get('gutter.right'),
     gutterTop: this.objects[0].get('gutter.top'),
     gutterBottom: this.objects[0].get('gutter.bottom')
});



Richard
Posted by L-W on 10th November 2015
Thanks for your quick reply.

Add a reply




« Back to message list