2012-03-09 158 views

回答

2

好,我已经找到了唯一的解决方案是创建一个自定义标签,并设置颜色的方法:

this._chart.ChartAreas[0].AxisX.CustomLabels.Add(new CustomLabel(position - 1, position + 1, point.AxisLabel, 0, LabelMarkStyle.None)); 

this._chart.ChartAreas[0].AxisX.CustomLabels[position - 1].ForeColor = GetColor(point.AxisLabel); 
4

您可以尝试向图表添加自定义标签,并允许您分别修改每个标签。

private void AddCustomLabelAtYValue(double YValue, string Text, Color ForeColor) 
{ 
    double scale = chart.ChartAreas["MyChart"].AxisY.Maximum - 
     chart.ChartAreas["MyChart"].AxisY.Minimum; 
    double offset = scale * 0.5; 
    CustomLabel customLabel = new CustomLabel(YValue - offset, 
     YValue + offset, Text, 0, LabelMarkStyle.None); 
    customLabel.ForeColor = ForeColor; 
    chart.ChartAreas["MyChart"].AxisY.CustomLabels.Add(customLabel); 
}