import{G as n}from"./GraphinaApexChartBase.js";class h extends n{constructor(){super(),this.observer={},this.secondaryChart=[],this.secondaryChartData=[]}setUpChartsHandler(){this.chartHandlers={nested_column:t=>this.observeChartElement(t,"bar")}}getChartOptions(t,e,a,r){return e==="nested_column"&&(t.plotOptions={bar:{distributed:!0,horizontal:!0,barHeight:"75%",dataLabels:{position:"bottom"}}},t.chart.id=`barYear-${r}`,t.chart.events={dataPointSelection:(s,o,i)=>{this.toggleSecondaryChartData(i.dataPointIndex,t,r)}},t.tooltip={x:{show:!0},y:{formatter:function(s){let o=0,i=a.chart_tooltip_prefix_val,c=a.chart_tooltip_postfix_val;return a.tooltip_formatter?i+new Intl.NumberFormat(window.gcfe_public_localize.locale_with_hyphen,{minimumFractionDigits:o,maximumFractionDigits:o}).format(s)+c:s}}}),this.initSChart(r,t),t}updateSecondaryChartVisibility(t){const e=jQuery(`.nested_column-chart-two-${t}`)[0],a=jQuery(`.nested_column-chart-one-${t}`)[0];this.secondaryChartData.length===0?(e.classList.remove("active"),a.classList.remove("chart-quarter-activated"),jQuery(`.nested_column-chart-two-${t}`).hide()):(a.classList.add("chart-quarter-activated"),e.classList.add("active"),jQuery(`.nested_column-chart-two-${t}`).show())}initSChart(t,e){const a=jQuery(`.nested_column-chart-two-${t}`);this.secondaryChart[t]=new ApexCharts(a[0],a.data("second_chart_options")),this.secondaryChart[t].render(),jQuery(`.nested_column-chart-two-${t}`).hide()}toggleSecondaryChartData(t,e,a){const r=e.series[0].data[t],s=this.secondaryChartData.findIndex(o=>o.name===r.x);s===-1?this.secondaryChartData.push({name:r.x,data:r.quarters,color:r.color}):this.secondaryChartData.splice(s,1),this.updateSecondaryChartVisibility(a),this.secondaryChart[a]&&this.secondaryChart[a].updateSeries(this.secondaryChartData)}}window.graphinaNestedcolumnChart=new h;
//# sourceMappingURL=nestedcolumn.js.map
