openvino/docs/sphinx_setup/_static/js/Plugin.Barchart.Background....

1 line
1.7 KiB
JavaScript

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("chart.js")):"function"==typeof define&&define.amd?define(["chart.js"],e):t.PluginBarchartBackground=e(t.Chart)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r={color:"#f3f3f3",axis:"category",mode:"odd"};var o={id:"chartJsPluginBarchartBackground",_hasData:function(t){return t&&t.datasets&&t.datasets.length>0},_findScale:function(t,e){var r=Object.keys(t.scales).map(function(e){return t.scales[e]});return"category"===e.axis?r.find(function(t){return"hierarchical"===t.type||"category"===t.type}):r.find(function(t){return t.id.startsWith(e.axis)})},beforeDraw:function(t,e,o){o=Object.assign({},r,o);var n=this._findScale(t,o);if(this._hasData(t.config.data)&&n){var i=n.getTicks();if(i&&0!==i.length){var a=n.isHorizontal(),f=t.chartArea,c=n.options.gridLines,u=t.ctx;u.save(),u.fillStyle=o.color;var l=i.map(function(t,e){return function(t,e,r){var o=t.getPixelForTick(e);return r&&(o-=0===e?(t.getPixelForTick(1)-o)/2:(o-t.getPixelForTick(e-1))/2),o}(n,e,c.offsetGridLines&&i.length>1)}),s="odd"===o.mode?0:1;if(l.length%2==1-s&&l.push(a?f.right:f.bottom),a)for(var d=f.bottom-f.top,y=s;y<l.length;y+=2){var h=l[y],p=l[y+1];u.fillRect(h,f.top,p-h,d)}else for(var g=f.right-f.left,m=s;m<l.length;m+=2){var b=l[m],v=l[m+1];u.fillRect(f.left,b,g,v-b)}u.restore()}}}};return"function"==typeof define&&define.amd||"object"===("undefined"==typeof module?"undefined":e(module))&&module.exports||t.pluginService.register(o),o});