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AAM,CACLjD,OAAQiB,EAAKjB,OACbkD,SAAU,CACT,CACCC,gBAAiBlC,EAAKhB,YACtBgD,KAAMhC,EAAKf,YACXkD,YAAa,MAIhBrB,QAASA,S,6BAzFSxC","sources":["webpack://ucn/./src/components/chart/chart.js"],"sourcesContent":["import Chart from \"chart.js/auto\";\n\nexport default class ChartBlock {\n\tconstructor(config) {\n\t\tthis.el = config.el || document.querySelectorAll(\".chart\");\n\t\tthis.piChart = this.el.querySelector(\".pie-chart\");\n\t\tthis.dataElems = this.el.querySelectorAll(\".chart__data\");\n\t\tthis.labels = [];\n\t\tthis.backgrounds = [];\n\t\tthis.percentages = [];\n\t\tthis.themes = {\n\t\t\tthemeBlue: \"#00646e\",\n\t\t\tthemeBlueLight: \"#bed6db\",\n\t\t\tthemeBlueDark: \"#004250\",\n\t\t\tthemeGrayLight: \"#e7ebed\",\n\t\t\tthemeYellow: \"#ffe673\",\n\t\t\tthemeWhite: \"#ffffff\",\n\t\t\tthemeOrange: \"#ffc87d\",\n\t\t\tthemePink: \"#ffa0d2\",\n\t\t\tthemeRed: \"#ffa591\",\n\t\t\tthemeTurquoise: \"#0096a0\",\n\t\t\tthemeTurquoiseLight: \"#a5dccd\",\n\t\t};\n\t\tthis.init();\n\t}\n\tinit() {\n\t\tthis.fetchData();\n\t}\n\tfetchData() {\n\t\tconst self = this;\n\t\tconst keys = Object.keys(self.themes);\n\n\t\tthis.dataElems.forEach((el, index) => {\n\t\t\tself.labels.push(\n\t\t\t\tel.dataset.label + \" \" + parseInt(el.dataset.percentage) + \"%\"\n\t\t\t);\n\t\t\tself.percentages.push(parseInt(el.dataset.percentage));\n\n\t\t\tkeys.forEach((key) => {\n\t\t\t\tif (key == el.dataset.background) {\n\t\t\t\t\tself.backgrounds.push(self.themes[key]);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\tsetTimeout(() => {\n\t\t\tself.setChart();\n\t\t}, 50);\n\t}\n\n\tsetChart() {\n\t\tconst self = this;\n\t\tlet screenWidth = screen.width;\n\t\tlet isLargeScreen = screenWidth >= 1025;\n\n\t\tlet options = {\n\t\t\tresponsive: true,\n\t\t\tplugins: {\n\t\t\t\tlegend: {\n\t\t\t\t\tdisplay: false,\n\t\t\t\t},\n\t\t\t\ttooltip: {\n\t\t\t\t\tbodyFont: {\n\t\t\t\t\t\tsize: 14,\n\t\t\t\t\t\tfamily: \"'Mont'\",\n\t\t\t\t\t},\n\t\t\t\t\tpadding: 10,\n\t\t\t\t\tdisplayColors: false,\n\t\t\t\t\tcallbacks: {\n\t\t\t\t\t\tlabel: function (context) {\n\t\t\t\t\t\t\treturn context.label;\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tlayout: {\n\t\t\t\tpadding: isLargeScreen ? 30 : 20,\n\t\t\t},\n\t\t};\n\n\t\tnew Chart(this.piChart, {\n\t\t\ttype: \"pie\",\n\t\t\tdata: {\n\t\t\t\tlabels: self.labels,\n\t\t\t\tdatasets: [\n\t\t\t\t\t{\n\t\t\t\t\t\tbackgroundColor: self.backgrounds,\n\t\t\t\t\t\tdata: self.percentages,\n\t\t\t\t\t\thoverOffset: 30,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\toptions: options,\n\t\t});\n\t}\n}\n"],"names":["ChartBlock","config","this","el","document","querySelectorAll","piChart","querySelector","dataElems","labels","backgrounds","percentages","themes","themeBlue","themeBlueLight","themeBlueDark","themeGrayLight","themeYellow","themeWhite","themeOrange","themePink","themeRed","themeTurquoise","themeTurquoiseLight","init","fetchData","self","keys","Object","forEach","index","push","dataset","label","parseInt","percentage","key","background","setTimeout","setChart","options","responsive","plugins","legend","display","tooltip","bodyFont","size","family","padding","displayColors","callbacks","context","layout","screen","width","Chart","type","data","datasets","backgroundColor","hoverOffset"],"sourceRoot":""}