/* * Flot plugin to order bars side by side. * * Released under the MIT license by Benjamin BUFFET, 20-Sep-2010. * * This plugin is an alpha version. * * To activate the plugin you must specify the parameter "order" for the specific serie : * * $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }]) * * If 2 series have the same order param, they are ordered by the position in the array; * * The plugin adjust the point by adding a value depanding of the barwidth * Exemple for 3 series (barwidth : 0.1) : * * first bar décalage : -0.15 * second bar décalage : -0.05 * third bar décalage : 0.05 * */(function(e){function t(e){function u(e,r,s){var o=null;if(a(r)){v(r);f(e);c(e);d(r);if(n>=2){var u=m(r),l=0,h=g();y(u)?l=-1*b(t,u-1,Math.floor(n/2)-1)-h:l=b(t,Math.ceil(n/2),u-2)+h+i*2;o=w(s,r,l);s.points=o}}return o}function a(e){return e.bars!=null&&e.bars.show&&e.bars.order!=null}function f(e){var t=o?e.getPlaceholder().innerHeight():e.getPlaceholder().innerWidth(),n=o?l(e.getData(),1):l(e.getData(),0),r=n[1]-n[0];s=r/t}function l(e,t){var n=new Array;for(var r=0;rr?1:0}function d(e){r=e.bars.lineWidth?e.bars.lineWidth:2;i=r*s}function v(e){e.bars.horizontal&&(o=!0)}function m(e){var n=0;for(var r=0;r