import { WorldTopoData as topology } from './HighChartConfigData'; export const getDefaultConfigurations = (chartType: string, inputData: any[], colors: string[]) => { const colorLength = colors?.length; let colorIndex = 0; switch (chartType) { case 'bar': const categories: string[] = []; const barData: number[] = []; inputData.forEach((item) => { categories.push(item.name); barData.push(item.value); }); return { chart: { type: 'bar', }, credits: { enabled: false, }, title: { text: '', }, plotOptions: { bar: { pointWidth: 26, }, }, xAxis: { categories: categories, lineWidth: 0, labels: { style: { fontFamily: 'Helvetica Neue, Helvetica, Arial, -apple-system, system-ui, sans-serif', fontSize: 16, fontWeight: 400, }, }, }, yAxis: { title: { text: 'Impacted Users', margin: 15, style: { color: '#26333F', opacity: 0.4, }, }, labels: { style: { fontFamily: 'Helvetica Neue, Helvetica, Arial, -apple-system, system-ui, sans-serif', color: '#26333F', opacity: 0.4, }, }, }, series: [ { showInLegend: false, data: barData, }, ], }; case 'packedbubble': inputData?.sort((a, b) => b.value - a.value); const bubbleData: any[] = []; inputData.forEach((item) => { bubbleData.push({ name: item.name, value: item.value, color: colors[colorIndex], }); colorIndex = (colorIndex + 1) % colorLength; }); return { chart: { type: 'packedbubble', events: { load: function (this: any) { var chart = this; chart.series[0].points.forEach(function (point: { marker: { radius: number }; update: (arg0: { dataLabels: { style: { width: string } } }, arg1: boolean) => void; }) { var bubbleWidth = 2 * point.marker.radius - 15; // Calculate width based on bubble size point.update( { dataLabels: { style: { width: bubbleWidth + 'px', }, }, }, false ); // Update dataLabels without reflowing the chart }); chart.redraw(); // Redraw the chart with updated dataLabels }, }, }, credits: { enabled: false, }, title: { text: '', }, tooltip: { enabled: true, useHTML: true, padding: 0, formatter: function (this: any) { return ( '