如何更改条形图中标签的大小

时间:2015-07-07 06:09:38

标签: c# mschart

如何在条形图中更改axisX上的一个标签的大小。我想只更改来自字符串的第一个标签。

c#c​​ode:

string pursue = _getLabel(reportLanguage, "Pursue_Noble_Goals");
string increase = _getLabel(reportLanguage, "Increase_Empathy");                  
string give = _getLabel(reportLanguage, "Give_Yourself");

chart.Series[1].Points.AddXY(pursue, Convert.ToDouble(_removeSomething(qas.PursueNobleGoalsScore, _str)));
chart.Series[1].Points[0].Color = System.Drawing.Color.FromArgb(128, 128, 128);                                       
chart.Series[1].Points.AddXY(increase, Convert.ToDouble(_removeSomething(qas.IncreaseEmpathyScore, _str)));
chart.Series[1].Points[1].Color = System.Drawing.Color.FromArgb(192, 192, 192);
chart.Series[1].Points.AddXY(give, Convert.ToDouble(_removeSomething(qas.GiveYourselfScore, _str)));                                     
chart.Series[1].Points[2].Color = System.Drawing.Color.FromArgb(255, 216, 25, 33);
chart.Series[1].Points.AddXY(exercise, Convert.ToDouble(_removeSomething(qas.ExcerciseOptimismScore, _str)));
chart.Series[1].Points[3].Color = System.Drawing.Color.FromArgb(255, 216, 25, 33);

1 个答案:

答案 0 :(得分:0)

在您发布的代码中,假设您要更改第一个点轴标签,即" Pursue_Noble_Goals"对于" Pursue_Noble_Thoughts"之类的东西,下面的代码行应该可以解决问题:

chart.Series[1].Points[0].AxisLabel = "Pursue_Noble_Thoughts";