MS图表:你怎么能更改条形图的轴的每个标签的颜色? [英] MS Chart: How can you change the color of each label on the Axis of a Bar Chart?

查看:374
本文介绍了MS图表:你怎么能更改条形图的轴的每个标签的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个条形图,显示在Y轴上不同的类别。

I have a bar chart which shows different categories on the Y axis.

我可以通过使用同时改变它们的所有的颜色上的轴

I can change the color of all of them on the axis at the same time by using:

 chart.ChartAreas["MyChart"].AxisY.LabelStyle.ForeColor = "Red";



然而,它没有让我设置颜色为他们每个人。

However it doesn't allow me to set the color for each of them.

任何帮助将非常感激。

推荐答案

好吧,我发现的唯一的解决办法是创建一个自定义标签,并设置颜色的方式:

Ok The only solution I have found is to create a custom label and set the color that way:

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);

这篇关于MS图表:你怎么能更改条形图的轴的每个标签的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆