/* * 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(k){k.plot.plugins.push({init:function(k){function m(a,c){for(var d=[],b=0;bb?1:0}function n(a,c,d){for(var b=0;c<=d;c++)b+=a[c].bars.barWidth+2*l;return b}var g,h,o,l,p=1,j=!1;k.hooks.processDatapoints.push(function(a,c,d){var b=null;if(null!=c.bars&&c.bars.show&&null!=c.bars.order){c.bars.horizontal&&(j=!0);var f=j?a.getPlaceholder().innerHeight(): a.getPlaceholder().innerWidth(),e=j?m(a.getData(),1):m(a.getData(),0);p=(e[1]-e[0])/f;a=a.getData();f=[];for(e=0;e