How can I stop adjusting during adjusting?

« 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 Sta on 11th September 2017
Is it possible to stop adjusting graph ( a bar for example)
during adjusting?

}).on('onadjust', function (obj)
         // If (..) then { STOP adjusting }


Posted by Richard on 11th September 2017
Hi there,

Well you could do it like this - which is the easy way:

new RGraph.Bar({
     id: 'cvs',
     data: [4,8,6,8,6,6,5],
     options: {
         adjustable: true
}).draw().on('adjust', function (obj)
     if ([1] <= 4) {
         obj.canvas.removeEventListener('mousemove', obj.canvas.rgraph_mousemove_event_listener, false);
         obj.canvas.removeEventListener('mousedown', obj.canvas.rgraph_mousedown_event_listener, false);

That disables adjusting when the minimum value is reached - but for *all* bars.

There's another way you could do it using the adjustingOnly property - but that does involve keeping a red=cord of which bars you want adjusting for.

ie Start with 5 bars:

var adjustableBars = [true, true, true, true, true];

bar.set('adjustingOnly', adjustableBars);

Then when one is not wanted any more set the relevant value to false and redraw the chart:

var adjustableBars = [true, true, false, true, true];

bar.set('adjustingOnly', adjustableBars);


I haven't tried this method - just the first one).


Add a reply

« Back to message list