You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
1.4 KiB
JavaScript
1 line
1.4 KiB
JavaScript
2 months ago
|
!function(r){function n(r){function n(r,n,e){var i=null;if(t(n)&&(l(n),a(r),o(r),s(n),v>=2)){var u=h(n),p=-1,w=f();p=c(u)?-1*d(g,u-1,Math.floor(v/2)-1)-w:d(g,Math.ceil(v/2),u-2)+w+2*W,i=b(e,n,p),e.points=i}return i}function t(r){return null!=r.bars&&r.bars.show&&null!=r.bars.order}function a(r){var n=D?r.getPlaceholder().innerHeight():r.getPlaceholder().innerWidth(),t=D?e(r.getData(),1):e(r.getData(),0),a=t[1]-t[0];w=a/n}function e(r,n){for(var t=new Array,a=0;a<r.length;a++)t[0]=r[a].data[0][n],t[1]=r[a].data[r[a].data.length-1][n];return t}function o(r){g=i(r.getData()),v=g.length}function i(r){for(var n=new Array,t=0;t<r.length;t++)null!=r[t].bars.order&&r[t].bars.show&&n.push(r[t]);return n.sort(u)}function u(r,n){var t=r.bars.order,a=n.bars.order;return a>t?-1:t>a?1:0}function s(r){p=r.bars.lineWidth?r.bars.lineWidth:2,W=p*w}function l(r){r.bars.horizontal&&(D=!0)}function h(r){for(var n=0,t=0;t<g.length;++t)if(r==g[t]){n=t;break}return n+1}function f(){var r=0;return 0!=v%2&&(r=g[Math.ceil(v/2)].bars.barWidth/2),r}function c(r){return r<=Math.ceil(v/2)}function d(r,n,t){for(var a=0,e=n;t>=e;e++)a+=r[e].bars.barWidth+2*W;return a}function b(r,n,t){for(var a=r.pointsize,e=r.points,o=0,i=D?1:0;i<e.length;i+=a)e[i]+=t,n.data[o][3]=e[i],o++;return e}var g,v,p,W,w=1,D=!1;r.hooks.processDatapoints.push(n)}var t={series:{bars:{order:null}}};r.plot.plugins.push({init:n,options:t,name:"orderBars",version:"0.2"})}(jQuery);
|