Загрузка данных


if (i == displayData.Count - 1 && currentAngle + angleSize < 360)
            {
                angleSize = 360 - currentAngle;
            }
            
            sectors.Add((currentAngle, currentAngle + angleSize, GetSymbolForChar(displayData[i].Key)));
            currentAngle += angleSize;
        }
        
        // Заполняем точки круга
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                int dx = x - centerX;
                int dy = y - centerY;
                double distance = Math.Sqrt(dx * dx + dy * dy);
                
                if (distance >= radius - 1 && distance <= radius + 1)
                {
                    chart[y, x] = '●';
                }
                else if (distance < radius - 1)
                {
                    double angle = Math.Atan2(dy, dx) * 180 / Math.PI;
                    if (angle < 0) angle += 360;
                    
                    for (int s = 0; s < sectors.Count; s++)
                    {
                        if (angle >= sectors[s].startAngle && angle < sectors[s].endAngle)
                        {
                            chart[y, x] = sectors[s].symbol;
                            break;
                        }
                    }
                }
            }
        }
        
        // Выводим диаграмму
        for (int y = 0; y < height; y++)
        {
            Console.Write("  ");
            for (int x = 0; x < width; x++)
            {
                if (chart[y, x] != ' ')
                {
                    char symbol = chart[y, x];
                    if (symbol == '●')
                    {
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write(symbol);
                    }
                    else
                    {
                        // Находим цвет для символа
                        for (int i = 0; i < sectors.Count; i++)
                        {
                            if (sectors[i].symbol == symbol)
                            {
                                Console.ForegroundColor = colors[i % colors.Length];
                                break;
                            }
                        }
                        Console.Write(symbol);
                    }
                }
                else
                {
                    Console.Write(' ');
                }
            }
            Console.ResetColor();
            Console.WriteLine();
        }
        
        // Легенда
        Console.WriteLine("\nЛЕГЕНДА:\n");
        for (int i = 0; i < displayData.Count; i++)
        {
            double percentage = (double)displayData[i].Value / total * 100;
            Console.ForegroundColor = colors[i % colors.Length];
            
            string symbol = displayData[i].Key == '?' ? "Другие" : $"'{displayData[i].Key}'";
            Console.Write($"  {symbol}");
            Console.ResetColor();
            Console.WriteLine($": {displayData[i].Value} ({percentage:F1}%)");
        }
    }
    
    static char GetSymbolForChar(char c)
    {
        // Возвращаем символ для отображения в диаграмме
        if (c == ' ') return '␣';
        if (c == '\n') return '↵';
        if (c == '\t') return '→';
        return c;
    }
}