Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当存在大量数据C#Wnforms时,并非所有x轴标签都显示出来_C#_Winforms_Charts_Label_Axis - Fatal编程技术网

当存在大量数据C#Wnforms时,并非所有x轴标签都显示出来

当存在大量数据C#Wnforms时,并非所有x轴标签都显示出来,c#,winforms,charts,label,axis,C#,Winforms,Charts,Label,Axis,您好,我有一个图表,它将为我打印异常数据图表,并标记每个异常类型,当我使用许多数据运行它时,图表仅显示3个标签,当我减少异常类型的数量时,文本开始显示在其中一些上,直到我减少更多,所有这些都将被标记 我使用了下面的区号 reportChart.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new Font("Ariel",7F); reportChart.ChartAreas["ChartArea1"].AxisX.LabelAutoFit

您好,我有一个图表,它将为我打印异常数据图表,并标记每个异常类型,当我使用许多数据运行它时,图表仅显示3个标签,当我减少异常类型的数量时,文本开始显示在其中一些上,直到我减少更多,所有这些都将被标记

我使用了下面的区号

 reportChart.ChartAreas["ChartArea1"].AxisX.LabelStyle.Font = new Font("Ariel",7F);
 reportChart.ChartAreas["ChartArea1"].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.WordWrap;
有没有一种方法,我可以包装文本,将足够小的标签数据和可读性。

更新 下面是我如何构建图表的

private void BuildChart()
    {
        int count = 0;
        Random random = new Random();
        foreach (KeyValuePair<string, int> exception in Messages)
        {
            int red = random.Next(0, 255);
            int green = random.Next(0, 255);
            int blue = random.Next(0, 255);
            if (exception.Value > int.Parse(thresholdTxb.Text))
            {
                reportChart.Series[0].Points.AddXY(exception.Key, exception.Value);
                reportChart.Series[0].Points[count].Color = Color.FromArgb(red, blue, green);
                count++;
            }
        }
    }
private void BuildChart()
{
整数计数=0;
随机=新随机();
foreach(消息中的KeyValuePair异常)
{
int red=random.Next(0255);
绿色整数=随机。下一步(0,255);
int blue=random.Next(0255);
if(exception.Value>int.Parse(thresholdTxb.Text))
{
reportChart.Series[0].Points.AddXY(exception.Key,exception.Value);
reportChart.Series[0]。点[count]。颜色=颜色。FromArgb(红色、蓝色、绿色);
计数++;
}
}
}
知道为什么吗 谢谢

制作:

 chart1.ChartAreas[0].AxisX.LabelStyle.Angle = -90;
 chart1.ChartAreas[0].AxisX.LabelStyle.Interval = 1;

谢谢,它可以工作,但我的文本正在被剪切。轴上是否有任何更改以确保所有文本都已打印??这些标签有多长?一定有尺寸限制。记住,它只是一个图表轴标签,而不是一个文本框。随着字体的减少,我相信这是你能做的最好的,据我所知。