{"version":3,"file":"group_chart_controller-CN2_S8jN.js","sources":["../../../app/javascript/entrypoints/controllers/group_chart_controller.jsx"],"sourcesContent":["/** @jsx renderer.create */\nimport { Controller } from \"@hotwired/stimulus\";\nimport dayjs from \"dayjs\";\n\nimport {\n Chart,\n CategoryScale,\n LinearScale,\n PointElement,\n LineElement,\n Title,\n Tooltip,\n Legend,\n} from \"chart.js\";\nimport ChartDataLabels from \"chartjs-plugin-datalabels\";\n\nimport _ from \"lodash\";\n\nimport { useWindowResize } from \"stimulus-use\";\nimport { useResize } from \"stimulus-use\";\nimport currency from \"currency.js\";\n\nimport numbro from \"numbro\";\n\nimport { CommonDOMRenderer } from \"render-jsx/dom\";\n\nimport { numberFormatter, ticksCallback } from \"../utils\";\n\nconst tooltipWidth = 350;\n\nconst red = \"rgba(255, 0, 0, 1)\";\nconst black = \"rgb(0, 0, 0, 1)\";\n\nChart.register(\n CategoryScale,\n LinearScale,\n PointElement,\n LineElement,\n Title,\n Tooltip,\n Legend,\n ChartDataLabels\n);\n\nexport default class extends Controller {\n chart = null;\n initial = false;\n values = [];\n labels = [];\n\n static targets = [\"chart\"];\n\n static values = {\n jsonData: Object,\n };\n\n initialize() {\n this.resize = _.throttle(this.resize, 750).bind(this);\n this.windowResize = _.throttle(this.windowResize, 750).bind(this);\n }\n\n chartTargetDisconnect(element) {\n const chart = Chart.getChart(`chart-${this.statId}`);\n if (chart) {\n chart.destroy();\n }\n }\n\n jsonDataValueChanged() {\n if (!this.initial) {\n this.initial = true;\n } else {\n const data = this.jsonDataValue;\n const rows = this.jsonDataValue.rows;\n\n this.statId = data.id;\n this.dataType = data.data_type;\n this.reverse = data.upside_down;\n this.decimalPlaces = data.decimal_places;\n this.tracking = data.tracking;\n this.endOfWeek = data.end_of_week;\n\n this.min = data.min;\n this.max = data.max;\n\n this.values = Object.values(rows) || [];\n\n if (this.tracking == \"week\") {\n this.labels = Object.keys(rows).map((key) => this.endOfWeek[key]);\n } else {\n this.labels = Object.keys(rows) || [];\n }\n\n let chart = Chart.getChart(`chart-${this.statId}`);\n\n if (chart) {\n chart.data.labels = this.labels;\n chart.data.datasets[0].data = this.values;\n\n chart.options = this.options(rows);\n\n chart.update(\"reset\");\n chart.update(\"normal\");\n } else {\n const ctx = document\n .getElementById(`chart-${this.statId}`)\n .getContext(\"2d\");\n this.createChart(ctx, rows, this.element);\n }\n }\n }\n\n chartTargetConnected(element) {\n const parsedData = this.jsonDataValue;\n\n if (_.isEmpty(parsedData) || _.isEmpty(parsedData.rows)) {\n return;\n }\n\n const data = parsedData.rows;\n\n this.values = Object.values(data) || [];\n\n this.tracking = parsedData.tracking;\n this.min = parsedData.min;\n this.max = parsedData.max;\n\n this.statId = parsedData.id;\n this.dataType = parsedData.data_type;\n this.reverse = parsedData.upside_down;\n this.decimalPlaces = parsedData.decimal_places;\n this.endOfWeek = parsedData.end_of_week;\n\n if (this.tracking == \"week\") {\n this.labels = Object.keys(data).map((key) => this.endOfWeek[key]);\n } else {\n this.labels = Object.keys(data) || [];\n }\n\n if (_.isEmpty(this.labels) || _.isEmpty(this.values)) {\n return;\n }\n\n const ctx = document\n .getElementById(`chart-${this.statId}`)\n .getContext(\"2d\");\n\n this.createChart(ctx, data, element);\n }\n\n getOrCreateTooltip = (chart) => {\n let tooltipEl = chart.canvas.parentNode.querySelector(\"div.chart-tooltip\");\n\n if (!tooltipEl) {\n tooltipEl = document.createElement(\"div\");\n\n tooltipEl.classList.add(\n \"bg-gray-100\",\n \"text-black\",\n \"rounded\",\n \"shadow-lg\",\n \"border\",\n \"chart-tooltip\"\n );\n\n tooltipEl.style.opacity = 1;\n tooltipEl.style.pointerEvents = \"none\";\n tooltipEl.style.position = \"absolute\";\n tooltipEl.style.transform = \"translate(-50%, 0)\";\n tooltipEl.style.transition = \"all .1s ease\";\n tooltipEl.style.zIndex = \"9999999999999999999999\";\n\n const table = document.createElement(\"table\");\n table.style.margin = \"0px\";\n\n tooltipEl.appendChild(table);\n chart.canvas.parentNode.appendChild(tooltipEl);\n }\n\n return tooltipEl;\n };\n\n createChart = (ctx, data, element) => {\n useWindowResize(this);\n useResize(this);\n\n let delayed;\n\n new Chart(ctx, {\n type: \"line\",\n data: {\n labels: this.labels,\n datasets: [\n {\n data: this.values,\n ...this.basicLineChartSettings(),\n datalabels: {\n display: true,\n color: \"black\",\n textStrokeWidth: 0.5,\n align: \"top\",\n offset: 12,\n font: {\n size: 12,\n },\n },\n },\n ],\n },\n options: {\n animation: {\n onComplete: () => {\n delayed = true;\n },\n delay: (context) => {\n let delay = 0;\n if (\n context.type === \"data\" &&\n context.mode === \"default\" &&\n !delayed\n ) {\n delay = context.dataIndex * 50 + context.datasetIndex * 25;\n }\n\n return delay;\n },\n },\n font: {\n family: \"Inter var\",\n size: 12,\n },\n ...this.options(data),\n },\n });\n\n document.addEventListener(\"chart:updated\", (event) => {\n const chart = Chart.getChart(element.id);\n const index = chart.data.labels.indexOf(event.detail.entryAt);\n\n if (index != undefined || index != -1) {\n let value = event.detail.entry;\n\n if (_.isEmpty(value) || value == \"No Report\" || value == \"NR\") {\n chart.data.datasets[0].data[index] = null;\n } else {\n try {\n const parsedValue = parseFloat(value.replace(/[^0-9.]/g, \"\"));\n chart.data.datasets[0].data[index] = parsedValue;\n } catch (error) {\n console.log(error);\n return;\n }\n }\n\n chart.update(\"active\");\n }\n });\n };\n\n externalTooltipHandler = (context) => {\n const { chart, tooltip } = context;\n const tooltipEl = this.getOrCreateTooltip(chart);\n\n tooltipEl.innerHTML = \"\";\n\n if (tooltip.opacity === 0) {\n tooltipEl.style.opacity = 0;\n return;\n }\n\n if (tooltip.body) {\n const bodyLines = tooltip.body.map((b) => b.lines);\n const titleLines = tooltip.title || [];\n const renderer = new CommonDOMRenderer();\n\n renderer\n .render(\n
\n
\n

\n {dayjs(titleLines[0]).format(\"MMM DD, YYYY\")}\n

\n
\n {tooltip.labelColors.map((color) => (\n \n ))}\n {bodyLines.map((body, i) => (\n
\n
\n {numberFormatter(\n body[i],\n this.dataType,\n this.decimalPlaces\n )}\n
\n
\n ))}\n
\n
\n
\n )\n .on(tooltipEl);\n }\n\n const { offsetLeft: positionX, offsetTop: positionY } = chart.canvas;\n\n const groupedContainer = document.getElementById(\"grouped-container\");\n\n const left = positionX + tooltip.caretX + tooltipWidth / 2 + 10;\n\n const container = groupedContainer;\n const containerRect = container.getBoundingClientRect();\n const containerRight = container.right;\n\n if (\n left + tooltipWidth / 2 > containerRight ||\n left + tooltipWidth / 2 > containerRect.width\n ) {\n tooltipEl.style.left = left - 350 + \"px\";\n } else {\n tooltipEl.style.left = left + \"px\";\n }\n\n tooltipEl.style.opacity = 1;\n tooltipEl.style.top = positionY + 15 + tooltip.caretY + \"px\";\n tooltipEl.style.font = tooltip.options.bodyFont.string;\n tooltipEl.style.padding =\n tooltip.options.padding + \"px \" + tooltip.options.padding + \"px\";\n tooltipEl.style.zIndex = \"9999999999999999999999\";\n tooltipEl.style.width = \"350px\";\n tooltipEl.style.maxWidth = \"350px\";\n };\n\n resize() {\n [...this.chartTargets].forEach((element) => {\n const chart = Chart.getChart(element.id);\n if (chart) {\n chart.resize();\n }\n });\n }\n\n windowResize({ width, height, event }) {\n [...this.chartTargets].forEach((element) => {\n const chart = Chart.getChart(element.id);\n if (chart) {\n chart.resize();\n }\n });\n }\n\n borderColor = (ctx) => {\n let color = black;\n\n if (\n ctx.index != 0 &&\n ((!this.reverse &&\n parseFloat(this.values[ctx.index - 1]) >=\n parseFloat(this.values[ctx.index])) ||\n (this.reverse &&\n parseFloat(this.values[ctx.index - 1]) <=\n parseFloat(this.values[ctx.index])))\n ) {\n color = red;\n }\n\n return color;\n };\n\n backgroundColor = (ctx, options) => {\n let color = black;\n\n if (\n ctx.index != 0 &&\n ((!this.reverse &&\n parseFloat(this.values[ctx.index - 1]) >=\n parseFloat(this.values[ctx.index])) ||\n (this.reverse &&\n parseFloat(this.values[ctx.index - 1]) <=\n parseFloat(this.values[ctx.index])))\n ) {\n color = red;\n }\n\n return color;\n };\n\n segmentBorderColor = (ctx) => {\n let color = black;\n\n if (\n (this.reverse && parseFloat(ctx.p0.raw) <= parseFloat(ctx.p1.raw)) ||\n (!this.reverse && parseFloat(ctx.p0.raw) >= parseFloat(ctx.p1.raw))\n ) {\n color = red;\n }\n\n return color;\n };\n\n basicLineChartSettings = () => {\n return {\n borderColor: this.borderColor,\n backgroundColor: this.backgroundColor,\n segment: {\n borderColor: this.segmentBorderColor,\n },\n };\n };\n\n options = (data) => {\n return {\n clip: 50,\n layout: {\n padding: {\n top: 40,\n bottom: 0,\n left: 10,\n right: 5,\n },\n },\n responsive: true,\n maintainAspectRatio: true,\n plugins: {\n legend: {\n display: false,\n },\n tooltip: {\n enabled: false,\n position: \"nearest\",\n external: this.externalTooltipHandler,\n },\n datalabels: {\n display: true,\n formatter: (value, context) => {\n if (this.dataType === \"currency\") {\n return currency(context.dataset.data[context.dataIndex] || 0, {\n precision: this.decimalPlaces,\n }).format();\n }\n\n if (this.dataType === \"percentage\") {\n return `${context.dataset.data[context.dataIndex] || 0}%`;\n }\n\n return value;\n },\n },\n },\n scales: {\n x: {\n grid: {\n color: \"rgb(0, 0, 0, .20)\",\n },\n ticks: {\n includeBounds: false,\n padding: 20,\n reverse: true,\n autoSkip: false,\n color: \"rgb(0, 0, 0)\",\n font: {\n size: 12,\n weight: \"bold\",\n },\n callback: (index) =>\n ticksCallback(index, this.tracking, this.labels, \"group\"),\n },\n },\n y: {\n suggestedMin: this.min || 0,\n suggestedMax: this.max || null,\n position: \"left\",\n reverse: this.reverse,\n ticks: {\n position: \"left\",\n precision: this.decimalPlaces,\n font: {\n family: \"Inter var\",\n size: 12,\n weight: \"bold\",\n },\n padding: 20,\n color: \"rgb(0, 0, 0)\",\n callback: (value, index, values) => {\n if (value == \"NR\") return value;\n\n if (this.dataType === \"currency\") {\n try {\n return numbro(value).formatCurrency({\n average: true,\n mantissa: this.decimalPlaces,\n optionalMantissa: true,\n currencyPosition: \"prefix\",\n });\n } catch (_) {\n return `$${value}`;\n }\n }\n\n if (this.dataType == \"percentage\") {\n return `${value}%`;\n }\n\n return numbro(value).format({\n thousandSeparated: true,\n mantissa: this.decimalPlaces,\n });\n },\n },\n },\n },\n };\n };\n}\n"],"names":["tooltipWidth","red","black","Chart","CategoryScale","LinearScale","PointElement","LineElement","Title","Tooltip","Legend","ChartDataLabels","group_chart_controller","Controller","__publicField","chart","tooltipEl","table","ctx","data","element","useWindowResize","useResize","delayed","context","delay","event","index","value","_","parsedValue","error","tooltip","bodyLines","b","titleLines","renderer","CommonDOMRenderer","dayjs","color","body","i","numberFormatter","positionX","positionY","groupedContainer","left","container","containerRect","containerRight","options","currency","ticksCallback","values","numbro","rows","key","parsedData","width","height"],"mappings":"mkBA4BA,MAAMA,EAAe,IAEfC,EAAM,qBACNC,EAAQ,kBAEdC,EAAM,SACJC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CACF,EAEA,MAAAC,UAA6BC,CAAW,CAAxC,kCACEC,EAAA,aAAQ,MACRA,EAAA,eAAU,IACVA,EAAA,cAAS,CAAA,GACTA,EAAA,cAAS,CAAA,GAsGTA,EAAA,0BAAsBC,GAAU,CAC9B,IAAIC,EAAYD,EAAM,OAAO,WAAW,cAAc,mBAAmB,EAEzE,GAAI,CAACC,EAAW,CACFA,EAAA,SAAS,cAAc,KAAK,EAExCA,EAAU,UAAU,IAClB,cACA,aACA,UACA,YACA,SACA,eAAA,EAGFA,EAAU,MAAM,QAAU,EAC1BA,EAAU,MAAM,cAAgB,OAChCA,EAAU,MAAM,SAAW,WAC3BA,EAAU,MAAM,UAAY,qBAC5BA,EAAU,MAAM,WAAa,eAC7BA,EAAU,MAAM,OAAS,yBAEnB,MAAAC,EAAQ,SAAS,cAAc,OAAO,EAC5CA,EAAM,MAAM,OAAS,MAErBD,EAAU,YAAYC,CAAK,EACrBF,EAAA,OAAO,WAAW,YAAYC,CAAS,CAC/C,CAEO,OAAAA,CAAA,GAGTF,EAAA,mBAAc,CAACI,EAAKC,EAAMC,IAAY,CACpCC,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